200-901 · Question #669
Drag and Drop Question Drag and drop the code from the bottom onto the box where the code is missing to present GigabitEthernet2 details in the XML format. Not all options are used. Answer:
The correct answer is get_config; running; name="2". The question requires filling in blanks in a Python script to retrieve the configuration details of GigabitEthernet2 from a network device using NETCONF, specifically targeting the running configuration via an XPath filter.
Question
Exhibit
Answer Area
Drag items
Correct arrangement
- get_config
- running
- name="2"
Explanation
The question requires filling in blanks in a Python script to retrieve the configuration details of GigabitEthernet2 from a network device using NETCONF, specifically targeting the running configuration via an XPath filter.
Approach. The goal is to retrieve configuration data for a specific interface.
-
First blank (
m. ______ (): The script intends to get configuration details. Among the available options,get_configis the correctncclientmethod for this purpose.put_config(or more commonlyedit_config) would be for modifying configuration, andcommitis for applying pending changes. -
Second blank (
' ______ ' ,): This argument specifies the NETCONF datastore from which the configuration should be retrieved.runningis a standard NETCONF datastore representing the active configuration on the device.currentis not a standard NETCONF datastore name. Therefore,runningis the correct choice. -
Third blank (
GigabitEthernet[ ______ ]): This is part of an XPath expression used to filter for a specific interface. To target 'GigabitEthernet2', assuming the interface number '2' is held in a 'name' attribute within the XML structure (a common practice for interface identification in NETCONF), the correct XPath filter would be[name="2"]. Just using[2]would select the second child element, which is not what's intended for filtering by interface number.
Common mistakes.
- common_mistake. 1. Using
put_configorcommitinstead ofget_config: These operations are for modifying or applying configuration changes, not for retrieving existing configuration. The question specifically asks to 'present' details, implying retrieval.
- Using
currentinstead ofrunningfor the datastore:currentis not a recognized NETCONF datastore. Therunningdatastore holds the active configuration of the device. - Using
2instead ofname="2"for the XPath filter: XPath filters for specific elements often use attribute-value pairs, like[attribute="value"]. Simply using[2]without an attribute name would typically select the second child element, not an element where an attribute's value is '2'. The prompt specifies 'GigabitEthernet2', which implies filtering by an identifier attribute like 'name'.
Concept tested. This question tests the understanding of NETCONF protocol operations (specifically get-config), NETCONF datastores (running), and how to construct XPath filters for querying specific data within an XML configuration tree. It also assesses familiarity with the Python ncclient library for interacting with NETCONF-enabled devices.
Topics
Community Discussion
No community discussion yet for this question.
