Skip to content
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

Patch Terminaison Câbles #18146

Open
LeCooperTLC opened this issue Dec 3, 2024 · 3 comments
Open

Patch Terminaison Câbles #18146

LeCooperTLC opened this issue Dec 3, 2024 · 3 comments
Labels
status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application

Comments

@LeCooperTLC
Copy link

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

@LeCooperTLC LeCooperTLC added status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application labels Dec 3, 2024
@arthanson
Copy link
Collaborator

@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 arthanson added status: revisions needed This issue requires additional information to be actionable and removed status: needs triage This issue is awaiting triage by a maintainer labels Dec 3, 2024
@LeCooperTLC
Copy link
Author

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.)

Copy link
Contributor

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 github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Dec 12, 2024
@bctiemann bctiemann added status: needs triage This issue is awaiting triage by a maintainer and removed status: revisions needed This issue requires additional information to be actionable pending closure Requires immediate attention to avoid being closed for inactivity labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue is awaiting triage by a maintainer type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

3 participants