VlanGroup - ArrayField rather than a start/end range #6607

Closed
opened 2025-12-29 19:43:03 +01:00 by adam · 6 comments
Owner

Originally created by @PieterL75 on GitHub (Jun 29, 2022).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.2.5

Feature type

Change to existing functionality

Proposed functionality

a VLAN Group has the option to limit the vlans that can be used in that group.
This FR is to make the vlan-member a comma-separated value and allow more that one range or separate vlans in a vlan group.

Use case

We have use cases where one group consists of 2 different ranges (1000-1099, 2500-2599 for example).
Currently we have to create a second group, or extend the vlangroup with vlans that should not be used in that group.

Database changes

  • Remove the min_vid, max_vid values
  • Replace with a ArrayField of Vlan/VlanRanges ?

External dependencies

No response

Originally created by @PieterL75 on GitHub (Jun 29, 2022). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.2.5 ### Feature type Change to existing functionality ### Proposed functionality a VLAN Group has the option to limit the vlans that can be used in that group. This FR is to make the vlan-member a comma-separated value and allow more that one range or separate vlans in a vlan group. ### Use case We have use cases where one group consists of 2 different ranges (1000-1099, 2500-2599 for example). Currently we have to create a second group, or extend the vlangroup with vlans that should not be used in that group. ### Database changes - Remove the min_vid, max_vid values - Replace with a ArrayField of Vlan/VlanRanges ? ### External dependencies _No response_
adam added the status: acceptedtype: featurecomplexity: medium labels 2025-12-29 19:43:03 +01:00
adam closed this issue 2025-12-29 19:43:03 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 1, 2022):

#9083 proposed something similar, but the transition to a single ArrayField seems more efficient.

@jeremystretch commented on GitHub (Jul 1, 2022): #9083 proposed something similar, but the transition to a single ArrayField seems more efficient.
Author
Owner

@jeremystretch commented on GitHub (Jul 6, 2022):

Need to put a bit more thought into how best to implement this. We do something similar with rack reservation units, however in that case we're actually storing a discrete integer for each rack unit to which the reservation applies. This doesn't scale well to ~4K VLAN IDs. We may be able to leverage an array of PostgreSQL range fields, but further research is needed.

While I would have liked to pursue this in v3.3, we're running a bit behind with this release as it is.

@jeremystretch commented on GitHub (Jul 6, 2022): Need to put a bit more thought into how best to implement this. We do something similar with rack reservation units, however in that case we're actually storing a discrete integer for each rack unit to which the reservation applies. This doesn't scale well to ~4K VLAN IDs. We may be able to leverage an array of PostgreSQL [range fields](https://docs.djangoproject.com/en/4.0/ref/contrib/postgres/fields/#range-fields), but further research is needed. While I would have liked to pursue this in v3.3, we're running a bit behind with this release as it is.
Author
Owner

@jcralbino commented on GitHub (Oct 24, 2022):

Hello Jeremy,
I wanted to know if this scenarios can be supported in this next iteration this range functionality. :

  1. Creation of several vlan ranges, that can be assigned to the a vlan pool.
  2. Each vlan range, can be defined with a separate status field to be configurable ( active, reserved.. )
  3. A vlan pool, can include several different ranges

I would say that the vlan range can be a separate model itself where additional information can also be added to this object, like comments, or even the change log to monitor changes in the range definition.

@jcralbino commented on GitHub (Oct 24, 2022): Hello Jeremy, I wanted to know if this scenarios can be supported in this next iteration this range functionality. : 1. Creation of several vlan ranges, that can be assigned to the a vlan pool. 2. Each vlan range, can be defined with a separate status field to be configurable ( active, reserved.. ) 3. A vlan pool, can include several different ranges I would say that the vlan range can be a separate model itself where additional information can also be added to this object, like comments, or even the change log to monitor changes in the range definition.
Author
Owner

@abhi1693 commented on GitHub (Feb 24, 2023):

Is it possible to take this up in v3.5?

@abhi1693 commented on GitHub (Feb 24, 2023): Is it possible to take this up in v3.5?
Author
Owner

@jeremystretch commented on GitHub (Jun 3, 2024):

It might be possible to employ an ArrayField of RangeFields.

@jeremystretch commented on GitHub (Jun 3, 2024): It might be possible to employ an ArrayField of RangeFields.
Author
Owner

@jeremystretch commented on GitHub (Jul 9, 2024):

Just noting for posterity: PostgreSQL 14 introduces native multirange types, which would be ideal. However, we would need to drop support for PostgreSQL 12 and 13 to utilize these. Additionally, these types appear unlikely to be supported by Django, so we would need to devise our own implementation for the ORM.

@jeremystretch commented on GitHub (Jul 9, 2024): Just noting for posterity: PostgreSQL 14 introduces native [multirange types](https://www.postgresql.org/docs/current/rangetypes.html), which would be ideal. However, we would need to drop support for PostgreSQL 12 and 13 to utilize these. Additionally, these types appear [unlikely to be supported by Django](https://code.djangoproject.com/ticket/33238), so we would need to devise our own implementation for the ORM.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6607