ACI programmability is rightfully getting a lot of attention lately due to its robust GUI and a RESTful API that supports both JSON and XML. ACI 's RESTful API will drastically help reduce the time it takes to deploy new network policy, update existing policy and deprovision policy for a new or existing application. Therefore, as a network engineer with 15 years in the industry and mostly only touching a CLI, I started to ask whether I should learn the GUI or learn how to leverage the RESTful API to reduce provisioning and deprovisioning times. I decided to invest my time in learning how best to take advantage of this rich API. However, I did recognize the ACI GUI is great for creating best practice configurations and verifying and testing them; but, leverage the API to automate the configurations best practices I created from the GUI for any new add, moves, changes or deletions.
I started researching the tools Cisco currently makes available to help a CLI jockey learn how to use this API. Onhttps://github.com/datacenter, I came across Arya, CobraSDK and ACIToolKit as popular tools to program ACI. Which one should I learn first?
Arya (https://github.com/datacenter/ACI/tree/master/arya) is a code generator. It essentially allows me to save APIC objects in XML or JSON format that I created in the GUI and convert them into ACI Python SDK code, where I can automate and deploy configurations in seconds. For example, I can take JSON or XML from APIC Visor, the API Inspector or a REST query, and generate Python source code to build a full configuration in seconds. There are some caveats: Arya doesn't validate configurations or perform advanced lookup logic, but it's a great way to create code from JSON or XML objects or classes that already exist. I view it as a great tool to help with creating great code with the Cobra SDK. But I wasn't ready to create code yet.
Next, I looked at the Cobra ACI Python SDK (https://github.com/datacenter/cobra). Cobra has an all-inclusive ACI object model implemented that can essentially do everything to configure an ACI fabric. It not only has a Python library that provides native bindings for all the REST functions but also a complete copy of the object model, which means data integrity can be ensured. This is important as it validates the configuration before executing it on APIC. The Cobra SDK provides methods for performing lookups or queries and object creation, modification and deletion that match the REST methods used by the GUI. What's cool is that I can take policy built in the GUI and use it as a programming template to build new code for super fast deployments for other tenants and their applications. Here's a link to the Cobra API documentation (http://cobra.readthedocs.org/en/latest/). Although I felt I wasn't quite ready for Cobra, I knew I would want to come back and learn how to use this SDK. If new to Python here is a great place to start: http://www.pythonlearn.com/ https://docs.python.org/2/tutorial/index.html http://www.learnpython.org/ https://developers.google.com/edu/python/
The ACIToolkit is very use-case oriented; for example, it knows how to build an EPG, but doesn't know how to manipulate all of the underlying objects and class inheritances. The ACIToolkit also provides an NXOS like CLI for ACI; therefore, I can leverage some of my CLI skills. Here is an example of some of the CLI available to configure ACI: https://github.com/datacenter/acitoolkit/blob/master/applications/cli/clicommands.txt
Take a look at a sample ACIToolkit script for building out a simple tenant and the application network profile to support a new application deployment at https://github.com/datacenter/acitoolkit/blob/master/samples/aci_demo_contract.py. I don't need to ssh or telnet to a number of switches to build this configuration, but instead I leveraged a single API where APIC distributes the policy to the fabric. You can imagine you can easily further customize this script to deploy for other applications.
If you want to evolve past the CLI samples and dive into Python, take a look at an example that leverages a simple Python script to create a tenant with a single EPG and assign it statically to 2 interfaces: http://goo.gl/cLTYlR
You can find a list of other ACIToolkit Python applications you can start to use athttps://github.com/datacenter/acitoolkit/tree/master/applications. One of my favorites is the end point tracker. It allows me to search for a mac address or IP address anywhere within the fabric. I can sort by Tenant, Application Network Profile, or by EPG. It's extremely flexible to have a single interface to configure, monitor, audit and troubleshoot the fabric.
Lastly, you can find additional examples that allow you to build out the fabric or query information from the fabric leveraging ACITookit python scripts at https://github.com/datacenter/acitoolkit/tree/master/samples. The ACIToolkit is a great way to start to evolve from what I know with CLI, move onto python scripts, and get me ready to dive into learning the ACI Python SDK next (Cobra).
In summary, I chose to start with ACIToolkit because I wanted something easy to learn.
Hello team,I have to get some information from lots of devices.In this case, I need information such as ip address, device name and serial number.When I send the request, it takes so long (we have more than 11k devices) because serial number does not appe...
Hello, I am getting following error while trying to use the filter for netconf in Python. Please help to make corrections: m = manager.connect(host="sandbox-iosxe-latest-1.cisco.com", port=830, username="developer", password="C1sco12345", hostke...
I am trying to configure the ospf on the router in CML lab through ansible. Snippet of my playbook and host_var is attached:this is the result that i am getting TASK [Configuring OSPF on Routers] ******************************************************...
Hi all, I am trying to use the Integrity Verification Application (ver 188.8.131.525) in APIC-EM (184.108.40.206024) to verify ISR 4331's platform integrity but facing the unknown boot0 measurement issue. I initially tried with bootloader version 16....
The Viptela API documentation suggests to reuse the rest API session, but I am unable to reuse the session, and also the documentation does not have an example for that, Below code give me an error if I store the cookies in a text file and reuse it f...