oob_ips & primary_ip's are deleted when a device is deleted #8700

Closed
opened 2025-12-29 20:40:04 +01:00 by adam · 1 comment
Owner

Originally created by @ITJamie on GitHub (Sep 29, 2023).

NetBox version

v3.6.3

Python version

3.10

Steps to Reproduce

  1. create a device
  2. assign an IP to two interfaces
  3. assign an IP to both oob_ip and primary_ip
  4. delete device
  5. look at changelog, the ips will have been deleted,

Expected Behavior

the ips should become unassigned from the device, not deleted

ref: https://github.com/netbox-community/netbox/issues/6015 - here deleting of ips when interfaces were deleted was disabled

Observed Behavior

oob_ip/primary_ip assigned addresses are deleted.
this is unexpected as the field models have on_delete=models.SET_NULL configured

Originally created by @ITJamie on GitHub (Sep 29, 2023). ### NetBox version v3.6.3 ### Python version 3.10 ### Steps to Reproduce 1. create a device 2. assign an IP to two interfaces 3. assign an IP to both oob_ip and primary_ip 4. delete device 5. look at changelog, the ips will have been deleted, ### Expected Behavior the ips should become unassigned from the device, not deleted ref: https://github.com/netbox-community/netbox/issues/6015 - here deleting of ips when interfaces were deleted was disabled ### Observed Behavior oob_ip/primary_ip assigned addresses are deleted. this is unexpected as the field models have `on_delete=models.SET_NULL` configured
adam added the type: bug label 2025-12-29 20:40:04 +01:00
adam closed this issue 2025-12-29 20:40:05 +01:00
Author
Owner

@ITJamie commented on GitHub (Sep 29, 2023):

device before deletion:
Screenshot 2023-09-29 at 21 31 25

changelog showing deleted ips:
Screenshot 2023-09-29 at 21 32 04

I noticed this when working on https://github.com/netbox-community/netbox/issues/13690. there the deletion modal I adjusted was showing oob_ip's and primary_ips were up for deletion...

I may have my logic backwards here when it comes to the on_delete=models.SET_NULL direction. However I still consider it surprising that primary_ip's or oob_ip's would be deleted on deletion of a device

@ITJamie commented on GitHub (Sep 29, 2023): device before deletion: <img width="1450" alt="Screenshot 2023-09-29 at 21 31 25" src="https://github.com/netbox-community/netbox/assets/1613241/4dd9aefd-ff38-4cb7-bfe3-4698c4c5138f"> changelog showing deleted ips: <img width="1443" alt="Screenshot 2023-09-29 at 21 32 04" src="https://github.com/netbox-community/netbox/assets/1613241/53800065-b2b0-4436-82b5-7fcb8fea1924"> I noticed this when working on https://github.com/netbox-community/netbox/issues/13690. there the deletion modal I adjusted was showing oob_ip's and primary_ips were up for deletion... I may have my logic backwards here when it comes to the `on_delete=models.SET_NULL` direction. However I still consider it surprising that primary_ip's or oob_ip's would be deleted on deletion of a device
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#8700