Implement a VLAN members view #1601

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

Originally created by @Alestor on GitHub (Mar 4, 2018).

Issue type

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

Environment

  • Python version: 3.5.3
  • NetBox version: 2.3.0

Description

Hello,

the webgui currently does not provide a view to check on which interfaces of devices a vlan is associated. At least I haven't found one yet.
Getting a summary list of access and trunk ports by selecting ipam/vlans/ipam_vlan.id/ would be a great enhancement from administrative perspective. This could be accomplished without any change to the database schema as far as i can tell.

A db query for devices / ports which have a vlan tagged associated

SELECT dcim_device.name, dcim_interface.name, dcim_interface.mode FROM dcim_interface_tagged_vlans INNER JOIN ipam_vlan ON dcim_interface_tagged_vlans.vlan_id = ipam_vlan.id INNER JOIN dcim_interface ON dcim_interface_tagged_vlans.interface_id = dcim_interface.id INNER JOIN dcim_device ON dcim_device.id = dcim_interface.device_id WHERE ipam_vlan.id =1;

and a query for devices and interfaces which have a vlan nativce associated:

SELECT dcim_device.name, dcim_interface.name, dcim_interface.mode FROM dcim_interface INNER JOIN ipam_vlan ON dcim_interface.untagged_vlan_id = ipam_vlan.id INNER JOIN dcim_device ON dcim_device.id = dcim_interface.device_id WHERE ipam_vlan.id =1;

I do know jack about SQL (and even less about python), so there is a good chance to do this in a better way.

Anyway at this point I like to thank the developers for this great piece of software.

best regards

Originally created by @Alestor on GitHub (Mar 4, 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.3 * NetBox version: 2.3.0 <!-- 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 Hello, the webgui currently does not provide a view to check on which interfaces of devices a vlan is associated. At least I haven't found one yet. Getting a summary list of access and trunk ports by selecting ipam/vlans/ipam_vlan.id/ would be a great enhancement from administrative perspective. This could be accomplished without any change to the database schema as far as i can tell. A db query for devices / ports which have a vlan tagged associated `SELECT dcim_device.name, dcim_interface.name, dcim_interface.mode FROM dcim_interface_tagged_vlans INNER JOIN ipam_vlan ON dcim_interface_tagged_vlans.vlan_id = ipam_vlan.id INNER JOIN dcim_interface ON dcim_interface_tagged_vlans.interface_id = dcim_interface.id INNER JOIN dcim_device ON dcim_device.id = dcim_interface.device_id WHERE ipam_vlan.id =1;` and a query for devices and interfaces which have a vlan nativce associated: `SELECT dcim_device.name, dcim_interface.name, dcim_interface.mode FROM dcim_interface INNER JOIN ipam_vlan ON dcim_interface.untagged_vlan_id = ipam_vlan.id INNER JOIN dcim_device ON dcim_device.id = dcim_interface.device_id WHERE ipam_vlan.id =1;` I do know jack about SQL (and even less about python), so there is a good chance to do this in a better way. Anyway at this point I like to thank the developers for this great piece of software. best regards
adam added the status: acceptedtype: feature labels 2025-12-29 16:33:22 +01:00
adam closed this issue 2025-12-29 16:33:23 +01:00
Author
Owner

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

Representing this data was something I struggled with when implementing #150. Ultimately I decided to defer the UI to get the feature out the door. Showing the associations from the device/interface context is tricky because of the number of vlans that could potentially be assigned. I had not considered the view from the opposite perspective (from the VLAN). I will play around with this; like you said it would not be that difficult.

@lampwins commented on GitHub (Mar 5, 2018): Representing this data was something I struggled with when implementing #150. Ultimately I decided to defer the UI to get the feature out the door. Showing the associations from the device/interface context is tricky because of the number of vlans that could potentially be assigned. I had not considered the view from the opposite perspective (from the VLAN). I will play around with this; like you said it would not be that difficult.
Author
Owner

@jeremystretch commented on GitHub (Mar 6, 2018):

Just so I understand, this request is to implement a view showing all of the interfaces (and their parent devices/VMs) assigned to a particular VLAN? Seems like we could add a "members" tab to the VLAN view to do this pretty easily.

@jeremystretch commented on GitHub (Mar 6, 2018): Just so I understand, this request is to implement a view showing all of the interfaces (and their parent devices/VMs) assigned to a particular VLAN? Seems like we could add a "members" tab to the VLAN view to do this pretty easily.
Author
Owner

@lampwins commented on GitHub (Mar 6, 2018):

@jeremystretch yep, that's pretty much exactly what I had in mind for this.

@lampwins commented on GitHub (Mar 6, 2018): @jeremystretch yep, that's pretty much exactly what I had in mind for this.
Author
Owner

@cyberlu commented on GitHub (Mar 22, 2018):

This is near of what we are searching for.
At the moment we still use our xls-Sheets shame because of the possibility to have an overview of the switch with the assinged vlans.
netbox_view_vlan

I would love to see this under the Device.
Populating a table would be easy enough, as all the data are already in the DB.
here is what i would do if i could program:
First Line:
The names on top will be filled with the "Connection" from Interfaces
Second Line:
Switch01 is simply the name of the Device then the Type with IP(and mac?)
Third Line:
Information titles and Portnames: VLAN -> ID -> Portname/number
Rest:
The VLAN-Names -> VLAN-ID -> Tagged or Untagged status.

to enumerate how big the table should get we can get the numbers of interfaces attached to the device (in this case 8) plus 2 to get 10 Rows
The number of tagged/untagged VLAN's on this device (no need to show VLAN's that are not tagged or untagged) we get 6 participating VLAN's plus 2 Columns = 8

So we would need a table with 10 Rows and 8 Columns to display an overview of the Switch-Config.

As we have a lot of VLAN's and Switches this is the only reason we do not have implemented Netbox yet.
if i can be of assistans anyhow please let me know. unfortunately i don't know anything about python

@cyberlu commented on GitHub (Mar 22, 2018): This is near of what we are searching for. At the moment we still use our xls-Sheets *shame* because of the possibility to have an overview of the switch with the assinged vlans. ![netbox_view_vlan](https://user-images.githubusercontent.com/37651812/37757113-1a236292-2dac-11e8-95f1-07c621a56ed6.JPG) I would love to see this under the Device. Populating a table would be easy enough, as all the data are already in the DB. here is what i would do if i could program: First Line: The names on top will be filled with the "Connection" from Interfaces Second Line: Switch01 is simply the name of the Device then the Type with IP(and mac?) Third Line: Information titles and Portnames: VLAN -> ID -> Portname/number Rest: The VLAN-Names -> VLAN-ID -> Tagged or Untagged status. to enumerate how big the table should get we can get the numbers of interfaces attached to the device (in this case 8) plus 2 to get 10 Rows The number of tagged/untagged VLAN's on this device (no need to show VLAN's that are not tagged or untagged) we get 6 participating VLAN's plus 2 Columns = 8 So we would need a table with 10 Rows and 8 Columns to display an overview of the Switch-Config. As we have a lot of VLAN's and Switches this is the only reason we do not have implemented Netbox yet. if i can be of assistans anyhow please let me know. unfortunately i don't know anything about python
Author
Owner

@Alestor commented on GitHub (Mar 23, 2018):

@jeremystretch: Thank you for the implementation. Works great.

@Alestor commented on GitHub (Mar 23, 2018): @jeremystretch: Thank you for the implementation. Works great.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1601