diff --git a/docs/entities/backuppoints.md b/docs/entities/backuppoints.md index 26cd610..9432346 100644 --- a/docs/entities/backuppoints.md +++ b/docs/entities/backuppoints.md @@ -19,6 +19,7 @@ If this param is `True`, backup will be performed each time respective Data Sour Defines protocol for uploading the Data Source. Available options are: + * Git (over http(s)) * Amazon S3 (or any other S3-compatible service) diff --git a/docs/entities/pollers.md b/docs/entities/pollers.md index 549b4a3..4161f00 100644 --- a/docs/entities/pollers.md +++ b/docs/entities/pollers.md @@ -64,3 +64,10 @@ There are 3 ways to bind a Poller to Device: * Set the Poller at **Device Type** level. Go to Device Type page at set the Poller via custom fields. This action applies this Poller to all the devices with this Device Type and overwrites the value from Manufacturer. * Set the Poller at the individual **Device** level. Go to Device page at set the Poller via custom fields. This action applies this Poller to one specific Device only and overwrites the values from Device Type and Manufacturer. + + +# Custom Pollers + +You can easily write your own polling backend, connect it to Validity and then use for polling. + +Read more about this feature in the [Custom Pollers](../features/custom_pollers.md) article. diff --git a/docs/entities/serializers.md b/docs/entities/serializers.md index e4bc48a..8fb3b40 100644 --- a/docs/entities/serializers.md +++ b/docs/entities/serializers.md @@ -139,7 +139,7 @@ ipv6: ``` ### XML -This method translates input XML-formatted text into Python dict using [xmltodict](https://github.com/martinblech/xmltodict) library. It is mainly used together with [Netconf commands](./commands.md#typenetconf). +This method translates input XML-formatted text into Python dict using [xmltodict](https://github.com/martinblech/xmltodict) library. It is mainly used together with [Netconf commands](./commands.md#type-netconf). **Input data:** ```xml diff --git a/docs/features/config_backup.md b/docs/features/config_backup.md index 5cc1a72..b07fc42 100644 --- a/docs/features/config_backup.md +++ b/docs/features/config_backup.md @@ -6,9 +6,9 @@ Validity supports device configurations backups to remote **Git** or **S3** serv 1. Follow the steps described in the [Quickstart: Polling](../quickstart_polling.md) article to set up all the entities required for device polling. -2. Polling is done when the Data Source is synced. In most cases it will be the default **Validity Polling** Data Source, but you are free to create your own one with the type *device_polling*. +2. Polling is done when the Data Source is synced. In most cases it will be the default **Validity Polling** Data Source, but you are free to create your own one with the type *device_polling*. -3. Create a [Backup Point](../entities/backuppoints.md) which describes a place where the Data Source with the configs have to be uploaded. +3. Create a [Backup Point](../entities/backuppoints.md) which describes a place where the Data Source with the configs has to be uploaded. Example using pynetbox: @@ -34,7 +34,7 @@ There are several options to trigger the backup process: * Press "Back Up" button on the Backup Point page. -* Specify `Backup After Sync: True` in the Backup Point settings. This will trigger the backup process each time the respective data source is being synced (no matter via button, API or somehow else). +* Specify `Backup After Sync: True` in the Backup Point settings. This will trigger the backup process each time the respective data source sync occurs (no matter via GUI button, API or somehow else). * Execute [RunTests](../entities/scripts.md#run-tests) script with `Sync Data Sources: True` option (`Backup After Sync: True` is required as well). @@ -43,13 +43,13 @@ There are several options to trigger the backup process: There are several options to provision periodic configuration backup process (e.g. daily, each 6 hours, etc): -1. Provision [RunTests](../entities/scripts.md#run-tests) script to execute on a regular basis using **Interval** script parameter. This will run everything at once: - * poll the devices (perform data source sync) - * execute compliance tests - * back up the data source +* Provision [RunTests](../entities/scripts.md#run-tests) script to start regularly using **Interval** script parameter. This will run everything at once: + 1. poll the devices (perform data source sync) + 2. execute compliance tests + 3. back up the data source -2. If you don't want to run the tests via scheduler and want backup only, you can create tiny [custom script](https://netboxlabs.com/docs/netbox/en/stable/customization/custom-scripts/) inside your NetBox and configure it to run periodically. +* If you don't want to run the tests via scheduler and want backup only, you can create tiny NetBox [Custom Script](https://netboxlabs.com/docs/netbox/en/stable/customization/custom-scripts/) inside your NetBox and configure it to run periodically. ```python from core.models import DataSource @@ -65,4 +65,5 @@ class SyncDataSource(Script): Execution of this script triggers the sync of the DataSource (and hence the backup process for bound Backup points with `Backup After Sync: True`). -3. Wait till periodic Data Source sync is implemented in the core NetBox. There is an [issue](https://github.com/netbox-community/netbox/issues/18287) for it, upvotes are appreciated. + +* Wait till periodic Data Source sync is implemented in the core NetBox. There is an [issue](https://github.com/netbox-community/netbox/issues/18287) for it, upvotes are appreciated. diff --git a/docs/features/custom_pollers.md b/docs/features/custom_pollers.md index 22e04b3..92f38dc 100644 --- a/docs/features/custom_pollers.md +++ b/docs/features/custom_pollers.md @@ -23,12 +23,16 @@ from validity.models import Command class ScrapliPoller(CustomPoller): + # this class/function will be supplied with poller parameters driver_factory = Scrapli - host_param_name = 'host' # Scrapli expects "host" param containing ip address of the device - driver_connect_method = 'open' # This driver method (if defined) will be called to open the connection. - driver_disconnect_method = 'close' # This driver method (if defined) will be called to gracefully close the connection. - - def poll_one_command(self, driver, command) -> str: + # Scrapli class expects "host" param containing ip address of the device + host_param_name = 'host' + # This driver method (if defined) will be called to open the connection. + driver_connect_method = 'open' + # This driver method (if defined) will be called to gracefully close the connection. + driver_disconnect_method = 'close' + + def poll_one_command(self, driver: Scrapli, command: Command) -> str: """ Arguments: driver - object returned by calling driver_factory, usually represents connection to a particular device @@ -64,9 +68,29 @@ PLUGIN_SETTINGS = { } ``` +??? info + The same setting may be defined via dict as well + ```python + # configuration.py + + from my_awesome_poller import ScrapliPoller + + PLUGIN_SETTINGS = { + 'validity': { + 'custom_pollers' : [ + 'class': ScrapliPoller, + 'name':'scrapli', + 'color':'pink', + 'command_types'=['CLI'], + ] + } + } + ``` + + PollerInfo parameters: -* **klass** - class inherited from `CustomPoller` +* **klass/class** - class inherited from `CustomPoller` * **name** - system name of the poller, must contain lowercase letters only * **verbose_name** - optional verbose name of the poller. Will be used in NetBox GUI * **color** - badge color used for "Connection Type" field in the GUI diff --git a/docs/installation/installation.md b/docs/installation/installation.md index 92efaf5..8b76e92 100644 --- a/docs/installation/installation.md +++ b/docs/installation/installation.md @@ -7,7 +7,7 @@ Validity is the [NetBox](https://netboxlabs.com/oss/netbox/) plugin. So, before | **Python** | **NetBox** | |------------|-----------------| -| >=3.10 | 3.7 | 4.0 | 4.1 | +| >=3.10 | 4.0 | 4.1 | 4.2 | ## Installation steps Once you have installed NetBox, you should follow these steps diff --git a/docs/installation/netbox_compatibility.md b/docs/installation/netbox_compatibility.md index 79c4b1e..12b2f69 100644 --- a/docs/installation/netbox_compatibility.md +++ b/docs/installation/netbox_compatibility.md @@ -26,7 +26,7 @@ In the table below you can find appropriate Validity version according to your N
- | NetBox |
+ NetBox |
||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
v3.4 | @@ -35,10 +35,11 @@ In the table below you can find appropriate Validity version according to your Nv3.7 | v4.0 | v4.1 | +v4.2 | ||||||||||
Validity |
+ Validity |
v1.4 | ✅ | ✅ | @@ -46,6 +47,7 @@ In the table below you can find appropriate Validity version according to your N+ | |||||||||
v2.2 | @@ -55,6 +57,7 @@ In the table below you can find appropriate Validity version according to your N✅ | + | ||||||||||||
v2.3 | @@ -64,6 +67,7 @@ In the table below you can find appropriate Validity version according to your N✅ | ✅ | + | |||||||||||
v3.0 | @@ -73,5 +77,16 @@ In the table below you can find appropriate Validity version according to your N✅ | ✅ | ✅ | ++ | ||||||||||
v3.1 | ++ | + | + | + | ✅ | +✅ | +✅ |