This repository is deprecated; please follow the main search page or use the ‘Related code repos’ widget on the right side of the current page.

Cisco SD-WAN - Device Templates (REST API)

The Cisco SD-WAN Solution (a.k.a Viptela) is a cloud-delivered overlay SD-WAN architecture that facilitates digital and cloud transformation for enterprises and communication service providers (CSP). It significantly reduces WAN costs and time to deploy new services.

Cisco SD-WAN builds a API based architecture that's crucial for enterprises and CSPs to do the configuration automation through their internal tools.

Once below templates are successfully created, these can be grouped under one device template which can then attached to an edge device

  • Feature Templates
  • Local Policy Template
  • Security Policy Template

Device Template - POSTMAN Collection

This postman collection provides some example of various APIs dealing with Device Templates.

This POSTMAN environment and collection that can be used to interact with the Cisco SD-WAN powered by Viptela vManage REST API. You can edit the variables in the environment to point to your own vManage instance. The collection contains REST API calls to create device template, attach device with device template and attach device template with device variable values. Please note that the username should have write permission for "Template Configuration" Feature for the usergroup that it is associated with.

Steps to execute APIs in the Postman Collection

  • Clone or Download the JSON files "CiscoSD-WAN-DeviceTemplate.postman_collection.json" and "Cisco-SD-WAN-Environment.postman_environment.json"
  • Import above files to the POSTMAN
  • In the POSTMAN, make sure you set the environment as "Cisco-SD-WAN-Environment" in the top right cornerSelectEnvDetails
  • Go to Environment options and edit the vmanage, j_username, j_password and port details as per your own vmanage environment. User account should have write permission for the feature "Template Configuration" Feature.EditEnvDetails
  • First execute the API under "Authentication\Authentication". This will make sure that you have logged into the vManage for that session.
  • Next execute the API under "DeviceTemplate\1.To Get Template ID of Feature Templates\To Get Template ID of Feature Templates".
    • In the response payload, search templateName and find its templateIdSearchFeatureTemplateId For instance, TestTemplate-AAA and TestTemplate-System are the template names you would have created as per our Feature Templates repository CiscoSD-WAN-FeatureTemplates
  • Next execute the API under "DeviceTemplate\2.To Get Id of the device\To Get Id of the device.
    • In the response payload, search deviceId or hostname or systemIp and find its deviceType and uuidSearchDeviceDetails
  • In order to execute the third API under "DeviceTemplate\3.To Create Device Template With Feature Template Attached\To Create Device Template With Feature Template Attached", replace value for below parameters in the request body
    • deviceType : deviceType fetched from the second API
    • aaa-Feature-TemplateId : templateId of AAA feature template
    • system-vedge-Feature-TemplateId : templateId of System feature template
    • After replacing the values, payload will somewhat look like as shown in screenshotSampleCreateDeviceTemplatePayload
  • Next execute the API under "DeviceTemplate\4.To Get Template ID of Device Template\To Get Template ID of Device Template".
    • In the response payload, search templateName and find its templateIdSearchDeviceTemplateId For instance, Test-DeviceTemplate is the template name you would have created using third API
  • In order to execute the fifth API under "DeviceTemplate\5.To Attach Device With Device Template\To Attach Device With Device Template", replace value for below parameters in the request body
    • Device-TemplateId : templateId fetched from the fourth API
    • deviceIds : uuid fetched from the second API
    • On successful execution of above api, vManage will return the device input variables as shown hereSampleAttachDevicewithDeviceTemplateOutput
    • Copy the output payload to a notepad.
  • In order to execute the final API under "DeviceTemplate\6.To Attach Device Template With Device Variable Values\To Attach Device Template With Device Variable Values",
    • In the request body replace Device-TemplateId with templateId fetched from the fourth API
    • From the notepad (which you have copy pasted in the above step), cut all the data present inside the "data" array and paste the same in the request payload. Enter value for all the variables as per your requirement.
    • After replacing the values, payload will somewhat look like as shown in screenshotSampleAttachDeviceTemplatewithDeviceVariableValuesPayload
  • We have successfully created a device template and attached to a device.
View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.