Cascade delete IP addresses with interfaces #4682

Closed
opened 2025-12-29 19:19:27 +01:00 by adam · 9 comments
Owner

Originally created by @proudbro on GitHub (Mar 19, 2021).

NetBox version

v.2.10.6

Feature type

Change to existing functionality

Proposed functionality

Steps to Reproduce:

  • Create any device with Interfaces components
  • Add IP address on interface
  • Delete Device
  • IP address is removed from the system

I propose to change the current behavior when removing an interface with assigned IP.
Now it occurs cascading IP address deletion with device and its interfaces despite user has prohibition on IP deletion.

Use case

Previously added IP address will return to the list of IP addresses and can be assigned instead of creating it again

Database changes

No response

External dependencies

No response

Based on: https://github.com/netbox-community/netbox/issues/5945

Originally created by @proudbro on GitHub (Mar 19, 2021). ### NetBox version v.2.10.6 ### Feature type Change to existing functionality ### Proposed functionality Steps to Reproduce: - Create any device with Interfaces components - Add IP address on interface - Delete Device - IP address is removed from the system I propose to change the current behavior when removing an interface with assigned IP. Now it occurs cascading IP address deletion with device and its interfaces despite user has prohibition on IP deletion. ### Use case Previously added IP address will return to the list of IP addresses and can be assigned instead of creating it again ### Database changes _No response_ ### External dependencies _No response_ Based on: https://github.com/netbox-community/netbox/issues/5945
adam added the type: featurestatus: needs ownerpending closure labels 2025-12-29 19:19:27 +01:00
adam closed this issue 2025-12-29 19:19:27 +01:00
Author
Owner

@jeremystretch commented on GitHub (Mar 29, 2021):

We generally avoid any workflows wherein data can be deleted unexpectedly. I personally would prefer to disable the deletion of an interface with assigned IP addresses, but it's open for discussion.

@jeremystretch commented on GitHub (Mar 29, 2021): We generally avoid any workflows wherein data can be deleted unexpectedly. I personally would prefer to disable the deletion of an interface with assigned IP addresses, but it's open for discussion.
Author
Owner

@ljb2of3 commented on GitHub (Apr 8, 2021):

I think I'd side with @jeremystretch on this one. Deleting the IP just because the interface got deleted would be unexpected behavior to me. However, there are times where the proposed functionality could be useful. Perhaps some sort of "deleting this interface / device will leave orphaned IPs (1.1.1.1, 2.3.4.5, etc). Delete these too?" prompt would be useful, but barring that if I had to choose between "auto delete IPs" and "block delete unless IPs are removed" I'd go with blocking the delete operation.

@ljb2of3 commented on GitHub (Apr 8, 2021): I think I'd side with @jeremystretch on this one. Deleting the IP just because the interface got deleted would be unexpected behavior to me. However, there are times where the proposed functionality could be useful. Perhaps some sort of "deleting this interface / device will leave orphaned IPs (1.1.1.1, 2.3.4.5, etc). Delete these too?" prompt would be useful, but barring that if I had to choose between "auto delete IPs" and "block delete unless IPs are removed" I'd go with blocking the delete operation.
Author
Owner

@abrahamvegh commented on GitHub (Apr 8, 2021):

I agree with @ljb2of3, presenting the option, especially when the objects will be orphaned, would be nice, but otherwise I think one of NetBox’s strong suites is making it difficult to accidentally lose data.

@abrahamvegh commented on GitHub (Apr 8, 2021): I agree with @ljb2of3, presenting the option, especially when the objects will be orphaned, would be nice, but otherwise I think one of NetBox’s strong suites is making it difficult to accidentally lose data.
Author
Owner

@jeremystretch commented on GitHub (Apr 21, 2021):

Somewhat related to #5418

@jeremystretch commented on GitHub (Apr 21, 2021): Somewhat related to #5418
Author
Owner

@jeremystretch commented on GitHub (May 4, 2021):

The best solution here might be to present the option to the user when an interface is being deleted. We should be able to add a checkbox labeled "delete n assigned IP addresses" to the confirmation form.

@jeremystretch commented on GitHub (May 4, 2021): The best solution here might be to present the option to the user when an interface is being deleted. We should be able to add a checkbox labeled "delete _n_ assigned IP addresses" to the confirmation form.
Author
Owner

@proudbro commented on GitHub (May 4, 2021):

@jeremystretch , yes, good idea

@proudbro commented on GitHub (May 4, 2021): @jeremystretch , yes, good idea
Author
Owner

@ljb2of3 commented on GitHub (May 4, 2021):

I like this idea. It gives you the option to delete or not, and seeing the
"delete n assigned IP addresses?" message works as a reminder that you may
be deleting the wrong thing if you didn't expect to see it.

On Tue, May 4, 2021 at 10:27 AM Jeremy Stretch @.***>
wrote:

The best solution here might be to present the option to the user when an
interface is being deleted. We should be able to add a checkbox labeled
"delete n assigned IP addresses" to the confirmation form.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/netbox-community/netbox/issues/6015#issuecomment-832030495,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ABMH6T5FSPUYFP2N5LMG4ALTMAG57ANCNFSM4ZOJF7CQ
.

@ljb2of3 commented on GitHub (May 4, 2021): I like this idea. It gives you the option to delete or not, and seeing the "delete n assigned IP addresses?" message works as a reminder that you may be deleting the wrong thing if you didn't expect to see it. On Tue, May 4, 2021 at 10:27 AM Jeremy Stretch ***@***.***> wrote: > The best solution here might be to present the option to the user when an > interface is being deleted. We should be able to add a checkbox labeled > "delete *n* assigned IP addresses" to the confirmation form. > > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub > <https://github.com/netbox-community/netbox/issues/6015#issuecomment-832030495>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/ABMH6T5FSPUYFP2N5LMG4ALTMAG57ANCNFSM4ZOJF7CQ> > . >
Author
Owner

@github-actions[bot] commented on GitHub (Aug 31, 2021):

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. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Aug 31, 2021): 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. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Oct 1, 2021):

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 (Oct 1, 2021): 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#4682