Skip to content

Commit cfe6a06

Browse files
committed
Initial commit
1 parent 564e54c commit cfe6a06

37 files changed

+1068
-63
lines changed

.github/workflows/commit.yaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@ on: [push, pull_request]
44

55
jobs:
66
lint:
7-
runs-on: ${{ matrix.os }}
7+
runs-on: ubuntu-latest
88
strategy:
99
max-parallel: 10
1010
matrix:
11-
os: [ubuntu-latest]
12-
version: ["3.10", "3.11"]
11+
python: ["3.10", "3.11"]
1312
steps:
1413
- uses: actions/checkout@v3
15-
- name: Set up python ${{ matrix.version }}
14+
- name: Set up python ${{ matrix.python }}
1615
uses: actions/setup-python@v4
1716
with:
18-
python-version: ${{ matrix.version }}
17+
python-version: ${{ matrix.python }}
1918
- name: Setup dev env
2019
run: |
2120
python -m pip install --upgrade pip

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ recursive-exclude * *.py[co]
88

99
recursive-include docs *.rst conf.py Makefile make.bat *.jpg *.png *.gif
1010
recursive-include netbox_config_diff/templates *
11+
recursive-include netbox_config_diff/static *

README.md

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ NetBox plugin for Config Diff.
66
* Free software: Apache-2.0
77
* Documentation: https://miaow2.github.io/netbox-config-diff/
88

9-
109
## Features
1110

12-
The features the plugin provides should be listed here.
11+
Find diff between configurations rendered in NetBox and actual on the device.
1312

1413
## Compatibility
1514

@@ -35,18 +34,75 @@ git+https://github.com/miaow2/netbox-config-diff
3534
```
3635

3736
Enable the plugin in `/opt/netbox/netbox/netbox/configuration.py`,
38-
or if you use netbox-docker, your `/configuration/plugins.py` file :
37+
or if you use netbox-docker, your `/configuration/plugins.py` file,
38+
and define credentials for devices connection:
3939

4040
```python
4141
PLUGINS = [
42-
'netbox_config_diff'
42+
"netbox_config_diff",
4343
]
4444

4545
PLUGINS_CONFIG = {
46-
"netbox_config_diff": {},
46+
"netbox_config_diff": {
47+
"USERNAME": "foo",
48+
"PASSWORD": "bar",
49+
},
4750
}
4851
```
4952

53+
Collect static from the plugin:
54+
55+
```bash
56+
python manage.py collectstatic --noinput
57+
```
58+
59+
## Usage
60+
61+
Under `Plugins` navbar menu you can find plugin
62+
63+
![Screenshot of navbar](docs/media/screenshots/navbar.png)
64+
65+
Add PlatformSetting objects for your platforms in NetBox.
66+
67+
Define:
68+
69+
- **Driver** for Scrapli, you can find all drivers in [Scrapli](https://github.com/carlmontanari/scrapli) and [Scrapli community](https://github.com/scrapli/scrapli_community) documentation.
70+
- **Command** to collect configuration
71+
- Optional regex patterns to exclude from actual config, specify each pattern on a new line
72+
73+
![Screenshot of PlatformSetting](docs/media/screenshots/platformsetting.png)
74+
75+
Plugin adds a custom script `ConfigDiffScript`
76+
77+
![Screenshot of the scripts list](docs/media/screenshots/script-list.png)
78+
79+
In the script, you can define a site, on which devices run compliance, or devices.
80+
If you define both fields, script will run only on devices from `Devices` field
81+
82+
> **Warning**
83+
>
84+
> Script run only on devices with status `Active`, assigned Primary IP, Platform and PlatformSetting
85+
86+
![Screenshot of the script](docs/media/screenshots/script.png)
87+
88+
After script is done you can find results in `Config Compliances` menu. Each device has its own result.
89+
90+
![Screenshot of the compliance list](docs/media/screenshots/compliance-list.png)
91+
92+
## Examples
93+
94+
Compliance finished with error
95+
96+
![Screenshot of the compliance error](docs/media/screenshots/compliance-error.png)
97+
98+
Render diff between configurations
99+
100+
![Screenshot of diff](docs/media/screenshots/compliance-diff.png)
101+
102+
No diff
103+
104+
![Screenshot of the compliance ok](docs/media/screenshots/compliance-ok.png)
105+
50106
## Credits
51107

52108
Based on the NetBox plugin tutorial:
33.1 KB
Loading
49.4 KB
Loading
23.2 KB
Loading
15.6 KB
Loading

docs/media/screenshots/navbar.png

4.87 KB
Loading
27.4 KB
Loading
14.4 KB
Loading

0 commit comments

Comments
 (0)