netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.79k stars 2.54k forks source link

vlans are not visible in site overview or API #9988

Closed sebastiaanvduijn closed 2 years ago

sebastiaanvduijn commented 2 years ago

NetBox version

3.2.7

Python version

3.8

Steps to Reproduce

Once a new vlan is created which is not directly attached to a site but to a site group and prefixes assigned to this vlan and assigned to a site, the vlan is not assigned to the site.

Site related objects

You get the same result while using the API

Expected Behavior

Expected behavior is to see the amount of vlans in use per site by doing a reverse lookup through prefixes assinged, this helps automation tools understanding the amount of vlans present and if not present create them.

Observed Behavior

vlans are not visible in the site overview or API

jeremystretch commented 2 years ago

Expected behavior is to see the amount of vlans in use per site by doing a reverse lookup through prefixes assinged

This would be extremely inefficient, which is one of the reasons the direct relationship between the site and VLAN objects exists. You need to assign VLANs to sites just as you do prefixes.

sebastiaanvduijn commented 2 years ago

As example: We have Vlan 60 which exist in 60 sites, if we need to assign a vlan per site this would mean 60 times vlan 60.... We have created vlan 60 once and the allocated prefixes are assigned to a site.

There for my ask for the above.

jeremystretch commented 2 years ago

if we need to assign a vlan per site this would mean 60 times vlan 60....

Correct. Do this. Because you have 60 VLANs, not one.