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.3.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.3.tar.gz.

File metadata

File hashes

Hashes for netbox_device_module_type_importer-0.0.3.tar.gz
Algorithm Hash digest
SHA256 7ab5eb19ed4945d7a3f1eedae4fc5601903f16bfb5e291fb16ef39466ab18d13
MD5 58d388a359318fa81b5754e74695ca76
BLAKE2b-256 7813cdb7d169965fe4cab5f3963cc10f03863c8b528fd4abe0c8cf244ab47e87

See more details on using hashes here.

Provenance

The following attestation bundles were made for netbox_device_module_type_importer-0.0.3.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.3-py3-none-any.whl.

File metadata

File hashes

Hashes for netbox_device_module_type_importer-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 05388dfa8a02a91d58e4abf878854ea263c9ff8d76a7e3dc7b6f434ddc70b613
MD5 290a44664f8174efae00c9683a74871f
BLAKE2b-256 b7a253c4f5c8c6f7088a6238bc6856b08050001c3caccab9d566f44f8234e5a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for netbox_device_module_type_importer-0.0.3-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