def test_command_cisco_exec(self): c = Connection(hostname='ncs', start=['mock_device_cli --os confd --state cisco_exec'], os='confd', username='******', tacacs_password='******') c.connect() r = c.command('screen-length 0') self.assertEqual(r, "screen-length 0\r\nuser@ncs# ")
def test_juniper_execute_switch_cli_configure(self): c = Connection( hostname='ncs', start=['mock_device_cli --os confd --state cisco_login'], os='confd', username='******', tacacs_password='******') c.connect() c.command('switch cli') c.execute('configure') self.assertEqual( "\n".join(c.spawn.match.match_output.splitlines()), """\ configure Entering configuration mode private [ok][1970-01-01 00:00:00] [edit] user@ncs% """)
def test_command_juniper_exec(self): c = Connection( hostname='ncs', start=['mock_device_cli --os confd --state juniper_exec'], os='confd', username='******', tacacs_password='******') c.connect() r = c.command('set screen length 0') assert r == "set screen length 0\r\nuser@ncs> "
def test_command_cisco_config(self): c = Connection(hostname='ncs', start=['mock_device_cli --os confd --state cisco_exec'], os='confd', username='******', tacacs_password='******') c.connect() r = c.command('config') self.assertEqual( "\n".join(r.splitlines()), """config Entering configuration mode terminal user@ncs(config)# """)
def test_command_juniper_config(self): c = Connection( hostname='ncs', start=['mock_device_cli --os confd --state juniper_config'], os='confd', username='******', tacacs_password='******') c.connect() r = c.command('configure') self.assertEqual( "\n".join(r.splitlines()), """configure Entering configuration mode private [ok][1970-01-01 00:00:00] [edit] user@ncs% """)