netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
15.77k stars 2.54k forks source link

Enable the import of device types from JSON-formatted definitions #451

Closed jeremystretch closed 4 years ago

jeremystretch commented 8 years ago

Currently, each NetBox user must create their own device types. This results in wasted effort because users inevitably end up duplicating work. For instance, ten users who each use Juniper EX4300-48T switches will end up creating identical (or at least exceeding similar) device types.

We don't want to pre-populate device types in NetBox on initial installation, because it's impossible to predict which device types a user will want. Extraneous device types would result in clutter that needs to be deleted.

Ideally, we could begin compiling a library of device type definitions formatted as JSON. A user could select the desired device types from the library and import them into NetBox to create device types.

fltchr commented 8 years ago

Is this users per instance (i.e. if I create a device for a Cisco 3560, my boss won't be able to select it), or NetBox users in general (i.e. if I create a device, there is no "device community" to share it with other companies?

If the first point, I haven't noticed yet (haven't tested on more than one user account as of yet), but we'll definitely need that before moving forward., if the second, a user submitted gallery or library would be an awesome resource.

rgstori commented 8 years ago

+1 for the user submitted gallery, I think it would be very popular; even with anybody's particular setting, little tweaks to each device type can always be done after the import

jeremystretch commented 8 years ago

@fltchr "User" in this context just means an organization using NetBox. Sorry for the confusion.

Here's a scenario. You just got in a shipment of Juniper QFX5100-48S switches that need to be racked up. You've never used these before, so first you need to create a new device type in NetBox. But rather than creating one manually, you can instruct NetBox to import a definition from a GitHub repo, e.g. netbox-devicetypes/juniper/qfx5100-48s.json. NetBox downloads the file and automatically creates a new DeviceType along with its console, power, and interface templates as defined.

I just need to come up with the logic to process JSON and start a library.

stianvi commented 8 years ago

@jeremystretch There are also modules for devices that need to be taken into consideration.

example: QFX5100-24Q: 32 ports (with hot-swappable expansion modules) QFX5100-24Q-AA: 32 ports (with hot-swappable expansion modules)

And then there is the cabling too: QFX5100-48S: 72 ports (48 10GbE SFP/SFP+ ports + 24 10GbE ports using QSFP+ to SFP+ DAC or QSFP+ to SFP+ fiber splitter cables and optics)

jeremystretch commented 8 years ago

@stianvi Expansion modules aren't part of the device, so they aren't attached to a device type. They may or may not be installed; that's up to the user to define. And cabling isn't modelled at all.

leandroteleco commented 8 years ago

I'm very interested on this feature. I'm working at important Service Provider and we are testing Netbox at our Demolab,

Thanks you for to do and to improve NetBox, I think could countribute with the device types submitted gallery. :)

askbow commented 7 years ago

An export feature for device types might be a good idea too: some of us have already created libraries of devices, sharing them might be useful, given import is implemented.

tobymccann commented 7 years ago

This would be extremely useful, including some of the ideas already mentioned such as export. I imagine some type of verification mechanism to verify the accuracy of each device type, but that could probably be controlled via Github workflow.

prolix21 commented 7 years ago

This would save so much work. We just setup Netbox and the thought of having to create all these device types gives me a headache.

bellwood commented 7 years ago

@jeremystretch I'm not sure the viability, but, Cisco/Juniper provide Visio stencils for all their hardware.

Providing one could process those VSS files (they are hexadecimal) you might be able to "easily" convert all the Visio stencils to JSON based on the data provided within.

That said, I'm not sure if the stencils include mgmt or con ports but it might be a place to start:

http://www.cisco.com/c/en/us/products/visio-stencil-listing.html https://www.juniper.net/us/en/products-services/icons-stencils/

If it goes that easily, perhaps also do the linecards so when NAPALM runs inventory it could suggest adding templates for discovered children?

I would also recommend that users with existing devices templates be able to "upgrade" their devices to the new templates as a method of standardization - if they so chose.

askbow commented 7 years ago

@bellwood probably this can be used to convert VSS files to something more open: https://github.com/kakwa/libvisio2svg

these VSS pictures might be somewhat useful for drawing rack faces (if you want them to look fancy), but I doubt you can export ports or other sticky points.

bellwood commented 7 years ago

I was hoping more for port details than graphics for JSON library building, just figured it's a somewhat complete provider library we might be able to process it

Graphics could/would nice though on the rack elevations via another feature request

tb-killa commented 5 years ago

@jeremystretch I found this nice library: django-import-export Maybe we could use this or the implementation logic for working with the json in / export ? I´m not an django expert to implement this stuff but maybe this would help you ?