Python library for NETCONF RPCs on Cisco IOS XE
Short answer
A Ncclient is the Python NETCONF client that performs manager.connect and get_config/edit_config RPCs against the IOS XE NETCONF subsystem, unlike requests, paramiko, or netmiko.
Question
Key Takeaways
NETCONF automation on Cisco IOS XE requires a protocol-aware Python client, and ncclient is the library built for that role. It establishes a manager.connect session to the NETCONF SSH subsystem and sends XML RPCs such as get_config and edit_config. Generic HTTP or SSH libraries and CLI-focused netmiko do not supply NETCONF session framing, capability exchange, or RPC reply parsing.
Expert Analysis
Because IOS XE presents NETCONF as an XML RPC service reached through the SSH netconf subsystem rather than as HTTP or CLI text, the protocol-aware client ncclient (A) is the library that satisfies the requirement.
NETCONF RPC semantics separate ncclient from HTTP and CLI transports
NETCONF is not simply SSH access to a router or XML sent over HTTP. It is a session-oriented protocol defined by RFC 6241: the client opens a transport, exchanges <hello> messages carrying capabilities, then invokes operations such as <get-config>, <edit-config>, <lock>, and <commit> inside <rpc> elements. A library is standard for NETCONF when it owns that entire layer, not only the socket underneath it. ncclient models the manager side directly: manager.connect establishes the SSH session to the NETCONF subsystem, negotiates capabilities, builds the RPC envelope with the correct urn:ietf:params:xml:ns:netconf:base:1.0 namespace, and parses the <rpc-reply> back into a usable object. Against IOS XE, the same library supplies operations such as get_config and edit_config without the engineer hand-assembling XML framing. requests belongs to HTTP and therefore to RESTCONF or another REST API; paramiko supplies an SSH channel but leaves NETCONF hello exchange, message framing, and RPC validation to the caller; netmiko automates CLI screens and expects prompt and response text. Those are useful libraries, but they sit at different boundaries: one is an HTTP client, one is a transport, and one is a CLI driver. Only ncclient is a NETCONF manager in the sense the protocol requires.
IOS XE's NETCONF subsystem on TCP 830 forces a protocol-aware client
The decisive condition is the object being invoked: the requirement names NETCONF RPCs, not configuration through a REST endpoint and not command-line execution. On IOS XE, NETCONF is offered as a service over an SSH transport, conventionally on TCP 830, using the netconf subsystem; the device's <hello> advertises base NETCONF capabilities plus YANG-model namespaces. A client therefore has to establish a NETCONF session before it can ask for the running configuration or edit a datastore. That is exactly the path ncclient.manager.connect implements: SSH transport, hello and capability exchange, then RPC dispatch. If the platform exposes RESTCONF over HTTPS instead, a different API surface and a different client style are in play; requests would then be a reasonable tool because it can GET or POST JSON or XML to the RESTCONF media types. If the requirement were merely to run show running-config and capture text, a CLI driver would be the natural choice. Neither substitution preserves the NETCONF contract. The word RPCs matters because it asserts structured operations and replies, not bytes over a socket. IOS XE can support multiple programmability interfaces side by side, so choosing the library is a question of which interface the requirement names, not which one merely reaches the management IP.
requests, paramiko and netmiko each break at a different layer
Option B, requests, can open a TCP/TLS conversation to an HTTP server and is excellent for RESTCONF, but it has no concept of a NETCONF <hello>, an <rpc> message-id, or a NETCONF <rpc-reply>; pointed at port 830 it would be speaking the wrong protocol. Option C, paramiko, gets closer because it can create an SSH channel, but it stops at the transport: the engineer would have to implement NETCONF hello handling, end-of-message framing, XML namespace construction, capability checks, and reply parsing, all work ncclient already does. Option D, netmiko, is designed for interactive CLI sessions and prompt handling; it can send show or configuration commands, but it does not expose get_config or edit_config as NETCONF operations or return structured RPC replies. In an IOS XE automation job, each choice imposes a different failure mode: requests fails at protocol mismatch, paramiko fails at missing NETCONF session logic, and netmiko fails at the data-model and RPC boundary. Any of them might reach the device, and that is precisely the trap: reachability is not protocol compliance. The requirement is for NETCONF RPCs, so only a manager library that speaks NETCONF can satisfy it without building a NETCONF client from scratch.
RFC 6241 client responsibilities explain why manager.connect is the required entry point
The governing rule is RFC 6241, which makes the client responsible for session establishment, capability discovery, RPC encoding, and reply correlation; RFC 6242 adds the SSH mapping, including the netconf subsystem and message framing. Those obligations are not optional decorations around a socket. A valid NETCONF request needs the base namespace, a unique message-id, and an operation element such as <get-config>; the reply must be matched to that id, and errors arrive as <rpc-error> rather than as an HTTP status code. ncclient.manager.connect is the entry point that hides this contract behind a Python API and exposes Cisco IOS XE-oriented device handling where needed. Using it means automation code can work at the level of get_config(source='running') or edit_config(target='running', config=...), while the library manages framing and XML construction. Cisco's programmability examples for IOS XE NETCONF likewise use a NETCONF client rather than an arbitrary SSH or HTTP package, because the platform expects the RFC-defined protocol, not a generic transport. The documented behaviour therefore points to one answer: when the operation is a NETCONF RPC, use a NETCONF manager; ncclient is the Python library that fills that role for IOS XE.
Official Reference
These links open the official vendor documentation in a new tab.
Exam Strategy
When the requirement names a protocol and asks for a Python library, eliminate generic transports first: requests maps to HTTP/RESTCONF, paramiko to raw SSH, and netmiko to CLI text, while ncclient is the only option that owns NETCONF RPC semantics. Recall the signature calls manager.connect, get_config and edit_config, and the transport details such as TCP 830 and the SSH netconf subsystem to separate NETCONF from RESTCONF. Do not choose a library just because it can reach the device; match the encoding and RPC layer the requirement names.
Related Analysis
Practice All 300-435 Questions
Access 150 questions with complete answers and detailed explanations.
View Full 300-435 Practice Test →