mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-11 21:10:29 +01:00
Updating a Cable Termination over the API results in a missing connection/trace #9341
Closed
opened 2025-12-29 20:48:44 +01:00 by adam
·
11 comments
No Branch/Tag Specified
main
update-changelog-comments-docs
feature-removal-issue-type
20911-dropdown
20239-plugin-menu-classes-mutable-state
21097-graphql-id-lookups
feature
fix_module_substitution
20923-dcim-templates
20044-elevation-stuck-lightmode
feature-ip-prefix-link
v4.5-beta1-release
20068-import-moduletype-attrs
20766-fix-german-translation-code-literals
20378-del-script
7604-filter-modifiers-v3
circuit-swap
12318-case-insensitive-uniqueness
20637-improve-device-q-filter
20660-script-load
19724-graphql
20614-update-ruff
14884-script
02496-max-page
19720-macaddress-interface-generic-relation
19408-circuit-terminations-export-templates
20203-openapi-check
fix-19669-api-image-download
7604-filter-modifiers
19275-fixes-interface-bulk-edit
fix-17794-get_field_value_return_list
11507-show-aggregate-and-rir-on-api
9583-add_column_specific_search_field_to_tables
v4.5.0
v4.4.10
v4.4.9
v4.5.0-beta1
v4.4.8
v4.4.7
v4.4.6
v4.4.5
v4.4.4
v4.4.3
v4.4.2
v4.4.1
v4.4.0
v4.3.7
v4.4.0-beta1
v4.3.6
v4.3.5
v4.3.4
v4.3.3
v4.3.2
v4.3.1
v4.3.0
v4.2.9
v4.3.0-beta2
v4.2.8
v4.3.0-beta1
v4.2.7
v4.2.6
v4.2.5
v4.2.4
v4.2.3
v4.2.2
v4.2.1
v4.2.0
v4.1.11
v4.1.10
v4.1.9
v4.1.8
v4.2-beta1
v4.1.7
v4.1.6
v4.1.5
v4.1.4
v4.1.3
v4.1.2
v4.1.1
v4.1.0
v4.0.11
v4.0.10
v4.0.9
v4.1-beta1
v4.0.8
v4.0.7
v4.0.6
v4.0.5
v4.0.3
v4.0.2
v4.0.1
v4.0.0
v3.7.8
v3.7.7
v4.0-beta2
v3.7.6
v3.7.5
v4.0-beta1
v3.7.4
v3.7.3
v3.7.2
v3.7.1
v3.7.0
v3.6.9
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.3-r1
v1.0.3
1.0.0
Labels
Clear labels
beta
breaking change
complexity: high
complexity: low
complexity: medium
needs milestone
netbox
pending closure
plugin candidate
pull-request
severity: high
severity: low
severity: medium
status: accepted
status: backlog
status: blocked
status: duplicate
status: needs owner
status: needs triage
status: revisions needed
status: under review
topic: GraphQL
topic: Internationalization
topic: OpenAPI
topic: UI/UX
topic: cabling
topic: event rules
topic: htmx navigation
topic: industrialization
topic: migrations
topic: plugins
topic: scripts
topic: templating
topic: testing
type: bug
type: deprecation
type: documentation
type: feature
type: housekeeping
type: translation
Mirrored from GitHub Pull Request
Milestone
No items
No Milestone
Projects
Clear projects
No project
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: starred/netbox#9341
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Hedius on GitHub (Mar 9, 2024).
Deployment Type
Self-hosted
NetBox Version
v3.7.3
Python Version
3.11
Steps to Reproduce
I only was able to identify issue #14200, #14137 (closed/rejected) as a similar problem.
The following steps are made for a clean empty netbox installation.
Initial setup
Create a manufacturer (HPE in this case).
Create a device type for that one. (ProLiant DL360 Gen11 in this case).
Create a device/VM role (Server in this case).
Create a site (DC1).
Create 2 Servers with that role, site and type. (server001, server002).

Assign an interface (eth0 in this case) to both servers.
Create a cable between both
After this POST the interfaces are cabled and you can see the connection and link peers. 2 Terminations with the IDs (1,2) exist after this.

Add more interfaces to servers and change the cable in the GUI.
The old termination is deleted, replaced with a new one, the connection is updated and you can trace the cable.

Now over the API, Delete termination B
api/dcim/cables./api/dcim/cable-terminations/3/curl -X 'DELETE' 'http://127.0.0.1:8000/api/dcim/cable-terminations/3/'Create a new B termination for server002 -> eth0
post data
Cable and terminations have correct data (Skip this... issue after this one :) )
Data for both terminations and the cable looks correct.... nothing special.
Connection is missing
However, in the server -> interfaces view, the connection is not listed anymore.

And you can no longer trace the cable.

Tracing over the API is also not possible at this point.
Summary
Correct me if I did smth wrong... But GUI actions cause the same actions and you suggested in #14200 to do it like this. Is this the correct way for updating cables?
Expected Behavior
Observed Behavior
Both terminations are interfaces. Furthermore, you cannot trace the path anymore.
@Hedius commented on GitHub (Mar 9, 2024):
Correction, ignore the edit exception part. Duplicate to: #11460
Removed it from the report.
I actually meant to reference #14137 before.
@jeffgdotorg commented on GitHub (Apr 2, 2024):
Thank you for opening a bug report and for taking the time to provide detailed steps to reproduce on a pristine system.
I was unable to reproduce the reported behavior on NetBox v3.7.4. Maybe this means we fixed the problem you're reporting in the course of doing other work. Please re-confirm the reported behavior on the current stable release and adjust your post above as necessary.
@Hedius commented on GitHub (Apr 2, 2024):
Hi, thank you for your answer and for looking into it. I will redo my script on stable later this week.
@Hedius commented on GitHub (Apr 6, 2024):
Hello I performed the same steps on NetBox 3.7,5 and I have the same issue again.
I took a cable. Deleted 1 termination over the API, created a new one and ended up with a cable without a connection as described above...
The cable exists with both terminations, but http://127.0.0.1:8000/dcim/interface-connections/ does not show any connections.
The cable path only contains the A-Termination and the cable. The B-Termination is missing.
What I did is:
I looked at the signals of dcim for CablePaths and updates are triggered in different cases (dcim/signals.py):
So from that posting a cable termination to
/api/cable-terminationswill never trigger an update of a cable path. (Therefore, no path in the table.... Also verified that the logic does not get triggered with break points.)Different take. (While in the referenced issue it was said that deleting/creating new cable terminations is the correct way, I gonna try now updating the cable directly with a PATCH to /api/dcim/cables/x/, because updating a termination cannot trigger the trace_path signal?
Before me changing the endpoints the path is documented correctly after creating the cable:
Updated cable the B termination of cable 3 from interface 2 to 3 with a PATCH to /api/dcim/cables/3/
Data:
This clearly seems to be incorrect though:
It does update the terminations now and a Path from A to B is created.
The B-Termination is updated correctly, but old B-Termination shows now 2 paths. (Instead of the new one showing one only to the A-Temrination)
I am lost now...
@jeffgdotorg Can you please explain how you updated the termination over the API? Did you update the cable or did you delete/create the terminations?
@Hedius commented on GitHub (Apr 6, 2024):
For reference: https://github.com/netbox-community/netbox/blob/develop/netbox/dcim/signals.py#L75 is the cable path logic, but I can only see it getting triggered if you use /api/dcim/cables
Jeremy made clear that you should not do this: https://github.com/netbox-community/netbox/issues/14137#issuecomment-1841141282
But posting a termination cannot trigger the trace_path logic. It is only triggered at
b7668fbfc3/netbox/dcim/models/cables.py (L240)(cable modifications)Correct me please if I am wrong here.
I have had the idea to open a PR and insert sending the trace_path signal in the cable termination save method, but this seems incorrect, because then trace paths would be triggered several times per cable modification/creation
@bsampaio commented on GitHub (Aug 14, 2024):
Hi!
I'm really looking forward to that fix. Thanks @arthanson for the effort.
I'm currently facing the same issue.
@github-actions[bot] commented on GitHub (Apr 24, 2025):
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.
@jeremystretch commented on GitHub (Sep 4, 2025):
Following up on this rather dated bug report.
This comment is on an issue concerning NetBox v3.6. On the current NetBox release (v4.4), modifying a cable's terminations via the REST API is supported.
Deleting the B terminations from a cable:
Setting a new B termination:
This approach ensures that the cable paths in either direction are updated appropriately. Updating cable terminations directly via the
/api/dim/cable-terminations/REST API endpoint does not recompute the paths, because thetrace_pathssignal is emitted only byCable.save().We might consider limiting the mutability of cable terminations via the dedicated endpoint to avoid confusion, but that's another discussion, and would result in a breaking change which must be explored.
@jeremystretch commented on GitHub (Sep 8, 2025):
I've opened FR #20295 to propose this change.
@jeremystretch commented on GitHub (Sep 11, 2025):
I'm going to close this issue as we've decided to make the cable terminations endpoint read-only per #20295, which will resolve this bug indirectly. Users are advised to modify cable terminations via the cables endpoint at
/api/dcim/cables/to avoid the bug captured here.@Hedius commented on GitHub (Sep 12, 2025):
Hi, thank you for your answer on the issue. Will change my setup to no longer use that endpoint.