def test_shell(self):
        c = Connection(hostname='switch',
                       start=['mock_device_cli --os nxos --state exec'],
                       os='nxos',
                       username='******',
                       tacacs_password='******')

        with c.attach_console(1) as console:
            console.execute('ls')
예제 #2
0
    def test_shell(self):
        c = Connection(hostname='switch',
                       start=['mock_device_cli --os nxos --state exec'],
                       os='nxos',
                       username='******',
                       tacacs_password='******')

        with c.attach_console(1) as console:
            console.execute('ls')
        self.assertEqual(c.state_machine.current_state, 'enable')
        c.disconnect()
예제 #3
0
    def test_attach_console(self):
        conn = Connection(hostname='Router',
                          start=['mock_device_cli --os iosxr --state enable1'],
                          os='iosxr',
                          enable_password='******')

        with conn.attach_console('0/RP0/CPU0') as console:
            out = console.execute('ls')
            self.assertIn('cmdline', out)
        ret = conn.spawn.match.match_output
        self.assertIn('exit', ret)
        self.assertIn('Router#', ret)
 def test_attach_console(self):
     c = Connection(
         hostname='LEAF',
         start=[
             'mock_device_cli --os nxos --state n9k_login --hostname LEAF'
         ],
         os='nxos',
         platform='aci',
         tacacs_password='******')
     c.connect()
     with c.attach_console() as mod:
         mod.execute('')
     c.disconnect()
    def test_attach_console_lc0(self):
        conn = Connection(hostname='Router',
                          start=['mock_device_cli --os iosxr --state spitfire_enable'],
                          os='iosxr',
                          platform='spitfire',
                          mit=True)

        conn.connect()
        with conn.attach_console('0/0/CPU0') as console:
            out = console.execute('ls')
            self.assertIn('dummy_file', out)
        ret = conn.spawn.match.match_output
        self.assertIn('exit\r\nlogout\r\nRP/0/RP0/CPU0:Router#', ret)
    def test_attach_console_lc0(self):
        conn = Connection(hostname='Router',
                       start=['mock_device_cli --os iosxr --state spitfire_enable'],
                       os='iosxr',
                       series='spitfire',
                       username='******',
                       enable_password='******')

        with conn.attach_console('0/0/CPU0') as console:
            out = console.execute('ls')
            self.assertIn('dummy_file', out)
        ret = conn.spawn.match.match_output
        self.assertEqual(ret,'exit\r\nlogout\r\nRP/0/RP0/CPU0:Router#')