Monday, 14 September 2020

Using the New Cisco SD-WAN SDK

What is a Software Development Kit (SDK)?


Put simply this is a set of tools, libraries, and documentation to simplify interacting with a REST API. The Cisco SD-WAN Python SDK is a Python-based SDK for Cisco vManage. The SDK is intended for anybody interested in automating the configuration and operation of Cisco SD-WAN deployments using Python.

What can you do with the SDK? 


The SDK enables configuration and operations of Cisco vManage via Python-based API bindings. In a traditional SD-WAN deployment, nearly all management of the SD-WAN control plane and overlay of VPNs and edge devices is done via the Cisco vManage GUI. The SDK allows automation of vManage via Python without any GUI interaction. The following examples illustrate some of the benefits of interacting with Cisco vManage programmatically.

◉ Integration with other platforms
◉ Basic management of policy or device/feature templates
◉ Backup/restore
◉ CI/CD

So, let’s get started:

Installing the Cisco SD-WAN SDK


The Cisco SD-WAN SDK is available via PyPI, so all that is required is “pip install”. It is also recommended to use a virtual environment. 

Cisco Prep, Cisco Exam Prep, Cisco Certification, Cisco Study Materials

You are now able to use the SDK. The SDK has a great help function built-in too, just in case you find yourself stuck. 

Cisco Prep, Cisco Exam Prep, Cisco Certification, Cisco Study Materials

Using the Cisco SD-WAN SDK


In this example, we can use the Always-On DevNet SD-WAN Sandbox. First we set credentials as environment variables from the sandbox supplying valid values for the following variables: 

Cisco Prep, Cisco Exam Prep, Cisco Certification, Cisco Study Materials

Next, open your python shell, in this example, I am using python. Create an authentication object and call the login function. Once you are authenticated to Cisco vManage, make API calls by creating an instance of the API object you are interested in (e.g. Device, Settings, Local Policy, etc.) and calling the functions from that object. The example below retrieves a list of all devices on the DevNet SD-WAN sandbox. 

Cisco Prep, Cisco Exam Prep, Cisco Certification, Cisco Study Materials

Source Code 

You can also get the source code, as the SDK is developed as a community project on GitHub. To get the source code go to DevNet Code Exchange.You can then install the package to your environment for development purposes: 

Cisco Prep, Cisco Exam Prep, Cisco Certification, Cisco Study Materials

Related Posts

0 comments:

Post a comment