Cisco ACI Python Cobra: SDK, API, Tutorial, Examples

Cisco ACI Python Cobra Examples

cisco aci python cobra
The Cisco ACI Python Cobra SDK enables network automation and programmability using python programming. The Cobra SDK is preferred over standard REST API development tools, such as Postman, when you need to use logic and pull in other resources. While the acitoolkit is an alternative, it limits your possibilities.

Cisco ACI tools such as ELAMicURL and moquery are great for troubleshooting but when you need a solution for network automation and programmability, acicobra is key.



Create Tenant

Creating a Tenant (fvTenant) is a basic construct of the Cisco ACI policy model. The Tenant serves as a logical container for application policies, such as Application Profile’s (fvAp), VRF’s (fvCtx) or Bridge Domain’s (fvBD).

Query a class

Queries can be performed on a specific object itself by its distinguished name (Dn) or on an entire class of objects, such as Tenant (fvTenant). This example demonstrates a class query that will print all tenants.

Query a class with property filter

The ACI API allows you to extract  specific class properties using property filters. While you could certainly query the entire class and filter the specifics in local memory, its much more efficient to let ACI do the work for you.

Query a class w/ property filter & subtree

For all management information tree (MIT) queries, you can optionally specify a subtree to access additional layers below your class.


See also:
Cisco ACI Leaf Switches
Cisco ACI ELAM Packet Capture
Cisco ACI Troubleshooting: icURL
Cisco ACI Troubleshooting: Moquery