Data importer from NetBox 2.10.x to Nautobot
Project description
Nautobot NetBox Importer
A plugin for Nautobot.
Installation
The plugin is available as a Python package in PyPI and can be installed with pip:
pip install nautobot-netbox-importer
The plugin is compatible with Nautobot 1.0.0b3 and later and can handle JSON data exported from NetBox 2.10.x at present.
Once installed, the plugin needs to be enabled in your nautobot_config.py
:
PLUGINS = ["nautobot_netbox_importer"]
Usage
Getting a data export from NetBox
From the NetBox root directory, run the following command to produce a JSON file (here, /tmp/netbox_data.json
) describing the contents of your NetBox database:
python netbox/manage.py dumpdata \
--traceback --format=json \
--exclude admin.logentry --exclude sessions.session \
--exclude extras.ObjectChange --exclude extras.Script --exclude extras.Report \
> /tmp/netbox_data.json
Importing the data into Nautobot
From within the Nautobot application environment, run nautobot-server import_netbox_json <json_file> <netbox_version>
, for example nautobot-server import_netbox_json /tmp/netbox_data.json 2.10.3
.
Contributing
Most of the internal logic of this plugin is based on the DiffSync library, which in turn is built atop Pydantic. A basic understanding of these two libraries will be helpful to those wishing to contribute to this project.
Pull requests are welcomed and automatically built and tested against multiple version of Python and multiple versions of Nautobot through TravisCI.
The project is packaged with a light development environment based on docker-compose
to help with the local development of the project and to run the tests within TravisCI.
The project is following Network to Code software development guideline and is leveraging:
- Black, Pylint, Bandit and pydocstyle for Python linting and formatting.
- Django unit test to ensure the plugin is working properly.
- Poetry for packaging and dependency management.
CLI Helper Commands
The project includes a CLI helper based on invoke to help setup the development environment. The commands are listed below in 3 categories dev environment
, utility
and testing
.
Each command can be executed with invoke <command>
. All commands support the argument --python-ver
if you want to manually define the version of Python to use. Each command also has its own help invoke <command> --help
Local dev environment
build Build all docker images.
debug Start Nautobot and its dependencies in debug mode.
destroy Destroy all containers and volumes.
restart Restart Nautobot and its dependencies.
start Start Nautobot and its dependencies in detached mode.
stop Stop Nautobot and its dependencies.
Utility
cli Launch a bash shell inside the running Nautobot container.
create-user Create a new user in django (default: admin), will prompt for password.
makemigrations Run Make Migration in Django.
nbshell Launch a nbshell session.
Testing
bandit Run bandit to validate basic static code security analysis.
black Run black to check that Python files adhere to its style standards.
flake8 This will run flake8 for the specified name and Python version.
pydocstyle Run pydocstyle to validate docstring formatting adheres to standards.
pylint Run pylint code analysis.
tests Run all tests for this plugin.
unittest Run Django unit tests for the plugin.
Questions
For any questions or comments, please check the FAQ first and feel free to swing by the #nautobot slack channel. Sign up here
Screenshots
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for nautobot-netbox-importer-1.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e89f3abd8b664eb27f7b7f0f29dad7a7859004f722126c59229d6d39bbf047c9 |
|
MD5 | 24d70d93e481d0d865b309886cc32c98 |
|
BLAKE2b-256 | cf0f07d0973c66ecca34318f52e6fde0f9a3b4b085c88c82c2a4b6190537c379 |
Hashes for nautobot_netbox_importer-1.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c8b0863008ec9ecece768bf66a1fe229b7ac85c2a213997e519d22b9b0faa16 |
|
MD5 | 861bbdd50dad51d1cc28eaac527710c8 |
|
BLAKE2b-256 | 19a2eeeb1eba47a9d9b3815eb6d8398836b4ac5be138b55768bb57a41428ba1d |