APIC SDK¶
The following services are supported by the SDK (Cobra) connector for APIC.
query¶
Mimics same-name function from MoDirectory class (cobra.mit.access)
Argument |
Description |
Default |
---|---|---|
queryObject (obj) |
A query object |
Mandatory |
For more information please visit the Cisco APIC Python API
commit¶
Mimics same-name function from MoDirectory class (cobra.mit.access)
Argument |
Description |
Default |
---|---|---|
configObject (obj) |
The configuration request to commit |
Mandatory |
For more information please visit the Cisco APIC Python API
lookupByDn¶
Mimics same-name function from MoDirectory class (cobra.mit.access)
Argument |
Description |
Default |
---|---|---|
dnStrOrDn (obj|str) |
DN of the object to lookup |
Mandatory |
queryParams (dict) |
Dictionary containing additional filters |
Optional |
For more information please visit the Cisco APIC Python API
lookupByClass¶
Mimics same-name function from MoDirectory class (cobra.mit.access)
Argument |
Description |
Default |
---|---|---|
classNames (str|list) |
Class name or list of classes |
Mandatory |
parentDn (obj|str) |
DN of the parent object |
None |
kwargs (dict) |
Dictionary containing additional filters |
Optional |
For more information please visit the Cisco APIC Python API
exists¶
Mimics same-name function from MoDirectory class (cobra.mit.access)
Argument |
Description |
Default |
---|---|---|
dnStrOrDn (obj|str) |
DN of the object to check |
Mandatory |
get_model¶
Automatically import the required library and return the model class
Argument |
Description |
Default |
---|---|---|
model (str) |
Unique identifier of the module and class (eg. fv.Tenant) |
Mandatory |
# Assuming the device is already connected
tenant_class = device.cobra.get_model(model='fv.Tenant')
create¶
Automatically import the required library and instantiate the model object
Argument |
Description |
Default |
---|---|---|
model (str) |
Unique identifier of the module and class (eg. “fv.Tenant”) |
Mandatory |
parent_mo_or_dn (obj|str) |
The parent MO or DN |
Mandatory |
extra_parms (dict) |
Dictionary containing additional attributes for the object |
Optional |
# Assuming the device is already connected
tenant = device.cobra.create(model='fv.Tenant',
parent_mo_or_dn='uni',
name='test')
config_and_commit¶
Add MO to ConfigRequest and push it to device
Argument |
Description |
Default |
---|---|---|
mo (obj) |
Object to be committed |
Mandatory |
expected_status_code (int) |
Expected result |
200 |
# Assuming the device is already connected
# and tenant object is created (create function)
tenant = device.cobra.config_and_commit(mo=tenant)
Additional info on the Cobra SDK can be found on the Cisco APIC Python API
Section author: Romel Tolos <rtolos@cisco.com>