Netmiko is the Python library for SSH device CLI interaction
Short answer
A Netmiko is the SSH client library that drives network-device CLI sessions, while ncclient, requests, and flask target NETCONF RPCs, HTTP APIs, and web serving respectively.
Question
Key Takeaways
Netmiko is the Python library for SSH-based network device CLI interaction, extending Paramiko with prompt handling, paging control, and configuration helpers. It is the right choice because ncclient targets NETCONF/YANG RPCs, requests targets HTTP APIs such as RESTCONF, and flask is a web framework rather than a device client.
Expert Analysis
When the automation requirement is an SSH session that drives the device's text CLI, netmiko is the library that fits, whereas ncclient, requests, and flask each operate at a different layer.
Netmiko versus ncclient at the SSH transport boundary
The closest conceptual collision is between netmiko and ncclient, because both can open an SSH transport to a router or switch yet they automate different interfaces. Netmiko treats the device as a terminal: it negotiates an SSH channel through Paramiko, waits for the CLI prompt, sends text commands such as show ip interface brief, and returns the rendered text output. Its contract is the command-line interface, with prompt detection, paging control, enable mode, and configuration mode as core concerns. ncclient treats the device as a NETCONF server: it exchanges XML-encoded RPCs defined by YANG models over an SSH subsystem, and the device must have NETCONF enabled. A NETCONF <get-config> or <edit-config> operation is not the same as typing show running-config or configure terminal; the payload is structured XML and the server enforces model constraints. That boundary explains why sharing SSH as a transport is a weak test: the deciding property is the payload and interaction model, not the port. The same distinction separates requests, which speaks HTTP to RESTCONF or another API, and flask, which exposes an HTTP service rather than initiating device sessions. For a requirement phrased as CLI interaction, only the terminal-oriented library matches.
CLI prompt handling makes netmiko the only direct fit
The decisive property is that the requested interaction is expressed as device CLI dialogue rather than as a structured model operation. A CLI automation library must do more than open a TCP/22 socket: it must identify the prompt after login, recognize the > and # modes, issue terminal length 0 to suppress --More-- paging on Cisco IOS XE, enter enable mode when a privileged command requires it, and send configuration lines followed by an explicit save or exit sequence. Those are exactly the responsibilities Netmiko abstracts through ConnectHandler, send_command, send_command_timing, and send_config_set. The requirement also names SSH, which rules out a serial-console or Telnet-only approach and points to an SSH client library with network-device awareness. Netmiko inherits Paramiko's SSH transport but adds platform-specific prompt and paging behavior, so it remains a CLI tool even though encryption and authentication are handled by SSH. ncclient satisfies the SSH transport clause but not the CLI clause; requests and flask satisfy neither. The verdict therefore rests on the object being automated — the text CLI — and not merely on the presence of SSH.
Costs of ncclient, requests, and flask in an SSH CLI workflow
Choosing ncclient would force the solution onto NETCONF: the device needs NETCONF enabled, the automation must construct XML RPCs against YANG models, and any existing CLI-only procedure or non-NETCONF platform becomes unreachable. Choosing requests would move the integration to HTTP, so it would need a RESTCONF or platform REST API endpoint, authentication tokens, and JSON/XML payloads; it cannot type show commands into an SSH shell. Choosing flask would invert the architecture by building a web application or API endpoint, adding routing, request handling, and server deployment without providing any device SSH client. Netmiko avoids those mismatches because its cost is only the need to handle prompt variability and text parsing, which is inherent to CLI automation. The other options do not merely add work; they change the protocol and the device-side prerequisite, so a design that selects them no longer satisfies the original SSH CLI interaction. A solution could combine them, but the library that answers the interaction requirement is still netmiko. Each replacement therefore fails at the protocol-selection step before any device command is sent. This is a protocol mismatch rather than a missing feature in those libraries.
Cisco blueprint separation and Netmiko's terminal mechanics
The 300-435 blueprint makes the separation explicit: objective 2.1 assigns device-level automation with Python and Netmiko, objective 2.2 assigns ncclient, and objective 2.3 assigns RESTCONF. That taxonomy is not cosmetic; each objective implies a different device API and a different failure mode. Netmiko's documented behavior is to wrap Paramiko's SSH channel and add network-device handling: the device_type argument selects platform-specific prompt patterns and commands, ConnectHandler establishes the session, and send_config_set enters configuration mode, sends an ordered list of commands, and exits. On Cisco IOS XE, the library also deals with the terminal length 0 convention so long show output does not stall on a pager. These mechanics are the reason the library can perform CLI interaction without a controller or model schema. A NETCONF client would instead depend on the <hello> capability exchange and YANG module support, while an HTTP client would depend on RESTCONF media types and status codes. Cisco's own automation curriculum groups these as distinct tools because the transport and payload jointly determine the correct library. The documented separation therefore makes Netmiko the required choice for SSH CLI work.
Official Reference
https://github.com/ktbyers/netmiko
This link opens the official vendor documentation in a new tab.
Exam Strategy
When an exam stem names a transport plus an interaction style, map both before scanning options: SSH plus CLI points to Netmiko, SSH plus XML RPC points to ncclient, and HTTP plus JSON/XML points to requests or a platform REST API. Eliminate libraries that supply only one half of the pair; Flask is especially easy to reject because it serves HTTP rather than initiating device sessions. Pair this with the blueprint's objective groupings (2.1, 2.2, 2.3) so protocol and payload, not popularity, drive the selection.
Related Analysis
Practice All 300-435 Questions
Access 150 questions with complete answers and detailed explanations.
View Full 300-435 Practice Test →