10-09-2015 10:59 AM
I wrote the following code to get all BDs in a specified tenant.
However, I got the error message like: AttributeError: 'list' object has no attribute 'BD'
Could someone tell me what is the problem?
Reference:
Examples — Cisco APIC Python API 0.1 documentation
APIC version: 1.1(3f)
---
from cobra.mit.access import MoDirectory
from cobra.mit.session import LoginSession
from cobra.mit.request import DnQuery
from cobra.model.fv import Tenant, Ctx, BD
session = LoginSession('http://1.1.1.1', 'admin', 'cisco')
moDir = MoDirectory(session)
moDir.login()
dnQuery = DnQuery('uni/tn-TENANT')
dnQuery.subtree = 'children'
tenantMo = moDir.query(dnQuery)
for bdMo in tenantMo.BD:
print str(bdMo.dn)