nerdexam
CiscoCisco

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.

Cisco Platforms and Development

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:

  1. First blank (qry1 = _____ ('f'uni/tn-{tenname}') ): The string 'f'uni/tn-{tenname}' represents a Distinguished Name (DN). Therefore, DnQuery is the correct choice here to query an object by its DN. The line becomes qry1 = DnQuery('f'uni/tn-{tenname}').
  2. **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, ClassQuery is used. The line becomes qry2 = ClassQuery('fvBD').
  3. Third blank (fvsubnet = cobra.model.fv.Subnet (______, ip=f'10.114.{i}.1/24')): This line creates a new fv.Subnet object. In the ACI object model, a subnet is a child of a Bridge Domain. The loop iterates through fvBDs, so fvBD (the current Bridge Domain object in the loop) is the correct parent object to associate the new subnet with. The line becomes fvsubnet = cobra.model.fv.Subnet(fvBD, ip=f'10.114.{i}.1/24').
  4. 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 cobra SDK uses the commit method on the aci access object to send the ConfigRequest (represented by c). The line becomes aci.commit(c).

Common mistakes.

  • common_mistake. Common mistakes include confusing DnQuery and ClassQuery. DnQuery is used when you have the full Distinguished Name of an object (e.g., 'uni/tn-Ten1'), while ClassQuery is used to find objects of a specific type (class name) (e.g., 'fvTenant', 'fvBD'). Another mistake would be to use fvTenant as the parent for fv.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, omitting commit or choosing any other option for the last blank would mean the configuration changes (adding subnets) would not be applied to the ACI fabric, as commit is essential to push the ConfigRequest to 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

#Cisco ACI#Network Automation#Python#API Usage

Community Discussion

No community discussion yet for this question.

Full 200-901 PracticeBrowse All 200-901 Questions