This public repo contains python code that can be used to interact with the Cisco SD-WAN vManage REST API
. The environment is pre-configured to access the Cisco DevNet Reservable Sandbox for SD-WAN fabric.You can edit the variables in the environment to point to your own vManage instance. The code contains REST API calls to authenticate, modify preferred color in Application Aware Routing policy. Cisco SD-WAN vManage 19.2.2.
To use this code you will need:
git clone https://github.com/ciscodevnet/sdwan-policy-automation.git
cd sdwan-policy-automation
python3.7 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt
To modify the preferred color in Application Aware Routing policy, run the script using command python modify-app-policy-color.py
on macOS/Ubuntu env or py -3.7 modify-app-policy-color.py
on windows env
Possible input values for the new transport color are as below
3g
biz-internet
blue
bronze
custom1
custom2
custom3
gold
green
lte
metro-ethernet
mpls
private1
private2
private3
private4
private5
private6
public-internet
red
silver
Outlook-AAR-Policy
if you are using the DevNet SD-WAN 19.2 Reserve SandboxApplication-Aware Routing policy is configured in vManage as a centralized data policy that maps the service-side application(s) to specific SLA requirements. The centralized policies provisioned in vSmart controller are pushed to relevant WAN Edge devices for enforcement. The defined policy consists of match-action pairs. The match statement defines the applications on a list or the type of traffic to match, and the action statement defines the SLA action the WAN Edge devices must enforce for the specified traffic.
Cisco SD-WAN Application-Aware Routing consists of three components:
/template/policy/definition/approute/<aar-policy-definition-id>
./template/policy/definition/approute/<aar-policy-definition-id>
.Using the affected master template id’s for vSmart devices, we retrieve the device-ids and input CSV variables for the vSmart template using these API endpoints in sequence:
template/device/config/attached/<affected-master-template-id>
/template/device/config/input
Now using the vSmart device CSV values we run a POST request on this API endpoint: /template/device/config/attachfeature
. This call completes the vSmart policy update (which contains our AAR policy which was modified).
Finally we can monitor the process-id using the API endpoint: /device/action/status/<process_id>
The process_id
is part of the response from vManage for the POST request /template/device/config/attachfeature
that you completed in Step Two.
When the status is "Done," it means vSmart policy has been updated successfully.
Owner
Contributors
Categories
NetworkingProducts
Catalyst SD-WANProgramming Languages
PythonLicense
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community