search for prefixes within a VRF does not work #2479

Closed
opened 2025-12-29 18:19:14 +01:00 by adam · 4 comments
Owner

Originally created by @JuergenKammer on GitHub (Mar 25, 2019).

Environment

  • Python version: 3.6.8
  • NetBox version: 2.5.8

Steps to Reproduce

  1. Create VRFs
  2. Create Prefixes in different VRFs
  3. Select "IPAM"->"Prefixes"
  4. Use the search area on the right side, select a VRF from which prefixes should be shown, and select "apply"

Expected Behavior

  1. Prefixes in only the selected VRF(s) are shown

Observed Behavior

  1. Prefixes from all VRFs are shown

REASON for the error:

  • the URL which is called when clicking on "apply" ends in something like:
    .../ipam/prefixes/?q=&within_include=&family=&mask_length=&vrf=8&is_pool=

SOLUTION:

it should be:
../ipam/prefixes/?q=&within_include=&family=&mask_length=&vrf_id=8&is_pool=

I.e. the selected vrf is mapped to its id, but the search looks for a vrf named such, not for the vrf_id with that number.

The URL with "vrf_id=..." results in the expected behavior.

Originally created by @JuergenKammer on GitHub (Mar 25, 2019). ### Environment * Python version: 3.6.8 * NetBox version: 2.5.8 ### Steps to Reproduce 1. Create VRFs 2. Create Prefixes in different VRFs 3. Select "IPAM"->"Prefixes" 4. Use the search area on the right side, select a VRF from which prefixes should be shown, and select "apply" <!-- What did you expect to happen? --> ### Expected Behavior 5. Prefixes in only the selected VRF(s) are shown <!-- What happened instead? --> ### Observed Behavior 5. Prefixes from all VRFs are shown ### REASON for the error: - the URL which is called when clicking on "apply" ends in something like: .../ipam/prefixes/?q=&within_include=&family=&mask_length=&vrf=8&is_pool= ### SOLUTION: it should be: ../ipam/prefixes/?q=&within_include=&family=&mask_length=&vrf_id=8&is_pool= I.e. the selected vrf is mapped to its id, but the search looks for a vrf named such, not for the vrf_id with that number. The URL with "vrf_id=..." results in the expected behavior.
adam added the type: bugstatus: accepted labels 2025-12-29 18:19:14 +01:00
adam closed this issue 2025-12-29 18:19:14 +01:00
Author
Owner

@DanSheps commented on GitHub (Mar 25, 2019):

I am unable to duplicate this on 2.5.8. Please provide a reproducible scenario on 2.5.8. Further, I checked the code and both the filter and form us "rd"

Data Load:

name, rd
VRF1, 1:1
VRF2, 2:2

prefix,vrf,status
192.168.1.0/24,1:1,Active
192.168.1.0/24,2:2,Active

Query:

IPAM->Prefixes
Filter for VRF1
"Apply"

Results:

192.168.1.0/24,1:1,Active

@DanSheps commented on GitHub (Mar 25, 2019): I am unable to duplicate this on 2.5.8. Please provide a reproducible scenario on 2.5.8. Further, I checked the code and both the filter and form us "rd" Data Load: ``` name, rd VRF1, 1:1 VRF2, 2:2 prefix,vrf,status 192.168.1.0/24,1:1,Active 192.168.1.0/24,2:2,Active ``` Query: IPAM->Prefixes Filter for VRF1 "Apply" Results: 192.168.1.0/24,1:1,Active
Author
Owner

@JuergenKammer commented on GitHub (Mar 25, 2019):

Ah.
I have NOT defined any rd.
Thus, try again, and define your VRFs without an rd.

This also explains why it could creep in, because RDs have not been optional for along time...

@JuergenKammer commented on GitHub (Mar 25, 2019): Ah. I have NOT defined any rd. Thus, try again, and define your VRFs without an rd. This also explains why it could creep in, because RDs have not been optional for along time...
Author
Owner

@DanSheps commented on GitHub (Mar 25, 2019):

I see...

This is related to the way ModelMultipleChoiceFilter works, because when it comes up against an invalid value, it returns null to the filter (which filters on nothing so you get everything)

@DanSheps commented on GitHub (Mar 25, 2019): I see... This is related to the way ModelMultipleChoiceFilter works, because when it comes up against an invalid value, it returns null to the filter (which filters on nothing so you get everything)
Author
Owner

@DanSheps commented on GitHub (Mar 25, 2019):

Any form using vrf rd will be affected.

@DanSheps commented on GitHub (Mar 25, 2019): Any form using vrf rd will be affected.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2479