Skip to content

Commit cad4d2e

Browse files
author
huacchob
committed
adding TYPE_API, and API remediation to perform config_merge operations for API based devices, such as Meraki, associated tests and documentation
1 parent 631d0f6 commit cad4d2e

8 files changed

Lines changed: 538 additions & 5 deletions

File tree

changes/1064.added

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Adding API remediation feature to support API dispatchers.

docs/user/app_feature_remediation.md

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Navigating Configuration Remediation
22

3-
Automated network configuration remediation is a systematic approach that leverages technology and processes to address and rectify configuration issues in network devices.
3+
Automated network configuration remediation is a systematic approach that leverages technology and processes to address and rectify configuration issues in network devices.
44
It involves the use of the Golden Configuration app to understand the current configuration state, compare it against the intended configuration state, and automatically generate remediation data.
55
Automated network configuration remediation improves efficiency by eliminating manual efforts and reducing the risk of human errors. It enables rapid response to security vulnerabilities, minimizes downtime, and enhances compliance with regulatory and industry standards.
66

@@ -48,6 +48,28 @@ Default Hier config options can be used or customized on a per platform basis, a
4848
For additional information on how to customize Hier Config options, please refer to the Hierarchical Configuration development guide:
4949
https://hier-config.readthedocs.io/en/latest/
5050

51+
### API Remediation Type
52+
53+
You can use the TYPE_API option to enable a device to use the API type of remediation. To use this, you would need to pass the settings
54+
that the API request would use as config context. Here is an example using Cisco Meraki platform.
55+
56+
```json
57+
org_remediation:
58+
- endpoint: "/organizations/{{ obj.get_config_context().get('organization_id', '')}}"
59+
method: "PUT"
60+
query: []
61+
fields:
62+
- "name"
63+
```
64+
65+
The way to create this is like this:
66+
67+
- The high level key should be '**feature-name**\_remediation', in this case the feature is **org**
68+
- endpoint: This is the endpoint you should call. You could pass jinja to the endpoint to dynamically create the endpoint.
69+
- method: This is the HTTP method to use for the call.
70+
- query: You add strings here, used as a filter if the endpoint supports it, like for example '?user=NTC' if you would like to filter a response searching for the NTC user.
71+
- fields: This is also a list of strings, and it should hold the key names of the response you got from the device, to include that in the payload you will send to the device when you execute the Config Plan. In this example, we only want the "name" field from the response.
72+
5173
### Custom Config Remediation Type
5274

5375
When a Network Operating System delivers configuration data in a format that is not CLI/Hierarchical, we can still perform remediation by using the Custom Remediation options. Custom Remediation is defined within a Python function that takes as input a Configuration Compliance object and returns a Remediation Field.
@@ -66,4 +88,4 @@ Once remediation settings are configured for a particular platform, remediation
6688

6789
Once remediation is configured for a particular Platform/Feature pair, it is possible to validate remediation operations by running a compliance job. Navigate to **Jobs -> Perform Configuration Compliance** and run a compliance job for a device that has remediation enabled. Verify that remediation data has been generated by navigating to **Golden Config -> Config Compliance**, select the device and check the compliance status for the feature with remediation enabled and the "Remediating Configuration" field, as shown below:
6890

69-
![Validate Configuration Remediation](../images/remediation_validate_feature.png)
91+
![Validate Configuration Remediation](../images/remediation_validate_feature.png)

nautobot_golden_config/choices.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ class RemediationTypeChoice(ChoiceSet):
2121
"""Choiceset used by RemediationSetting."""
2222

2323
TYPE_HIERCONFIG = "hierconfig"
24+
TYPE_API = "api"
2425
TYPE_CUSTOM = "custom_remediation"
2526

2627
CHOICES = (
2728
(TYPE_HIERCONFIG, "HIERCONFIG"),
29+
(TYPE_API, "API"),
2830
(TYPE_CUSTOM, "CUSTOM_REMEDIATION"),
2931
)
3032

0 commit comments

Comments
 (0)