Steps:
Launch Python program.
Enter the snippet code then save as python file.
#!/usr/bin/env_python
import getpass
import sys
import telnetlib
HOST = 1.1.1.1
user = raw_input(“5G-ITTC CCNA Training.”)
password = getpass.getpass()
tn = telnetlib.Telnet(HOST)
tn.read_until(“Username po ninyo: “)
tn.write(user + “\n”)
if password:
tn.read_until(“Password po: “)
tn.write(password + “\n”)
tn.write(“configure terminal\n”)
for x in range(2, 60):
tn.write(“vlan “ + str(x) + “ \n”)
tn.write(“name 5GITTC” + str(x) + “ \n”)
tn.write(“end \n”)
tn.write(“exit \n”)
print tn.read_all()
- Telnet the L3 switch.