Ejemplo n.º 1
0
def _preserve_iface_state(dev):
    dev_was_up = iface.is_up(dev)
    try:
        yield
    finally:
        if dev_was_up and not iface.is_up(dev):
            iface.up(dev)
Ejemplo n.º 2
0
 def test_bond_devices_are_up(self):
     with dummy_devices(2) as (nic1, nic2):
         with bond_device() as bond:
             bond.add_slaves((nic1, nic2))
             bond.up()
             self.assertTrue(iface.is_up(nic1))
             self.assertTrue(iface.is_up(nic2))
             self.assertTrue(iface.is_up(bond.master))
Ejemplo n.º 3
0
 def test_bond_devices_are_up(self):
     with dummy_devices(2) as (nic1, nic2):
         with bond_device() as bond:
             bond.add_slaves((nic1, nic2))
             bond.up()
             self.assertTrue(iface.is_up(nic1))
             self.assertTrue(iface.is_up(nic2))
             self.assertTrue(iface.is_up(bond.master))
Ejemplo n.º 4
0
 def test_iface_down(self):
     with dummy_device() as nic:
         iface.up(nic)
         iface.down(nic)
         self.assertFalse(iface.is_up(nic))
Ejemplo n.º 5
0
 def test_iface_up(self):
     with dummy_device() as nic:
         iface.up(nic)
         self.assertTrue(iface.is_up(nic))
Ejemplo n.º 6
0
 def test_iface_down(self):
     with dummy_device() as nic:
         iface.up(nic)
         iface.down(nic)
         self.assertFalse(iface.is_up(nic))
Ejemplo n.º 7
0
 def test_iface_up(self):
     with dummy_device() as nic:
         iface.up(nic)
         self.assertTrue(iface.is_up(nic))
Ejemplo n.º 8
0
 def test_bond_with_slaves(self):
     with dummy_devices(2) as (nic1, nic2):
         with bond_device() as bond:
             bond.add_slaves((nic1, nic2))
             self.assertFalse(iface.is_up(bond.master))
Ejemplo n.º 9
0
 def test_bond_without_slaves(self):
     with bond_device() as bond:
         self.assertFalse(iface.is_up(bond.master))
Ejemplo n.º 10
0
 def test_bond_with_slaves(self):
     with dummy_devices(2) as (nic1, nic2):
         with bond_device() as bond:
             bond.add_slaves((nic1, nic2))
             self.assertFalse(iface.is_up(bond.master))
Ejemplo n.º 11
0
 def test_bond_without_slaves(self):
     with bond_device() as bond:
         self.assertFalse(iface.is_up(bond.master))