Nautobot Nornir plugin.
Project description
ntc-nautobot-plugin-nornir
A plugin for Nautobot.
Installation
The plugin is available as a Python package in pypi and can be installed with pip
pip install nautobot-plugin-nornir
The plugin is compatible with Nautobot 1.0.0 and higher
To ensure Nautobot Nornir Plugin is automatically re-installed during future upgrades, create a file named local_requirements.txt
(if not already existing) in the Nautobot root directory (alongside requirements.txt
) and list the nautobot_nornir
package:
# echo nautobot-plugin-nornir>> local_requirements.txt
Once installed, the plugin needs to be enabled in your configuration.py
# In your configuration.py
PLUGINS = ["nautobot_nornir"]
PLUGINS_CONFIG = {
"nautobot_nornir": {
"nornir_settings": {
"credentials": "nautobot_nornir.credentials.env_vars.CredentialsEnvVars",
"nornir.core": {"num_workers": 10},
"runner": {
"plugin": "threaded",
"options": {
"num_workers": 10,
},
},
},
}
The plugin behavior can be controlled with the following list of settings
- TODO
Usage
API
TODO
Contributing
Pull requests are welcomed and automatically built and tested against multiple version of Python and multiple version 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.
CLI Helper Commands
The project is coming with 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 arguments --nautobot-ver
and --python-ver
if you want to manually define the version of Python and Nautobot 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 NTC defined 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 Network to Code slack channel (channel #networktocode). Sign up here
Screenshots
TODO
Initial very basic usage
from nornir import InitNornir
PLUGIN_SETTINGS = {
"inventory": "nautobot_nornir.inventory.nautobot_orm.NautobotORMInventory",
"credentials": "nautobot_nornir.credentials.env_vars.CredentialsEnvVars",
"nornir.core": {"num_workers": 10},
"inventory_params" : {
"use_fqdn": True,
"fqdn": "example.com",
},
}
nornir = InitNornir(
core=PLUGIN_SETTINGS.get("nornir.core"),
logging={"enabled": False},
inventory={
"plugin": PLUGIN_SETTINGS.get("inventory"),
"options": {
"credentials_class": PLUGIN_SETTINGS.get("credentials"),
"params": PLUGIN_SETTINGS.get("inventory_params"),
"queryset": self.queryset,
},
},
)
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-plugin-nornir-0.9.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f435bc4f08b7c957e8c01506281454633895a1af4de4fc4bd7867b6f003c0e7b |
|
MD5 | 0f0d0df1967bac31f3af9a2a59fe978c |
|
BLAKE2b-256 | 5a2df9af74e22703ffcdc589b9283e14a36d41e31084fc769075a2a13bc9a3a3 |
Hashes for nautobot_plugin_nornir-0.9.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a18dcbe62910d5762b7e3f5c1ed552b2e338d56dd8e0b41a75ae392ff97cf5d3 |
|
MD5 | d5f6a7f356f6b6b3433f775864a9a4de |
|
BLAKE2b-256 | 94591cc6fc81bebb9f36f38abb4f2a96062f5371c2987b765a4a74ef49f9758f |