200-901 · Question #411
200-901 Question #411: Real Exam Question with Answer & Explanation
The question requires completing a Python script using the Cisco ACI cobra SDK to query a tenant and its bridge domains, then add a subnet to each bridge domain and commit the changes.
Question
Drag and Drop Question Refer to the exhibit. Drag and drop the code from the bottom onto the box where the code is missing to add a subnet to each bridge domain in the Ten1 tenant. Not all options are used. Answer:
Explanation
The question requires completing a Python script using the Cisco ACI cobra SDK to query a tenant and its bridge domains, then add a subnet to each bridge domain and commit the changes.
Approach. The correct interaction involves dragging the appropriate code snippets into the four blank spaces in the Python script:
- First blank (qry1 = _____ ('f'uni/tn-{tenname}') ): The string 'f'uni/tn-{tenname}' represents a Distinguished Name (DN). Therefore,
DnQueryis the correct choice here to query an object by its DN. The line becomesqry1 = DnQuery('f'uni/tn-{tenname}'). - **Second blank (qry2 = _____ ('fvBD')): ** The string 'fvBD' refers to a class name (specifically, the class for Bridge Domains in ACI). To query objects by their class name,
ClassQueryis used. The line becomesqry2 = ClassQuery('fvBD'). - Third blank (fvsubnet = cobra.model.fv.Subnet (______, ip=f'10.114.{i}.1/24')): This line creates a new
fv.Subnetobject. In the ACI object model, a subnet is a child of a Bridge Domain. The loop iterates throughfvBDs, sofvBD(the current Bridge Domain object in the loop) is the correct parent object to associate the new subnet with. The line becomesfvsubnet = cobra.model.fv.Subnet(fvBD, ip=f'10.114.{i}.1/24'). - Fourth blank (aci. ______ (c)): After making configuration changes (like adding a subnet), these changes need to be sent to the ACI controller to be applied. The
cobraSDK uses thecommitmethod on theaciaccess object to send theConfigRequest(represented byc). The line becomesaci.commit(c).
Common mistakes.
- common_mistake. Common mistakes include confusing
DnQueryandClassQuery.DnQueryis used when you have the full Distinguished Name of an object (e.g., 'uni/tn-Ten1'), whileClassQueryis used to find objects of a specific type (class name) (e.g., 'fvTenant', 'fvBD'). Another mistake would be to usefvTenantas the parent forfv.Subnet; subnets are children of Bridge Domains (fvBD), not directly of the tenant. Using 'bdname' as a parent would also be incorrect because 'bdname' is likely a string or a placeholder, not an actual parent object to which the subnet is attached. Finally, omittingcommitor choosing any other option for the last blank would mean the configuration changes (adding subnets) would not be applied to the ACI fabric, ascommitis essential to push theConfigRequestto the ACI APIC.
Concept tested. This question tests the understanding of Cisco ACI's object model and hierarchy, along with proficiency in using the cobra Python SDK for ACI automation. Specifically, it assesses the ability to query ACI objects using both Distinguished Names and class names, to create child objects within the ACI hierarchy, and to commit configuration changes to the ACI fabric.
Topics
Community Discussion
No community discussion yet for this question.