Administrator Guide

Table Of Contents
1662 Dell Networking Python Support
USERNAME = 'admin'
PASSWORD = 'password'
ENABLE_PASSWORD = ''
TIMEOUT = 3
def do_terminal_settings(tn):
tn.write(TERMINAL_MONITOR)
tn.read_until("#")
tn.write(TERMINAL_LEN_ZERO)
tn.read_until("#")
def do_login(tn):
print "TN object created\n"
tn.read_until(LOGIN_STRING, TIMEOUT)
print "Read Login Prompt\n"
tn.write(USERNAME + "\n")
tn.read_until(PASSWORD_STRING, TIMEOUT)
print "Read Password Prompt\n"
tn.write(PASSWORD + "\n")
tn.read_until(">", TIMEOUT)
print "Received Exec Prompt\n"
tn.write(ENABLE_STRING)
tn.read_until("#", TIMEOUT)
print "Received Enable Prompt\n"
def do_config(tn):
tn.write(CONFIG_STRING)
tn.read_until("#", TIMEOUT)
print "Received Config Prompt\n"
tn.write("ip routing\n");
print "Enabled ip routing\n"
tn.write("exit\n");
tn.read_until("#")
def main():
telnet = telnetlib.Telnet(HOST,PORT)
do_login(telnet)
do_terminal_settings(telnet)
do_config(telnet)
telnet.close()
sys.exit(0)
main()