• Stars
    star
    262
  • Rank 156,136 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 5 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This library is intended to assist with importing device and module types into NetBox from the NetBox Community DeviceType-Library

Netbox Device Type Import

This library is intended to be your friend and help you import all the device-types defined within the the NetBox Device Type Library Repository.

Tested working with 2.9.4, 2.10.4

๐Ÿช„ Description

This script will clone a copy of the netbox-community/devicetype-library repository to your machine to allow it to import the device types you would like without copy and pasting them into the Netbox UI.

๐Ÿš€ Getting Started

  1. This script is written in Python, so lets setup a virtual environment.
git clone https://github.com/netbox-community/Device-Type-Library-Import.git
cd Netbox-Device-Type-Library-Import
python3 -m venv venv
source venv/bin/activate
  1. Now that we have the basics setup, we'll need to install the requirements.
pip install -r requirements.txt
  1. There are two variables that are required when using this script to import device types into your Netbox installation. (1) Your Netbox instance URL and (2) a token with write rights.

Copy the existing .env.example to your own .env file, and fill in the variables.

cp .env.example .env
vim .env

Finally, we are able to execute the script and import some device templates!

๐Ÿ”Œ Usage

To use the script, simply execute the script as follows. Make sure you're still in the activated virtual environment we created before.

./nb-dt-import.py

This will clone the latest master branch from the netbox-community/devicetype-library from Github and install it into the repo subdirectory. If this directory already exists, it will perform a git pull to update the reposity instead.

Next, it will loop over every manufacturer and every device of every manufacturer and begin checking if your Netbox install already has them, and if not, creates them. It will skip preexisting manufacturers, devices, interfaces, etc. so as to not end up with duplicate entries in your Netbox instance.

๐Ÿงฐ Arguments

This script currently accepts a list of vendors as an arugment, so that you can selectively import devices.

To import only device by APC, for example:

./nb-dt-import.py --vendors apc

--vendors can also accept a comma separated list of vendors if you want to import multiple.

./nb-dt-import.py --vendors apc,juniper

Docker build

It's possible to use this project as a docker container.

To build :

docker build -t netbox-devicetype-import-library .

Alternatively you can pull a pre-built image from Github Container Registry (ghcr.io):

docker pull ghcr.io/minitriga/netbox-device-type-library-import

The container supports the following env var as configuration :

  • REPO_URL, the repo to look for device types (defaults to https://github.com/netbox-community/devicetype-library.git)
  • REPO_BRANCH, the branch to check out if appropriate, defaults to master.
  • NETBOX_URL, used to access netbox
  • NETBOX_TOKEN, token for accessing netbox
  • VENDORS, a comma-separated list of vendors to import (defaults to None)

To run :

docker run -e "NETBOX_URL=http://netbox:8080/" -e "NETBOX_TOKEN=98765434567890" ghcr.io/minitriga/netbox-device-type-library-import

๐Ÿง‘โ€๐Ÿ’ป Contributing

We're happy about any pull requests!

๐Ÿ“œ License

MIT

More Repositories

1

netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
Python
15,828
star
2

netbox-docker

๐Ÿณ Docker Image of NetBox
Python
1,800
star
3

devicetype-library

A collection of community-sourced DeviceType definitions for import to NetBox
Python
899
star
4

netbox-topology-views

A netbox plugin that draws topology views
Python
753
star
5

pynetbox

Python API client library for Netbox.
Python
563
star
6

ansible_modules

NetBox modules for Ansible using Ansible Collections
Python
327
star
7

netbox-chart

A Helm chart for NetBox
Mustache
247
star
8

netbox-bgp

NetBox plugin for BGP related objects documentation
Python
242
star
9

customizations

A collection of community submitted and maintained customizations including reports, scripts, validators and export templates
Python
205
star
10

netbox-qrcode

NetBox Plugin for generate QR Codes
Python
201
star
11

go-netbox

The official Go API client for Netbox IPAM and DCIM service.
Shell
197
star
12

awesome-netbox

A curated list of awesome NetBox resources
186
star
13

netbox-zero-to-hero

A short course designed to take new NetBox users from โ€˜Zero to Heroโ€™.
Python
149
star
14

netbox-plugin-tutorial

A tutorial on building custom plugins for NetBox v3.2+
89
star
15

netbox-acls

A NetBox plugin for Access Lists based off of the NetBox Plugin Demo
Python
86
star
16

netbox-napalm-plugin

NetBox Napalm plugin
JavaScript
49
star
17

netbox-reorder-rack

NetBox plugin to allow users to reorder devices within a rack using a drag and drop UI.
Python
45
star
18

netbox-python

Python NetBox API Client
Python
37
star
19

netbox-operator

[INCUBATING] A Kubernetes operator to manage NetBox resources directly through Kubernetes.
Go
33
star
20

cookiecutter-netbox-plugin

Cookiecutter template for easy building NetBox plugins
Python
22
star
21

netbox-healthcheck-plugin

HTML
20
star
22

netbox-demo-data

Demo data useful for populating demo instances of NetBox
19
star
23

migration-scripts

Python
10
star
24

netbox-plugin-demo

Python
7
star
25

netbox.dev-old

netbox.dev website
HTML
1
star
26

netbox-demo

A plugin for NetBox demo instances
Python
1
star