Closes #12622: Fix assigning VLAN without site to Prefix #12784
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This Pull Request enables users to be to select VLANs without a site assignment during creation and bulk import of Prefixes.
This Pull Request addresses issues #12622 and #12619.
Background
Previously, only VLANs assigned to the same site as the prefix were available for selection. However, as it is possible to create VLANs without a site assignment, a subset of selectable VLANs was excluded from the VLAN filter dropdown. Additionally, the import logic did not allow the assignment of a VLAN without a site when a site was specified for the prefix.
Changes
This Pull Request introduces a selector dialog to facilitate filtering and searching for VLANs during assignment. Furthermore, the prefix import code is enhanced to include VLANs without a site assignment in the filtering logic.
Benefits
This change enhances the usability of NetBox by allowing users to assign VLANs with a null site to Prefixes through the UI. Without this modification, Prefixes could only be assigned VLANs from the same site when a site was selected for a Prefix.
Creation Test
10.1.0.0/24
DM-Akron
Import Test
Steps for reproducing importing a new Prefix:
Import Query Tests
I manually tested importing different variations of prefixes to verify the new query in
PrefixImportForm
. The query results were collected by temporarily adding a print statement toPrefixImportForm.__init__
Import Test 1
This resulted in the following query:
Import Test 2
This resulted in the following query:
Import Test 3
This resulted in the following query:
Import Test 4
This resulted in the following query: