Cisco SD-WAN export with python

You can use the REST API to connect to SD-WAN - vManage and export your configuration.

The following Python tool does a great job exporting templates and policies:

https://github.com/CiscoSE/cisco-sd-wan-export-import

Example

Create export

Here is a quick example:

$ python sd-wan-exim.py 10.1.0.1 admin admin export Action: export Export entire configuration. device_template Exporting ID: 42affc2c-6ff6-4fc7-8259-ff33361eb63e Exporting ID: 2a64b1d4-49be-45b5-976f-5a5d65e22c82 Exporting ID: 8a5e797b-f543-41bc-9d58-720653d34c63 Exporting ID: e7e2eae3-50d3-4e7c-91c3-d212b3be1b34 Exporting ID: 12b4e4b1-f988-4a8f-a6e1-da31402cd418 Exporting ID: d231c8af-ebdc-4e0b-8deb-8f2b9931d89c Successfully exported the device templates from 10.1.0.1 feature_template Exporting ID: c2f000fb-c433-4f32-b96f-e46e0e685352 Exporting ID: a51a42e9-7921-4c43-a164-530ba5a71067 Exporting ID: 956c2ba2-1862-4ca5-99e1-75ed09a3b3bc Exporting ID: e41e0216-08d0-4878-aa7a-49c411aa348b Exporting ID: c524ef53-67f4-41da-a767-5c62305c031a Exporting ID: e368eeac-896f-45b4-84bc-00ed0ca070a8 Exporting ID: 014a4ee2-e2aa-4600-84bf-7c54071541e2 Exporting ID: 0cf24588-e602-40ef-b542-31f72128feba Exporting ID: bf84775b-eb92-428b-8cfa-371fd143da02 Exporting ID: 5185efd3-c269-4206-9337-f083db4b8e4c Exporting ID: 45502911-54f6-4690-a4ff-b7f2ee5c9961 Exporting ID: 94610143-300c-4df6-9968-4eb317516d4b Exporting ID: 4957567d-dd1a-407f-8f07-58a0bd110e28 Exporting ID: 37c37982-d323-4a4e-926f-b5e73dd65c97 Exporting ID: 18a9753c-e0e6-45f4-b829-8267d8a49a4f Exporting ID: bf3f7bb3-ca10-4386-8aa4-3b73ff8e843e Exporting ID: 0d8b3d5b-e3a7-421b-94d2-1aabfa5f97c7 Exporting ID: 7271d1d3-6d9e-498a-ae38-b46742f6b813 Exporting ID: 97ae3fd3-8308-4f7c-b45a-1e2e9147a070 Exporting ID: 63c504a0-0960-44f7-a11e-861effe2eeb9 Exporting ID: 08e04bfe-e8f4-4225-82d4-7158352d32a6 Exporting ID: 3aadeec7-6c5f-46bd-8721-9ea8e3b9c193 Exporting ID: 1125df6e-774b-4a8d-850f-48a212fd0b81 Exporting ID: 5f0c6513-be8c-4a22-a1c0-8b0ea6f1ce2f Exporting ID: cf604384-79bf-45eb-a8f7-bd8decc460d0 Exporting ID: d104bcab-f12a-439e-99eb-4425a41f5a98 Exporting ID: aab06536-3f72-4d60-a3e4-bd442aeec065 Exporting ID: a2c47aee-617d-400d-a292-8b97d6b8f163 Exporting ID: ece08d1f-41ee-484d-b4b6-7df9f2b4893a Exporting ID: 3231b574-1de6-4a1f-aa09-a3ff97fb34ec Exporting ID: 793a5bd0-68f5-4174-a138-89bbdf05fa25 Exporting ID: bbbd4879-063f-4738-9b8a-e88223a57af4 Exporting ID: 04702fa6-fae5-4422-9818-f66b44da954c Exporting ID: 70fa5bfe-c1ac-4320-a41e-a720a546d927 Exporting ID: 62519c23-facf-4dea-80f6-054575d0f4b1 Exporting ID: e7d695d4-b746-4285-a6f2-b9d51515c4a6 Exporting ID: 0576da45-81b9-4c73-987a-164687d524a4 Exporting ID: b66a63da-da10-4c5a-9e57-1c6ed9d38a17 Successfully exported the feature templates from 10.1.0.1 vedge_policy Exporting ID: 40581f8c-3034-4629-8aa5-bc2606326288 Exporting ID: 265e602e-4a65-43ca-8f86-e6db13ee1e2c Exporting ID: ead68006-6721-4537-9606-f4c91677c698 Successfully exported the vEdge policies from 10.1.0.1 vsmart_policy Exporting ID: aca76ebd-8bbd-46f5-8f0e-2c707ede29ec Exporting ID: 7c370521-e9e8-40bc-8143-11540b2dcade Exporting ID: caaf5cdc-d34f-43ff-af44-0f4b537e53c7 Successfully exported the vSmart policies from 10.1.0.1 security_policy Successfully exported the security policies from 10.1.0.1 vedge_policy_id Successfully exported the vEdge policy IDs from 10.1.0.1 vsmart_policy_id Successfully exported the vSmart policy IDs from 10.1.0.1 security_policy_id Successfully exported the security policy IDs from 10.1.0.1 policy_definition Exporting done for /cflowd Exporting done for /dnssecurity Exporting done for /advancedMalwareProtection Exporting done for /control Exporting done for /intrusionprevention Exporting done for /vedgeroute Exporting done for /hubandspoke Exporting done for /acl Exporting done for /vpnmembershipgroup Exporting done for /approute Exporting done for /zonebasedfw Exporting done for /urlfiltering Exporting done for /qosmap Exporting done for /aclv6 Exporting done for /mesh Exporting done for /data Exporting done for /rewriterule Exporting ID: f1eae995-13ba-4924-bf2b-1f55598605f9 Exporting ID: 10d38226-bfae-4cbc-9272-ec246486f888 Exporting ID: aa796fbf-90ab-46aa-a862-e2ccc4fbd0ae Exporting ID: ebe9da95-ec99-4d6f-bb4f-40a4080976b0 Exporting ID: 0acb0fad-b59f-48f8-b577-12393a672e30 Exporting ID: 02b19dff-9ddb-445e-a047-248ebce7a7a6 Exporting ID: b45b22bc-0c65-4e79-abca-a06322ff8a8a Exporting ID: 364eab0e-1d5d-4d2a-bc13-97f3b65d9bfe Exporting ID: 18b15475-ea2e-4749-a5c2-aa3068f34d5a Exporting ID: cc0e0e05-1739-44a1-a550-c290c45f7de3 Exporting ID: f15ec638-3d81-4f33-a778-ae69b1136803 Exporting ID: d411b99e-1fda-4efd-a535-ebd42d9c845f Exporting ID: 5835c6f5-cea0-4e9c-8b86-8ed6523f0bc5 Exporting ID: 22c48643-99e8-4af9-a21a-f49fd036677e Exporting ID: 82f7c617-1e8f-4b73-bf9c-f8a03c4a0cad Exporting ID: 18ca3a30-b0ab-411c-9e52-98991f8001a3 Exporting ID: c5322de7-1630-441c-a30e-8807be924e78 Exporting ID: 573c1f66-d82d-4b04-a867-66a66df58b90 Exporting ID: 3f297c53-9726-4a00-959e-1a63c2ba0022 Exporting ID: 906a9be1-1bed-4c9b-8843-c92125a7a6cf Exporting ID: 80c75a75-bf8a-4daa-ae9a-13e419286a39 Exporting ID: e559a9e2-fcd9-43c5-bd36-fe73af5f9492 Exporting ID: 06b1b632-63a5-4247-91a6-01a916e08097 Exporting ID: 761c1b31-6d28-4f0a-afbf-b8dd900f4000 Exporting ID: 52ebbe04-f961-494d-9324-895ccee9a219 Exporting ID: 01ea7444-93f6-43aa-a198-4b9ba6048cc7 Successfully exported the policy definitions from 10.1.0.1 policy_list Exporting done for /community Exporting done for /localdomain Exporting done for /dataipv6prefix Exporting done for /ipv6prefix Exporting done for /tloc Exporting done for /umbrellasecret Exporting done for /aspath Exporting done for /zone Exporting done for /color Exporting done for /sla Exporting done for /localapp Exporting done for /app Exporting done for /mirror Exporting done for /dataprefix Exporting done for /extcommunity Exporting done for /site Exporting done for /prefix Exporting done for /umbrelladata Exporting done for /class Exporting done for /ipssignature Exporting done for /urlblacklist Exporting done for /policer Exporting done for /urlwhitelist Exporting done for /vpn Exporting done for /tgapikey Exporting ID: a48d514b-db79-43ce-b8cb-d9a712d2a083 Exporting ID: 1e0bed49-f1f7-4f06-8b64-31473629e74e Exporting ID: 661e2be3-19c8-4bbd-94d1-34ebf6997b2e Exporting ID: d0bf4b0f-757a-4eb9-a19f-9de36a162132 Exporting ID: 4b310c4e-b2d9-4670-910c-5c7099931964 Exporting ID: 20b8e131-0b31-41b8-9a7d-3881d92331e4 Exporting ID: b25998eb-dab8-44e2-8a76-78b9dcfd9276 Exporting ID: bf7d8ca1-a73a-4d4f-90cb-087ff0d86d41 Exporting ID: af96d7a1-b08d-4c37-8c92-fdc7398af063 Exporting ID: 7b4acf70-266a-42a3-b7bb-d4408162c8cb Exporting ID: 1d4e3940-f22a-4630-8b86-cb7e6d244fa3 Exporting ID: 74e391d6-ebdf-4742-acb9-0dc4b15d56fd Exporting ID: 63944aed-470a-4f69-9e5e-cd21f6aabaa7 Exporting ID: 957dfb09-5da0-41de-90ac-1ab5383fd289 Exporting ID: 19653f91-17b2-485d-91dc-584a4e986048 Exporting ID: f67c0e74-99af-48bd-aa05-2afe9811de79 Exporting ID: 1d985e5c-b945-4cee-85b9-b59d2a1dedc9 Exporting ID: 470b9321-d857-460d-a2e1-d008f08a933f Exporting ID: c0963795-7781-4efc-a74a-240be09baf43 Exporting ID: ba6f6819-b185-49c7-872b-956cd3fa2914 Exporting ID: 278b7d25-880f-4c43-829f-2a5042c24fc6 Exporting ID: 5284ddbe-502d-4bd7-9a60-87f1e6e7896b Exporting ID: 083637bf-4b9c-4d3a-b237-38abbdbe7a4f Exporting ID: 94a7e949-3a4e-4da4-8822-b279ccaea017 Exporting ID: c63df8d0-c15c-4a73-a470-58b9cbc45672 Exporting ID: f857d267-08ae-4ab5-9c8d-4901d96c186c Exporting ID: f525b98a-0d14-43e3-90bf-737157b479b7 Exporting ID: 563cc7ea-e912-4c08-9387-6f7b7230a946 Exporting ID: 58d1ad00-aaa9-481e-9abd-6aba5b5c8a28 Exporting ID: 559c9c70-1bf1-4f97-a10b-4085bc6bfe0b Exporting ID: d943f21e-ec73-4595-a4e0-f30a758dff5b Exporting ID: 8a8cec58-9f50-4daa-a642-f89ad82fcc79 Exporting ID: ddeebb78-c0f2-41a9-b640-0ad29a2f2324 Exporting ID: f81a9037-63b1-405f-be3f-61a7f87f58c3 Exporting ID: 04ed82f6-ab03-42d6-a70d-f3ea324019bf Exporting ID: 7ebaf741-bd36-437f-bfcf-315c17d9510b Exporting ID: fcaefbe4-820e-422e-8ee9-3d22a354fae4 Exporting ID: 3db1418f-59c6-4515-812f-5b52528e61b6 Successfully exported the policy lists from 10.1.0.1 Successfully exported the configuration from 10.1.0.1

Everything is stored in a single config_archive.tar file.

Device Policy

Here is an example output of a policy in JSON:

{ "configuration": [ { "policyName": "BGP-LOCAL-PREFERENCE-POLICY", "policyDescription": "BGP-LOCAL-PREFERENCE-POLICY", "policyDefinition": { "assembly": [ { "definitionId": "ebe9da95-ec99-4d6f-bb4f-40a4080976b0", "type": "vedgeRoute" } ], "settings": {} }, "policyDefinitionEdit": { "assembly": [ { "definitionId": "ebe9da95-ec99-4d6f-bb4f-40a4080976b0", "type": "vedgeRoute" } ], "settings": {} }, "policyType": "feature" }, { "policyName": "POLICY-SITE2-POLICER", "policyDescription": "POLICY-SITE2-POLICER", "policyDefinition": { "assembly": [ { "definitionId": "906a9be1-1bed-4c9b-8843-c92125a7a6cf", "type": "acl" } ], "settings": { "flowVisibility": true, "appVisibility": true, "logFrequency": 60 } }, "policyDefinitionEdit": { "assembly": [ { "definitionId": "906a9be1-1bed-4c9b-8843-c92125a7a6cf", "type": "acl" } ], "settings": { "flowVisibility": true, "appVisibility": true, "logFrequency": 60 } }, "policyType": "feature" }, { "policyName": "this-is-a-policy", "policyDescription": "this-is-a-policy", "policyDefinition": { "assembly": [ { "definitionId": "10d38226-bfae-4cbc-9272-ec246486f888", "type": "vedgeRoute" } ], "settings": {} }, "policyDefinitionEdit": { "assembly": [ { "definitionId": "10d38226-bfae-4cbc-9272-ec246486f888", "type": "vedgeRoute" } ], "settings": {} }, "policyType": "feature" } ] }