|
1 | | -# NetBox Onboaring plugin |
| 1 | +# NetBox Onboarding plugin |
2 | 2 |
|
3 | 3 | <!-- Build status with linky to the builds for ease of access. --> |
4 | 4 | [](https://travis-ci.com/networktocode/ntc-netbox-plugin-onboarding) |
5 | 5 |
|
6 | | -<!-- TODO: https://github.com/networktocode/ntc-netbox-plugin-onboarding/issues/3 |
| 6 | +A plugin for [NetBox](https://github.com/netbox-community/netbox) to easily onboard new devices. |
7 | 7 |
|
8 | | -Improve this readme with accurate descriptions of what this does, as well as |
9 | | -appropriate links to rendered documentation and standard sections such as: |
| 8 | +`ntc-netbox-plugin-onboarding` is leverating Netmiko, NAPALM & Django-RQ to simplify the onboarding process of a new device into NetBox down to an IP Address and a site. |
| 9 | +The goal of this plugin is not to import everything about a device into NetBox but rather to help build quickly an inventory in NetBox that is often the first step into an automation journey. |
10 | 10 |
|
11 | 11 | ## Installation |
12 | 12 |
|
| 13 | +The plugin is available as a Python package in pypi and can be installed with pip |
| 14 | +```shell |
| 15 | +pip install ntc-netbox-plugin-onboarding |
| 16 | +``` |
| 17 | + |
| 18 | +Once installed, the plugin need to be enabled in your `configuration.py` |
| 19 | +```python |
| 20 | +# In your configuration.py |
| 21 | +PLUGINS = ["netbox_onboarding"] |
| 22 | + |
| 23 | +# If need you can override the default settings of the plugin too |
| 24 | +# PLUGINS_CONFIG = { |
| 25 | +# "netbox_onboarding": { |
| 26 | +# "create_platform_if_missing": True, |
| 27 | +# "create_manufacturer_if_missing": True, |
| 28 | +# "create_device_type_if_missing": True, |
| 29 | +# "create_device_role_if_missing": True, |
| 30 | +# "default_device_role": "network", |
| 31 | +# } |
| 32 | +# } |
| 33 | +``` |
| 34 | + |
13 | 35 | ## Usage |
| 36 | +### Preparation |
14 | 37 |
|
15 | | -## Contributing |
| 38 | +The work properly the plugin need to know the Site, Platform, Device Type, Device Role of each device as well as its IP primary IP address. |
| 39 | +It's recommended to create these objects in NetBox ahead of time and to provide them when you want to start the onboarding process. |
| 40 | + |
| 41 | +If `Platform`, `Device Type` and/or `Device Role` are not provided, the plugin will try to identify these information automatically and, based on the settings, it can create them in NetBox as needed. |
| 42 | +> If the Platform is provided, it must contains a valid Napalm driver available to the worker in Python |
| 43 | +
|
| 44 | +### Onboard a new device |
| 45 | + |
| 46 | +A new device can be onboarded via : |
| 47 | +- A web form |
| 48 | +- A CSV form to import multiple devices in bulk. `/plugins/onboarding/import/` |
| 49 | +- An API, `POST /plugins/onboarding/onboarding/` |
16 | 50 |
|
17 | | ---> |
| 51 | +### Consult the status of onboarding tasks |
18 | 52 |
|
| 53 | +The status of the onboarding process for each device is maintain is a dedicated table in NetBox and can be retrive : |
| 54 | +- Via the UI `/plugins/onboarding/` |
| 55 | +- Via the API `GET /plugins/onboarding/onboarding/` |
19 | 56 |
|
| 57 | +<ADD SCREEN SHOT HERE> |
| 58 | + |
| 59 | +### API |
| 60 | + |
| 61 | +The plugin comes with 4 new API endpoints to manage devices onbarding tasks |
| 62 | + |
| 63 | +```shell |
| 64 | +GET /plugins/onboarding/onboarding/ Check status of all onboarding tasks. |
| 65 | +POST /plugins/onboarding/onboarding/ Onboard a new device |
| 66 | +GET /plugins/onboarding/onboarding/{id}/ Check the status of a specific onboarding task |
| 67 | +DELETE /plugins/onboarding/onboarding/{id}/ Delete a specific onboarding task |
20 | 68 | ``` |
21 | | -invoke --list |
22 | | -Available tasks: |
23 | 69 |
|
| 70 | +## Contributing |
| 71 | + |
| 72 | +Pull requests are welcomed and automatically built and tested against multiple version of Python and multiple version of NetBox through TravisCI. |
| 73 | + |
| 74 | +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. |
| 75 | + |
| 76 | +The project is following Network to Code software development guideline and is leveraging: |
| 77 | +- Black, Pylint, Bandit and pydocstyle for Python format |
| 78 | +- Django unit test to ensure the plugin is working properly. |
| 79 | + |
| 80 | +### CLI Helper Commands |
| 81 | + |
| 82 | +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`. |
| 83 | + |
| 84 | +Each command can be executed with `invoke <command>` |
| 85 | +All commands support the arguments `--netbox-ver` and `--python-ver` if you want to manually the version of Python and NetBox to use. Each command also has its own help `invoke <command> --help` |
| 86 | + |
| 87 | +#### Local dev environment |
| 88 | +``` |
24 | 89 | build Build all docker images. |
25 | | - cli Launch a bash shell inside the running NetBox container. |
26 | | - create-user Create a new user in django (default: admin), will prompt for password |
27 | 90 | debug Start NetBox and its dependencies in debug mode. |
28 | 91 | destroy Destroy all containers and volumes. |
29 | | - makemigrations Run Make Migration in Django |
30 | | - nbshell Launch a nbshell session. |
31 | 92 | start Start NetBox and its dependencies in detached mode. |
32 | 93 | stop Stop NetBox and its dependencies. |
33 | 94 | ``` |
| 95 | + |
| 96 | +#### Utility |
| 97 | +``` |
| 98 | + cli Launch a bash shell inside the running NetBox container. |
| 99 | + create-user Create a new user in django (default: admin), will prompt for password. |
| 100 | + makemigrations Run Make Migration in Django. |
| 101 | + nbshell Launch a nbshell session. |
| 102 | +``` |
| 103 | +#### Testing |
| 104 | + |
| 105 | +``` |
| 106 | + tests Run all tests for this plugin. |
| 107 | + pylint Run pylint code analysis. |
| 108 | + pydocstyle Run pydocstyle to validate docstring formatting adheres to NTC defined standards. |
| 109 | + bandit Run bandit to validate basic static code security analysis. |
| 110 | + black Run black to check that Python files adhere to its style standards. |
| 111 | + unittest Run Django unit tests for the plugin. |
| 112 | +``` |
| 113 | + |
| 114 | +## Questions |
| 115 | + |
| 116 | +For any questions or comments, please check the [FAQ](FAQ.md) first and feel free to swing by the [Network to Code slack channel](https://networktocode.slack.com/) (channel #networktocode). |
| 117 | +Sign up [here](http://slack.networktocode.com/) |
0 commit comments