-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Environment
- Python version: 3.9.1
- NetBox version: 2.10.3
Steps to Reproduce
API endpoint for listing interface connection seems to have broken between versions 2.9 and 2.10.
- Create two devices with a connection between their interfaces, starting from the first device.
- Try using hostname with /api/dcim/interface-connections/?device=HOSTNAME and get HTTP error 500
- Try listing interfaces for the second device with /api/dcim/interface-connections/?device_id=2 (or whatever id you have) and get an empty list.
Expected Behavior
You could previously fetch device's interface connections with /api/dcim/interface-connections/?device=HOSTNAME or with /api/dcim/interface-connections/?device_id=1337 . API should return all connections where the device is a part of, no matter the end of cable the device is in (so both interface_a and interface_b). This behaviour is still standard in the web interface where all connections are shown under /dcim/devices/1337/interfaces/ .
Observed Behavior
Using the interface-connections endpoint with ?device=HOSTNAME returns ValueError with a HTTP status of 500 and the error message of "Field 'id' expected a number but got 'server01'."
Looking at the commits for 2.10 (this for example), it seems like searching with a name has been deprecated and you can actually use both device or device_id to list the connections when you specify the id. This however works only for listing connections that have their first end (interface_a) as that device. As I expect to use the API endpoint (and can use the web interface) to see all connections to and from that device, I consider this a bug.