[PR #20678] [MERGED] Fixes #20646: Prevent cables from connecting to marked_connected objects #16007

Closed
opened 2025-12-30 00:25:17 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/20678
Author: @pheus
Created: 10/24/2025
Status: Merged
Merged: 10/25/2025
Merged by: @jnovinger

Base: mainHead: 20646-cable-mark-connected-validation


📝 Commits (1)

  • 8bc3a8b fix(dcim): Prevent cables from connecting to marked objects

📊 Changes

2 files changed (+26 additions, -3 deletions)

View changed files

📝 netbox/dcim/models/cables.py (+14 -3)
📝 netbox/dcim/tests/test_models.py (+12 -0)

📄 Description

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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/20678 **Author:** [@pheus](https://github.com/pheus) **Created:** 10/24/2025 **Status:** ✅ Merged **Merged:** 10/25/2025 **Merged by:** [@jnovinger](https://github.com/jnovinger) **Base:** `main` ← **Head:** `20646-cable-mark-connected-validation` --- ### 📝 Commits (1) - [`8bc3a8b`](https://github.com/netbox-community/netbox/commit/8bc3a8b17af57590afa574f337b1a33b9588ba78) fix(dcim): Prevent cables from connecting to marked objects ### 📊 Changes **2 files changed** (+26 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `netbox/dcim/models/cables.py` (+14 -3) 📝 `netbox/dcim/tests/test_models.py` (+12 -0) </details> ### 📄 Description <!-- 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` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 00:25:17 +01:00
adam closed this issue 2025-12-30 00:25:18 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#16007