예제 #1
0
    def test_disable_enable(self):
        d = Connection(
            hostname='Router',
            start=[
                'mock_device_cli --os iosxe --state quad_login',
                'mock_device_cli --os iosxe --state quad_ics_login',
                'mock_device_cli --os iosxe --state quad_stby_login',
                'mock_device_cli --os iosxe --state quad_ics_login'
            ],
            os='iosxe',
            chassis_type='quad',
            username='******',
            tacacs_password='******',
            enable_password='******')
        d.connect()

        d.disable()
        self.assertEqual(d.spawn.match.match_output, 'disable\r\nRouter>')

        d.enable()
        self.assertEqual(d.spawn.match.match_output, 'cisco\r\nRouter#')

        d.disable(target='standby')
        self.assertEqual(d.standby.spawn.match.match_output,
                         'disable\r\nRouter-stby>')

        d.enable(target='standby')
        self.assertEqual(d.standby.spawn.match.match_output,
                         'cisco\r\nRouter-stby#')

        d.disconnect()
    def test_disable_enable(self):
        c = Connection(hostname='Router',
                       start=['mock_device_cli --os iosxe --state isr_exec'],
                       os='iosxe',
                       username='******',
                       tacacs_password='******',
                       enable_password='******')

        r = c.disable()
        self.assertEqual(c.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable()
        self.assertEqual(c.spawn.match.match_output, 'cisco\r\nRouter#')

        r = c.disable()
        self.assertEqual(c.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable(command='enable 7')
        self.assertEqual(c.spawn.match.match_output, 'cisco\r\nRouter#')
    def test_disable_enable(self):
        c = Connection(hostname='Router',
                       start = ['mock_device_cli --os iosxe --state stack_enable']*5,
                       os='iosxe',
                       chassis_type='stack',
                       username='******',
                       tacacs_password='******',
                       enable_password='******')
        c.connect()

        r = c.disable()
        self.assertEqual(c.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable()
        self.assertEqual(c.spawn.match.match_output, 'cisco\r\nRouter#')

        r = c.disable(target='standby')
        self.assertEqual(c.standby.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable(target='standby')
        self.assertEqual(c.standby.spawn.match.match_output, 'cisco\r\nRouter#')
예제 #4
0
    def test_disable_enable(self):
        c = Connection(
            hostname='Router',
            start=['mock_device_cli --os iosxe --state isr_exec'],
            os='iosxe',
            credentials=dict(default=dict(username='******', password='******')),
            log_buffer=True)

        r = c.disable()
        self.assertEqual(c.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable()
        self.assertEqual(c.spawn.match.match_output, 'cisco\r\nRouter#')

        r = c.disable()
        self.assertEqual(c.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable(command='enable 7')
        self.assertEqual(c.spawn.match.match_output, 'cisco\r\nRouter#')

        c.disconnect()
예제 #5
0
    def test_disable_enable(self):
        c = Connection(hostname='Router',
                       start=['mock_device_cli --os iosxe --state isr_exec'],
                       os='iosxe',
                       username='******',
                       tacacs_password='******',
                       enable_password='******',
                       settings=dict(POST_DISCONNECT_WAIT_SEC=0,
                                     GRACEFUL_DISCONNECT_WAIT_SEC=0.2),
                       log_buffer=True)

        r = c.disable()
        self.assertEqual(c.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable()
        self.assertEqual(c.spawn.match.match_output, 'cisco\r\nRouter#')

        r = c.disable()
        self.assertEqual(c.spawn.match.match_output, 'disable\r\nRouter>')

        r = c.enable(command='enable 7')
        self.assertEqual(c.spawn.match.match_output, 'cisco\r\nRouter#')

        c.disconnect()