Allow non-unique VLAN names within a VLAN group #1498

Closed
opened 2025-12-29 16:32:29 +01:00 by adam · 5 comments
Owner

Originally created by @CoolSilver on GitHub (Jan 17, 2018).

Issue type

[x] Feature request
[ ] Bug report
[ ] Documentation

Environment

  • Python version: 3.5.1.3
  • NetBox version: 2.2.8

Description

It would be nice to have multiple vlans in a particular vlan group with the same name. Currently you can have the same name on multiple vlans as long as they are either not assigned to a vlan group or different groups. This would be good for the same customer and application who have multiple vlans on different IP segments.

Taking two vlans named the same, assigning to the same vlan group gives the following message about unique ids

Duplicate key value violates unique constraint "ipam_vlan_group_id_name__uniq"
Detail: Key (group_id, name) = (5, vlan-name) already exists

Can this relationship be tied to the vlan itself since there is already a constraint on one per vlan number per group?

Originally created by @CoolSilver on GitHub (Jan 17, 2018). <!-- Before opening a new issue, please search through the existing issues to see if your topic has already been addressed. Note that you may need to remove the "is:open" filter from the search bar to include closed issues. Check the appropriate type for your issue below by placing an x between the brackets. For assistance with installation issues, or for any other issues other than those listed below, please raise your topic for discussion on our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please note that issues which do not fall under any of the below categories will be closed. Due to an excessive backlog of feature requests, we are not currently accepting any proposals which extend NetBox's feature scope. Do not prepend any sort of tag to your issue's title. An administrator will review your issue and assign labels as appropriate. ---> ### Issue type [x] Feature request <!-- An enhancement of existing functionality --> [ ] Bug report <!-- Unexpected or erroneous behavior --> [ ] Documentation <!-- A modification to the documentation --> <!-- Please describe the environment in which you are running NetBox. (Be sure to verify that you are running the latest stable release of NetBox before submitting a bug report.) If you are submitting a bug report and have made any changes to the code base, please first validate that your bug can be recreated while running an official release. --> ### Environment * Python version: 3.5.1.3 <!-- Example: 3.5.4 --> * NetBox version: 2.2.8 <!-- Example: 2.1.3 --> <!-- BUG REPORTS must include: * A list of the steps needed for someone else to reproduce the bug * A description of the expected and observed behavior * Any relevant error messages (screenshots may also help) FEATURE REQUESTS must include: * A detailed description of the proposed functionality * A use case for the new feature * A rough description of any necessary changes to the database schema * Any relevant third-party libraries which would be needed --> ### Description It would be nice to have multiple vlans in a particular vlan group with the same name. Currently you can have the same name on multiple vlans as long as they are either not assigned to a vlan group or different groups. This would be good for the same customer and application who have multiple vlans on different IP segments. Taking two vlans named the same, assigning to the same vlan group gives the following message about unique ids Duplicate key value violates unique constraint "ipam_vlan_group_id_name_<random>_uniq" Detail: Key (group_id, name) = (5, vlan-name) already exists Can this relationship be tied to the vlan itself since there is already a constraint on one per vlan number per group?
adam closed this issue 2025-12-29 16:32:29 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 30, 2018):

I can see use cases both for and against the unique constraint imposed on the VLAN name. Leaving this open for feedback.

@jeremystretch commented on GitHub (Jan 30, 2018): I can see use cases both for and against the unique constraint imposed on the VLAN name. Leaving this open for feedback.
Author
Owner

@lampwins commented on GitHub (Feb 5, 2018):

I have come across this before myself. Really it comes down to use case. As @jeremystretch has pointed out, it is easy to see it both ways but the current constraint does make NetBox opinionated as to the intended use case. That being said, I worked around it in other ways (not related to the use case explained above). The only danger I see is if two vlans are created without assigning a prefix, it would be hard to differentiate them in the UI.

@lampwins commented on GitHub (Feb 5, 2018): I have come across this before myself. Really it comes down to use case. As @jeremystretch has pointed out, it is easy to see it both ways but the current constraint does make NetBox opinionated as to the intended use case. That being said, I worked around it in other ways (not related to the use case explained above). The only danger I see is if two vlans are created without assigning a prefix, it would be hard to differentiate them in the UI.
Author
Owner

@CoolSilver commented on GitHub (Feb 5, 2018):

True it would be difficult if there were named the same and the same vlan id. The only difference would be the group name as a difference which works.

In my example there are two different vlan ids with the same name. Each exists without any group without conflict. Only when adding to same group. They are still forced unique by the vlan id per group.

Not every vlan would have a prefix as some could be layer 2 only between sites or devices etc

@CoolSilver commented on GitHub (Feb 5, 2018): True it would be difficult if there were named the same and the same vlan id. The only difference would be the group name as a difference which works. In my example there are two different vlan ids with the same name. Each exists without any group without conflict. Only when adding to same group. They are still forced unique by the vlan id per group. Not every vlan would have a prefix as some could be layer 2 only between sites or devices etc
Author
Owner

@jeremystretch commented on GitHub (Apr 3, 2018):

This doesn't seem to have gotten any traction, and I think the constraint we have in place now is the less-surprising approach.

@jeremystretch commented on GitHub (Apr 3, 2018): This doesn't seem to have gotten any traction, and I think the constraint we have in place now is the less-surprising approach.
Author
Owner

@swerveshot commented on GitHub (Dec 4, 2018):

Hey guys,

I ran into this issue as well when porting an existing VLAN administration from mediawiki (yeah, I know) to netbox. A large number of VLANs have a reservation status and a generic name. So lots of duplicates. I could potentially include the VLAN ID in the name but it feels a bit clunky.

I'm running netbox v2.4.8.

@jeremystretch Could you please consider re-opening this case?

@swerveshot commented on GitHub (Dec 4, 2018): Hey guys, I ran into this issue as well when porting an existing VLAN administration from mediawiki (yeah, I know) to netbox. A large number of VLANs have a reservation status and a generic name. So lots of duplicates. I _could_ potentially include the VLAN ID in the name but it feels a bit clunky. I'm running netbox v2.4.8. @jeremystretch Could you please consider re-opening this case?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1498