What Is Achieved by This Python NETCONF XML Parsing Code?

Refer to the exhibit. What is achieved by the XML code? - image

  1. It displays the access list sequence numbers from the output of the show ip access-list extended flp command on the terminal screen
  2. It displays the output of the show ip access-list extended flp command on the terminal screen
  3. It reads the access list sequence numbers from the output of the show ip access-list extended flp command into a dictionary list Source Reference Answer
  4. It reads the output of the show ip access-list extended flp command into a dictionary list

Community Votes

C
54%
D
46%

54% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The question tests whether you can trace nested dictionary key indexing to recognize that only specific XML sub-elements are targeted for extraction, not the entire CLI output or raw terminal display.

This question evaluates your ability to interpret Python scripts that parse NETCONF RPC responses using the xmltodict library. The community consensus confirms the code isolates and extracts only access control list sequence rule data into a list, rather than dumping the full configuration or printing it directly.

Candidates frequently select option D because they assume any NETCONF parser automatically loads the complete configuration block; however, the explicit bracket notation in the script filters out all other ACL attributes, restricting the result to just the sequence rules.

Community Discussion (15 comments)

kldoyle97 👍 10
A and B cannot be correct because the python code is not using the print function/ display information. based on the code, I believe the answer is C because the last line is reference Sequence numbers ["access-list-seq-rule"]
d4doppelganger 👍 7 Selected: D
The output would look something like this. { '10': { 'sequence': '10', 'action': 'permit', 'source': '192.168.1.0 0.0.0.255', 'destination': 'any', 'protocol': 'ip', 'description': 'Allow traffic from 192.168.1.0/24 to any' }, '20': { 'sequence': '20', 'action': 'deny', 'source': 'any', 'destination': 'any', 'protocol': 'icmp', 'description': 'Deny all ICMP traffic' }, ... }
Calinserban 👍 1 Selected: D
I say D, the script return entire ACL
AbdullahMohammad251 👍 2 Selected: C
I will go with option 'C.' Towards the end of the exhibit, we see the command "['access-list-seq-rule']" which indicates that we're specifically accessing the value for the 'sequence-number' key. All rules will share the same parent keys, only the value for the 'access-list-seq-rule' key will be unique, therefore; it's the only item which was parsed into a python list.
chiacche 👍 1 Selected: C
It parses the returned XML result into a dictionary and extracts the access control list's serial number information from the command's output into a list of dictionaries.
Shri_Fcb10 👍 2 Selected: C
The XML configuration uses a <get-config> RPC call to retrieve the running configuration related to the specified access list (flp). The filter specifies that it only retrieves information related to the ip and access-list with the name flp. The Python code further processes the RPC reply by parsing it into a dictionary (d1) and specifically looks for the access list sequence rule numbers in the response ('access-list-seq-rule').
Rfvaz 👍 1 Selected: C
correct c
Mohaned990_go 👍 1 Selected: D
correct D
a197cbf 👍 1 Selected: D
My vote is for D. The "access-list-seq-rule" is NOT just the value of the sequence number. The command would require the sub-tag <sequence> to pull the sequence number separately. Here's a sample XML format of an <access-list-seq-rule> block: <access-list-seq-rule> <sequence>10</sequence> <ace-rule> <action>permit</action> <protocol>tcp</protocol> <any/> <dst-any/> <dst-range1>5060</dst-range1> <dst-range2>5061</dst-range2> </ace-rule> </access-list-seq-rule> With that, if the most drilled-down block is the "access-list-seq-rule" then D makes sense since it's listing out each entire rule per sequence number, rather than just the sequence numbers themselves like option C specifies. If anyone disagrees, please correct me if I'm wrong.
[Removed] 👍 1 Selected: D
D is correct the code does parse the access list sequence rules into a dictionary, but it doesn't specify that only sequence numbers are extracted.
supershysherlock 👍 1
The correct answer will depend on the exact functionality of the NETCONF library and functions being used (like xmltodict.parse). If the functions xmltodict.parse and md.dispatch are being used as typically intended, they would parse the NETCONF response into a dictionary (D). So, based on the typical use of these functions, Option D is the most likely correct answer. It reads the output of the command into a dictionary list, allowing for structured access to the data within the application or script.
slacker_at_work 👍 3 Selected: C
• The Python code establishes a NETCONF session with a Cisco IOS XE device and sends a <get-config> RPC payload to retrieve the running configuration of an extended ACL named "fip". • It then parses the XML response received from the device and extracts the access list sequence numbers from the configuration data of the extended ACL rules. • This sequence numbers are then read into a dictionary list.
slacker_at_work 👍 2
pl1 = [ <get-config xmlns="urn.ietf.params.xml.ns.netconf base:1.0"> <source> <running/> </source> <filter> <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native"> <ip> <access-list> <extended xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-acl"> <name>fip</name> </extended> </access-list> </ip> </native> </filter> </get-config> ] with manager.connect(host=10.1.1.1, port=830, username=cisco, password=cisco, timeout=90, hostkey_verify=False) as m for rpc in pl1. r1=m.dispatch(et.fromstring(rpc)) d1=xmitodict.parse(r1.xml)['rpc-reply']['data']['native']['ip']['access-list']['extended']['access-list-seq-rule']
kivi_bg 👍 2
Answer C This is based on the line d1= xmltodict.parse(r1.xml)['rpc-reply']['data']['native']['ip']['access-list']['extended']['access-list-seq-rule'], which indicates that the XML response is parsed, and the specific information about access list sequence rules is extracted into a dictionary.
Mizuchan 👍 3 Selected: C
xmitodict that means C.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Core Concept: NETCONF XML Parsing with Python

Automation-focused exams like 350-401 frequently test your ability to read Python scripts that interact with network infrastructure via NETCONF. The exhibit demonstrates a script that establishes a session, sends a <get-config> RPC payload, and uses xmltodict.parse() to convert the returned XML into a native Python dictionary structure.

Why Option C is Correct

The pivotal line in the code uses chained dictionary key access: ['rpc-reply']['data']['native']['ip']['access-list']['extended']['access-list-seq-rule']. As highlighted by community members, this explicitly drills down to isolate only the sequence rule blocks from the broader configuration tree. A surrounding list comprehension then compiles these extracted elements into a Python list, which aligns perfectly with option C.

Why Other Options Are Incorrect

Options A and B suggest terminal output, but the script contains no print() statements, eliminating any direct display functionality. Option D claims the entire ACL output is read into a dictionary; while the initial XML response is indeed parsed into a dictionary, the final assignment filters out all other parameters (such as actions, protocols, or IP addresses) by targeting only access-list-seq-rule. Therefore, the script does not capture the complete ACL definition, making D incorrect.

Exam Context & Best Practices

Always follow the data flow from raw XML → dictionary conversion → key indexing → final variable assignment. If the code isolates a specific tag, the answer will reflect that granularity rather than a bulk operation.

Official Reference

Exam Strategy

When analyzing automation scripts, trace variable assignments step-by-step and verify exact data types before selecting an answer. Always check for I/O functions like print() before choosing display-related options, and use bracket notation to determine precisely which XML nodes are being targeted versus loaded wholesale.

Related Analysis

Practice All 350-401 Questions

Access 218 questions with complete answers and detailed explanations.

View Full 350-401 Practice Test →

← Back to 350-401 Study Guide