What Is Achieved by This Python NETCONF XML Parsing Code?
Short answer
C It reads the access list sequence numbers from the output of the show ip access-list extended flp command into a dictionary list
Question

Key Takeaways
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.
Common mistake: 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.
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
- https://github.com/martinblech/xmltodict
- RFC 6241 - Network Configuration Protocol (NETCONF)
These links open the official vendor documentation in a new tab.
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.
Community Votes
54% of anonymous learners picked answer C. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 15 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 15
-
kldoyle97 👍 10A 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 Answered DThe 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' }, ... }
-
slacker_at_work 👍 3 Answered 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 👍 2pl1 = [ <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']
-
Shri_Fcb10 👍 2 Answered CThe 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').
Show 10 more comments
-
AbdullahMohammad251 👍 2 Answered CI 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.
-
kivi_bg 👍 2Answer 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.
-
a197cbf 👍 1 Answered DMy 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.
-
supershysherlock 👍 1The 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.
-
chiacche 👍 1 Answered CIt 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.
-
[Removed] 👍 1 Answered DD 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.
-
Calinserban 👍 1 Answered DI say D, the script return entire ACL
-
Mizuchan 👍 3 Answered Cxmitodict that means C.
-
Rfvaz 👍 1 Answered Ccorrect c
-
Mohaned990_go 👍 1 Answered Dcorrect D
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All 350-401 Questions
Access 218 questions with complete answers and detailed explanations.
View Full 350-401 Practice Test →