Exemple #1
0
 def test_remove_bond_attached_to_network_that_was_removed(self):
     fake_kernel_nics = ['eth0', 'eth1']
     nets = {'net1': {'remove': True}}
     running_nets = {'net1': {'bond': 'bond1'}}
     with self.assertNotRaises():
         ovs_validator.validate_bond_configuration(
             'bond1', {'remove': True, 'switch': 'ovs'}, nets, running_nets,
             fake_kernel_nics)
Exemple #2
0
 def test_add_bond_with_no_slaves(self):
     fake_kernel_nics = []
     nets = {}
     running_nets = {}
     with self.assertRaises(ne.ConfigNetworkError):
         ovs_validator.validate_bond_configuration(
             'bond1', {'switch': 'ovs'}, nets, running_nets,
             fake_kernel_nics)
Exemple #3
0
 def test_add_bond_with_two_slaves(self):
     fake_kernel_nics = ['eth0', 'eth1']
     nets = {}
     running_nets = {}
     with self.assertNotRaises():
         ovs_validator.validate_bond_configuration(
             'bond1', {'nics': ['eth0', 'eth1'], 'switch': 'ovs'}, nets,
             running_nets, fake_kernel_nics)
Exemple #4
0
 def test_remove_bond_attached_to_a_network(self):
     fake_kernel_nics = ['eth0', 'eth1']
     nets = {}
     running_nets = {}
     with self.assertNotRaises():
         ovs_validator.validate_bond_configuration(
             'bond1', {'remove': True}, nets, running_nets,
             fake_kernel_nics)
Exemple #5
0
 def test_add_bond_with_one_slave_twice(self):
     fake_kernel_nics = ['eth0']
     nets = {}
     running_nets = {}
     with self.assertRaises(ne.ConfigNetworkError):
         ovs_validator.validate_bond_configuration(
             'bond1', {'nics': ['eth0', 'eth0'], 'switch': 'ovs'}, nets,
             running_nets, fake_kernel_nics)
Exemple #6
0
 def test_remove_bond_attached_to_network_that_was_not_removed(self):
     fake_kernel_nics = ['eth0', 'eth1']
     nets = {}
     running_nets = {'net1': {'bond': 'bond1'}}
     with self.assertRaises(ne.ConfigNetworkError) as e:
         ovs_validator.validate_bond_configuration(
             'bond1', {'remove': True, 'switch': 'ovs'}, nets, running_nets,
             fake_kernel_nics)
     self.assertEquals(e.exception[0], ne.ERR_USED_BOND)
Exemple #7
0
 def test_remove_bond_reattached_to_another_network(self):
     fake_kernel_nics = ['eth0', 'eth1', 'eth2']
     nets = {'net1': {'nic': 'eth0'}, 'net2': {'bonding': 'bond1'}}
     running_nets = {'net1': {'bond': 'bond1'}}
     with self.assertRaises(ne.ConfigNetworkError) as e:
         ovs_validator.validate_bond_configuration(
             'bond1', {'remove': True}, nets, running_nets,
             fake_kernel_nics)
     self.assertEquals(e.exception[0], ne.ERR_USED_BOND)