Cable traces break when rear ports of a cable are moved and one end of the trace is a circuit #8193

Closed
opened 2025-12-29 20:33:38 +01:00 by adam · 8 comments
Owner

Originally created by @eskyuu on GitHub (Jun 13, 2023).

NetBox version

v3.5.3

Python version

3.9

Steps to Reproduce

  1. Connect a circuit to more than 1 rear port
  2. Connect the corresponding front ports to an interface
  3. Using an API PATCH request, move the endpoints of the circuit->rear port to different rear ports
  4. Using an API PATCH request, move the endpoints of the circuit->rear port back to the original rear ports

Expected Behavior

The cable path from the interface should be complete up to the original rear port.
The cable path from the interface should be correct again after step 4.

Observed Behavior

After step 3, the cable path is marked as split, and the rear ports are not part of the path
After step 4, the cable path does not get updated because the rear ports were not part of the path after step 3.

Originally created by @eskyuu on GitHub (Jun 13, 2023). ### NetBox version v3.5.3 ### Python version 3.9 ### Steps to Reproduce 1. Connect a circuit to more than 1 rear port 2. Connect the corresponding front ports to an interface 3. Using an API PATCH request, move the endpoints of the circuit->rear port to different rear ports 4. Using an API PATCH request, move the endpoints of the circuit->rear port back to the original rear ports ### Expected Behavior The cable path from the interface should be complete up to the original rear port. The cable path from the interface should be correct again after step 4. ### Observed Behavior After step 3, the cable path is marked as split, and the rear ports are not part of the path After step 4, the cable path does not get updated because the rear ports were not part of the path after step 3.
adam added the type: bugstatus: revisions neededtopic: cabling labels 2025-12-29 20:33:38 +01:00
adam closed this issue 2025-12-29 20:33:39 +01:00
Author
Owner

@eskyuu commented on GitHub (Jun 13, 2023):

I have found that the underlying issue is that the cable termination deletions in netbox/dcim/models/cables.py on lines 206 and 209 result in nullify_connected_endpoints being called in netbox/dcim/signals.py. Because there are 2 cables, the first cable deletion causes from_origin to stop at line 503 in netbox/dcim/models/cables.py. This means the rear ports are not part of the path. When the second cable termination is deleted, the cable is not part of the path, so nullify_connected_endpoints does not find any paths to re-evaluate.

I have created a branch (link below) that updates nullify_connected_endpoints to look for paths on front and rear ports when appropriate if the cable is not part of a path, which causes the deletion of cable terminations to find and re-evaluate the correct paths when deleting multiple cables.
https://github.com/eskyuu/netbox/tree/ct-trace-fix

@eskyuu commented on GitHub (Jun 13, 2023): I have found that the underlying issue is that the cable termination deletions in netbox/dcim/models/cables.py on lines 206 and 209 result in nullify_connected_endpoints being called in netbox/dcim/signals.py. Because there are 2 cables, the first cable deletion causes from_origin to stop at line 503 in netbox/dcim/models/cables.py. This means the rear ports are not part of the path. When the second cable termination is deleted, the cable is not part of the path, so nullify_connected_endpoints does not find any paths to re-evaluate. I have created a branch (link below) that updates nullify_connected_endpoints to look for paths on front and rear ports when appropriate if the cable is not part of a path, which causes the deletion of cable terminations to find and re-evaluate the correct paths when deleting multiple cables. https://github.com/eskyuu/netbox/tree/ct-trace-fix
Author
Owner

@eskyuu commented on GitHub (Jun 13, 2023):

I also found an error where api PATCH operations were updating the paths on the original terminations instead of the new ones (POST operations worked correctly). I have added another change to the signal code to avoid the terminations.all() call, which uses cached information.

Let me know if I should open a separate bug for this second issue, or if you're happy to bundle them both as cable tracing issues.

@eskyuu commented on GitHub (Jun 13, 2023): I also found an error where api PATCH operations were updating the paths on the original terminations instead of the new ones (POST operations worked correctly). I have added another change to the signal code to avoid the terminations.all() call, which uses cached information. Let me know if I should open a separate bug for this second issue, or if you're happy to bundle them both as cable tracing issues.
Author
Owner

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

Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.

@jeremystretch commented on GitHub (Sep 11, 2023): Thank you for opening a bug report. Unfortunately, the information you have provided is not sufficient for someone else to attempt to reproduce the reported behavior. Remember, each bug report must include detailed steps that someone else can follow on a clean, empty NetBox installation to reproduce the exact problem you're experiencing. These instructions should include the creation of any involved objects, any configuration changes, and complete accounting of the actions being taken. Also be sure that your report does not reference data on the public NetBox demo, as that is subject to change at any time by an outside party and cannot be relied upon for bug reports.
Author
Owner

@eskyuu commented on GitHub (Sep 15, 2023):

Can you please advise which step number is unclear? I am happy to clarify, or provide screenshots if needed.

@eskyuu commented on GitHub (Sep 15, 2023): Can you please advise which step number is unclear? I am happy to clarify, or provide screenshots if needed.
Author
Owner

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

@eskyuu please rewrite your reproduction steps to include clear instructions, including the exact values you are using at each step, so that someone else can confidently attempt to reproduce the reported issue.

@jeremystretch commented on GitHub (Sep 21, 2023): @eskyuu please rewrite your reproduction steps to include clear instructions, including the exact values you are using at each step, so that someone else can confidently attempt to reproduce the reported issue.
Author
Owner

@jeremystretch commented on GitHub (Oct 5, 2023):

This issue is being closed as no further information has been provided. If you would like to revisit this topic, please first modify your original post to include all the requested detail, and then ask that the issue be reopened.

@jeremystretch commented on GitHub (Oct 5, 2023): This issue is being closed as no further information has been provided. If you would like to revisit this topic, please first modify your original post to include all the requested detail, and then ask that the issue be reopened.
Author
Owner

@eskyuu commented on GitHub (Oct 9, 2023):

Sorry for the delay in replying. I have been off grid, and prior to that didn't have immediate access to an unpatched system to reproduce the issue (we are running the patch that I've linked to above internally, so I can't reproduce the issue on our systems). I have just attempted to reproduce the issue in the public demo environment, and then realised that the issue only occurs during an API PATCH operation, which was not mentioned in my original post.

Given that the API request and PATCH operation requires the use of various IDs (cable ID, device ID, interface ID, etc), I am not sure how I can provide exact commands to run. Do you have a document that you can point me to that I can follow to ensure I submit the correct information? Would a python script that can run against the demo environment be acceptable?

The Web UI appears to use POST operations, so it didn't when I attempted to reproduce the issue in the demo environment's web UI. I think the PATCH operations fetch the object first, and the issue is that after updating the object in the database it uses the data cached from the fetch when refreshing the cable trace. This is based on the comments I put into the patch I created.

@eskyuu commented on GitHub (Oct 9, 2023): Sorry for the delay in replying. I have been off grid, and prior to that didn't have immediate access to an unpatched system to reproduce the issue (we are running the patch that I've linked to above internally, so I can't reproduce the issue on our systems). I have just attempted to reproduce the issue in the public demo environment, and then realised that the issue only occurs during an API PATCH operation, which was not mentioned in my original post. Given that the API request and PATCH operation requires the use of various IDs (cable ID, device ID, interface ID, etc), I am not sure how I can provide exact commands to run. Do you have a document that you can point me to that I can follow to ensure I submit the correct information? Would a python script that can run against the demo environment be acceptable? The Web UI appears to use POST operations, so it didn't when I attempted to reproduce the issue in the demo environment's web UI. I think the PATCH operations fetch the object first, and the issue is that after updating the object in the database it uses the data cached from the fetch when refreshing the cable trace. This is based on the comments I put into the patch I created.
Author
Owner

@DanSheps commented on GitHub (Oct 10, 2023):

I would say to the best of your abilities provide a "fake" (whatever ID you use in your environment) id with instructions to use a real ID for reproduction

@DanSheps commented on GitHub (Oct 10, 2023): I would say to the best of your abilities provide a "fake" (whatever ID you use in your environment) id with instructions to use a real ID for reproduction
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8193