コード例 #1
0
 def test_bash_ha_standby(self):
     ha = MockDeviceTcpWrapperNXOS(port=0, state='exec,nxos_exec_standby')
     ha.start()
     d = Connection(hostname='Router',
                     start=['telnet 127.0.0.1 '+  str(ha.ports[0]), 'telnet 127.0.0.1 '+ str(ha.ports[1]) ],
                    os='nxos', username='******', tacacs_password='******')
     d.connect()
     with d.bash_console(target='standby') as console:
         console.execute('ls', target='standby')
     self.assertIn('exit', d.standby.spawn.match.match_output)
     self.assertIn('switch(standby)#', d.standby.spawn.match.match_output)
     d.disconnect()
     ha.stop()
コード例 #2
0
 def test_ha_guestshell_basic(self):
     ha = MockDeviceTcpWrapperNXOS(port=0, state='exec,nxos_exec_standby')
     ha.start()
     d = Connection(hostname='Router',
                    start=['telnet 127.0.0.1 ' + str(ha.ports[0]),
                           'telnet 127.0.0.1 ' + str(ha.ports[1])],
                    os='nxos',
                    username='******',
                    tacacs_password='******')
     d.connect()
     with d.guestshell() as gs:
         output = gs.execute('pwd')
     self.assertEqual('/home/admin', output)
     self.assertIn('exit', d.active.spawn.match.match_output)
     self.assertIn('switch#', d.active.spawn.match.match_output)
     d.disconnect()
     ha.stop()