In this lesson, we will cover:

  • How to send a command and retrieve the output from a device.
  • How to modify the expected response back from the device.

The scripts and code for this lesson can be found within the Netmiko repo under the directory: examples/sending.

Basic Usage

First of all, we can use send_command to send a command to the device. Before we do so, we first enter enable mode via enable(). For example.

ios_net_connection.send_command("show version")

By default, the Netmiko send_command() works by sending the command, and then looking for the device prompt within the output. At the point, the command prompt is found Netmiko determines that this is the end of the output from the command. The command prompt that Netmiko looks for is obtained via the Netmiko method - find_prompt().

Below shows an example for collecting the output of show version from the ios and eos based devices, using the previously created connectHandler.

Members Only Content
Join today and get access to:
  • Full deep-dive course library (inc. Batfish, pyATS, Netmiko)
  • Code repositories inc. full course code, scripts and examples
  • 24x7 Multi-vendor labs (Arista, Cisco, Juniper)
  • Private online community
  • Monthly online meetups

100% Satisfaction Guaranteed!
Cancel your membership at any time.


Join Today
Close You've successfully subscribed to Packet Coders.
Close Success! Your account is fully activated, you now have access to all content.
Close Welcome back! You've successfully signed in.
Close Nearly there! To activate your account, please click the link in the email we just sent you.