def setUpClass(cls):
        cls.d = Connection(hostname='Router',
                           start=['mock_device_cli --os ios --state exec'],
                           os='ios',
                           enable_password='******',
                           username='******',
                           tacacs_password='******',
                           service_attributes=dict(ping=dict(timeout=2468)))
        cls.d.connect()
        cls.md = mock_device.MockDevice(device_os='ios', state='exec')
        cls.ha = MockDeviceTcpWrapperIOS(port=0, state='login,exec_standby')

        # Add command output with 80K lines
        cls.ha.mockdevice.mock_data['enable']['commands']['show ospf dummy'] = \
        "123.123.123.123     123.123.123.123 1000        0x80000003 0x000000 0\n" * 80000

        cls.ha.start()
        cls.ha_device = Connection(
            hostname='Router',
            start=[
                'telnet 127.0.0.1 ' + str(cls.ha.ports[0]),
                'telnet 127.0.0.1 ' + str(cls.ha.ports[1])
            ],
            os='ios',
            username='******',
            tacacs_password='******',
            enable_password='******')
        cls.ha_device.connect()
        cls.logfile_testfile = '/tmp/test_log_file.log'
示例#2
0
 def setUpClass(cls):
     cls.d = Connection(
         hostname='Router',
         start=['mock_device_cli --os iosxe --state enable_isr'],
         os='iosxe')
     cls.d.connect()
     cls.md = mock_device.MockDevice(device_os='iosxe', state='enable_isr')
示例#3
0
 def setUpClass(cls):
     cls.d = Connection(hostname='Router',
                        start=['mock_device_cli --os ios --state exec'],
                        os='ios',
                        username='******',
                        tacacs_password='******',
                        enable_password='******')
     cls.d.connect()
     cls.md = mock_device.MockDevice(device_os='ios', state='exec')
 def test_learn_hostname_default(self):
     c = Connection(hostname='Router',
                         start=['mock_device_cli --os ios --state exec'],
                         os='ios', enable_password='******',
                         username='******',
                         tacacs_password='******',
                         learn_hostname=True)
     c.settings.TERM='vt100'
     c.connect()
     md = mock_device.MockDevice(device_os='ios', state='exec')
     expected_output = md.mock_data['exec']['commands']['show version'].rstrip()
     output = c.execute('show version').replace('\r', '')
     self.assertEqual(output, expected_output)
 def setUpClass(cls):
     cls.d = Connection(hostname='Router',
                         start=['mock_device_cli --os ios --state exec'],
                         os='ios', enable_password='******',
                         username='******',
                         tacacs_password='******')
     cls.d.connect()
     cls.md = mock_device.MockDevice(device_os='ios', state='exec')
     cls.ha = MockDeviceTcpWrapperIOS(port=0, state='login,exec_standby')
     cls.ha.start()
     cls.ha_device = Connection(hostname='Router',
                     start=['telnet 127.0.0.1 '+  str(cls.ha.ports[0]), 'telnet 127.0.0.1 '+ str(cls.ha.ports[1]) ],
                     os='ios', username='******', tacacs_password='******', enable_password='******')
     cls.ha_device.connect()
示例#6
0
 def setUpClass(cls):
     cls.d = Connection(hostname='Router',
                        start=['mock_device_cli --os nxos --state exec'],
                        os='nxos')
     cls.d.connect()
     cls.md = mock_device.MockDevice(device_os='nxos', state='exec')