Skip to content

Commit 967f7d7

Browse files
authored
Version 2.0.0
2 parents 135af20 + 6d68e43 commit 967f7d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2464
-66
lines changed

.github/workflows/commit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
max-parallel: 10
3333
matrix:
34-
netbox_version: ["v3.5.9", "v3.6.1"]
34+
netbox_version: ["v3.5.9", "v3.6.4"]
3535
steps:
3636
- name: Checkout
3737
uses: actions/checkout@v3

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,29 @@
1616
<!--about-start-->
1717
## About
1818

19+
### Collecting diffs
20+
1921
With this plugin you can find diff between the rendered configuration for a device to its actual configuration, retrieved from the device itself, or stored in DataSource.
2022
Read about [DataSources](https://demo.netbox.dev/static/docs/models/core/datasource/) for further details.
2123

2224
Device configuration renders natively in NetBox. This [feature](https://demo.netbox.dev/static/docs/features/configuration-rendering/) was introduced in 3.5 version.
2325
NetBox Labs [blog](https://netboxlabs.com/blog/how-to-generate-device-configurations-with-netbox/) post about it.
2426

2527
Plugin supports a wide list of vendors (Cisco, Juniper, Huawei, MicroTik etc.) with the help of Scrapli. Read [Scrapli](https://carlmontanari.github.io/scrapli/user_guide/project_details/#supported-platforms) and [scrapli-community](https://scrapli.github.io/scrapli_community/user_guide/project_details/#supported-platforms) documentations to find full list of vendors.
28+
29+
### Pushing configuration
30+
31+
Also you can push rendered configuration from NetBox to device and apply it.
32+
33+
Supported platforms:
34+
35+
* `arista_eos`
36+
* `cisco_iosxe`
37+
* `cisco_iosxr`
38+
* `cisco_nxos`
39+
* `juniper_junos`
40+
41+
This is possible thanks to the scrapli_cfg. Read [Scrapli](https://github.com/scrapli/scrapli_cfg/) documentation for more info.
2642
<!--about-end-->
2743

2844
## Compatibility

docs/changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.0.0 (2023-10-XX)
4+
5+
* [#25](https://github.com/miaow2/netbox-config-diff/issues/25) Add configuration management
6+
37
## 1.2.2 (2023-09-29)
48

59
* [#28](https://github.com/miaow2/netbox-config-diff/issues/28) Add legacy ssh algorithms to support old OS versions

docs/usage.md renamed to docs/colliecting-diffs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ In the script, you can define a site, on which devices run compliance, or device
3232
If you define both fields, script will run only on devices from `Devices` field
3333

3434
!!! warning
35-
Script runs only on devices with status `Active`, assigned Primary IP, Platform and PlatformSetting
35+
Script runs only on devices with status `Active`, assigned Primary IP, Config Template, Platform and PlatformSetting
3636

3737
If you have configs in NetBox DataSource, you can define it, the script instead of connecting to devices will find configs in DataSource by device's names.
3838

docs/configuratiom-management.md

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
# Usage
2+
3+
With plugin you can push rendered configuration from NetBox to devices.
4+
5+
Supported platforms:
6+
7+
* `arista_eos`
8+
* `cisco_iosxe`
9+
* `cisco_iosxr`
10+
* `cisco_nxos`
11+
* `juniper_junos`
12+
13+
Plugin using [scrapli-cfg](https://github.com/scrapli/scrapli_cfg) for this feature.
14+
15+
## Substitutes
16+
17+
If you render not full configuration, it is acceptable to pull missing config sections from the actual configuration to render full configuration.
18+
19+
!!! note
20+
If you render full configuration in NetBox, you can proceed to `Configuration Request` part
21+
22+
To do that you should create substitute.
23+
24+
Substitutes is a "tag" that needs to be replaced with output from the real device, and a regex pattern that "pulls" this section from the actual device itself.
25+
26+
![Screenshot of the substitute](media/screenshots/substitute.png)
27+
28+
In screenshot below we add substitute for Arista PlatformSetting
29+
30+
* **Name** is a "tag", you should put this as jinja2 variable in your config template in NetBox
31+
* **Regexp** is a regex, that "pulls" what matched from device and replace `Name` jinja2 variable in config template
32+
33+
In example substitute `ethernet_interfaces` section will be replaced with whatever the provided pattern finds from the real device.
34+
35+
This pattern matches all ethernet interfaces on a Arista device.
36+
37+
To correctly render substitute in config template you have two options:
38+
39+
```
40+
{{ "{{ ethernet_interfaces }}" }}
41+
```
42+
43+
or
44+
45+
```
46+
{% raw %}{{ ethernet_interfaces }}{% endraw %}
47+
```
48+
49+
Config template will look like:
50+
51+
![Screenshot of the config template with substitute](media/screenshots/config-temp-substitute.png)
52+
53+
And rendered config template with substitute
54+
55+
![Screenshot of the rendered template with substitute](media/screenshots/render-temp-substitute.png)
56+
57+
## Configuration Request
58+
59+
Now you let's create `Configuration Request` with devices you want to configure.
60+
61+
!!! warning
62+
For request only accepts devices with `Active` status and assigned Platform, Primary IP, Config Template and PlatformSetting
63+
64+
Find `Configuration Requests` in navbar.
65+
66+
Now collect diffs for devices pressing `Collecting diffs` button.
67+
68+
![Screenshot of the Collecting diffs button](media/screenshots/cr-collecting-diff-button.png)
69+
70+
On tab `Diffs` you can review diffs for devices.
71+
72+
![Screenshot of the Diffs tab](media/screenshots/cr-diffs-tab.png)
73+
74+
To continue approve request by pressing `Approve` button.
75+
76+
![Screenshot of the Approve button](media/screenshots/cr-approve-button.png)
77+
78+
Also you can cancel approve after that.
79+
80+
![Screenshot of the Unapprove button](media/screenshots/cr-unapprove-button.png)
81+
82+
After approval you can see by whom configuration request is approved.
83+
84+
![Screenshot of the Approved request](media/screenshots/cr-approved.png)
85+
86+
At this moment you can schedule job that will push rendered configuration to devices in configuration request by pressing schedule button.
87+
88+
![Screenshot of the Schedule button](media/screenshots/cr-schedule-button.png)
89+
90+
After that you can see by whom configuration request is scheduled and time.
91+
92+
![Screenshot of the Scheduled request](media/screenshots/cr-scheduled.png)
93+
94+
Also you can cancel scheduled job by pressing `Unschedule` button.
95+
96+
![Screenshot of the Unschedule button](media/screenshots/cr-unschedule-button.png)
97+
98+
!!! warning
99+
Approve and Schedule buttons is accessable only to user with `netbox_config_diff.approve_configurationrequest`
100+
permission
101+
102+
!!! warning
103+
If you unapprove scheduled configuration request, scheduled job will be canceled
104+
105+
After scheduled job is completed you can job logs on configuration request page.
106+
107+
![Screenshot of the Unschedule button](media/screenshots/cr-job-log.png)
108+
109+
!!! note
110+
Completed configuration requests can't be edited.
111+
112+
## Rollback
113+
114+
If an error occurs while executing a job that pushes configurations to devices then all configured devices will be rollbacked to the previous version of the configuration.

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212

1313
## Usage
1414

15-
Read this [doc](usage.md) to find out how to use plugin
15+
Read this [doc](colliecting-diffs.md) about collecting diffs, for configuration management read [this](configuratiom-management.md)
9.74 KB
Loading
1.39 KB
Loading
13.9 KB
Loading
1.58 KB
Loading

0 commit comments

Comments
 (0)