Update terminations in cable by API #8523

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

Originally created by @Etibru on GitHub (Aug 28, 2023).

NetBox version

V.3.5.8

Python version

3.10

Steps to Reproduce

  1. Create 2 devices with one or more network interfaces

  2. Create cable between devices
    example : DeviceA(mgmt0) to DeviceB (ge-1/0/2)

  3. Now use PUT/PATCH API (/api/dcim/cables/{id_of_your_cable}/) (example id_of_your_cable = 23 for exemple)

curl -X 'PUT' \
  'http://X.X.X.X:8100/api/dcim/cables/23/' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -H 'X-CSRFTOKEN: XXXXXXXXXXXXXXXXXXXXXXXXXXXX' \
  -d '{
  "a_terminations": [{ "object_type": "dcim.interface", "object_id": 187 }],
  "b_terminations": [{ "object_type": "dcim.interface", "object_id": 66 }],
  "status": "connected",
  "type": "cat7"
}
'

In this application, the device A interface identifier remains the same (so 187 is for the device A interface called mgmt0), but the device B interface has changed, 66 is one device interface but another (for example ge-1/0/3).

You will get this error :

{
  "error": "list index out of range",
  "exception": "IndexError",
  "netbox_version": "3.5.8",
  "python_version": "3.10.12"
}

Expected Behavior

I want to modify the cable termination(s)
return the cable with the new interface(s)

Observed Behavior

error 500

{
  "error": "list index out of range",
  "exception": "IndexError",
  "netbox_version": "3.5.8",
  "python_version": "3.10.12"
}
Originally created by @Etibru on GitHub (Aug 28, 2023). ### NetBox version V.3.5.8 ### Python version 3.10 ### Steps to Reproduce 1. Create 2 devices with one or more network interfaces 2. Create cable between devices example : DeviceA(mgmt0) to DeviceB (ge-1/0/2) 3. Now use PUT/PATCH API (/api/dcim/cables/{id_of_your_cable}/) (example id_of_your_cable = 23 for exemple) ```bach curl -X 'PUT' \ 'http://X.X.X.X:8100/api/dcim/cables/23/' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H 'X-CSRFTOKEN: XXXXXXXXXXXXXXXXXXXXXXXXXXXX' \ -d '{ "a_terminations": [{ "object_type": "dcim.interface", "object_id": 187 }], "b_terminations": [{ "object_type": "dcim.interface", "object_id": 66 }], "status": "connected", "type": "cat7" } ' ``` In this application, the device A interface identifier remains the same (so 187 is for the device A interface called mgmt0), but the device B interface has changed, 66 is one device interface but another (for example ge-1/0/**3**). You will get this error : ```json { "error": "list index out of range", "exception": "IndexError", "netbox_version": "3.5.8", "python_version": "3.10.12" } ``` ### Expected Behavior I want to modify the cable termination(s) return the cable with the new interface(s) ### Observed Behavior error 500 ```json { "error": "list index out of range", "exception": "IndexError", "netbox_version": "3.5.8", "python_version": "3.10.12" } ```
adam added the type: bugstatus: duplicate labels 2025-12-29 20:37:46 +01:00
adam closed this issue 2025-12-29 20:37:46 +01:00
Author
Owner

@arthanson commented on GitHub (Sep 6, 2023):

https://github.com/netbox-community/netbox/pull/13337 looks like it fixes this as well.

@arthanson commented on GitHub (Sep 6, 2023): https://github.com/netbox-community/netbox/pull/13337 looks like it fixes this as well.
Author
Owner

@jeremystretch commented on GitHub (Sep 26, 2023):

This appears to be a duplicate of #11901, which has been resolved by #13337.

@jeremystretch commented on GitHub (Sep 26, 2023): This appears to be a duplicate of #11901, which has been resolved by #13337.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8523