API: returns too many interfaces for VC member when filtering for device_id #8501

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

Originally created by @cs-1 on GitHub (Aug 23, 2023).

NetBox version

v3.5.8

Python version

3.10

Steps to Reproduce

  1. Create a device a with x interfaces.
  2. Create a device b with y interfaces.
  3. Create virtual chassis and add both devices a and b.
  4. Make an API call at /api/dcim/interfaces and filter for device_id of device a.

Expected Behavior

Only interfaces for device "a" are returned.

Observed Behavior

Interfaces for device a and device b are returned.

This behaviour was different in NetBox v3.5.6, only interfaces of device "a" were returned when filtering for the according device_id.

When using the device name of device "a" as a filter criterium, only interfaces of device "a" are returned as expected.

Originally created by @cs-1 on GitHub (Aug 23, 2023). ### NetBox version v3.5.8 ### Python version 3.10 ### Steps to Reproduce 1. Create a device a with x interfaces. 2. Create a device b with y interfaces. 3. Create virtual chassis and add both devices a and b. 4. Make an API call at /api/dcim/interfaces and filter for device_id of device a. ### Expected Behavior Only interfaces for device "a" are returned. ### Observed Behavior Interfaces for device a **and** device b are returned. This behaviour was different in NetBox v3.5.6, only interfaces of device "a" were returned when filtering for the according device_id. When using the device name of device "a" as a filter criterium, only interfaces of device "a" are returned as expected.
adam closed this issue 2025-12-29 20:37:30 +01:00
Author
Owner

@jeremystretch commented on GitHub (Aug 23, 2023):

@DanSheps please have a look at this and see how it's impacted (if at all) by your PR #13296.

@jeremystretch commented on GitHub (Aug 23, 2023): @DanSheps please have a look at this and see how it's impacted (if at all) by your PR #13296.
Author
Owner

@kkthxbye-code commented on GitHub (Aug 23, 2023):

This behaviour was different in NetBox v3.5.6, only interfaces of device "a" were returned when filtering for the according device_id.

I was unaware of any changes regarding this in 3.5.7 or 3.5.8, so I tested it locally and I cannot replicate it at all. Both 3.5.6 and 3.5.8 returns all interfaces in the chassis. This also bizarely bizarrely seems like a duplicate of your very own issue:

https://github.com/netbox-community/netbox/issues/11478

Please revise your replication steps to ensure that something actually changed in the two last patch versions. Maybe you made local changes to your netbox install that were removed when upgrading?

As to your questions @jeremystretch - I just tested https://github.com/netbox-community/netbox/pull/13296 and it does solve the issue here. However the issue was introduced in v3.3.6, so I'm assuming local modifications were made to @cs-1's netbox or something.

@kkthxbye-code commented on GitHub (Aug 23, 2023): > This behaviour was different in NetBox v3.5.6, only interfaces of device "a" were returned when filtering for the according device_id. I was unaware of any changes regarding this in 3.5.7 or 3.5.8, so I tested it locally and I cannot replicate it at all. Both 3.5.6 and 3.5.8 returns all interfaces in the chassis. This also bizarely bizarrely seems like a duplicate of your very own issue: https://github.com/netbox-community/netbox/issues/11478 Please revise your replication steps to ensure that something actually changed in the two last patch versions. Maybe you made local changes to your netbox install that were removed when upgrading? As to your questions @jeremystretch - I just tested https://github.com/netbox-community/netbox/pull/13296 and it does solve the issue here. However the issue was introduced in v3.3.6, so I'm assuming local modifications were made to @cs-1's netbox or something.
Author
Owner

@DanSheps commented on GitHub (Aug 23, 2023):

I think @kkthxbye-code is right on the money in that this has for the most part been consistent behaviour from the 2.x days.

That said, #13296 will resolve this as it will make the device filters only return relevant device interfaces and virtual_chassis_member will now return interfaces for the VC unless filtered further.

@DanSheps commented on GitHub (Aug 23, 2023): I think @kkthxbye-code is right on the money in that this has for the most part been consistent behaviour from the 2.x days. That said, #13296 will resolve this as it will make the device filters only return relevant device interfaces and virtual_chassis_member will now return interfaces for the VC unless filtered further.
Author
Owner

@cs-1 commented on GitHub (Aug 25, 2023):

We didn't make any local changes to our code, it's the release code from the NetBox's git repo. The issue can be reproduced in the Swagger interface too, see the two screenshots. Note the "count" attribute of the returned JSON and also note that the device ID is "870" in both cases. If https://github.com/netbox-community/netbox/pull/13296 resolves this issue as @DanSheps says it's perfectly fine for me. I did not assume that this was a dupe of https://github.com/netbox-community/netbox/issues/11478 because the API used to return only the interfaces of a specific chassis before when querying for the device_id and it struck me as odd that I don't get the same results when querying the same device by ID and by name.

Query using device ID
Query using device ID

Query using device name
Query using device name

Anyhow, if https://github.com/netbox-community/netbox/pull/13296 resolves this, all is fine.

@cs-1 commented on GitHub (Aug 25, 2023): We didn't make any local changes to our code, it's the release code from the NetBox's git repo. The issue can be reproduced in the Swagger interface too, see the two screenshots. Note the "count" attribute of the returned JSON and also note that the device ID is "870" in both cases. If https://github.com/netbox-community/netbox/pull/13296 resolves this issue as @DanSheps says it's perfectly fine for me. I did not assume that this was a dupe of https://github.com/netbox-community/netbox/issues/11478 because the API used to return only the interfaces of a specific chassis before when querying for the device_id and it struck me as odd that I don't get the same results when querying the same device by ID and by name. ![Query using device ID](https://github.com/netbox-community/netbox/assets/12844146/14c3fbc8-7bf7-4124-a7f0-cb8e92e8d55b) Query using device ID ![Query using device name](https://github.com/netbox-community/netbox/assets/12844146/c6530733-2687-47a5-b9c1-e6eb9a8c4e0d) Query using device name Anyhow, if https://github.com/netbox-community/netbox/pull/13296 resolves this, all is fine.
Author
Owner

@kkthxbye-code commented on GitHub (Aug 25, 2023):

This behaviour was different in NetBox v3.5.6, only interfaces of device "a" were returned when filtering for the according device_id.
because the API used to return only the interfaces of a specific chassis before when querying for the device_id and it struck me as odd that I don't get the same results when querying the same device by ID and by name.

I think you are missing the point again.

Here's where we're at:

Before v3.3.6:

  • Filtering by device id returned only the devices interfaces.
  • Filtering by device name returned only the devices interfaces.

After v3.3.6:

  • Filtering by device id returns all vc interfaces..
  • Filtering by device name returned only the devices interfaces.

Nothing has changed regarding this between v3.5.6 and v3.5.8 as you claim it has. Also the above is exactly what is covered by your own issue https://github.com/netbox-community/netbox/issues/11478.

I'll close this out as a duplicate, but in the future please make sure there's actually been a change in the version you suggest. It wastes a lot of time for everyone.

@kkthxbye-code commented on GitHub (Aug 25, 2023): >This behaviour **was different in NetBox v3.5.6**, only interfaces of device "a" were returned when filtering for the according device_id. > because the API used to return only the interfaces of a specific chassis before when querying for the device_id and it struck me as odd that I don't get the same results when querying the same device by ID and by name. I think you are missing the point again. Here's where we're at: Before v3.3.6: * Filtering by device id returned only the devices interfaces. * Filtering by device name returned only the devices interfaces. After v3.3.6: * Filtering by device id returns all vc interfaces.. * Filtering by device name returned only the devices interfaces. Nothing has changed regarding this between v3.5.6 and v3.5.8 as you claim it has. Also the above is exactly what is covered by your own issue https://github.com/netbox-community/netbox/issues/11478. I'll close this out as a duplicate, but in the future please make sure there's actually been a change in the version you suggest. It wastes a lot of time for everyone.
Author
Owner

@cs-1 commented on GitHub (Aug 28, 2023):

I'll close this out as a duplicate, but in the future please make sure there's actually been a change in the version you suggest. It wastes a lot of time for everyone.

I'm sorry, it was an honest mistake, I accidentally checked v3.5.6 against a non-VC chassis.

@cs-1 commented on GitHub (Aug 28, 2023): > I'll close this out as a duplicate, but in the future please make sure there's actually been a change in the version you suggest. It wastes a lot of time for everyone. I'm sorry, it was an honest mistake, I accidentally checked v3.5.6 against a non-VC chassis.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8501