CSV Import IP Addresses - Can set as primary IP on device without specifying an interface #5560

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

Originally created by @rhyser9 on GitHub (Oct 26, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.0.4

Python version

3.8

Steps to Reproduce

Only tested v3.0.4, but don't see any relevant changelogs on more recent versions.

  1. Create a device
  2. Import an IP address via CSV, and specify 'device' and 'is_primary'
address,status,device,is_primary
1.1.1.1/32,active,my_device,true

Expected Behavior

The CSV import should fail if is_primary is defined without a valid device and interface pair being defined.

or

Primary IPs should not be dependent on being assigned to an interface, but rather any defined IP object should be valid.

Observed Behavior

Created IP address object does not indicate that it is assigned to a device:
image

Device shows that a primary IP is assigned, despite that IP not being assigned to an interface.
image
image

Editing my_device details results in the primary IP being removed.

Bulk editing a range of devices that includes my_device (i.e. to add a tag) results in the error my_device failed validation: The specified IP address (1.1.1.1/32) is not assigned to this device.

Deleting the imported IP does properly remove the primary IP from the device (I half expected that to fail somehow).

Originally created by @rhyser9 on GitHub (Oct 26, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.0.4 ### Python version 3.8 ### Steps to Reproduce Only tested v3.0.4, but don't see any relevant changelogs on more recent versions. 1) Create a device 2) Import an IP address via CSV, and specify 'device' and 'is_primary' ``` address,status,device,is_primary 1.1.1.1/32,active,my_device,true ``` ### Expected Behavior The CSV import should fail if is_primary is defined without a valid device and interface pair being defined. *or* Primary IPs should not be dependent on being assigned to an interface, but rather any defined IP object should be valid. ### Observed Behavior Created IP address object does not indicate that it is assigned to a device: ![image](https://user-images.githubusercontent.com/3577982/138946099-d297b307-2d85-401c-951f-d1cf283d046c.png) Device shows that a primary IP is assigned, despite that IP not being assigned to an interface. ![image](https://user-images.githubusercontent.com/3577982/138946329-63a6de24-dbc4-420b-a729-50fc59fd58a3.png) ![image](https://user-images.githubusercontent.com/3577982/138946510-f3aebe07-1531-4c28-9077-39cec8764684.png) Editing `my_device` details results in the primary IP being removed. Bulk editing a range of devices that includes `my_device` (i.e. to add a tag) results in the error `my_device failed validation: The specified IP address (1.1.1.1/32) is not assigned to this device.` Deleting the imported IP _does_ properly remove the primary IP from the device (I half expected that to fail somehow).
adam added the type: bugstatus: accepted labels 2025-12-29 19:29:24 +01:00
adam closed this issue 2025-12-29 19:29:24 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5560