Example #1
0
 def test_remove_bond_reattached_to_another_network(self, net_info):
     bonds = {BOND0: {'remove': True}}
     nets = {NET1: {'nic': NICS[0]}, NET0: {'bonding': BOND0}}
     with pytest.raises(ne.ConfigNetworkError) as e:
         valid = validator.Validator(nets, bonds, net_info)
         valid.validate_bond(BOND0)
     assert e.value.errCode == ne.ERR_USED_BOND
Example #2
0
 def test_remove_bond_attached_to_network_that_was_not_removed(
         self, net_info):
     bonds = {BOND0: {'remove': True}}
     with pytest.raises(ne.ConfigNetworkError) as e:
         valid = validator.Validator({}, bonds, net_info)
         valid.validate_bond(BOND0)
     assert e.value.errCode == ne.ERR_USED_BOND
Example #3
0
    def test_add_bond_with_slaves_fail(self, slaves, net_info):
        bonds = {BOND2: {'switch': 'ovs'}}
        if slaves:
            bonds[BOND2]['nics'] = slaves

        with pytest.raises(ne.ConfigNetworkError):
            valid = validator.Validator({}, bonds, net_info)
            valid.validate_bond(BOND2)
Example #4
0
    def test_nic_used_by_new_bond_only(self, net_info):
        bonds_to_add = {'bond1': {'nics': ['eth3', 'eth4']}}

        valid = validator.Validator({}, bonds_to_add, net_info)
        valid.validate_nic_usage()
Example #5
0
    def test_nic_used_by_new_network_only(self, net_info):
        nets_to_add = {'net2': {'nic': 'eth3'}}

        valid = validator.Validator(nets_to_add, {}, net_info)
        valid.validate_nic_usage()
Example #6
0
 def test_vlanned_nic_used_by_new_bond(self, net_info):
     bonds_to_add = {'bond1': {'nics': ['eth10', 'eth11']}}
     with pytest.raises(ne.ConfigNetworkError) as cne_context:
         valid = validator.Validator({}, bonds_to_add, net_info)
         valid.validate_nic_usage()
     assert cne_context.value.errCode == ne.ERR_USED_NIC
Example #7
0
 def test_nic_used_by_new_network_and_current_bond(self, net_info):
     nets_to_add = {'net1': {'nic': 'eth1'}}
     with pytest.raises(ne.ConfigNetworkError) as cne_context:
         valid = validator.Validator(nets_to_add, {}, net_info)
         valid.validate_nic_usage()
     assert cne_context.value.errCode == ne.ERR_USED_NIC
Example #8
0
 def test_network_with_invalid_vlan_id(self, vlan_id, net_info):
     nets = {NET2: {'vlan': vlan_id, 'bridged': True, 'nic': NICS[0]}}
     with pytest.raises(ne.ConfigNetworkError) as cne_context:
         valid = validator.Validator(nets, {}, net_info)
         valid.validate_net(NET2)
     assert cne_context.value.errCode == ne.ERR_BAD_VLAN
Example #9
0
 def test_add_network_with_non_existing_bond(self, net_info):
     nets = {NET2: {'bonding': FAKE_BOND, 'switch': 'ovs'}}
     with pytest.raises(ne.ConfigNetworkError) as e:
         valid = validator.Validator(nets, {}, net_info)
         valid.validate_net(NET2)
     assert e.value.errCode == ne.ERR_BAD_BONDING
Example #10
0
 def test_remove_bond_attached_to_network_that_will_use_nic(self, net_info):
     bonds = {BOND0: {'remove': True}}
     nets = {NET1: {'nic': NICS[0]}}
     valid = validator.Validator(nets, bonds, net_info)
     valid.validate_bond(BOND0)
Example #11
0
 def test_remove_bond_attached_to_network_that_was_removed(self, net_info):
     bonds = {BOND0: {'remove': True}}
     nets = {NET1: {'remove': True}}
     valid = validator.Validator(nets, bonds, net_info)
     valid.validate_bond(BOND0)
Example #12
0
 def test_remove_bond_not_attached_to_a_network(self, net_info):
     bonds = {BOND1: {'remove': True}}
     valid = validator.Validator({}, bonds, net_info)
     valid.validate_bond(BOND1)
Example #13
0
    def test_add_bond_with_slaves_pass(self, slaves, net_info):
        bonds = {BOND2: {'switch': 'ovs', 'nics': slaves}}

        valid = validator.Validator({}, bonds, net_info)
        valid.validate_bond(BOND2)
Example #14
0
 def test_add_network_with_running_bond(self, net_info):
     nets = {NET2: {'bonding': BOND1, 'switch': 'ovs'}}
     valid = validator.Validator(nets, {}, net_info)
     valid.validate_net(NET2)
Example #15
0
 def test_adding_a_new_single_untagged_net(self, net_info):
     nets = {NET2: {'nic': NICS[0], 'switch': 'ovs'}}
     valid = validator.Validator(nets, {}, net_info)
     valid.validate_net(NET2)
Example #16
0
 def test_remove_missing_net_fails(self, net_info):
     nets = {NET2: {'remove': True}}
     with pytest.raises(ne.ConfigNetworkError) as cne:
         valid = validator.Validator(nets, {}, net_info)
         valid.validate_net(NET2)
     assert cne.value.errCode == ne.ERR_BAD_BRIDGE
Example #17
0
 def test_edit_single_untagged_net_nic(self, net_info):
     nets = {NET1: {'nic': NICS[0], 'switch': 'ovs'}}
     valid = validator.Validator(nets, {}, net_info)
     valid.validate_net(NET1)
Example #18
0
 def test_remove_broken_net_succeeds(self, net_info):
     nets = {NET_BROKEN: {'remove': True}}
     valid = validator.Validator(nets, {}, net_info)
     valid.validate_net(NET_BROKEN)
Example #19
0
 def test_add_network_with_to_be_added_bond(self, net_info):
     nets = {NET2: {'bonding': BOND2, 'switch': 'ovs'}}
     bonds = {BOND2: {'nics': NICS[:1], 'switch': 'ovs'}}
     valid = validator.Validator(nets, bonds, net_info)
     valid.validate_net(NET2)
Example #20
0
 def test_add_bond_with_dpdk(self, net_info):
     bonds = {BOND2: {'nics': [NICS[0], DPDK_NIC0], 'switch': 'ovs'}}
     with pytest.raises(ne.ConfigNetworkError):
         valid = validator.Validator({}, bonds, net_info)
         valid.validate_bond(BOND2)