What Is Achieved by This Python NETCONF XML Parsing Code?
Refer to the exhibit. What is achieved by the XML code? - 
Community Votes
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)
Comments & Corrections
No comments yet — spotted an error or have a note? Share it below.
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 onlyaccess-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://www.cisco.com/c/en/us/td/docs/ios-xml/ios/prog/configuration/1690/b_1690_programmability_cg/netconf.html
- https://github.com/martinblech/xmltodict
- RFC 6241 - Network Configuration Protocol (NETCONF)
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 →