Hello David. Any reason why this only configure one switch? I am able to telnet from my SW1 to all the devices and also from my home laptop that run the script. Every time I ran it, it only configure SW4, if I reduce the range, it will take any of the random SW
!/usr/local/bin/python3.9
import getpass
import sys
import telnetlib
user = input("Enter your telnet user name: ")
password = getpass.getpass()
for n in range (10,14):
HOST = "10.115.0." + str(n)
tn = telnetlib.Telnet(HOST)
tn.read_until(b"Username: ")
tn.write(user.encode('ascii') + b"\n")
if password:
tn.read_until(b"Password: ")
tn.write(password.encode('ascii') + b"\n")
tn.write(b"config t\n")
for n in range(2,11):
tn.write(b"vlan " + str(n).encode('ascii') + b"\n")
tn.write(b"name Python_VLAN_" + str(n).encode('ascii') + b"\n")
Hello David. Any reason why this only configure one switch? I am able to telnet from my SW1 to all the devices and also from my home laptop that run the script. Every time I ran it, it only configure SW4, if I reduce the range, it will take any of the random SW
!/usr/local/bin/python3.9
import getpass import sys import telnetlib
user = input("Enter your telnet user name: ") password = getpass.getpass()
for n in range (10,14): HOST = "10.115.0." + str(n) tn = telnetlib.Telnet(HOST)
tn.write(b"end\n") tn.write(b"write\n") tn.write(b"exit\n")
print(tn.read_all().decode('ascii'))