Below script is used to run ping test to a destination from all routers.
e.g ip.txt must in same folder where you are
storing you python program.
storing you python program.
Note:-
Make sure router IP must be reachable from the machine where python script is
configured.
Make sure router IP must be reachable from the machine where python script is
configured.
File used in the scripts are :-
import telnetlib
import time
user = “test”
password = “test”
ips = [i.strip() for i in open(“ip.txt”)]
for ip in ips:
telnet = telnetlib.Telnet(ip)
telnet.read_until(“Username: “)
telnet.write(user + “n”)
telnet.read_until(“Password: “)
telnet.write(password + “n”)
telnet.write(“ping 192.168.10.100n”) #< 192.168.10.100 is the destination
time.sleep(1)
telnet.write(“exitn”)
print telnet.read_all()