Device CSV Import: Add field to import Primary IP address #2420

Closed
opened 2025-12-29 17:25:57 +01:00 by adam · 4 comments
Owner

Originally created by @anthonyeden on GitHub (Mar 1, 2019).

Environment

  • Python version: 3.7.2
  • NetBox version: 2.5.7

Proposed Functionality

I'd like to modify the Device Import CSV screen (/dcim/devices/import/) to allow importing a Primary IPv4 and/or IPv6 address along with devices.

This would include adding two new optional column headers, which can be detected by the CSV importer.

I'd also like to include these two new columns in the Device Export CSV template.

I am willing to implement this myself and create a pull request.

Use Case

This would assist with on boarding new users to Netbox, especially where they have existing de-normalised spreadsheets containing devices and their Primary IP Addresses in the same spreadsheet.

Database Changes

I do not believe this change would require any change to the database.

External Dependencies

N/A

Originally created by @anthonyeden on GitHub (Mar 1, 2019). ### Environment * Python version: 3.7.2 * NetBox version: 2.5.7 ### Proposed Functionality I'd like to modify the Device Import CSV screen (/dcim/devices/import/) to allow importing a Primary IPv4 and/or IPv6 address along with devices. This would include adding two new optional column headers, which can be detected by the CSV importer. I'd also like to include these two new columns in the Device Export CSV template. I am willing to implement this myself and create a pull request. ### Use Case This would assist with on boarding new users to Netbox, especially where they have existing de-normalised spreadsheets containing devices and their Primary IP Addresses in the same spreadsheet. ### Database Changes I do not believe this change would require any change to the database. ### External Dependencies N/A
adam closed this issue 2025-12-29 17:25:57 +01:00
Author
Owner

@DanSheps commented on GitHub (Mar 1, 2019):

Just to point out, this is not an easy thing to do. The primary IP is simply an IP tied to an interface designated as primary.

You would have to import an interface as well (or have an existing interface it can be assigned to).

There is currently a backlog of feature requests that need to be addressed first. It is unlikely that this will be an accepted FR in the short term.

@DanSheps commented on GitHub (Mar 1, 2019): Just to point out, this is not an easy thing to do. The primary IP is simply an IP tied to an interface designated as primary. You would have to import an interface as well (or have an existing interface it can be assigned to). There is currently a backlog of feature requests that need to be addressed first. It is unlikely that this will be an accepted FR in the short term.
Author
Owner

@DouglasHeriot commented on GitHub (Mar 4, 2019):

Yeah I realise there's a few steps to implementing this as it spans a few model objects, but it would be a big usability win for us to get more users entering devices into NetBox properly.

If we do the work on it and submit a pull request, I hope that this is a feature that fits with the project and will be accepted?

@DouglasHeriot commented on GitHub (Mar 4, 2019): Yeah I realise there's a few steps to implementing this as it spans a few model objects, but it would be a big usability win for us to get more users entering devices into NetBox properly. If we do the work on it and submit a pull request, I hope that this is a feature that fits with the project and will be accepted?
Author
Owner

@jeremystretch commented on GitHub (Mar 4, 2019):

Unfortunately the data model won't allow for this to be implemented in any sane way. As @DanSheps notes, designating a primary IP requires several steps:

  1. Create the device
  2. Create an interface on that device
  3. Assign an IP address to that interface
  4. Update the device to reflect the new primary IP

This isn't feasible inside the CSV import workflow, which is limited to working with a single object type. However, it would be pretty straightforward to script these operations out using the REST API or command shell.

@jeremystretch commented on GitHub (Mar 4, 2019): Unfortunately the data model won't allow for this to be implemented in any sane way. As @DanSheps notes, designating a primary IP requires several steps: 1. Create the device 2. Create an interface on that device 3. Assign an IP address to that interface 4. Update the device to reflect the new primary IP This isn't feasible inside the CSV import workflow, which is limited to working with a single object type. However, it would be pretty straightforward to script these operations out using the REST API or command shell.
Author
Owner

@candlerb commented on GitHub (Apr 7, 2019):

Maybe a first step would be to allow the REST API to allow creation of composite objects from JSON: i.e. a Device with nested Interfaces with nested IP Addresses.

@candlerb commented on GitHub (Apr 7, 2019): Maybe a first step would be to allow the REST API to allow creation of composite objects from JSON: i.e. a Device with nested Interfaces with nested IP Addresses.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2420