"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
Full Script is below
from napalm import get_network_driver
from pprint import pprint
from datetime import datetime
from getpass import getpass
import json
username = input('Enter your SSH username: ')
password=getpass()
with open('IP-LIST') as f:
devices = f.read().splitlines()
print (devices)
for ip in devices:
print ("Connecting to Device =======================================" + str(ip))
junos_driver = get_network_driver("junos")
mx_router = junos_driver(hostname=ip,
username=username,
password=password)
mx_router.open()
if mx_router.is_alive()["is_alive"]:
output = mx_router.ping("194.145.149.88")
print (json.dumps(output,indent=4))
output = mx_router.ping("194.145.149.128")
print (json.dumps(output,indent=4))
lab@admin:~$ cat IP-LIST
192.168.0.122
192.168.0.85