def test_login_shellexec(self):
     c = Connection(hostname='switch',
                    start=['mock_device_cli --os nxos_mds --state exec'],
                    os='nxos',
                    series='mds',
                    username='******',
                    tacacs_password='******')
     c.shellexec(['ls'])
     assert c.spawn.match.match_output == 'exit\r\nswitch#'
예제 #2
0
 def test_login_shellexec(self):
     c = Connection(
         hostname='switch',
         start=['mock_device_cli --os nxos_mds --state exec'],
         os='nxos',
         platform='mds',
         credentials=dict(default=dict(username='******', password='******')),
         mit=True)
     c.shellexec(['ls'])
     assert c.spawn.match.match_output == 'exit\r\nswitch#'
예제 #3
0
 def test_shellexec_n3k(self):
     c = Connection(hostname='switch',
                    start=['mock_device_cli --os nxos --state exec_n3k'],
                    os='nxos',
                    platform='n3k',
                    username='******',
                    tacacs_password='******')
     c.shellexec(['ls'])
     assert c.spawn.match.match_output == 'exit\r\nswitch# '
     c.disconnect()
    def test_shellexec(self):
        c = Connection(hostname='switch',
                       start=['mock_device_cli --os nxos --state exec'],
                       os='nxos',
                       username='******',
                       tacacs_password='******')

        output = c.shellexec(['sudo yum list installed | grep n9000'])
        assert output == "\r\n".join("""\
sudo yum list installed | grep n9000
base-files.n9000                        3.0.14-r74.2                   installed
bfd.lib32_n9000                         1.0.0-r0                       installed
bash-4.2$""".splitlines())

        assert c.spawn.match.match_output == 'exit\r\nswitch# '