Esempio n. 1
0
    def test_state_for_verify_remove_undesired_data(self):
        iface_info = gen_foo_iface_info()
        expected_iface_info = deepcopy(iface_info)

        iface = BaseIface(iface_info)
        iface.raw["foo_a"] = "b"

        assert iface.state_for_verify() == expected_iface_info
Esempio n. 2
0
    def test_state_for_verify_empty_description(self):
        iface_info = gen_foo_iface_info()
        expected_iface_info = deepcopy(iface_info)

        iface_info[Interface.DESCRIPTION] = ""

        iface = BaseIface(iface_info)

        assert iface.state_for_verify() == expected_iface_info
Esempio n. 3
0
    def test_capitalize_mac(self):
        iface_info = gen_foo_iface_info()
        iface_info.update({Interface.MAC: MAC_ADDRESS1})

        expected_info = deepcopy(iface_info)
        iface_info[Interface.MAC] = iface_info[Interface.MAC].lower()

        iface = BaseIface(iface_info)

        assert iface.state_for_verify() == expected_info
Esempio n. 4
0
    def test_state_for_verify_remove_link_local_address(self):
        iface_info = gen_foo_iface_info()
        ipv6_info = {
            InterfaceIPv6.ENABLED: True,
            InterfaceIPv6.ADDRESS: IPV6_ADDRESSES,
        }
        iface_info[Interface.IPV6] = ipv6_info
        expected_iface_info = deepcopy(iface_info)

        iface_info[Interface.IPV6][InterfaceIPv6.ADDRESS].append({
            InterfaceIPv6.ADDRESS_IP:
            IPV6_LINK_LOCAL_ADDRESS1,
            InterfaceIPv6.ADDRESS_PREFIX_LENGTH:
            64,
        })
        iface = BaseIface(iface_info)

        assert iface.state_for_verify() == expected_iface_info