From the GUI we can't assign vlans from a VLAN Group with Virtualization Cluster as scope (works with the API) #8102

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

Originally created by @SteveRodrigue on GitHub (May 23, 2023).

NetBox version

v3.3.10

Python version

3.9

Steps to Reproduce

  1. Create a device in a site. <-- Will be referred to "the device" from now on.
  2. Create a Virtualization Cluster with at least the device.
    2a. Create in the IPAM a VLAN Group attached to the site of the device (created in step 0).
    2b. Create in the IPAM a VLAN Group attached to the just created Virtualization Cluster.
  3. Create at least 1 vlan in that newly created VLAN Groups (site and cluster based).
    4a. From the web GUI try to attach this Virtualization Cluster VLAN (from step 3) to an interface on a device in the group (from step 1). <-- The vlan don't show up in the drop down list.
    4b. From the API, we can assign the vlan that is impossible to assign from the GUI.

Expected Behavior

The WEB Gui dropdown list should pull from the appropriate VLAN group. It looks like the the list that is pulled by default is the "site" vlan group and we can't override the behaviour.

Observed Behavior

When using the API, this limitation si not present. In fact, since it's working the WEB Gui display the correct vlan until we try to edit the interface, then when we select the vlans, the Virtualization vlan disappear from the list and it is replaced by the list of vlans from the site group instead.

Originally created by @SteveRodrigue on GitHub (May 23, 2023). ### NetBox version v3.3.10 ### Python version 3.9 ### Steps to Reproduce 0. Create a device in a site. <-- Will be referred to "the device" from now on. 1. Create a Virtualization Cluster with at least the device. 2a. Create in the IPAM a VLAN Group attached to the site of the device (created in step 0). 2b. Create in the IPAM a VLAN Group attached to the just created Virtualization Cluster. 3. Create at least 1 vlan in that newly created VLAN Groups (site and cluster based). 4a. From the web GUI try to attach this Virtualization Cluster VLAN (from step 3) to an interface on a device in the group (from step 1). <-- The vlan don't show up in the drop down list. 4b. From the API, we can assign the vlan that is impossible to assign from the GUI. ### Expected Behavior The WEB Gui dropdown list should pull from the appropriate VLAN group. It looks like the the list that is pulled by default is the "site" vlan group and we can't override the behaviour. ### Observed Behavior When using the API, this limitation si not present. In fact, since it's working the WEB Gui display the _correct_ vlan until we try to edit the interface, then when we select the vlans, the Virtualization vlan disappear from the list and it is replaced by the list of vlans from the site group instead.
adam added the type: bugstatus: revisions needed labels 2025-12-29 20:32:23 +01:00
adam closed this issue 2025-12-29 20:32:23 +01:00
Author
Owner

@stuntguy3000 commented on GitHub (May 24, 2023):

image

Unable to replicate, but can you please clarify your replication steps as they are not clear and are hard to follow. Pictures or a video would assist.

@stuntguy3000 commented on GitHub (May 24, 2023): ![image](https://github.com/netbox-community/netbox/assets/1522389/699254b5-7324-46e0-967b-99bdeb5654a8) Unable to replicate, but can you please clarify your replication steps as they are not clear and are hard to follow. Pictures or a video would assist.
Author
Owner

@SteveRodrigue commented on GitHub (May 24, 2023):

@stuntguy3000 : I'll go back in my lab environnement and go over the steps by steps once more to check it.

@SteveRodrigue commented on GitHub (May 24, 2023): @stuntguy3000 : I'll go back in my lab environnement and go over the steps by steps once more to check it.
Author
Owner

@jeremystretch commented on GitHub (May 24, 2023):

v3.3.10

Your NetBox version is rather old. Please also try upgrading to the current stable release (v3.5.2).

@jeremystretch commented on GitHub (May 24, 2023): > v3.3.10 Your NetBox version is rather old. Please also try upgrading to the current stable release (v3.5.2).
Author
Owner

@SteveRodrigue commented on GitHub (May 24, 2023):

@jeremystretch : That's something we'll need to try. Can you confirm the problem we experience may be related to the Netbox version (from the changelogs and/or your quite extensive knowledge of the product/code).

I was about to post that I can reliability reproduce the problem (on v.3.3.10) and, I feel like the problem isn't in the core code per se, but in the Web interface processing of the VLAN selection (dynamic) menu.

@SteveRodrigue commented on GitHub (May 24, 2023): @jeremystretch : That's something we'll need to try. Can you confirm the problem we experience may be related to the Netbox version (from the changelogs and/or your quite extensive knowledge of the product/code). I was about to post that I can reliability reproduce the problem (on v.3.3.10) and, I feel like the problem isn't in the core code per se, but in the Web interface processing of the VLAN selection (dynamic) menu.
Author
Owner

@jeremystretch commented on GitHub (May 24, 2023):

No, but you can find the release notes here: https://docs.netbox.dev/en/stable/release-notes/

@jeremystretch commented on GitHub (May 24, 2023): No, but you can find the release notes here: https://docs.netbox.dev/en/stable/release-notes/
Author
Owner

@SteveRodrigue commented on GitHub (May 24, 2023):

I looked the source code of the web page.

Netbox v3.3.10 WEB UI is doing this call: /api/ipam/vlans/?available_on_device=1234&brief=true&group_id=26

When I manually test this exact API call, it returns an empty list of vlans. If I edit the API call, I get the correct list of vlan: /api/ipam/vlans/?brief=true&group_id=26

I'll try to test it on the latest Netbox (need to install/upgrade our lab). So, I'll be able to confirm if the behaviour changed in the latest and greatest Netbox.

@SteveRodrigue commented on GitHub (May 24, 2023): I looked the source code of the web page. Netbox v3.3.10 WEB UI is doing this call: `/api/ipam/vlans/?available_on_device=1234&brief=true&group_id=26` When I manually test this exact API call, it returns an empty list of vlans. If I edit the API call, I get the correct list of vlan: `/api/ipam/vlans/?brief=true&group_id=26` I'll try to test it on the latest Netbox (need to install/upgrade our lab). So, I'll be able to confirm if the behaviour changed in the latest and greatest Netbox.
Author
Owner

@SteveRodrigue commented on GitHub (May 24, 2023):

@stuntguy3000 : I just did the test on https://demo.netbox.dev and I have the same behaviour.

Virtualization cluster:
https://demo.netbox.dev/virtualization/clusters/43/

VLAN group:
https://demo.netbox.dev/ipam/vlan-groups/10/

Interface I can't assign the vlan on:
https://demo.netbox.dev/dcim/interfaces/1924/

Here is the list of related changelogs in the demo server:

8719	2023-05-24 13:27	admin	—	Created	Interface  et-0/0/0	              b371ca56-7ff8-4ad3-a89b-496c4a7c580b	
8718	2023-05-24 13:26	admin	—	Created	VLAN       test_vlan (1111)	      667962d5-ead4-443b-a8dc-7983a925c82d	
8714	2023-05-24 13:26	admin	—	Created	VLAN Group test_fabric_vlan_group 746a8458-150a-48a4-9c37-c8f48594effc	
8713	2023-05-24 13:25	admin	—	Updated	Device     fabricA-device1        b91322d4-5171-4143-8289-0975311b4758	
8712	2023-05-24 13:25	admin	—	Created	Device     fabricA-device1 	      c513eea3-d91a-4588-93b0-52a3c8eb1424	
8711	2023-05-24 13:24	admin	—	Created	Cluster	   test_fabric	          ee38fd21-e086-4f0d-bf6e-c65a34c340d4
@SteveRodrigue commented on GitHub (May 24, 2023): @stuntguy3000 : I just did the test on https://demo.netbox.dev and I have the same behaviour. Virtualization cluster: https://demo.netbox.dev/virtualization/clusters/43/ VLAN group: https://demo.netbox.dev/ipam/vlan-groups/10/ Interface I can't assign the vlan on: https://demo.netbox.dev/dcim/interfaces/1924/ Here is the list of related changelogs in the demo server: ``` 8719 2023-05-24 13:27 admin — Created Interface et-0/0/0 b371ca56-7ff8-4ad3-a89b-496c4a7c580b 8718 2023-05-24 13:26 admin — Created VLAN test_vlan (1111) 667962d5-ead4-443b-a8dc-7983a925c82d 8714 2023-05-24 13:26 admin — Created VLAN Group test_fabric_vlan_group 746a8458-150a-48a4-9c37-c8f48594effc 8713 2023-05-24 13:25 admin — Updated Device fabricA-device1 b91322d4-5171-4143-8289-0975311b4758 8712 2023-05-24 13:25 admin — Created Device fabricA-device1 c513eea3-d91a-4588-93b0-52a3c8eb1424 8711 2023-05-24 13:24 admin — Created Cluster test_fabric ee38fd21-e086-4f0d-bf6e-c65a34c340d4 ```
Author
Owner

@stuntguy3000 commented on GitHub (May 24, 2023):

Gotchya - I see what you mean. Will do more investigations tomorrow, I think your Issue Title covers it - note the demo instance will be wiped every 24hrs so those links won't be handy for long.

@stuntguy3000 commented on GitHub (May 24, 2023): Gotchya - I see what you mean. Will do more investigations tomorrow, I think your Issue Title covers it - note the demo instance will be wiped every 24hrs so those links won't be handy for long.
Author
Owner

@SteveRodrigue commented on GitHub (May 24, 2023):

@stuntguy3000 : It's OK. It's easy to reproduce the issue. I just found it handy to use demo.netbox.dev to show/reproduce the issue. I could even create a quick Ansible playbook to recreate the context whenever we want.

The current workaround will be for us to use Netbox Scripts (and/or API calls) to properly assign the vlans.

@SteveRodrigue commented on GitHub (May 24, 2023): @stuntguy3000 : It's OK. It's easy to reproduce the issue. I just found it handy to use demo.netbox.dev to show/reproduce the issue. I could even create a quick Ansible playbook to recreate the context whenever we want. The current workaround will be for us to use Netbox Scripts (and/or API calls) to properly assign the vlans.
Author
Owner

@DanSheps commented on GitHub (May 24, 2023):

@SteveRodrigue We still require more clear reproduction steps so that we can implement a fix (if needed) and perform testing after the fact. Demo data is destroyed daily.

@DanSheps commented on GitHub (May 24, 2023): @SteveRodrigue We still require more clear reproduction steps so that we can implement a fix (if needed) and perform testing after the fact. Demo data is destroyed daily.
Author
Owner

@SteveRodrigue commented on GitHub (May 24, 2023):

@DanSheps : Ok. So, what I'll do is to document all the API calls to reproduce a setup. Basically, I'll take note of the changelogs listed in my previous post. 😄

This should be enough and will make the problem easy to reproduce.

@SteveRodrigue commented on GitHub (May 24, 2023): @DanSheps : Ok. So, what I'll do is to document all the API calls to reproduce a setup. Basically, I'll take note of the changelogs listed in my previous post. 😄 This should be enough and will make the problem easy to reproduce.
Author
Owner

@SteveRodrigue commented on GitHub (May 24, 2023):

The following Ansible Playbook will create all objects required and will display the instructions to replicate the issue.

---
#
# WARNING: This playbook is provided as-is and may not work on all Netbox instance
#
# This Ansible playbook recreates all required object to simulate the
# problem of VLAN assignment when the VLAN group scope is a Virtualization
# Cluster (may apply to other scope, haven't tested).
#
# To run this playbook on your Netbox instance, you should replace the
# following variable with the one your using in your environment:
# {{ netbox_url }}          <-- Your Netbox server API URL
# {{ netbox_api_token_rw }} <-- Your Netbox read/write API token
#
# Created by Steve Rodrigue (steve.rodrigue@gmail.com)
# Related GIT issue/post: https://github.com/netbox-community/netbox/issues/12690
#
- name: "Create the required objects to reproduce the vlan assignment when using vlan group with a Virt->Cluster scope."
  hosts: localhost
  connection: local
  gather_facts: false
  vars:
    cluster_type: "test_cluster_type"      # Required to create a cluster (dummy data)
    cluster_name: "test_cluster"           # Cluster name
    device_manufacturer: "test_acme"       # Required to create a device (dummy data)
    device_model: "test_acme_switch"       # Required to create a device (dummy data)
    device_role: "switch"                  # Required to create a device (dummy data)
    site: "Palmer Station"                 # Required to create a device (dummy data)
    device_name: "test_cluster_member1"    # Name of the device to be added to the cluster
    interface_name: "et-0/0/0"             # We create one interface in the device to test vlan assignment
    vlan_group: "test_cluster_vlans"       # Vlan group assigned to the cluster (via a scope)
    vlan_id: "1111"                        # Vlan ID to be used
    vlan_name: "test_want-to-be-assigned"  # Vlan name to be used
  tasks:
    - name: "Create a new cluster type"
      netbox.netbox.netbox_cluster_type:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ cluster_type }}"
    - name: "Create a new cluster"
      netbox.netbox.netbox_cluster:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ cluster_name }}"
          cluster_type: "{{ cluster_type }}"
      register: cluster_creation
    - name: "Create a device manufacturer for the device type to be created"
      netbox.netbox.netbox_manufacturer:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ device_manufacturer }}"
    - name: "Create a device type for the device to be created"
      netbox.netbox.netbox_device_type:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          model: "{{ device_model }}"
          manufacturer: "{{ device_manufacturer }}"
    - name: "Create a device and assign it to a cluster"
      netbox.netbox.netbox_device_role:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ device_role }}"
    - name: "Create a device and assign it to a cluster"
      netbox.netbox.netbox_site:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ site }}"
    - name: "Create a device and assign it to a cluster"
      netbox.netbox.netbox_device:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ device_name }}"
          cluster: "{{ cluster_name }}"
          device_type: "{{ device_model }}"
          device_role: "{{ device_role }}"
          site: "{{ site }}"
    - name: "Create an interface to assign vlan onto in the WEB UI."
      netbox.netbox.netbox_device_interface:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ interface_name }}"
          device: "{{ device_name }}"
          type: "10gbase-x-sfpp"
      register: interface_creation
    - name: "Create a vlan group with a scope."
      netbox.netbox.netbox_vlan_group:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ vlan_group }}"
          scope_type: "virtualization.cluster"
          scope: "{{ cluster_name }}"
      register: vlan_group_creation
    - name: "Add a vlan to the vlan group"
      netbox.netbox.netbox_vlan:
        netbox_url: "{{ netbox_url }}"
        netbox_token: "{{ netbox_api_token_rw }}"
        state: present
        data:
          name: "{{ vlan_name }}"
          vid: "{{ vlan_id }}"
          vlan_group: "{{ vlan_group }}"
      register: vlan_creation
    - name: "What to do next?"
      ansible.builtin.debug:
        msg: "\n1. Go to this URL with your browser: {{ interface_creation.interface.url | replace ('api/', '') }}
              \n2. Edit the interface.
              \n3. Set the interface to 802.1Q access mode.
              \n4. Select VLAN group: {{ vlan_group }}
              \n5. Try to assign vlan {{ vlan_name }}/{{ vlan_id }} from that VLAN group.
              \n
              \nUseful URLs:
              \nCluster:    {{ cluster_creation.cluster.url | replace ('api/', '') }}
              \nVlan group: {{ vlan_group_creation.vlan_group.url | replace ('api/', '') }}
              \nVlan:       {{ vlan_creation.vlan.url | replace ('api/', '') }}"
      failed_when: false

@SteveRodrigue commented on GitHub (May 24, 2023): The following Ansible Playbook will create all objects required and will display the instructions to replicate the issue. ``` --- # # WARNING: This playbook is provided as-is and may not work on all Netbox instance # # This Ansible playbook recreates all required object to simulate the # problem of VLAN assignment when the VLAN group scope is a Virtualization # Cluster (may apply to other scope, haven't tested). # # To run this playbook on your Netbox instance, you should replace the # following variable with the one your using in your environment: # {{ netbox_url }} <-- Your Netbox server API URL # {{ netbox_api_token_rw }} <-- Your Netbox read/write API token # # Created by Steve Rodrigue (steve.rodrigue@gmail.com) # Related GIT issue/post: https://github.com/netbox-community/netbox/issues/12690 # - name: "Create the required objects to reproduce the vlan assignment when using vlan group with a Virt->Cluster scope." hosts: localhost connection: local gather_facts: false vars: cluster_type: "test_cluster_type" # Required to create a cluster (dummy data) cluster_name: "test_cluster" # Cluster name device_manufacturer: "test_acme" # Required to create a device (dummy data) device_model: "test_acme_switch" # Required to create a device (dummy data) device_role: "switch" # Required to create a device (dummy data) site: "Palmer Station" # Required to create a device (dummy data) device_name: "test_cluster_member1" # Name of the device to be added to the cluster interface_name: "et-0/0/0" # We create one interface in the device to test vlan assignment vlan_group: "test_cluster_vlans" # Vlan group assigned to the cluster (via a scope) vlan_id: "1111" # Vlan ID to be used vlan_name: "test_want-to-be-assigned" # Vlan name to be used tasks: - name: "Create a new cluster type" netbox.netbox.netbox_cluster_type: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ cluster_type }}" - name: "Create a new cluster" netbox.netbox.netbox_cluster: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ cluster_name }}" cluster_type: "{{ cluster_type }}" register: cluster_creation - name: "Create a device manufacturer for the device type to be created" netbox.netbox.netbox_manufacturer: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ device_manufacturer }}" - name: "Create a device type for the device to be created" netbox.netbox.netbox_device_type: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: model: "{{ device_model }}" manufacturer: "{{ device_manufacturer }}" - name: "Create a device and assign it to a cluster" netbox.netbox.netbox_device_role: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ device_role }}" - name: "Create a device and assign it to a cluster" netbox.netbox.netbox_site: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ site }}" - name: "Create a device and assign it to a cluster" netbox.netbox.netbox_device: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ device_name }}" cluster: "{{ cluster_name }}" device_type: "{{ device_model }}" device_role: "{{ device_role }}" site: "{{ site }}" - name: "Create an interface to assign vlan onto in the WEB UI." netbox.netbox.netbox_device_interface: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ interface_name }}" device: "{{ device_name }}" type: "10gbase-x-sfpp" register: interface_creation - name: "Create a vlan group with a scope." netbox.netbox.netbox_vlan_group: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ vlan_group }}" scope_type: "virtualization.cluster" scope: "{{ cluster_name }}" register: vlan_group_creation - name: "Add a vlan to the vlan group" netbox.netbox.netbox_vlan: netbox_url: "{{ netbox_url }}" netbox_token: "{{ netbox_api_token_rw }}" state: present data: name: "{{ vlan_name }}" vid: "{{ vlan_id }}" vlan_group: "{{ vlan_group }}" register: vlan_creation - name: "What to do next?" ansible.builtin.debug: msg: "\n1. Go to this URL with your browser: {{ interface_creation.interface.url | replace ('api/', '') }} \n2. Edit the interface. \n3. Set the interface to 802.1Q access mode. \n4. Select VLAN group: {{ vlan_group }} \n5. Try to assign vlan {{ vlan_name }}/{{ vlan_id }} from that VLAN group. \n \nUseful URLs: \nCluster: {{ cluster_creation.cluster.url | replace ('api/', '') }} \nVlan group: {{ vlan_group_creation.vlan_group.url | replace ('api/', '') }} \nVlan: {{ vlan_creation.vlan.url | replace ('api/', '') }}" failed_when: false ```
Author
Owner

@DanSheps commented on GitHub (May 25, 2023):

We don't use Ansible.

Please review the Issue intake policy, contributing guide and the getting involved wiki.

@DanSheps commented on GitHub (May 25, 2023): We don't use Ansible. Please review the [Issue intake](https://github.com/netbox-community/netbox/wiki/Issue-Intake-Policy) policy, [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md) and the [getting involved](https://github.com/netbox-community/netbox/wiki/Getting-Involved) wiki.
Author
Owner

@stuntguy3000 commented on GitHub (May 25, 2023):

I've been able to replicate the issue - working on a fix.

@stuntguy3000 commented on GitHub (May 25, 2023): I've been able to replicate the issue - working on a fix.
Author
Owner

@SteveRodrigue commented on GitHub (May 25, 2023):

@DanSheps : I've used Ansible because this is what I use to interact with Netbox most of the time. Since @stuntguy3000 have been able to reproduce the problem, I won't rewrite my how-to guide. Next time, I'll check how I can submit required data into another format.

I assumed many of the Netbox contributors would be comfortable with Ansible (and Ansible Netbox modules).

@SteveRodrigue commented on GitHub (May 25, 2023): @DanSheps : I've used Ansible because this is what I use to interact with Netbox most of the time. Since @stuntguy3000 have been able to reproduce the problem, I won't rewrite my how-to guide. Next time, I'll check how I can submit required data into another format. I assumed many of the Netbox contributors would be comfortable with Ansible (and Ansible Netbox modules).
Author
Owner

@jeremystretch commented on GitHub (May 30, 2023):

As you've opted not to provide clear reproduction instructions despite being asked several times, I'm closing this issue. @stuntguy3000 if you would like to submit a new issue clearly documenting the steps you've followed to reproduce the issue, you are welcome to do so.

@jeremystretch commented on GitHub (May 30, 2023): As you've opted not to provide clear reproduction instructions despite being asked several times, I'm closing this issue. @stuntguy3000 if you would like to submit a new issue clearly documenting the steps you've followed to reproduce the issue, you are welcome to do so.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8102