예제 #1
0
def test_same_devices_missing():
    with pytest.raises(KeyError, match="Different devices"):
        o_ifaces = {
            "topo-r01": {
                "eth0": "90.4.1.3/24",
                "eth1": "231.3.2.1/24",
                "eth2": "192.168.90.4/24",
            },
            "topo-r02": {
                "enp0": "45.2.3.1/24",
                "enp1": "85.14.4.4/24",
                "enp2": "122.56.2.1/24",
                "enp3": "92.14.45.8/24",
            }
        }

        s_ifaces = {
            "topo-r01": {
                "eth10": "10.4.1.3/24",
                "eth12": "10.3.2.1/24",
                "eth23": "10.168.90.4/24",
            },
            "topo-r02": {
                "enp01": "10.2.3.1/24",
                "enp13": "10.14.4.4/24",
                "enp23": "10.56.2.1/24",
                "enp32": "10.14.45.8/24",
            },
            "topo-r03": {
                "weth10": "10.45.3.55/24",
            }
        }

        nat_ifaces.check_same_devices(o_ifaces, s_ifaces)
예제 #2
0
def test_same_devices_fail_empty_sim():
    with pytest.raises(KeyError, match="No devices in sim file"):
        o_ifaces = {
            "topo-r01": {
                "eth10": "10.4.1.3/24",
                "eth12": "10.3.2.1/24",
                "eth23": "10.168.90.4/24",
            },
            "topo-r02": {
                "enp01": "10.2.3.1/24",
                "enp13": "10.14.4.4/24",
                "enp23": "10.56.2.1/24",
                "enp32": "10.14.45.8/24",
            },
            "topo-r03": {
                "weth10": "10.45.3.55/24",
            }
        }

        s_ifaces = {}

        nat_ifaces.check_same_devices(o_ifaces, s_ifaces)
예제 #3
0
def test_same_devices():
    o_ifaces = {
        "topo-r01": {
            "eth0": "90.4.1.3/24",
            "eth1": "231.3.2.1/24",
            "eth2": "192.168.90.4/24",
        },
        "topo-r02": {
            "enp0": "45.2.3.1/24",
            "enp1": "85.14.4.4/24",
            "enp2": "122.56.2.1/24",
            "enp3": "92.14.45.8/24",
        },
        "topo-r03": {
            "weth0": "115.45.3.55/24",
        }
    }

    s_ifaces = {
        "topo-r01": {
            "eth10": "10.4.1.3/24",
            "eth12": "10.3.2.1/24",
            "eth23": "10.168.90.4/24",
        },
        "topo-r02": {
            "enp01": "10.2.3.1/24",
            "enp13": "10.14.4.4/24",
            "enp23": "10.56.2.1/24",
            "enp32": "10.14.45.8/24",
        },
        "topo-r03": {
            "weth10": "10.45.3.55/24",
        }
    }

    nat_ifaces.check_same_devices(o_ifaces, s_ifaces)