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

Empty cable objects after deleting last termination #10769

Closed
kr3ator opened this issue Oct 27, 2022 · 19 comments
Closed

Empty cable objects after deleting last termination #10769

kr3ator opened this issue Oct 27, 2022 · 19 comments
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: under review Further discussion is needed to determine this issue's scope and/or implementation topic: cabling type: bug A confirmed report of unexpected behavior in the application

Comments

@kr3ator
Copy link

kr3ator commented Oct 27, 2022

NetBox version

v3.3.5

Python version

3.10

Steps to Reproduce

  1. Create two devices with interfaces.
  2. Create a cable between the devices.
  3. Delete device A.
  4. Either delete device B or the interface of device B that was used in the Cable.

Expected Behavior

The Cable object should be deleted after deleting the last termination.

Observed Behavior

The Cable object is not deleted and has no terminations in it.

@kr3ator kr3ator added the type: bug A confirmed report of unexpected behavior in the application label Oct 27, 2022
@jeremystretch jeremystretch added the status: under review Further discussion is needed to determine this issue's scope and/or implementation label Nov 1, 2022
@fggec
Copy link

fggec commented Nov 23, 2022

Same here.

@jeremystretch
Copy link
Member

The Cable object should be deleted after deleting the last termination.

I think our current sticking point is deciding whether or not the above assertion is true. I don't have a strong opinion either way, but the current implementation permits cables to exist with no terminations at either end. Whether this was by design or by accident I can't recall. 😆

@CADbloke
Copy link

It is physically possible for a cable to exist without terminations so it should probably be possible too in the documentation for that cable. imho.

@fggec
Copy link

fggec commented Jan 11, 2023

Yes but then you have to reference it somewhere in the Doku. I see 3 possible solutions for this:

  1. cables can exist without a termination. -> Reference in Doku
  2. cables cannot exist without a termination. -> should be deleted.
  3. let the users choose if 1 or 2. this could be a separate checkbox or separate window. When you delete a device the user can select every cable that should be deleted or not with checkboxes maybe. Also for single cable if it's disconnected and has only one termination on one device left.

I would prefer the third way

@jeremystretch
Copy link
Member

We discussed this in today's maintainers meeting, and the consensus was to delete a cable upon the deletion of its last termination. In the UI, this will first prompt the user to confirm the cable's deletion.

@CADbloke
Copy link

We discussed this in today's maintainers meeting, and the consensus was to delete a cable upon the deletion of its last termination. In the UI, this will first prompt the user to confirm the cable's deletion.

What will the default behaviour for the API be? Alternatively, can we specify they behaviour in the API call?

@arthanson
Copy link
Collaborator

arthanson commented Mar 23, 2023

Thinking for the API case it should probably maintain default of not deleting the cable, but provide an option "delete_if_unterminated" or something on the termination delete API.

Also there is the bulk-disconnect case, not sure if it makes sense to put a cable deletion confirmation on that as well.. would need to filter the cables that have no terminations and present a list of all of them.

@arthanson arthanson self-assigned this Mar 23, 2023
@PaulWestphal
Copy link

I'm getting an AtributeError when trying to edit a cable after deleting all terminations on one side:

<class 'AttributeError'>

'str' object has no attribute 'label'

Python version: 3.10.6
NetBox version: 3.4.6

@arthanson arthanson removed their assignment Mar 30, 2023
@serge-deiss-obt
Copy link

@PaulWestphal :
I do get the same Error if i try to edit them, however it is still possible to delete them.
In the GUI there is currently to my knowledge no way to filter for these now orphaned Cables specifically to delete them in Bulk.

<class 'AttributeError'>

'str' object has no attribute 'label'

Python version: 3.10.6
NetBox version: 3.4.8

@jeremystretch jeremystretch added the severity: medium Results in substantial degraded or broken functionality for specfic workflows label Jun 23, 2023
@jsenecal jsenecal self-assigned this Jul 31, 2023
@sedyvlk
Copy link

sedyvlk commented Aug 9, 2023

If it is possible to have cable without one termination end, we should also allow cables to be created without one termination end. Consider the following scenario: The device fails and needs to be replaced ( like for like) and all cables new to be moved from failed device to the new device. Since cables can't be re-assigned they need to be deleted and re-created. I can't create a cable without connecting to A and B, yet having a cable with only one termination end is allowed

@kkthxbye-code
Copy link
Contributor

Since cables can't be re-assigned they need to be deleted and re-created.

This is not true, you can re-assign the ends of cables.

yet having a cable with only one termination end is allowed

It's not really by design though, so I'm not sure it should be used as an argument.

@fggec
Copy link

fggec commented Aug 9, 2023

This is not completely false. You can re-assign cables to same type of destination. You can't re-assign them to another type. If you want to change the destination from Interface to front-port there is currently no possibility to do it without recreating.

@kkthxbye-code
Copy link
Contributor

His scenario was from two devices of the same type - a replacement of a broken device. Regardless, it seems unlikely that supporting changing the termination type will be supported by the fix to this issue. It was also suggested recently in a seperate issue:

#13278

@sedyvlk
Copy link

sedyvlk commented Aug 9, 2023

I interpret the following

We discussed this in today's maintainers meeting, and the consensus was to delete a cable upon the deletion of its last termination. In the UI, this will first prompt the user to confirm the cable's deletion.

as: what's currently a bug will no longer be a bug. My point is that if I can get to this state by deleting one side, I should able be able to get to this state by simply creating the cable.

@jsenecal jsenecal removed their assignment Aug 15, 2023
@arthanson
Copy link
Collaborator

After talking to Jeremy:
For the API case we will leave the cable
For the bulk delete case will present the list of empty cables on the bulk confirmation screen noting that they will be deleted automatically.

@arthanson
Copy link
Collaborator

arthanson commented Oct 4, 2023

After digging into this I'm not sure the proposed solution for confirmation to delete the cable if remove all terminations is the correct solution.

I've created a separate FR #13972 This solution allows filtering of cables if they have a_terminations and/or b_terminations - so the user can filter if not a an b terminations and find any unterminated cables and just manually remove them if needed.

There are several issues with the confirm on delete solution:

IMHO: Probably most companies would have a procedure for either always keeping or deleting the cable and therefore it probably makes more sense as a config setting (AUTO_DELETE_UNTERMINATED_CABLES) that is used to automatically delete or not-delete cables when the last termination is deleted - this can then be used in both the UI and API case.

@gormur
Copy link

gormur commented Nov 21, 2023

What is so bad about just keeping the now half or disconnected cable? They are entities like any other in the data model. They have their own page (Connection/Cables). If one could sort by A or B termination in that page, one would easily find them. They could potentially, in real life, be hanging out of a device on the move. Or be laying around ready for re-use. They could be labeled with some asset barcode and have a length and color. They don't just vanish in thin air if one just happens to disconnect it.
True, one might be needing some easier way in the UI to find and connect them again, but that is no different from, say, assigning a "loose" ip address to an interface.

@arthanson arthanson removed their assignment Dec 4, 2023
@arthanson
Copy link
Collaborator

@gormur actually that is what I was proposing, #13972 now allows cables to be filtered for unterminated cables and therefore they can be cleaned up manually. I'm not sure if this is needed anymore.

@jeremystretch
Copy link
Member

We've gone back and forth on this a bit, but I agree that leaving the cable in place after all its terminations have been deleted is the most and consistent and therefor least surprising choice, and best accommodates programmatic logic. As @arthanson mentions, now that we've introduced the ability to easily filter for cables with no terminations, this should no longer be needed, so I'm going to close it out.

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
severity: medium Results in substantial degraded or broken functionality for specfic workflows status: under review Further discussion is needed to determine this issue's scope and/or implementation topic: cabling type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests