nerdexam
CiscoCisco

200-901 · Question #561

200-901 Question #561: Real Exam Question with Answer & Explanation

The question tests the ability to construct a Python script to configure a network interface using RESTCONF, correctly mapping the ietf-interfaces YANG data model to a JSON payload.

Cisco Platforms and Development

Question

Drag and Drop Question Refer to the exhibit. A new loopback34 must be created on a Cisco IOS XE router that has an IP address of 10.34.1.2/24. Drag and drop the code from the bottom onto the box where the code is missing to construct the Python script that configures the IP address on the interface according to the YANG data model of ietf-interfaces. Not all options are used. Answer:

Explanation

The question tests the ability to construct a Python script to configure a network interface using RESTCONF, correctly mapping the ietf-interfaces YANG data model to a JSON payload.

Approach. The Python script is constructing a JSON payload to send to a RESTCONF endpoint. This payload must adhere to the 'ietf-interfaces' YANG model. The 'int_url' shows the path '/restconf/data/ietf-interfaces:interfaces/', indicating that the top-level keys in the JSON payload will correspond to the YANG module and its top-level containers/lists.

  1. First blank (ietf-interfaces): The JSON payload for a RESTCONF operation targeting a specific module often starts with the module's namespace or prefix. The URL includes 'ietf-interfaces', and the YANG model itself is 'ietf-interfaces'. Thus, the top-level key for the data payload should be 'ietf-interfaces'.
  2. Second blank (interface): According to the YANG model, within 'ietf-interfaces', there is a container 'interfaces' which contains a list named 'interface'. The URL '/restconf/data/ietf-interfaces:interfaces/' points to this list. The JSON syntax ':[[{...}]]' indicates a list of objects. Therefore, 'interface' is the correct key for this list.
  3. Third blank (address): Inside 'ietf-ipv4' (which is a container for IPv4 configuration), the YANG model shows 'address' as a list. The JSON structure ':[['ip': '10.34.1.2', ...]]' confirms that an 'address' list is being defined, with 'ip' as a leaf within it. So, 'address' is the correct key here.
  4. Fourth blank (netmask): The problem states the IP address is '10.34.1.2/24', and the provided value in the JSON is '255.255.255.0'. The YANG model for 'address' offers a choice between 'prefix-length' and 'netmask'. Since '255.255.255.0' is a subnet mask, 'netmask' is the appropriate key to complete the IP address configuration.

Common mistakes.

  • common_mistake. Common mistakes stem from misinterpreting the YANG model hierarchy or confusing keys with values.
  • 'ipv4': While 'ietf-ipv4' is part of the path, 'ipv4' by itself is not a direct key at the positions requiring 'ietf-interfaces' or 'address'. 'ietf-ipv4' is already explicitly stated as a key in the JSON, so 'ipv4' would be redundant or incorrect as a parent key.
  • 'loopback': 'Loopback34' is the value for the 'name' leaf, not a key in the JSON structure at any of the blank spots.
  • 'subnet': The YANG model shows 'subnet' as a 'choice' grouping, not a direct key to define the subnet mask value. The actual keys are 'prefix-length' or 'netmask'. Since '255.255.255.0' is provided, 'netmask' is the correct specific key from the 'subnet' choice.
  • 'ietf-interfaces' for other blanks: While it's the root module, it would be incorrect for subsequent nested keys. Similarly, 'interface' is specific to the list of interfaces, not to nested IPv4 details or the root module.

Concept tested. YANG data modeling for network configuration, RESTCONF protocol for programmatically configuring network devices, JSON payload construction, and understanding the hierarchical structure of network configuration data.

Topics

#Python Scripting#YANG Data Models#Network Automation#Cisco IOS XE Automation

Community Discussion

No community discussion yet for this question.

Full 200-901 PracticeBrowse All 200-901 Questions