Exemplo n.º 1
0
    def test_use_active_iface(self):
        cli = LinuxCLI(log_cmd=True)
        h = Host('test', None, cli, lambda name: None, lambda name: None)
        i = Interface('testi', h, ip_addr=['192.168.0.2'])
        cli.cmd('ip l add dev testi type dummy')
        self.assertTrue(cli.grep_cmd('ip l | grep testi', 'state DOWN'))

        i.up()

        time.sleep(1)
        self.assertTrue(cli.grep_cmd('ip l | grep testi', 'UP'))

        i.down()

        self.assertFalse(cli.grep_cmd('ip l | grep testi', 'UP'))

        cli.cmd('ip l del testi')
Exemplo n.º 2
0
 def is_installed(self, package):
     cli = LinuxCLI()
     if not cli.grep_cmd('dpkg -l', package):
         return False
     return True