Filter interface/virtual interface on assigned untagged vlan using API #12319
Replies: 5 comments 4 replies
-
What data model are you having an issue with, the vlan model allows search by vid
/ipam/vlans/?vid=2
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: ziggekatten ***@***.***>
Sent: Friday, April 21, 2023 8:57 AM
To: netbox-community/netbox ***@***.***>
Cc: Subscribed ***@***.***>
Subject: [netbox-community/netbox] Filter interface/virtual interface on assigned untagged vlan using API (Discussion #12319)
It seems that it's not possible to filter on vlan_id or vlan_vid/group using the API. The swagger documentation shows no such option.
Am I right, or have I missed sometning here? I see references to that the feature was added in 2.4.7 (#2427<#2427>), but those keys do not work in either of 3.2.9 or 3.4.4 that we have as running versions.
—
Reply to this email directly, view it on GitHub<#12319>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UM6CZCPBB3QFTD2V6X3XCKG6LANCNFSM6AAAAAAXG5A32M>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Ah so, thanks.
So in my testing /dcim/interfaces/?vlan_id=12345 finds interfaces referencing VLAN record id 12345 /ipam/vlans/?id=12345 and /dcim/interfaces/?vlan=10 finds all interfaces with /ipam/vlans/?vid=10 which may be several different VLAN records in different Sites or VLAN Groups. I didn't cross-check on /virtualization/interfaces but I'd expect it to work similarly (virt interfaces are different because they don't connect to physical cables). If you are searching by VID it doesn't look like you can further filter by VLAN Group on the /dcim/interfaces endpoint but you can always do a two step lookup, get the record ID from /ipam/vlans/?vid=10&group=your_group&brief=1 then lookup /dcim/interfaces/?vlan_id=
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: ziggekatten ***@***.***>
Sent: Friday, April 21, 2023 9:16 AM
To: netbox-community/netbox ***@***.***>
Cc: Mark Tinberg ***@***.***>; Comment ***@***.***>
Subject: Re: [netbox-community/netbox] Filter interface/virtual interface on assigned untagged vlan using API (Discussion #12319)
As stated in the title: device.interfaces and virtualization.interfaces
—
Reply to this email directly, view it on GitHub<#12319 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UM35DA5G3NFLAMITSITXCKJDXANCNFSM6AAAAAAXG5A32M>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
dcim/interfaces/?vlan_id=xxxx works on physical interface. On virtualization/interfaces/?vlan_id=xxxx always return all interfaces, thus indicating that there is an difference between physical and virtual interfaces in terms of how filters are implemented. Bummer if that is the case. |
Beta Was this translation helpful? Give feedback.
-
Time for an upgrade of Netbox then, since I'm at older versions. |
Beta Was this translation helpful? Give feedback.
-
That's the easiest kind of bugfix, the work is already done! 😉
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: ziggekatten ***@***.***>
Sent: Monday, April 24, 2023 5:11 AM
To: netbox-community/netbox ***@***.***>
Cc: Mark Tinberg ***@***.***>; Comment ***@***.***>
Subject: Re: [netbox-community/netbox] Filter interface/virtual interface on assigned untagged vlan using API (Discussion #12319)
Time for an upgrade of Netbox then, since I'm at older versions.
—
Reply to this email directly, view it on GitHub<#12319 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UM6W7EE4TX2YZHBMHTLXCZGU5ANCNFSM6AAAAAAXG5A32M>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
It seems that it's not possible to filter on vlan_id or vlan_vid/group using the API. The swagger documentation shows no such option.
Am I right, or have I missed sometning here? I see references to that the feature was added in 2.4.7 (#2427), but those keys do not work in either of 3.2.9 or 3.4.4 that we have as running versions.
Beta Was this translation helpful? Give feedback.
All reactions