예제 #1
0
    def test_validate_mac_restriced_mode_with_desire_has_no_mac(self):
        cur_iface_info = self._gen_iface_info()
        cur_iface_info[Interface.MAC] = MAC_ADDRESS1
        cur_iface = BondIface(cur_iface_info)
        iface_info = self._gen_iface_info()
        iface_info[Bond.CONFIG_SUBTREE][Bond.MODE] = BondMode.ACTIVE_BACKUP
        iface_info[Bond.CONFIG_SUBTREE][Bond.OPTIONS_SUBTREE] = {
            "fail_over_mac": "active"
        }
        iface = BondIface(iface_info)

        iface.merge(cur_iface)
        iface.pre_edit_validation_and_cleanup()
예제 #2
0
    def test_validate_mac_restriced_mode_with_desire_has_mac_only(self):
        cur_iface_info = self._gen_iface_info()
        cur_iface_info[Bond.CONFIG_SUBTREE][Bond.MODE] = BondMode.ACTIVE_BACKUP
        cur_iface_info[Bond.CONFIG_SUBTREE][Bond.OPTIONS_SUBTREE] = {
            "fail_over_mac": "active"
        }
        cur_iface = BondIface(cur_iface_info)
        iface_info = self._gen_iface_info()
        iface_info[Bond.CONFIG_SUBTREE].pop(Bond.MODE)
        iface_info[Bond.CONFIG_SUBTREE].pop(Bond.OPTIONS_SUBTREE)
        iface_info[Interface.MAC] = MAC_ADDRESS1
        iface = BondIface(iface_info)

        iface.merge(cur_iface)
        with pytest.raises(NmstateValueError):
            iface.pre_edit_validation_and_cleanup()