Prevent the deletion of device components with a cable attached #6716

Closed
opened 2025-12-29 19:44:26 +01:00 by adam · 6 comments
Owner

Originally created by @jeremystretch on GitHub (Jul 25, 2022).

NetBox version

v3.3-beta1

Feature type

Change to existing functionality

Proposed functionality

Prevent the deletion of a device component (e.g. interface, console port, etc.) or other object to which a cable is terminated. The cable must be disconnected before the object can be deleted.

Use case

This behavior was originally proposed in #5418 but never acted upon. However, it deserves to be revisited in v3.3 because the cabling model has changed. Previously, deleting a terminating object (e.g. an interface) forced the deletion of an attached cable, because each cable must have both its A and B terminations defined. However, in v3.3 and later, this is no longer a strict requirement: It's possible to have a cable with only one end terminated.

Requiring the user to first disconnect any attached cable prior to deleting the terminating object introduces a new step in the workflow, but with the benefits of guarding against inadvertent deletions and preventing "orphaned" cables.

Related: #9778

Database changes

No response

External dependencies

No response

Originally created by @jeremystretch on GitHub (Jul 25, 2022). ### NetBox version v3.3-beta1 ### Feature type Change to existing functionality ### Proposed functionality Prevent the deletion of a device component (e.g. interface, console port, etc.) or other object to which a cable is terminated. The cable must be disconnected before the object can be deleted. ### Use case This behavior was originally proposed in #5418 but never acted upon. However, it deserves to be revisited in v3.3 because the cabling model has changed. Previously, deleting a terminating object (e.g. an interface) _forced_ the deletion of an attached cable, because each cable must have both its A and B terminations defined. However, in v3.3 and later, this is no longer a strict requirement: It's possible to have a cable with only one end terminated. Requiring the user to first disconnect any attached cable prior to deleting the terminating object introduces a new step in the workflow, but with the benefits of guarding against inadvertent deletions and preventing "orphaned" cables. Related: #9778 ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurepending closurestatus: under review labels 2025-12-29 19:44:26 +01:00
adam closed this issue 2025-12-29 19:44:26 +01:00
Author
Owner

@themmini commented on GitHub (Jul 26, 2022):

One possible behavior is:
If deleting interface with cable attached.

  • remove that particular endpoint from the cable
    • if no more endpoints exist for the cable, delete the cable
  • delete the interface
    This for me, would be the 'expected' result.

But having it be a manual step is also consistent with the rest of the Netbox experience.

@themmini commented on GitHub (Jul 26, 2022): One possible behavior is: If deleting interface with cable attached. - remove that particular endpoint from the cable - - if no more endpoints exist for the cable, delete the cable - delete the interface This for me, would be the 'expected' result. But having it be a manual step is also consistent with the rest of the Netbox experience.
Author
Owner

@bistraque commented on GitHub (Jul 27, 2022):

With this new workflow, there is a possibility to treat cables as a new type of physical asset (not sure if it can "live" without any connection though). This makes sense for "expensive" cables such highspeed AOC or DAC, and for splitter cables of course. It would probably require new attributes such "serial number" and "asset id", but these can already be implemented as custom fields.

With that in mind I think the proposed workflow (i.e. explicit disconnect before delete) is better than implicit delete because it allows to use netbox to track cable items if needed.

@bistraque commented on GitHub (Jul 27, 2022): With this new workflow, there is a possibility to treat cables as a new type of physical asset (not sure if it can "live" without any connection though). This makes sense for "expensive" cables such highspeed AOC or DAC, and for splitter cables of course. It would probably require new attributes such "serial number" and "asset id", but these can already be implemented as custom fields. With that in mind I think the proposed workflow (i.e. explicit disconnect before delete) is better than implicit delete because it allows to use netbox to track cable items if needed.
Author
Owner

@jsenecal commented on GitHub (Jul 28, 2022):

In my experience, cables have the following characteristics:

  1. Most have manufacturers and model numbers; Not always useful to track, but could be nice to have this information documented where applicable. We could also introduce the "CableTemplate" model to automatically populate cable color/length/etc.
  2. Most have serial numbers (could be useful to track them in netbox to inventory those that have a serial number, and find them in netbox by their serial)
  3. They are often left in place in the datacenter environment and forgotten... Leaving an unterminated cable in netbox could be useful to track them down and either re-use them or task someone to remove them.

Obviously 1. and 2. above would probably benefit from their own feature request. Only 3. applies to this issue.

@jsenecal commented on GitHub (Jul 28, 2022): In my experience, cables have the following characteristics: 1. Most have manufacturers and model numbers; Not always useful to track, but could be nice to have this information documented where applicable. We could also introduce the "CableTemplate" model to automatically populate cable color/length/etc. 2. Most have serial numbers (could be useful to track them in netbox to inventory those that have a serial number, and find them in netbox by their serial) 3. They are often left in place in the datacenter environment and forgotten... Leaving an unterminated cable in netbox could be useful to track them down and either re-use them or task someone to remove them. Obviously 1. and 2. above would probably benefit from their own feature request. Only 3. applies to this issue.
Author
Owner

@eronlloyd commented on GitHub (Sep 13, 2022):

I think this is an important conversation. From an optical network engineer's perspective, each cable has specific and important characteristics that are specified in the design, tested in the installation, and updated during operation/maintenance.

To me, cables should be first class objects, as in reality they are a critical part of Layer 1 and warrant that level of treatment as part of the system. The recent changes to 3.3 that allows the editing of cables is an important step in that direction, and tracking link state and protecting against either devices or cables that are attached as part of the link makes sense.

@eronlloyd commented on GitHub (Sep 13, 2022): I think this is an important conversation. From an optical network engineer's perspective, each cable has specific and important characteristics that are specified in the design, tested in the installation, and updated during operation/maintenance. To me, cables should be first class objects, as in reality they are a critical part of Layer 1 and warrant that level of treatment as part of the system. The recent changes to 3.3 that allows the editing of cables is an important step in that direction, and tracking link state and protecting against either devices or cables that are attached as part of the link makes sense.
Author
Owner

@github-actions[bot] commented on GitHub (Nov 13, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Nov 13, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. **Do not** attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Dec 14, 2022):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Dec 14, 2022): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6716