Skip to content

device.site.vlans.all() does not work with VLAN groups #20434

@misch42

Description

@misch42

NetBox Edition

NetBox Community

NetBox Version

v4.4.1

Python Version

3.12

Steps to Reproduce

Create a VLAN group with the scope "site" and choose site "A".
Create two VLANs, i.e. 10 and 20.
Assign VLAN 10 direct to the site "A".
Assign VLAN 20 to the group that is assigned to site "A".

To get all VLANs in a config tamplate I use:
for vlan in device.site.vlans.all()

With the change to deprecate VLAN to site assignment I only get the VLAN 10, that is directly assigned to the site. BUT NOT the vlan that is assigned to the VLAN group assigned to the site.

so the template
{% for vlan in device.site.vlans.all() %} vlan {{ vlan.vid }} name {{ vlan.name }} {%- endfor %}

results in

vlan 10 name MANAGEMENT

but no VLAN 20 any more.

Any idea how to solve this?

Michael Schwartzkopff

Expected Behavior

netbox renders all vlans regardless of assigned to a site or assigned to a group that is assigned to a site.

Observed Behavior

netbox only renders VLANs directly assigned to the site. VLANs in the group are ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs triageThis issue is awaiting triage by a maintainertype: bugA confirmed report of unexpected behavior in the application

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions