Getting prefixes by vrf name fails #3484

Closed
opened 2025-12-29 18:29:27 +01:00 by adam · 6 comments
Owner

Originally created by @Dimaqa on GitHub (Mar 18, 2020).

Environment

Python version: 3.6.9
NetBox version: 2.7.6, same behavior on 2.7.9-dev

Steps to Reproduce

GET /api/ipam/prefixes/?vrf=FOR-TESTS

Probably its a swagger bug and you cant really get prefixes by vrf name directrly (There are two fields: vrf and vrf_id), because if you search through netbox unterface, it replaces vrf name with id in query

Observed Behavior

400 Bad Request: {'vrf': ['Select a valid choice. TEST-VRF is not one of the available choices.']}

Originally created by @Dimaqa on GitHub (Mar 18, 2020). ### Environment Python version: 3.6.9 NetBox version: 2.7.6, same behavior on 2.7.9-dev ### Steps to Reproduce GET /api/ipam/prefixes/?vrf=FOR-TESTS Probably its a swagger bug and you cant really get prefixes by vrf name directrly (There are two fields: vrf and vrf_id), because if you search through netbox unterface, it replaces vrf name with id in query ### Observed Behavior 400 Bad Request: {'vrf': ['Select a valid choice. TEST-VRF is not one of the available choices.']}
adam closed this issue 2025-12-29 18:29:27 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 18, 2020):

NetBox version: develop

We do not accept bug reports for anything other than a recent stable release. Please attempt to reproduce the behavior on a current release and update your issue accordingly.

@jeremystretch commented on GitHub (Mar 18, 2020): > NetBox version: develop We do not accept bug reports for anything other than a recent stable release. Please attempt to reproduce the behavior on a current release and update your issue accordingly.
Author
Owner

@Dimaqa commented on GitHub (Mar 18, 2020):

Same behavior on 2.7.6 and 2.7.9-dev

@Dimaqa commented on GitHub (Mar 18, 2020): Same behavior on 2.7.6 and 2.7.9-dev
Author
Owner

@Dimaqa commented on GitHub (Mar 18, 2020):

Getting prefixes by vrf name makes things awkward if we have 2 vrf with the same name. So maybe you should just delete this field from swagger. Also rename vrf to vrf_id on creation would be nice, because this naming breaks my mind every time

@Dimaqa commented on GitHub (Mar 18, 2020): Getting prefixes by vrf name makes things awkward if we have 2 vrf with the same name. So maybe you should just delete this field from swagger. Also rename vrf to vrf_id on creation would be nice, because this naming breaks my mind every time
Author
Owner

@jeremystretch commented on GitHub (Mar 18, 2020):

The vrf filter references VRF objects by RD, not by name.

@jeremystretch commented on GitHub (Mar 18, 2020): The ` vrf` filter references VRF objects by RD, not by name.
Author
Owner

@Dimaqa commented on GitHub (Mar 18, 2020):

Thank you! But but thats really strange way to name RD, since vrf is vrf_id on creation (POST).

@Dimaqa commented on GitHub (Mar 18, 2020): Thank you! But but thats really strange way to name RD, since vrf is vrf_id on creation (POST).
Author
Owner

@jeremystretch commented on GitHub (Mar 18, 2020):

vrf_id the VRF's primary key; vrf is its RD. This is analogous to site referencing a site's slug and site_id its PK.

@jeremystretch commented on GitHub (Mar 18, 2020): `vrf_id` the VRF's primary key; `vrf` is its RD. This is analogous to `site` referencing a site's slug and `site_id` its PK.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3484