Bulk-create IPv6 prefixes #9384

Open
opened 2025-12-29 20:49:10 +01:00 by adam · 3 comments
Owner

Originally created by @aibix0001 on GitHub (Mar 22, 2024).

NetBox version

v3.7.4

Feature type

Change to existing functionality

Proposed functionality

Adding an range of IPv6 prefixes in one go, like:
fd00::[48-4F]00::/56
to create 8 /56 e.g.

Use case

adding addressing plan for IPv6 is tedious

Database changes

No response

External dependencies

No response

Originally created by @aibix0001 on GitHub (Mar 22, 2024). ### NetBox version v3.7.4 ### Feature type Change to existing functionality ### Proposed functionality Adding an range of IPv6 prefixes in one go, like: fd00::[48-4F]00::/56 to create 8 /56 e.g. ### Use case adding addressing plan for IPv6 is tedious ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurenetboxstatus: backlogcomplexity: high labels 2025-12-29 20:49:10 +01:00
Author
Owner

@MiFeu112 commented on GitHub (Mar 22, 2024):

That would be wonderful so that you don't have to create entire IPv6 networks manually.

@MiFeu112 commented on GitHub (Mar 22, 2024): That would be wonderful so that you don't have to create entire IPv6 networks manually.
Author
Owner

@gkjg1 commented on GitHub (Mar 23, 2024):

It would be a nice feature

@gkjg1 commented on GitHub (Mar 23, 2024): It would be a nice feature
Author
Owner

@rfdrake commented on GitHub (Sep 25, 2025):

It looks like it's been a while since this was suggested. I think either a small CLI script that generates a CSV or a custom script might be a better way to support this because there is some business logic in addressing schemes.

If you just said "I need 8 contiguous /56 prefixes created" that seems easy enough, but what about their attributes? Would they all have the same role, description, tags, etc?

What I'm saying is that it might be a long while before this could be completed, so having a workaround is probably the best choice in the short term.


Having said that, it appears that IPAddresses already support this feature, so I can't see why Prefixes would not. https://github.com/netbox-community/netbox/blob/main/netbox/utilities/forms/fields/expandable.py

Note: the hex letters, like "F" in this case has to be lowercase to match the regex. I don't know if this is intentional or if it should be fixed.
a437931aef/netbox/utilities/forms/constants.py (L7)

>>> from utilities.forms.fields import ExpandableIPAddressField
>>> x = ExpandableIPAddressField(label='z')
>> x.to_python('fd00::[48-4F]00::/56')
['fd00::[48-4F]00::/56']
>>> x.to_python('fd00::[48-4f]00::/56')
['fd00::4800::/56', 'fd00::4900::/56', 'fd00::4a00::/56', 'fd00::4b00::/56', 'fd00::4c00::/56', 'fd00::4d00::/56', 'fd00::4e00::/56', 'fd00::4f00::/56']

So, to get started with this it looks like we need a new view for PrefixBulkCreate. This would be in netbox/ipam/views.py. It needs a template file called netbox/templates/ipam/prefix_bulk_add.html

Then we need a prefix_edit_header.html file in netbox/templates/ipam/inc which looks like the one for ipaddress_edit_header.html. A prefix_edit.html needs to be created which looks like the ipaddress_edit.html.

Finally it's back to python for changes to netbox/ipam/views.py and probably a couple of other places.

@rfdrake commented on GitHub (Sep 25, 2025): It looks like it's been a while since this was suggested. I think either a small CLI script that generates a CSV or a custom script might be a better way to support this because there is some business logic in addressing schemes. If you just said "I need 8 contiguous /56 prefixes created" that seems easy enough, but what about their attributes? Would they all have the same role, description, tags, etc? What I'm saying is that it might be a long while before this could be completed, so having a workaround is probably the best choice in the short term. --- Having said that, it appears that IPAddresses already support this feature, so I can't see why Prefixes would not. https://github.com/netbox-community/netbox/blob/main/netbox/utilities/forms/fields/expandable.py Note: the hex letters, like "F" in this case has to be lowercase to match the regex. I don't know if this is intentional or if it should be fixed. https://github.com/netbox-community/netbox/blob/a437931aef913ba28bd947aec93fd2607316b389/netbox/utilities/forms/constants.py#L7 ``` >>> from utilities.forms.fields import ExpandableIPAddressField >>> x = ExpandableIPAddressField(label='z') >> x.to_python('fd00::[48-4F]00::/56') ['fd00::[48-4F]00::/56'] >>> x.to_python('fd00::[48-4f]00::/56') ['fd00::4800::/56', 'fd00::4900::/56', 'fd00::4a00::/56', 'fd00::4b00::/56', 'fd00::4c00::/56', 'fd00::4d00::/56', 'fd00::4e00::/56', 'fd00::4f00::/56'] ``` So, to get started with this it looks like we need a new view for PrefixBulkCreate. This would be in netbox/ipam/views.py. It needs a template file called netbox/templates/ipam/prefix_bulk_add.html Then we need a prefix_edit_header.html file in netbox/templates/ipam/inc which looks like the one for ipaddress_edit_header.html. A prefix_edit.html needs to be created which looks like the ipaddress_edit.html. Finally it's back to python for changes to netbox/ipam/views.py and probably a couple of other places.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9384