This is an example to perform on configuration backup using netmiko python library on any device.

from netmiko import ConnectHandler
import getpass
import os

location = '/home/venkat/Documents/SDN_bckup_Cfg/'
#host = input("Enter Hostname: ")
username = input("Enter Username: ")
password = getpass.getpass()
user_cmd = input("Enter command: ")

with open("Hosts.txt", 'r') as hostsfile:
    for line in hostsfile:
        hostline = line.strip()
        cisco = {
            'device_type': 'cisco_ios', 
            'host': hostline,
            'username': username, 
            'password': password,
            'secret': 'admin',
        net_connect = ConnectHandler(**cisco)
        output = net_connect.send_command(user_cmd)

        outputfile = os.path.join(location, hostline +".txt")
        with open(outputfile, 'w') as result:
            x = result.write(output)


Welcome to Typer

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join Typer
Registration is closed.