Netbox: Bulk import of device components

Created on 20 Jan 2017  路  14Comments  路  Source: netbox-community/netbox

I would to nice to be able to import interfaces in devices in CSV format, like VLANs, etc.

accepted

Most helpful comment

+1
Interfaces inherits from their device type however their MAC details needs to be manually added per device it becomes tedious for bulk of machines

We will need an API to ADD MAC associated with an interface for a host as well UPDATE MAC for an associated host interface whenever NIC replacement takes place

It should also validate in case duplicate MAC exists at the time of update &add

Most of the vendors like DELL/HP do provide CFI data which includes MAC details associated with the server NIC cards much ahead before they get shipped to the DC . This helps in preparing and planning server allocations , boot strapping

All 14 comments

Could you describe your use case for this? Interfaces can be created in bulk and should typically be inherited at the time of creation from a device's device type.

We have a bunch of devices with dozens of VLAN interfaces. It was a pain to add them to netbox as the VLANs were randomly numbered. Indeed, we haven't included the VLAN interfaces to the corresponding device types as these are virtual interfaces, so we had to add them manually.
I have created a PR referencing #821 to support commas in bulk creation. But it doesn't help to create descriptions in bulk too.
So, having a way to import interfaces with descriptions would be nice.

+1
Interfaces inherits from their device type however their MAC details needs to be manually added per device it becomes tedious for bulk of machines

We will need an API to ADD MAC associated with an interface for a host as well UPDATE MAC for an associated host interface whenever NIC replacement takes place

It should also validate in case duplicate MAC exists at the time of update &add

Most of the vendors like DELL/HP do provide CFI data which includes MAC details associated with the server NIC cards much ahead before they get shipped to the DC . This helps in preparing and planning server allocations , boot strapping

We would also need this. We have 2000 servers in a exisiting DC and need a some way to import "current state" including interfaces, their vlans and mac addresses.

I would second this feature but from a much more simple use-case, simply to add the ability to move all data from one netbox installation to another without modify it. Simply put just to export all the data for all Interfaces and to what VM:s they are connected. Then import it again in a new Netbox instance.

The original counter-argument said:

Interfaces can be created in bulk and should typically be inherited at the time of creation from a device's device type

However, VMs do not have templates or device types, and don't even get a single interface by default (#1492). So bulk import of interfaces would be especially useful for VMs.

This would be _so_ helpful! Adding big core routers with many interfaces of different types and statuses can be a pain manually.

BIG +1 for this. Our use case: several routers terminating hundreds of L2 customer connections as dot1q subinterfaces. Without the ability to import, I need to manually enter these hundreds of connections with unique interface names and descriptions.

I can very easily create a CSV from router output which would turn a day+ long job into a 5 minute job.

Extending the scope from interfaces to all device components.

Another use case for importing interfaces is for routers with line cards.

The interfaces on the main Device are only those interfaces on the chassis. When you add a line card (as an inventory item) you don't get any more interfaces, so those interfaces all need to be imported directly against the Device. This is also the point where you choose the appropriate names (e.g. Gi1/0/1..24 vs Gi2/0/1..24)

i wrote a few python scripts that pull from our monitoring solution's api and updates interfaces in netbox via the api. Mac addresses, descriptions, etc are easily added and updated via python manage.py sync -h. I can see about scrubbing them and sharing if any interest.

i wrote a few python scripts that pull from our monitoring solution's api and updates interfaces in netbox via the api. Mac addresses, descriptions, etc are easily added and updated via python manage.py sync -h. I can see about scrubbing them and sharing if any interest.

I think both an import function and example sync scripts have their place. I'd love to see them!

Hmmm, the only dependency I have to #3564 is for webpages to link to/from, so I rebased my changes and have a clean patch against develop now.

The bulk of this work was accomplished by @steffann in #3711, however we still need to link to the import views in the navigation menu. Waiting on #3719 for that.

Was this page helpful?
0 / 5 - 0 ratings