Cable Bulk Uploads allow mark_connected AND a cable to be present (validation error) #11760

Closed
opened 2025-12-29 21:49:31 +01:00 by adam · 2 comments
Owner

Originally created by @cruse1977 on GitHub (Oct 21, 2025).

Originally assigned to: @pheus on GitHub.

NetBox Edition

NetBox Community

NetBox Version

v4.4.4

Python Version

3.10

Steps to Reproduce

  1. Create a device (eg: dmi-albany-rtr01) with interfaces GigabitEthernet0/1/6 and GigabitEthernet0/1/7 in a site "DM-Albany"

  2. On dmi01-albany-rtr01, set interface GigabitEthernet0/1/6 as mark connected and save.

  3. Bulk Upload the following

side_a_device, side_a_type, side_a_name, side_b_device, side_b_type, side_b_name, side_a_site, side_b_site
"dmi01-albany-rtr01", "dcim.interface", "GigabitEthernet0/1/6", "dmi01-albany-rtr01", "dcim.interface", "GigabitEthernet0/1/7", "DM-Albany", "DM-Albany"

Expected Behavior

Upload fails due to mark_connected being set, and adding a cable to that interface

Observed Behavior

Cable is allowed, however this will manifest in netbox-branching as a branch failing to sync or merge, due to the validation error of mark_connected AND cable - Screenshot showing the update change entry which will cause this:

Image
Originally created by @cruse1977 on GitHub (Oct 21, 2025). Originally assigned to: @pheus on GitHub. ### NetBox Edition NetBox Community ### NetBox Version v4.4.4 ### Python Version 3.10 ### Steps to Reproduce 1. Create a device (eg: dmi-albany-rtr01) with interfaces GigabitEthernet0/1/6 and GigabitEthernet0/1/7 in a site "DM-Albany" 1. On dmi01-albany-rtr01, set interface GigabitEthernet0/1/6 as mark connected and save. 2. Bulk Upload the following ``` side_a_device, side_a_type, side_a_name, side_b_device, side_b_type, side_b_name, side_a_site, side_b_site "dmi01-albany-rtr01", "dcim.interface", "GigabitEthernet0/1/6", "dmi01-albany-rtr01", "dcim.interface", "GigabitEthernet0/1/7", "DM-Albany", "DM-Albany" ``` ### Expected Behavior Upload fails due to mark_connected being set, and adding a cable to that interface ### Observed Behavior Cable is allowed, however this will manifest in netbox-branching as a branch failing to sync or merge, due to the validation error of mark_connected AND cable - Screenshot showing the update change entry which will cause this: <img width="1681" height="1037" alt="Image" src="https://github.com/user-attachments/assets/440e958c-0459-49dc-8d38-3714bf34e051" />
adam added the type: bugstatus: acceptednetboxseverity: low labels 2025-12-29 21:49:31 +01:00
adam closed this issue 2025-12-29 21:49:31 +01:00
Author
Owner

@pheus commented on GitHub (Oct 24, 2025):

I'd like to contribute this bugfix. Could you please assign the issue to me? Thanks!

@pheus commented on GitHub (Oct 24, 2025): I'd like to contribute this bugfix. Could you please assign the issue to me? Thanks!
Author
Owner

@pheus commented on GitHub (Oct 24, 2025):

Just to add a UI angle: this can also happen in the web UI due to a stale selection. The interface dropdowns correctly disable endpoints that are already cabled or have mark_connected=True. However:

  1. Open the cable form and select an eligible interface.
  2. Before submitting, the interface is edited (by you in another tab or by someone else) to change its state — e.g., set mark_connected=True.
  3. Submitting the form may still proceed because the selection was made against the earlier state.

The “already cabled” case is typically caught by the existing duplicate‑termination check, but the mark_connected case isn’t enforced at the model layer today. The PR addresses this by adding a guard in CableTermination.clean() so a cable cannot be attached when the endpoint has mark_connected=True. That closes the UI/API/CSV gap and returns a clear validation error instead of allowing an inconsistent state.

@pheus commented on GitHub (Oct 24, 2025): _Just to add a UI angle_: this can also happen in the web UI due to a stale selection. The interface dropdowns correctly disable endpoints that are already cabled or have `mark_connected=True`. However: 1. Open the cable form and select an eligible interface. 2. Before submitting, the interface is edited (by you in another tab or by someone else) to change its state — e.g., set `mark_connected=True`. 3. Submitting the form may still proceed because the selection was made against the earlier state. The “already cabled” case is typically caught by the existing duplicate‑termination check, but the `mark_connected` case isn’t enforced at the model layer today. The PR addresses this by adding a guard in `CableTermination.clean()` so a cable cannot be attached when the endpoint has `mark_connected=True`. That closes the UI/API/CSV gap and returns a clear validation error instead of allowing an inconsistent state.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11760