nerdexam
Cisco

200-901 · Question #406

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 return the number of interfaces on a network device by using the Cisco…

The correct answer is device_id; DNACenterAPI; port_list; devices. This question requires correctly completing a Python script to retrieve device interface information using the Cisco DNA Center SDK by filling in variable names, class instantiation, and SDK module access.

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 return the number of interfaces on a network device by using the Cisco DNA Center SDK. Not all options are used. Answer:

Exhibit

200-901 question #406 exhibit

Answer Area

Drag items

router_iddevice_idDNACenterAPIDNACport_listroutersdevices

Correct arrangement

  • device_id
  • DNACenterAPI
  • port_list
  • devices

Explanation

This question requires correctly completing a Python script to retrieve device interface information using the Cisco DNA Center SDK by filling in variable names, class instantiation, and SDK module access.

Approach. The correct interaction is to drag and drop the following options into the blanks:

  1. Blank 1 (variable assignment): Drag device_id to the first blank. The value 'da4606c3-63ad-4ed4-8f35-6bfec7c2df04' is a UUID, which serves as an identifier for a network device. The get_interface_info_by_id function, as shown in Exhibit 1, explicitly takes a device_id as a parameter.
  2. Blank 2 (class instantiation): Drag DNACenterAPI to the second blank. The line from dnacentersdk import DNACenterAPI imports the DNACenterAPI class. To create an instance of the API client, this class must be called (e.g., DNACenterAPI(...)).
  3. Blank 3 (list variable): Drag port_list to the third blank. The list comprehension [item['portName'] for item in ...] is constructing a list of port names. The subsequent print statement uses len(port_list), clearly indicating that the variable port_list is intended to hold this generated list.
  4. Blank 4 (SDK module access): Drag devices to the fourth blank. In the dnacentersdk, API calls are typically organized into logical modules or categories accessible as attributes of the main DNACenterAPI object instance (dnac). Operations related to managing and retrieving information about network devices are commonly grouped under a devices attribute (e.g., dnac.devices.get_interface_info_by_id). This follows a common pattern in well-designed SDKs.

Common mistakes.

  • common_mistake. Using router_id instead of device_id for the first blank is incorrect because device_id is the generic and explicit parameter for the function, and not all network devices are routers. Using DNAC instead of DNACenterAPI for the second blank is wrong because DNAC is the variable name assigned to the instantiated object, not the class itself used for instantiation. Using routers instead of devices for the fourth blank is incorrect because devices is a broader and more common module name within an SDK to encompass all types of network devices and their related operations, whereas routers would imply a narrower scope and might not contain the get_interface_info_by_id method. The remaining options like DNAC (variable name), router_id (too specific), routers (too specific), and DNACenterAPI (class, already used) are not suitable for the module access.

Concept tested. Understanding and applying the structure and usage of Python SDKs (Software Development Kits) for network automation, specifically with the Cisco DNA Center SDK. This includes knowledge of class instantiation, method calls, parameter identification from documentation, and recognizing common SDK object hierarchies for API resource access.

Topics

#Cisco DNA Center SDK#API interaction#Python programming#Network inventory

Community Discussion

No community discussion yet for this question.

Full 200-901 Practice