When it comes to network automation we are spoilt with the plethora of tools available to us. One tool that deserves its space within any network automation toolbox is Netmiko.

Netmiko is a multi-vendor Python SSH library that simplifies the process of configuring and obtaining data from your network devices.

In short, Netmiko provides support for a ton of devices, a low barrier of entry for learning, and various built-in features such as structured parsing. Therefore you can get some great automation wins - QUICK!

For example below shows you how to backup a device config with less than 10 lines of code:

# Install
$ pip3 install netmiko

# Create ConnectHandler
from netmiko import ConnectHandler

net_connect_ios = ConnectHandler(
    {
        "device_type": "cisco_ios",
        "host": "lab.packetflow.co.uk",
        "username": "username",
        "password": "password",
    }
)

# Collect config
output = net_connect_ios.send_command("show run")

# Write to file
with open("device-backup.txt", "w") as opened_file:
    opened_file.write(output)
Master Network Automation
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