Revised plugins documentation

This commit is contained in:
Jeremy Stretch
2020-03-26 11:09:20 -04:00
parent 59815ea53d
commit 68ef5dd2a4
3 changed files with 81 additions and 37 deletions

View File

@@ -8,21 +8,21 @@ Plugins are supported on NetBox v2.8 and later.
The NetBox plugin architecture allows for the following:
* **Add new data models.** A plugin can introduce one or more models to hold data. (A model is essentially a SQL table.)
* **Add new URLs and views.** Plugins can register URLS under the `/plugins` root path to provide browsable views for users.
* **Add new data models.** A plugin can introduce one or more models to hold data. (A model is essentially a table in the SQL database.)
* **Add new URLs and views.** Plugins can register URLs under the `/plugins` root path to provide browsable views for users.
* **Add content to existing model templates.** A template content class can be used to inject custom HTML content within the view of a core NetBox model. This content can appear in the left side, right side, or bottom of the page.
* **Add navigation menu items.** Each plugin can register new links in the navigation menu. Each link may have a set of buttons for specific actions, similar to the built-in navigation items.
* **Add custom middleware.** Custom Django middleware can be registered by each plugin.
* **Declare configuration parameters.** Each plugin can define required, optional, and default configuration parameters within its unique namespace.
* **Declare configuration parameters.** Each plugin can define required, optional, and default configuration parameters within its unique namespace. Plug configuration parameter are defined by the user under `PLUGINS_CONFIG` in `configuration.py`.
* **Limit installation by NetBox version.** A plugin can specify a minimum and/or maximum NetBox version with which it is compatible.
## Limitations
Either by policy or by technical limitation, the interaction of plugins with NetBox core is restricted in certain ways. These include:
Either by policy or by technical limitation, the interaction of plugins with NetBox core is restricted in certain ways. A plugin may not:
* **Modify core models.** Plugins may not alter, remove, or override core NetBox models in any way. This rule is in place to ensure the integrity of the core data model.
* **Register URLs outside the `/plugins` root.`** All plugin URLs are restricted to this path to prevent name/path collisions.
* **Override core templates.** The only avenue available for injecting content into core templates is the provided
* **Register URLs outside the `/plugins` root.** All plugin URLs are restricted to this path to prevent path collisions with core or other plugins.
* **Override core templates.** Plugins can inject additional content where supported, but may not manipulate or remove core content.
* **Modify core settings.** A configuration registry is provided for plugins, however they cannot alter or delete the core configuration.
* **Disable core components.** Plugins are not permitted to disable or hide core NetBox components.
@@ -32,11 +32,18 @@ The instructions below detail the process for installing and enabling a NetBox p
### Install Package
TODO
Download and install the plugin package per its installation instructions. Plugins published via PyPI are typically installed using pip. Be sure to install the plugin within NetBox's virtual environment.
```no-highlight
$ source /opt/netbox/venv/bin/activate
(venv) $ pip install <package>
```
Alternatively, you may wish to install the plugin manually by running `python setup.py install`. If you are developing a plugin and want to install it only temporarily, run `python setup.py develop` instead.
### Enable Plugins
In `configuration.py`, set the `PLUGINS_ENABLED` parameter to True (if not already set):
In `configuration.py`, ensure the `PLUGINS_ENABLED` parameter is set to True:
```python
PLUGINS_ENABLED = True
@@ -57,7 +64,7 @@ PLUGINS_CONFIG = {
### Restart WSGI Service
Restart the WSGI service to detect the new plugin:
Restart the WSGI service to load the new plugin:
```no-highlight
# sudo systemctl restart netbox