Patch Terminaison Câbles #10534

Closed
opened 2025-12-29 21:32:48 +01:00 by adam · 7 comments
Owner

Originally created by @LeCooperTLC on GitHub (Dec 3, 2024).

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.7

Python Version

3.12

Steps to Reproduce

  • I created switches, then created the interfaces.

Capture d'écran 2024-12-03 142809

  • I also created the patch panels that connect the switches to the PCs. On the patch panels, I created rear ports, followed by front ports.

Capture d'écran 2024-12-03 144742-English

  • Then, I created the PCs.
  • I created a cable to connect a switch interface to the front port of the patch panel.
  • I also created a cable to connect the rear port of the patch panel to the PC.

Capture d'écran 2024-12-03 143009
Capture d'écran 2024-12-03 143236

  • The result is this trace.

Capture d'écran 2024-12-03 143043

  • When everything is working, in the "Connection" column, I can see the switch and the port to which I am connected. I can also see the trace from the PC.

Capture d'écran 2024-12-03 145410

I have now created a script that retrieves data such as the hostname, the switch, and the port it is connected to. However, when these details change, I want everything to be reconnected to the correct switch.
Let me explain: let's say PC-1 is connected to Switch-1, Port-1. If my file is updated and the new configuration shows that PC-1 should be connected to Switch-2, Port-1, then I delete the termination on side A and patch it with the LAN0 interface ID of the PC I want to connect.

Script :
delete_response=$(curl -skX 'DELETE'
"https://netbox.""/api/dcim/cable-terminations/$a_termination_id/"
-H 'accept: application/json'
-H 'Content-Type: application/json'
-H "Authorization: Token "" ")

                                                                            echo $delete_response

                                                                            patch_response=$(curl -skX 'PATCH' \
                                                                            "https://netbox.""api/dcim/cables/$cable_id_rear_port/" \
                                                                            -H 'accept: application/json' \
                                                                            -H 'Content-Type: application/json' \
                                                                            -H "Authorization: Token "" " \
                                                                            -d '{
                                                                                            "a_terminations": [
                                                                                            {
                                                                                                            "object_type" : "dcim.interface",
                                                                                                            "object_id": '"$interface_id"'
                                                                                            }
                                                                                             ],
                                                                                               "status": "connected"
                                                                                            }')
  • The script correctly deletes and reconnects.

I would like to clarify that when I delete the termination and reconnect it to the cable, it works. I get the trace, and in the "Connection" column of the PC, the switch and port it is connected to appear correctly.

Expected Behavior

  • When the script deletes and reconnects the termination to the cable, it works, but the trace and the "Connection" column remain empty.
Capture d'écran 2024-12-03 153132
  • But when I look at the trace from the switch, I can see all the links.
Capture d'écran 2024-12-03 152416 Capture d'écran 2024-12-03 152515 Capture d'écran 2024-12-03 152534

Observed Behavior

  • I noticed that in the database, the path_id 1891 was deleted and not recreated, except for path_id 1893, but the latter allows seeing the trace from the switch.

Database path_id
Capture d'écran 2024-12-03 113129

Originally created by @LeCooperTLC on GitHub (Dec 3, 2024). ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.1.7 ### Python Version 3.12 ### Steps to Reproduce - I created switches, then created the interfaces. ![Capture d'écran 2024-12-03 142809](https://github.com/user-attachments/assets/96bcd7db-547b-45ae-be09-98fbf5411b2e) - I also created the patch panels that connect the switches to the PCs. On the patch panels, I created rear ports, followed by front ports. ![Capture d'écran 2024-12-03 144742-English](https://github.com/user-attachments/assets/9373fb4c-4457-45ca-ab9e-f4f15b19f59e) - Then, I created the PCs. - I created a cable to connect a switch interface to the front port of the patch panel. - I also created a cable to connect the rear port of the patch panel to the PC. ![Capture d'écran 2024-12-03 143009](https://github.com/user-attachments/assets/e9e01a52-1dbe-4fa8-b6c6-e9bc3ab3ed20) ![Capture d'écran 2024-12-03 143236](https://github.com/user-attachments/assets/288c3425-0ad3-4283-91bd-52efa8cfa7e9) - The result is this trace. ![Capture d'écran 2024-12-03 143043](https://github.com/user-attachments/assets/9106bb3f-016d-4b79-baac-e9d4ea5365cb) - When everything is working, in the "Connection" column, I can see the switch and the port to which I am connected. I can also see the trace from the PC. ![Capture d'écran 2024-12-03 145410](https://github.com/user-attachments/assets/feee3e36-33a5-4c0d-a937-3fe81074e722) I have now created a script that retrieves data such as the hostname, the switch, and the port it is connected to. However, when these details change, I want everything to be reconnected to the correct switch. Let me explain: let's say PC-1 is connected to Switch-1, Port-1. If my file is updated and the new configuration shows that PC-1 should be connected to Switch-2, Port-1, then I delete the termination on side A and patch it with the LAN0 interface ID of the PC I want to connect. Script : delete_response=$(curl -skX 'DELETE' \ "https://netbox.""/api/dcim/cable-terminations/$a_termination_id/" \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H "Authorization: Token "" ") echo $delete_response patch_response=$(curl -skX 'PATCH' \ "https://netbox.""api/dcim/cables/$cable_id_rear_port/" \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -H "Authorization: Token "" " \ -d '{ "a_terminations": [ { "object_type" : "dcim.interface", "object_id": '"$interface_id"' } ], "status": "connected" }') - The script correctly deletes and reconnects. I would like to clarify that when I delete the termination and reconnect it to the cable, it works. I get the trace, and in the "Connection" column of the PC, the switch and port it is connected to appear correctly. ### Expected Behavior - When the script deletes and reconnects the termination to the cable, it works, but the trace and the "Connection" column remain empty. - <img width="336" alt="Capture d'écran 2024-12-03 153132" src="https://github.com/user-attachments/assets/b66110ee-8bc4-4ee9-a490-d5b2ea80725f"> - But when I look at the trace from the switch, I can see all the links. <img width="428" alt="Capture d'écran 2024-12-03 152416" src="https://github.com/user-attachments/assets/0d6719e7-2f60-460c-a0b0-e7a27314cf94"> <img width="832" alt="Capture d'écran 2024-12-03 152515" src="https://github.com/user-attachments/assets/b6a31f4b-6fb1-47e6-96f7-addc0f4a87ca"> <img width="166" alt="Capture d'écran 2024-12-03 152534" src="https://github.com/user-attachments/assets/ced4d50f-3252-4ae3-9ee8-3a7d683be37c"> ### Observed Behavior - I noticed that in the database, the path_id 1891 was deleted and not recreated, except for path_id 1893, but the latter allows seeing the trace from the switch. ![Database path_id](https://github.com/user-attachments/assets/be05e503-c97b-4784-acb2-58abe605321a) ![Capture d'écran 2024-12-03 113129](https://github.com/user-attachments/assets/32783706-c3bc-4f9d-a0d0-0366d9efc3b6)
adam added the type: bugpending closurestatus: revisions needed labels 2025-12-29 21:32:48 +01:00
adam closed this issue 2025-12-29 21:32:48 +01:00
Author
Owner

@arthanson commented on GitHub (Dec 3, 2024):

@LeCooperTLC Can you please provide the reproduction steps in text instead of screenshots. I.E. The first part "I created switches, then created the interfaces." can you please list out the interfaces needed, for example:

  1. create device name "xxx" with ...
  2. On device xxx add an interface: name: interface1 ...

It allows us to quickly try and reproduce the issue without having to decode screenshots and figure out what you might have entered.

@arthanson commented on GitHub (Dec 3, 2024): @LeCooperTLC Can you please provide the reproduction steps in text instead of screenshots. I.E. The first part "I created switches, then created the interfaces." can you please list out the interfaces needed, for example: 1. create device name "xxx" with ... 2. On device xxx add an interface: name: interface1 ... It allows us to quickly try and reproduce the issue without having to decode screenshots and figure out what you might have entered.
Author
Owner

@LeCooperTLC commented on GitHub (Dec 4, 2024):

I created a switch "Switch01", then added 54 interfaces from [01-54] of type 1000BASE-T.

Next, I created a patch panel "Panel01". I created rear ports [01-24] and front ports [01-24]. The rear ports are automatically detected (make sure to create the rear ports first).

Now, I go to my switch, select the interface I want, and click "connect cable" on the front port, then select my patch panel and connect the desired front port.

I create a PC "pc01", create an interface "LAN0" of type 1000BASE-T, then connect the cable to the rear port of Panel01.

Normally, after that, everything is properly connected and the trace is visible, but when the A-end of the cable connecting the PC to the patch panel is removed and patched, the trace disappears.

a_termination_id=$(curl -skH "Authorization: Token """ \
"https://netbox.""/api/dcim/cable-terminations/?cable=$cable_id" | jq -r '.results[0].id')

(This command allows you to get the ID of the A-end of the cable that connects the PC to the patch panel.)

@LeCooperTLC commented on GitHub (Dec 4, 2024): I created a switch "Switch01", then added 54 interfaces from [01-54] of type 1000BASE-T. Next, I created a patch panel "Panel01". I created rear ports [01-24] and front ports [01-24]. The rear ports are automatically detected (make sure to create the rear ports first). Now, I go to my switch, select the interface I want, and click "connect cable" on the front port, then select my patch panel and connect the desired front port. I create a PC "pc01", create an interface "LAN0" of type 1000BASE-T, then connect the cable to the rear port of Panel01. Normally, after that, everything is properly connected and the trace is visible, but when the A-end of the cable connecting the PC to the patch panel is removed and patched, the trace disappears. a_termination_id=$(curl -skH "Authorization: Token """ \ "https://netbox.""/api/dcim/cable-terminations/?cable=$cable_id" | jq -r '.results[0].id') (This command allows you to get the ID of the A-end of the cable that connects the PC to the patch panel.)
Author
Owner

@github-actions[bot] commented on GitHub (Dec 12, 2024):

This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.

@github-actions[bot] commented on GitHub (Dec 12, 2024): This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.
Author
Owner

@LeCooperTLC commented on GitHub (Dec 16, 2024):

What additional information do you need ?

@LeCooperTLC commented on GitHub (Dec 16, 2024): What additional information do you need ?
Author
Owner

@jeremystretch commented on GitHub (Dec 27, 2024):

@LeCooperTLC it is not clear from your description thus far exactly what you are doing or what the problem is. Please rewrite your post above to provide concise, explicit instructions for reproducing the problem.

Please also note that the use of custom scripts in this context is outside the acceptable scope for a bug report. If you need help with a custom script, please open a discussion instead.

@jeremystretch commented on GitHub (Dec 27, 2024): @LeCooperTLC it is not clear from your description thus far exactly what you are doing or what the problem is. Please rewrite your post above to provide concise, explicit instructions for reproducing the problem. Please also note that the use of custom scripts in this context is outside the acceptable scope for a bug report. If you need help with a custom script, please open a [discussion](https://github.com/netbox-community/netbox/discussions/new/choose) instead.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 4, 2025):

This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.

@github-actions[bot] commented on GitHub (Jan 4, 2025): This is a reminder that additional information is needed in order to further triage this issue. If the requested details are not provided, the issue will soon be closed automatically.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 11, 2025):

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.

@github-actions[bot] commented on GitHub (Jan 11, 2025): 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.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10534