HOW to execute CLI commands on "MULTIPLE" ROUTERS using EASY Python Script

Published: 28 February 2023
on channel: Network Tips and Topics - Plexinor
211
3

"Want more expert insights and updates? Follow us on LinkedIn and explore our company page to connect with us directly. Don’t miss out - click the link and join the conversation!"

Follow us on LinkedIn   / plexinor  
Company Website Https://www.plexinor.com

Beginner's Guide: Basic Python Script to execute commands on "MULTIPLE" router using ssh

The full script is given below

lab@admin:~$ cat SSH-Show-Commands
from netmiko import Netmiko
from getpass import getpass


my_device = {
"host": "192.168.0.85",
"username": "lab",
"password": getpass(),
"device_type": "juniper_junos",
}

my_device1 = {
"host": "192.168.0.122",
"username": "lab",
"password": getpass(),
"device_type": "juniper_junos",
}

my_device2 = {
"host": "192.168.0.75",
"username": "lab",
"password": getpass(),
"device_type": "juniper_junos",
}

ALL = [my_device,my_device1,my_device2]

for dd in ALL:
net_connect = Netmiko(**dd)
output = net_connect.send_command("show version|no-more")
print(output)
output = net_connect.send_command("show arp no-resolve")
print(output)


net_connect.disconnect()


On this page of the site you can watch the video online HOW to execute CLI commands on "MULTIPLE" ROUTERS using EASY Python Script with a duration of hours minute second in good quality, which was uploaded by the user Network Tips and Topics - Plexinor 28 February 2023, share the link with friends and acquaintances, this video has already been watched 211 times on youtube and it was liked by 3 viewers. Enjoy your viewing!