Giter Club home page Giter Club logo

device-type-library-import's Introduction

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 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 repository 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 argument, 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

device-type-library-import's People

Contributors

minitriga avatar danner26 avatar dmcken avatar ndom91 avatar mtinberg avatar dalrrard avatar floeisen avatar gaby avatar k0rventen avatar dependabot[bot] avatar basictheprogram avatar florianheigl avatar en0rm avatar jbemmel avatar ljarasius avatar suom1 avatar p-rintz avatar rmundel avatar lordwolf2004 avatar mayafox avatar rsp2k avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.