Skip to content

Conversation

@dhenschen
Copy link
Contributor

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

dhenschen and others added 2 commits May 18, 2023 23:27
…i-port edits

This commit allows users to be able to select VLANs without a site assignment
during bulk interfaces edits under Devices > DEVICE COMPONENTS > Interfaces.

Prior to this commit, only VLANs that were assigned the same site as the device
were available for selection.
@jeremystretch
Copy link
Member

Thanks @dhenschen, nice work! I made one small tweak: I replaced the string null with a reference to the FILTERS_NULL_CHOICE_VALUE constant (which has the same value), just to ensure its usage can be tracked.

@jeremystretch jeremystretch merged commit 078893e into netbox-community:develop May 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot add tagged VLAN from other site on multiple port edit

2 participants