Patching cable termination_(a|b)_id results in same termination associated to two devices #2658

Closed
opened 2025-12-29 18:20:57 +01:00 by adam · 1 comment
Owner

Originally created by @louis-6wind on GitHub (Jun 5, 2019).

Environment

  • Python version: 3.6.6
  • NetBox version: 2.5.13

Steps to Reproduce

  1. Select an dcim.interface with a cable linked to a dcim.frontport (ex: dcim.interface id 9322)
  2. Select an dcim.interface WITHOUT a cable (ex: dcim.interface id 9378)
  3. Use a API to move cable termination from one interface to another
    HTTP PATCH on the cable : JSON request exemple
    {'termination_a_id': 28402, 'termination_a_type': 'dcim.frontport', 'termination_b_id': 9378, 'termination_b_type': 'dcim.interface', 'label': 'MOVE 5M00799'}

Note that providing just termination_b_id in JSON results in HTTP error 500 with the same result. I.e. {'termination_b_id': 9378, 'label': 'MOVE 5M00799'}

Expected Behavior

API get on dcim/interfaces NOK

  • no more cable on old dcim.interface id 9322
  • connected_endpoint moved is updated accordlingly to the change

Handle case only termination_(a|b)_id provided by providing error message

Observed Behavior

API get on dcim/interfaces NOK

  • same cable for dcim.interface id 9322 and 9378
  • connected_endpoint remains on old interface id 9322

API get on dcim/cables OK

  • termination_b changed from dcim.interface id 9322 to 9378
  • termination_a unchanged

HTTP error 500 if only termination_b_id provided

Trace after API PATCH

dcim/cables
{
"id": 8997,
"termination_a_type": "dcim.frontport",
"termination_a_id": 28402,
"termination_a": {
"id": 28402,
"url": "http://XXX/api/dcim/front-ports/28402/",
"device": {
"id": 1584,
"url": "http://XXX/api/dcim/devices/1584/",
"name": "1-6:D08:45 to 1-6:C08:45",
"display_name": "1-6:D08:45 to 1-6:C08:45"
},
"name": "4",
"cable": 8997
},
"termination_b_type": "dcim.interface",
"termination_b_id": 9378,
"termination_b": {
"id": 9378,
"url": "http://XXX/api/dcim/interfaces/9378/",
"device": {
"id": 546,
"url": "http://XXX/api/dcim/devices/546/",
"name": "SWXXX-P22",
"display_name": "SWXXX-P22"
},
"name": "Eth1/6",
"cable": 8997,
"connection_status": null
},
"type": 1610,
"status": {
"value": true,
"label": "Connected"
},
"label": "5M00799",
"color": "",
"length": 5,
"length_unit": {
"value": 1200,
"label": "Meters"
}
}

Old dcim/interfaces
{
"id": 9322,
"device": {
"id": 545,
"url": "http://XXX/api/dcim/devices/545/",
"name": "SWXXX-P20",
"display_name": "SWXXX-P20"
},
"name": "Eth1/7",
"form_factor": {
"value": 1150,
"label": "10GBASE-T (10GE)"
},
"enabled": true,
"lag": null,
"mtu": 1500,
"mac_address": "28:6F:7F:41:8E:70",
"mgmt_only": false,
"description": "XXX Q1NIC0",
"connected_endpoint_type": "dcim.interface",
"connected_endpoint": {
"id": 46,
"url": "http://XXX/api/dcim/interfaces/46/",
"device": {
"id": 150,
"url": "http://XXX/api/dcim/devices/150/",
"name": "BLP23",
"display_name": "BLP23"
},
"name": "OA2",
"cable": 8996,
"connection_status": {
"value": true,
"label": "Connected"
}
},
"connection_status": {
"value": true,
"label": "Connected"
},
"cable": {
"id": 8997,
"url": "http://XXX/api/dcim/cables/8997/",
"label": "5M00799"
}
}

New dcim/interfaces
{
"id": 9378,
"device": {
"id": 546,
"url": "http://XXX/api/dcim/devices/546/",
"name": "SWXXX-P22",
"display_name": "SWXXX-P22"
},
"name": "Eth1/6",
"form_factor": {
"value": 1150,
"label": "10GBASE-T (10GE)"
},
"enabled": true,
"lag": null,
"mtu": 1500,
"mac_address": "28:6F:7F:41:8C:DF",
"mgmt_only": false,
"description": "XXX NIC0",
"connected_endpoint_type": null,
"connected_endpoint": null,
"connection_status": null,
"cable": {
"id": 8997,
"url": "http://XXX/api/dcim/cables/8997/",
"label": "5M00799"
}
}

Originally created by @louis-6wind on GitHub (Jun 5, 2019). ### Environment * Python version: 3.6.6 * NetBox version: 2.5.13 ### Steps to Reproduce 1. Select an dcim.interface with a cable linked to a dcim.frontport (ex: dcim.interface id 9322) 2. Select an dcim.interface WITHOUT a cable (ex: dcim.interface id 9378) 3. Use a API to move cable termination from one interface to another HTTP PATCH on the cable : JSON request exemple {'termination_a_id': 28402, 'termination_a_type': 'dcim.frontport', 'termination_b_id': 9378, 'termination_b_type': 'dcim.interface', 'label': 'MOVE 5M00799'} Note that providing just termination_b_id in JSON results in HTTP error 500 with the same result. I.e. {'termination_b_id': 9378, 'label': 'MOVE 5M00799'} ### Expected Behavior API get on dcim/interfaces NOK - no more cable on old dcim.interface id 9322 - connected_endpoint moved is updated accordlingly to the change Handle case only termination_(a|b)_id provided by providing error message ### Observed Behavior API get on dcim/interfaces NOK - same cable for dcim.interface id 9322 and 9378 - connected_endpoint remains on old interface id 9322 API get on dcim/cables OK - termination_b changed from dcim.interface id 9322 to 9378 - termination_a unchanged HTTP error 500 if only termination_b_id provided ### Trace after API PATCH dcim/cables { "id": 8997, "termination_a_type": "dcim.frontport", "termination_a_id": 28402, "termination_a": { "id": 28402, "url": "http://XXX/api/dcim/front-ports/28402/", "device": { "id": 1584, "url": "http://XXX/api/dcim/devices/1584/", "name": "1-6:D08:45 to 1-6:C08:45", "display_name": "1-6:D08:45 to 1-6:C08:45" }, "name": "4", "cable": 8997 }, "termination_b_type": "dcim.interface", "termination_b_id": 9378, "termination_b": { "id": 9378, "url": "http://XXX/api/dcim/interfaces/9378/", "device": { "id": 546, "url": "http://XXX/api/dcim/devices/546/", "name": "SWXXX-P22", "display_name": "SWXXX-P22" }, "name": "Eth1/6", "cable": 8997, "connection_status": null }, "type": 1610, "status": { "value": true, "label": "Connected" }, "label": "5M00799", "color": "", "length": 5, "length_unit": { "value": 1200, "label": "Meters" } } Old dcim/interfaces { "id": 9322, "device": { "id": 545, "url": "http://XXX/api/dcim/devices/545/", "name": "SWXXX-P20", "display_name": "SWXXX-P20" }, "name": "Eth1/7", "form_factor": { "value": 1150, "label": "10GBASE-T (10GE)" }, "enabled": true, "lag": null, "mtu": 1500, "mac_address": "28:6F:7F:41:8E:70", "mgmt_only": false, "description": "XXX Q1NIC0", "connected_endpoint_type": "dcim.interface", "connected_endpoint": { "id": 46, "url": "http://XXX/api/dcim/interfaces/46/", "device": { "id": 150, "url": "http://XXX/api/dcim/devices/150/", "name": "BLP23", "display_name": "BLP23" }, "name": "OA2", "cable": 8996, "connection_status": { "value": true, "label": "Connected" } }, "connection_status": { "value": true, "label": "Connected" }, "cable": { "id": 8997, "url": "http://XXX/api/dcim/cables/8997/", "label": "5M00799" } } New dcim/interfaces { "id": 9378, "device": { "id": 546, "url": "http://XXX/api/dcim/devices/546/", "name": "SWXXX-P22", "display_name": "SWXXX-P22" }, "name": "Eth1/6", "form_factor": { "value": 1150, "label": "10GBASE-T (10GE)" }, "enabled": true, "lag": null, "mtu": 1500, "mac_address": "28:6F:7F:41:8C:DF", "mgmt_only": false, "description": "XXX NIC0", "connected_endpoint_type": null, "connected_endpoint": null, "connection_status": null, "cable": { "id": 8997, "url": "http://XXX/api/dcim/cables/8997/", "label": "5M00799" } }
adam added the type: bugstatus: duplicate labels 2025-12-29 18:20:57 +01:00
adam closed this issue 2025-12-29 18:20:58 +01:00
Author
Owner

@louis-6wind commented on GitHub (Jun 6, 2019):

Related to https://github.com/digitalocean/netbox/issues/2994 even the issue is different

@louis-6wind commented on GitHub (Jun 6, 2019): Related to https://github.com/digitalocean/netbox/issues/2994 even the issue is different
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2658