Fixes #20646: Prevent cables from connecting to marked_connected objects #980

Closed
opened 2026-04-05 19:26:44 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @pheus on 10/24/2025

Fixes: #20646

Restricts creating cable terminations for endpoints flagged as "mark connected" to avoid the invalid state of being both virtually connected and physically cabled. The validation is implemented in dcim.CableTermination.clean(), ensuring consistent behavior across the UI, REST API, and CSV import. Includes a test covering the rejection case.

Summary of Changes

  • Add a guard in CableTermination.clean() to raise ValidationError when termination.mark_connected == True.
  • Keep the check generic so it applies to any cabled model exposing mark_connected (e.g., interfaces, power/power-feed ports, front/rear ports, circuit terminations).
  • Add test exercising:
    • rejection when the endpoint is mark_connected
*Originally created by @pheus on 10/24/2025* <!-- Thank you for your interest in contributing to NetBox! Please note that our contribution policy requires that a feature request or bug report be approved and assigned prior to opening a pull request. This helps avoid waste time and effort on a proposed change that we might not be able to accept. IF YOUR PULL REQUEST DOES NOT REFERENCE AN ISSUE WHICH HAS BEEN ASSIGNED TO YOU, IT WILL BE CLOSED AUTOMATICALLY. Please specify your assigned issue number on the line below. --> ### Fixes: #20646 <!-- Please include a summary of the proposed changes below. --> Restricts creating cable terminations for endpoints flagged as **"mark connected"** to avoid the invalid state of being both virtually connected and physically cabled. The validation is implemented in `dcim.CableTermination.clean()`, ensuring consistent behavior across the UI, REST API, and CSV import. Includes a test covering the rejection case. #### Summary of Changes - Add a guard in `CableTermination.clean()` to raise `ValidationError` when `termination.mark_connected == True`. - Keep the check generic so it applies to any cabled model exposing `mark_connected` (e.g., interfaces, power/power-feed ports, front/rear ports, circuit terminations). - Add test exercising: - rejection when the endpoint is `mark_connected`
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#980