Skip to main content

A Netbox plugin for importing device and module types from the device type library.

Project description

NetBox Device Type Importer Plugin

Netbox plugin for easy import DeviceType/ModuleType from NetBox Device Type Library.

PyPi Stars Badge Forks Badge Issues Badge Pull Requests Badge GitHub contributors License Badge Code Style Black Downloads Downloads/Week Downloads/Month

[!WARNING]

Importing Device/Module Type definitions uses Async IO and can take some time (10 to 20 mins) to complete.

The plugin uses GitHub GraphQL API to load DeviceType or ModuleType from NetBox Device Type Library.

The plugin loads only file tree representation from a Github repo and shows it as a table with vendor and model columns.

DeviceType definitions files are loaded when you try to import selected models.

So, if you have a lot of models in the repo, it can take a lot of time to load them all.

Please be patient and don't refresh the page while the plugin is loading data from Github.

Description

The plugin uses GitHub GraphQL API to load DeviceType or ModuleType from NetBox Device Type Library. The plugin loads only file tree representation from a Github repo and shows it as a table with vendor and model columns. DeviceType definitions files are loaded when you try to import selected models.

To use GraphQL API you need to set GitHub personal access token in plugin settings. You don't need to grant any permissions to the token.
How to create the token, see "Creating a personal access token."

Compatibility

NetBox Version NetBox Device Type Importer Version
NetBox 4.5 >= 0.0.1

Installation

The plugin is available as a Python package in pypi and can be installed with pip

pip install netbox-device-module-type-importer

Enable the plugin in /opt/netbox/netbox/netbox/configuration.py:

PLUGINS = ['netbox_device_module_type_importer',]

Restart NetBox and add netbox-device-module-type-importer to your local_requirements.txt

Perform database migrations:

cd /opt/netbox
source venv/bin/activate
python ./netbox/manage.py migrate netbox_device_module_type_importer

Full documentation on using plugins with NetBox: Using Plugins - NetBox Documentation

Configuration

Put your GitHub personal access token to NetBox plugins config

Minimum configuration

PLUGINS_CONFIG = {
    'netbox_device_module_type_importer': {
        "github_token": "<YOUR-GITHUB-TOKEN>"
    }
}

Additional configuration

You can configure the plugin to use different GitHub GraphQL API endpoint, batch size, and concurrency settings.

PLUGINS_CONFIG = {
    'netbox_device_module_type_importer': {
        "repo_owner": "netbox-community",
        "repo": "devicetype-library",
        "github_url": "https://api.github.com/graphql",
        "batch_size": 50,
        "max_concurrent_requests": 20,
        "max_concurrent_vendors": 20,
    }
}

Benchmarking using AsyncIO versus SyncIO

Note that based on benchmark tests, all connectivity to GitHub is done synchronously. The plugin uses AsyncIO to load DeviceType definitions from GitHub in parallel, which significantly reduces the time it takes to load all models from the repo.

Configuration Time (s) Files/s Speedup
Synchronous 360.65s 14.7 1.00×
Async (req=10, vendors=5) 88.56s 59.9 4.07×
Async (req=15, vendors=10) 57.71s 91.9 6.25×
Async (req=20, vendors=20) 31.39s 169.0 11.49×

Contribute

Contributions are always welcome! Please see the Contribution Guidelines

Screenshots

Future

  • Import device images from GitHub repo
  • Add support for Gitlab repositories

Credits

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

netbox_device_module_type_importer-0.0.2.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file netbox_device_module_type_importer-0.0.2.tar.gz.

File metadata

File hashes

Hashes for netbox_device_module_type_importer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 51e7744115007b106854f8dc7b0ce9422a552541780b30c0366bcb36c86693b2
MD5 a88cb256a9dc0737dea82b7c6d2a5184
BLAKE2b-256 74649b797848cfb292faa170fcba844b207ea87644c64926329cbe774d01e821

See more details on using hashes here.

Provenance

The following attestation bundles were made for netbox_device_module_type_importer-0.0.2.tar.gz:

Publisher: publish.yml on andy-shady-org/netbox-device-module-type-importer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file netbox_device_module_type_importer-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for netbox_device_module_type_importer-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ca099f9994eb373c64f264bab585be8fb505582fdd004a964fd7ded00f1a98c7
MD5 2b51a07723015246067d3ae8206ce004
BLAKE2b-256 c58ba2d971f287a6f47f50472e948c77ff11939ccae8396af59363a950e50099

See more details on using hashes here.

Provenance

The following attestation bundles were made for netbox_device_module_type_importer-0.0.2-py3-none-any.whl:

Publisher: publish.yml on andy-shady-org/netbox-device-module-type-importer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page