-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating a Cable Termination over the API results in a missing connection/trace #15390
Comments
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. |
Hi, thank you for your answer and for looking into it. I will redo my script on stable later this week. |
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 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? |
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: #14137 (comment) But posting a termination cannot trigger the trace_path logic. It is only triggered at netbox/netbox/dcim/models/cables.py Line 240 in b7668fb
Correct me please if I am wrong here. |
Hi! |
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.
The text was updated successfully, but these errors were encountered: