def connect(switch): # connect to the switch, and log in: console = pexpect.spawn('telnet ' + switch.hostname) console.expect('User Name:') console.sendline(switch.username) console.expect('Password:'******'Logged in to switch %r', switch) prompts = _console.get_prompts(console) return _Session(switch=switch, console=console, **prompts)
def connect(switch): console = pexpect.spawn('telnet ' + switch.hostname) console.expect('login: '******'Password: ') console.sendline(switch.password) prompts = _console.get_prompts(console) return _Session(console=console, dummy_vlan=switch.dummy_vlan, switch=switch, **prompts)
def connect(switch): console = pexpect.spawn("telnet " + switch.hostname) console.expect("login: "******"Password: "******"telnet " + switch.hostname) console.expect("login: "******"Password: ") console.sendline(switch.password) prompts = _console.get_prompts(console) return _Session(console=console, dummy_vlan=switch.dummy_vlan, switch=switch, **prompts)