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

Structured import of VMs/Devices e.g. with JSON #1501

Closed
candlerb opened this issue Sep 16, 2017 · 1 comment
Closed

Structured import of VMs/Devices e.g. with JSON #1501

candlerb opened this issue Sep 16, 2017 · 1 comment

Comments

@candlerb
Copy link
Contributor

Issue type

[X] Feature request
[ ] Bug report
[ ] Documentation

Environment

  • Python version: 3.5.2
  • NetBox version: v2.2-beta1

Description

Use case: I want to import VMs. I have an existing table of VMs with their IPv4 and IPv6 addresses.

Using CSV import, this would be a three-step affair:

  1. Import VMs with just their names + cluster
  2. Import interfaces (not yet supported, see Templatize VM interfaces #1492 and Bulk import of device components #822)
  3. Import IP addresses (not yet supported for VMs, see Virtualization: ability to attach to VM interface when importing Addresses via CSV #1500)

Importing Devices requires steps 1 and 3, if the Device Type has been properly configured to create the interfaces.

So I am suggesting some sort of structured import which can create the related items at once, e.g.

{"name":"unifi","platform":"Ubuntu 16.04","interfaces":[
  {"name":"eth0","mac":"54:00:00:28:56:1c","addresses":[
    {"address":"192.0.2.30/24","primary":True},
    {"address":"2001:db8::30/64","primary":True}
  ]}
]}

(If this were done for Device, then any interfaces which had been pre-created from the Device Type would be updated rather than created)

This sort of import could be done via the API. However as far as I can tell, the API doesn't support transactions, so the importer application would have to explicitly track changes and roll them back on error.

@jeremystretch jeremystretch changed the title Feature: structured import of VMs/Devices e.g. with JSON Structured import of VMs/Devices e.g. with JSON Sep 18, 2017
@jeremystretch
Copy link
Member

The CSV-formatted bulk import functions work with only one type of object at a time and are provided for convenience. Any bulk operations requiring more complex logic will need to be performed via the REST API (or directly via the CLI shell). As with most APIs, you'll need to handle errors on the client side accordingly.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants