[PR #12659] [MERGED] Closes #11619: Include VLANs with a null site in query during bulk interface edit for Devices > DEVICE COMPONENTS > Interfaces #14027

Closed
opened 2025-12-29 23:22:07 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/12659
Author: @dhenschen
Created: 5/19/2023
Status: Merged
Merged: 5/22/2023
Merged by: @jeremystretch

Base: developHead: 11619-cannot-add-tagged-vlan-without-site-on-multiple-port-edit


📝 Commits (2)

  • 9a159db Closes #11619: Allow VLANs without a site during multi-port edits
  • 17d68c4 Replace 'null' with FILTERS_NULL_CHOICE_VALUE constant

📊 Changes

1 file changed (+8 additions, -2 deletions)

View changed files

📝 netbox/dcim/forms/bulk_edit.py (+8 -2)

📄 Description

Fixes: #11619

Summary

This Pull Request enables users to be to select VLANs without a site assignment during bulk interface edits under Devices > DEVICE COMPONENTS > Interfaces.

Background

Previously, only VLANs assigned to the same site as the filtered device were available for selection. However, since it is possible to create VLANs without a site assignment, this led to a subset of selectable VLANs being omitted from the VLAN filter dropdown. This Pull Request addresses this issue by enhancing the functionality to include all selectable VLANs in the filter dropdown.

Changes

This Pull Request updates the query parameters in the code behind the bulk edit to search for VLANs with the site set to null, allowing the selection of VLANs without a site assignment.

Benefits

By incorporating this change, NetBox's usability is improved as users can now assign VLANs with a null site during a bulk interface edit. Without this modification, each interface would need to be individually edited through a different section of the UI that already worked.

Test

To reproduce the bug described in issue #11619, follow these steps:

  1. Create a site named SITE_TEST.
  2. Import a new VLAN with the following details:
vid: 10
name: VLAN 10 SITE_TEST
status: active
site: SITE_TEST
  1. Import another VLAN without specifying a site:
vid: 20
name: VLAN 20 SITE_TEST
status: active
  1. Create a device DEV_TEST in Site SITE_TEST with at least two interfaces. You can use the ISR 1111-8P defined in this GitHub repository, or alternatively, import the device using the following YAML:
name: DEV_TEST
site: SITE_TEST
device_role: Access Switch
status: active
manufacturer: Cisco
device_type: ISR 1111-8P
  1. Navigate to Devices -> DEVICE COMPONENTS -> Interfaces
  2. Filter for all interfaces belonging to the DEV_TEST device.

image

  1. The changes introduced by this Pull Request can be visually compared in the following sections:

Prior to this Pull Request

Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Untagged VLAN includes only VLAN 10

image

Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Tagged VLANs includes only VLAN 10

image

With this Pull Request

Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Untagged VLAN includes VLAN 10 and VLAN 20

image

Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Tagged VLANs includes VLAN 10 and VLAN 20

image


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/12659 **Author:** [@dhenschen](https://github.com/dhenschen) **Created:** 5/19/2023 **Status:** ✅ Merged **Merged:** 5/22/2023 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop` ← **Head:** `11619-cannot-add-tagged-vlan-without-site-on-multiple-port-edit` --- ### 📝 Commits (2) - [`9a159db`](https://github.com/netbox-community/netbox/commit/9a159dbdcd534a2f81a8dcc6b747531ac35d18b2) Closes #11619: Allow VLANs without a site during multi-port edits - [`17d68c4`](https://github.com/netbox-community/netbox/commit/17d68c4390ac7aaf80e3bb54d0f8a36a16430bdc) Replace 'null' with FILTERS_NULL_CHOICE_VALUE constant ### 📊 Changes **1 file changed** (+8 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/forms/bulk_edit.py` (+8 -2) </details> ### 📄 Description ### Fixes: #11619 ### Summary This Pull Request enables users to be to select VLANs **without** a site assignment during bulk interface edits under Devices > DEVICE COMPONENTS > Interfaces. ### Background Previously, only VLANs assigned to the same site as the filtered device were available for selection. However, since it is possible to create VLANs without a site assignment, this led to a subset of selectable VLANs being omitted from the VLAN filter dropdown. This Pull Request addresses this issue by enhancing the functionality to include all selectable VLANs in the filter dropdown. ### Changes This Pull Request updates the query parameters in the code behind the bulk edit to search for VLANs with the site set to null, allowing the selection of VLANs without a site assignment. ### Benefits By incorporating this change, NetBox's usability is improved as users can now assign VLANs with a null site during a bulk interface edit. Without this modification, each interface would need to be individually edited through a different section of the UI that already worked. ## Test To reproduce the bug described in issue #11619, follow these steps: 1. Create a site named SITE_TEST. 2. Import a new VLAN with the following details: ```yaml vid: 10 name: VLAN 10 SITE_TEST status: active site: SITE_TEST ``` 4. Import another VLAN without specifying a site: ```yaml vid: 20 name: VLAN 20 SITE_TEST status: active ``` 5. Create a device `DEV_TEST` in Site `SITE_TEST` with at least two interfaces. You can use the ISR 1111-8P defined in [this GitHub repository](https://github.com/netbox-community/netbox-demo-data), or alternatively, import the device using the following YAML: ```yaml name: DEV_TEST site: SITE_TEST device_role: Access Switch status: active manufacturer: Cisco device_type: ISR 1111-8P ``` 7. Navigate to [Devices -> DEVICE COMPONENTS -> Interfaces](https://demo.netbox.dev/dcim/interfaces/) 8. Filter for all interfaces belonging to the `DEV_TEST` device. ![image](https://github.com/netbox-community/netbox/assets/11417982/17104b61-2b41-4d90-8973-253b83ae0946) 10. The changes introduced by this Pull Request can be visually compared in the following sections: ### Prior to this Pull Request Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Untagged VLAN includes only VLAN 10 ![image](https://github.com/netbox-community/netbox/assets/11417982/fede615e-fec2-4eb7-80f2-85aa0272b757) Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Tagged VLANs includes only VLAN 10 ![image](https://github.com/netbox-community/netbox/assets/11417982/228d1592-0921-43b5-a6e1-e8a9f544c7a0) ### With this Pull Request Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Untagged VLAN includes VLAN 10 and VLAN 20 ![image](https://github.com/netbox-community/netbox/assets/11417982/b8c0212b-4a8e-4dc1-8fea-fecbab0d4520) Edit multiple interfaces -> 802.1Q Switching Mode: Tagged -> Tagged VLANs includes VLAN 10 and VLAN 20 ![image](https://github.com/netbox-community/netbox/assets/11417982/c29400f6-cdb1-41d8-b7bb-0e2689def3b0) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 23:22:07 +01:00
adam closed this issue 2025-12-29 23:22:07 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#14027