예제 #1
0
def test_that_ip_route_show(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.show(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.show(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "25.23.246.53",
                            "table": 6484,
                            "protocol": "zrizfogj",
                            "type": "oyvbokbq",
                            "scope": "jfddgfyp",
                            "options": "botfbchq",
                        },
                        {
                            # command 2
                            "dst": "67.39.94.245",
                            "table": 9456,
                            "protocol": "ubnkduob",
                            "type": "ddjkrezi",
                            "scope": "smehyqzu",
                            "options": "vpoirlev",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.show(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "25.23.246.53",
                            "table": 6484,
                            "protocol": "zrizfogj",
                            "type": "oyvbokbq",
                            "scope": "jfddgfyp",
                            "options": "botfbchq",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "67.39.94.245",
                            "table": 9456,
                            "protocol": "ubnkduob",
                            "type": "ddjkrezi",
                            "scope": "smehyqzu",
                            "options": "vpoirlev",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #2
0
def test_that_ip_route_replace(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.replace(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.replace(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "201.222.242.61",
                            "tos": 2535,
                            "table": 345,
                            "protocol": "oaswkgyg",
                            "scope": "deowuxgu",
                            "metric": 3101,
                            "via": "53.26.121.162",
                            "dev": "guvkwabx",
                            "weight": 6485,
                            "nhflags": 9661,
                            "mtu": 4306,
                            "advmss": 1302,
                            "rtt": 985,
                            "rttvar": 4168,
                            "reordering": 2429,
                            "window": 888,
                            "cwnd": 9230,
                            "ssthresh": 7059,
                            "realms": 2477,
                            "rto_min": "",
                            "initcwnd": 2972,
                            "initrwnd": 2621,
                            "src": "108.137.169.18",
                            "options": "ddjaqpnk",
                        },
                        {
                            # command 2
                            "dst": "51.233.212.29",
                            "tos": 903,
                            "table": 600,
                            "protocol": "zomjarva",
                            "scope": "emtovppo",
                            "metric": 8678,
                            "via": "54.134.180.144",
                            "dev": "noejzanx",
                            "weight": 3182,
                            "nhflags": 3828,
                            "mtu": 4481,
                            "advmss": 1746,
                            "rtt": 6903,
                            "rttvar": 4617,
                            "reordering": 3920,
                            "window": 6885,
                            "cwnd": 9716,
                            "ssthresh": 3382,
                            "realms": 4105,
                            "rto_min": "",
                            "initcwnd": 2284,
                            "initrwnd": 4532,
                            "src": "201.6.181.33",
                            "options": "tghdiruw",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.replace(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "201.222.242.61",
                            "tos": 2535,
                            "table": 345,
                            "protocol": "oaswkgyg",
                            "scope": "deowuxgu",
                            "metric": 3101,
                            "via": "53.26.121.162",
                            "dev": "guvkwabx",
                            "weight": 6485,
                            "nhflags": 9661,
                            "mtu": 4306,
                            "advmss": 1302,
                            "rtt": 985,
                            "rttvar": 4168,
                            "reordering": 2429,
                            "window": 888,
                            "cwnd": 9230,
                            "ssthresh": 7059,
                            "realms": 2477,
                            "rto_min": "",
                            "initcwnd": 2972,
                            "initrwnd": 2621,
                            "src": "108.137.169.18",
                            "options": "ddjaqpnk",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "51.233.212.29",
                            "tos": 903,
                            "table": 600,
                            "protocol": "zomjarva",
                            "scope": "emtovppo",
                            "metric": 8678,
                            "via": "54.134.180.144",
                            "dev": "noejzanx",
                            "weight": 3182,
                            "nhflags": 3828,
                            "mtu": 4481,
                            "advmss": 1746,
                            "rtt": 6903,
                            "rttvar": 4617,
                            "reordering": 3920,
                            "window": 6885,
                            "cwnd": 9716,
                            "ssthresh": 3382,
                            "realms": 4105,
                            "rto_min": "",
                            "initcwnd": 2284,
                            "initrwnd": 4532,
                            "src": "201.6.181.33",
                            "options": "tghdiruw",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #3
0
def test_that_ip_route_get(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.get(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.get(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "57.196.250.162",
                            "tos": 3141,
                            "options": "eahkjmml",
                        },
                        {
                            # command 2
                            "dst": "4.128.217.170",
                            "tos": 4594,
                            "options": "qphblnpq",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.get(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "57.196.250.162",
                            "tos": 3141,
                            "options": "eahkjmml",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "4.128.217.170",
                            "tos": 4594,
                            "options": "qphblnpq",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #4
0
def test_that_ip_route_change(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.change(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.change(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "125.65.131.176",
                            "tos": 9603,
                            "table": 8109,
                            "protocol": "iwnqskhk",
                            "scope": "yzqdbynt",
                            "metric": 9919,
                            "via": "231.64.246.125",
                            "dev": "cntreexl",
                            "weight": 2025,
                            "nhflags": 8996,
                            "mtu": 2054,
                            "advmss": 3076,
                            "rtt": 1600,
                            "rttvar": 6679,
                            "reordering": 9654,
                            "window": 2644,
                            "cwnd": 4492,
                            "ssthresh": 4672,
                            "realms": 6250,
                            "rto_min": "",
                            "initcwnd": 9684,
                            "initrwnd": 1860,
                            "src": "34.216.220.10",
                            "options": "ckuninpk",
                        },
                        {
                            # command 2
                            "dst": "52.94.2.216",
                            "tos": 7318,
                            "table": 8471,
                            "protocol": "kcptbrqx",
                            "scope": "zuhmvozj",
                            "metric": 1583,
                            "via": "251.23.128.225",
                            "dev": "enalxjrw",
                            "weight": 2847,
                            "nhflags": 402,
                            "mtu": 7355,
                            "advmss": 355,
                            "rtt": 3611,
                            "rttvar": 5182,
                            "reordering": 7882,
                            "window": 5565,
                            "cwnd": 9136,
                            "ssthresh": 410,
                            "realms": 6195,
                            "rto_min": "",
                            "initcwnd": 8993,
                            "initrwnd": 9343,
                            "src": "161.42.66.136",
                            "options": "ymnghdlj",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.change(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "125.65.131.176",
                            "tos": 9603,
                            "table": 8109,
                            "protocol": "iwnqskhk",
                            "scope": "yzqdbynt",
                            "metric": 9919,
                            "via": "231.64.246.125",
                            "dev": "cntreexl",
                            "weight": 2025,
                            "nhflags": 8996,
                            "mtu": 2054,
                            "advmss": 3076,
                            "rtt": 1600,
                            "rttvar": 6679,
                            "reordering": 9654,
                            "window": 2644,
                            "cwnd": 4492,
                            "ssthresh": 4672,
                            "realms": 6250,
                            "rto_min": "",
                            "initcwnd": 9684,
                            "initrwnd": 1860,
                            "src": "34.216.220.10",
                            "options": "ckuninpk",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "52.94.2.216",
                            "tos": 7318,
                            "table": 8471,
                            "protocol": "kcptbrqx",
                            "scope": "zuhmvozj",
                            "metric": 1583,
                            "via": "251.23.128.225",
                            "dev": "enalxjrw",
                            "weight": 2847,
                            "nhflags": 402,
                            "mtu": 7355,
                            "advmss": 355,
                            "rtt": 3611,
                            "rttvar": 5182,
                            "reordering": 7882,
                            "window": 5565,
                            "cwnd": 9136,
                            "ssthresh": 410,
                            "realms": 6195,
                            "rto_min": "",
                            "initcwnd": 8993,
                            "initrwnd": 9343,
                            "src": "161.42.66.136",
                            "options": "ymnghdlj",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #5
0
def test_that_ip_route_append(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.append(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.append(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "159.28.32.77",
                            "tos": 2490,
                            "table": 9001,
                            "protocol": "ktnffgdy",
                            "scope": "dufaxauk",
                            "metric": 8743,
                            "via": "185.62.31.50",
                            "dev": "pboanhso",
                            "weight": 7979,
                            "nhflags": 1887,
                            "mtu": 3890,
                            "advmss": 6818,
                            "rtt": 1231,
                            "rttvar": 4601,
                            "reordering": 6570,
                            "window": 744,
                            "cwnd": 5302,
                            "ssthresh": 6269,
                            "realms": 6784,
                            "rto_min": "",
                            "initcwnd": 697,
                            "initrwnd": 7356,
                            "src": "85.69.172.197",
                            "options": "hkylpngx",
                        },
                        {
                            # command 2
                            "dst": "171.119.109.101",
                            "tos": 9293,
                            "table": 2685,
                            "protocol": "dqizduli",
                            "scope": "udengprw",
                            "metric": 9815,
                            "via": "210.163.214.195",
                            "dev": "ugpzjknr",
                            "weight": 2164,
                            "nhflags": 7150,
                            "mtu": 6590,
                            "advmss": 8892,
                            "rtt": 1763,
                            "rttvar": 8185,
                            "reordering": 3626,
                            "window": 1884,
                            "cwnd": 3768,
                            "ssthresh": 768,
                            "realms": 9907,
                            "rto_min": "",
                            "initcwnd": 7003,
                            "initrwnd": 5331,
                            "src": "148.160.97.230",
                            "options": "ewganlsa",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.append(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "159.28.32.77",
                            "tos": 2490,
                            "table": 9001,
                            "protocol": "ktnffgdy",
                            "scope": "dufaxauk",
                            "metric": 8743,
                            "via": "185.62.31.50",
                            "dev": "pboanhso",
                            "weight": 7979,
                            "nhflags": 1887,
                            "mtu": 3890,
                            "advmss": 6818,
                            "rtt": 1231,
                            "rttvar": 4601,
                            "reordering": 6570,
                            "window": 744,
                            "cwnd": 5302,
                            "ssthresh": 6269,
                            "realms": 6784,
                            "rto_min": "",
                            "initcwnd": 697,
                            "initrwnd": 7356,
                            "src": "85.69.172.197",
                            "options": "hkylpngx",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "171.119.109.101",
                            "tos": 9293,
                            "table": 2685,
                            "protocol": "dqizduli",
                            "scope": "udengprw",
                            "metric": 9815,
                            "via": "210.163.214.195",
                            "dev": "ugpzjknr",
                            "weight": 2164,
                            "nhflags": 7150,
                            "mtu": 6590,
                            "advmss": 8892,
                            "rtt": 1763,
                            "rttvar": 8185,
                            "reordering": 3626,
                            "window": 1884,
                            "cwnd": 3768,
                            "ssthresh": 768,
                            "realms": 9907,
                            "rto_min": "",
                            "initcwnd": 7003,
                            "initrwnd": 5331,
                            "src": "148.160.97.230",
                            "options": "ewganlsa",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #6
0
def test_that_ip_route_delete(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.delete(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.delete(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "181.55.166.136",
                            "tos": 8051,
                            "table": 3867,
                            "protocol": "hfyhwabn",
                            "scope": "bnxmajet",
                            "metric": 3304,
                            "via": "228.53.36.151",
                            "dev": "roqieyqr",
                            "weight": 2247,
                            "nhflags": 9163,
                            "mtu": 4918,
                            "advmss": 2726,
                            "rtt": 1848,
                            "rttvar": 2853,
                            "reordering": 8176,
                            "window": 6211,
                            "cwnd": 7433,
                            "ssthresh": 6549,
                            "realms": 4519,
                            "rto_min": "",
                            "initcwnd": 2454,
                            "initrwnd": 3942,
                            "src": "245.231.129.17",
                            "options": "exigzard",
                        },
                        {
                            # command 2
                            "dst": "54.193.15.49",
                            "tos": 1380,
                            "table": 748,
                            "protocol": "tlmujupc",
                            "scope": "sbmdyzxb",
                            "metric": 5287,
                            "via": "227.43.223.224",
                            "dev": "oabthcyp",
                            "weight": 8539,
                            "nhflags": 6136,
                            "mtu": 1001,
                            "advmss": 8300,
                            "rtt": 1130,
                            "rttvar": 3793,
                            "reordering": 1648,
                            "window": 6547,
                            "cwnd": 3973,
                            "ssthresh": 264,
                            "realms": 1832,
                            "rto_min": "",
                            "initcwnd": 7482,
                            "initrwnd": 5318,
                            "src": "149.254.236.240",
                            "options": "atrhjsma",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.delete(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "181.55.166.136",
                            "tos": 8051,
                            "table": 3867,
                            "protocol": "hfyhwabn",
                            "scope": "bnxmajet",
                            "metric": 3304,
                            "via": "228.53.36.151",
                            "dev": "roqieyqr",
                            "weight": 2247,
                            "nhflags": 9163,
                            "mtu": 4918,
                            "advmss": 2726,
                            "rtt": 1848,
                            "rttvar": 2853,
                            "reordering": 8176,
                            "window": 6211,
                            "cwnd": 7433,
                            "ssthresh": 6549,
                            "realms": 4519,
                            "rto_min": "",
                            "initcwnd": 2454,
                            "initrwnd": 3942,
                            "src": "245.231.129.17",
                            "options": "exigzard",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "54.193.15.49",
                            "tos": 1380,
                            "table": 748,
                            "protocol": "tlmujupc",
                            "scope": "sbmdyzxb",
                            "metric": 5287,
                            "via": "227.43.223.224",
                            "dev": "oabthcyp",
                            "weight": 8539,
                            "nhflags": 6136,
                            "mtu": 1001,
                            "advmss": 8300,
                            "rtt": 1130,
                            "rttvar": 3793,
                            "reordering": 1648,
                            "window": 6547,
                            "cwnd": 3973,
                            "ssthresh": 264,
                            "realms": 1832,
                            "rto_min": "",
                            "initcwnd": 7482,
                            "initrwnd": 5318,
                            "src": "149.254.236.240",
                            "options": "atrhjsma",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #7
0
def test_that_ip_route_restore(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.restore(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.restore(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                        },
                        {
                            # command 2
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.restore(
            input_data=[
                {
                    # device 1
                    "test_dev1": [{}],
                    # device 2
                    "test_dev2": [{}],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #8
0
def test_that_ip_route_add(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.add(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.add(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "155.211.189.213",
                            "tos": 7867,
                            "table": 6494,
                            "protocol": "xmvgyexv",
                            "scope": "svoyfcry",
                            "metric": 836,
                            "via": "31.204.150.170",
                            "dev": "aoemihxm",
                            "weight": 3182,
                            "nhflags": 3348,
                            "mtu": 604,
                            "advmss": 2061,
                            "rtt": 4886,
                            "rttvar": 3407,
                            "reordering": 1142,
                            "window": 8680,
                            "cwnd": 2580,
                            "ssthresh": 1632,
                            "realms": 7422,
                            "rto_min": "",
                            "initcwnd": 800,
                            "initrwnd": 7005,
                            "src": "59.132.167.246",
                            "options": "bvfryxen",
                        },
                        {
                            # command 2
                            "dst": "229.240.253.196",
                            "tos": 2951,
                            "table": 421,
                            "protocol": "zvwvlvgn",
                            "scope": "hwptdgax",
                            "metric": 8241,
                            "via": "177.172.227.147",
                            "dev": "miwbdgvj",
                            "weight": 2037,
                            "nhflags": 1388,
                            "mtu": 8585,
                            "advmss": 2493,
                            "rtt": 5166,
                            "rttvar": 4772,
                            "reordering": 8294,
                            "window": 2166,
                            "cwnd": 7501,
                            "ssthresh": 6135,
                            "realms": 9597,
                            "rto_min": "",
                            "initcwnd": 139,
                            "initrwnd": 7105,
                            "src": "172.124.116.132",
                            "options": "sdvrfurp",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.add(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "155.211.189.213",
                            "tos": 7867,
                            "table": 6494,
                            "protocol": "xmvgyexv",
                            "scope": "svoyfcry",
                            "metric": 836,
                            "via": "31.204.150.170",
                            "dev": "aoemihxm",
                            "weight": 3182,
                            "nhflags": 3348,
                            "mtu": 604,
                            "advmss": 2061,
                            "rtt": 4886,
                            "rttvar": 3407,
                            "reordering": 1142,
                            "window": 8680,
                            "cwnd": 2580,
                            "ssthresh": 1632,
                            "realms": 7422,
                            "rto_min": "",
                            "initcwnd": 800,
                            "initrwnd": 7005,
                            "src": "59.132.167.246",
                            "options": "bvfryxen",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "229.240.253.196",
                            "tos": 2951,
                            "table": 421,
                            "protocol": "zvwvlvgn",
                            "scope": "hwptdgax",
                            "metric": 8241,
                            "via": "177.172.227.147",
                            "dev": "miwbdgvj",
                            "weight": 2037,
                            "nhflags": 1388,
                            "mtu": 8585,
                            "advmss": 2493,
                            "rtt": 5166,
                            "rttvar": 4772,
                            "reordering": 8294,
                            "window": 2166,
                            "cwnd": 7501,
                            "ssthresh": 6135,
                            "realms": 9597,
                            "rto_min": "",
                            "initcwnd": 139,
                            "initrwnd": 7105,
                            "src": "172.124.116.132",
                            "options": "sdvrfurp",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #9
0
def test_that_ip_route_save(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.save(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.save(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "table": 5545,
                            "protocol": "byojpiar",
                            "type": "xnbuneam",
                            "scope": "wumotmcr",
                            "options": "vvbxajdj",
                        },
                        {
                            # command 2
                            "table": 1989,
                            "protocol": "kzwaoszl",
                            "type": "wsjmpyvk",
                            "scope": "yhprvykz",
                            "options": "hsuubxjy",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.save(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "table": 5545,
                            "protocol": "byojpiar",
                            "type": "xnbuneam",
                            "scope": "wumotmcr",
                            "options": "vvbxajdj",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "table": 1989,
                            "protocol": "kzwaoszl",
                            "type": "wsjmpyvk",
                            "scope": "yhprvykz",
                            "options": "hsuubxjy",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0
예제 #10
0
def test_that_ip_route_flush(capfd):

    dv1 = TestDevice(platform="dentos")
    dv2 = TestDevice(platform="dentos")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.flush(
            input_data=[
                {
                    # device 1
                    "test_dev": [{}],
                }
            ],
            device_obj={"test_dev": dv1},
        )
    )
    print(out)
    assert "command" in out[0]["test_dev"].keys()
    assert "result" in out[0]["test_dev"].keys()
    # check the rc
    assert out[0]["test_dev"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.flush(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "dst": "37.50.154.22",
                            "table": 9163,
                            "protocol": "ksruhkev",
                            "type": "abhyjycd",
                            "scope": "utrzwinr",
                            "options": "iogfyncr",
                        },
                        {
                            # command 2
                            "dst": "2.192.188.186",
                            "table": 610,
                            "protocol": "icolfkfc",
                            "type": "khveasmy",
                            "scope": "pqhqotta",
                            "options": "dlizefsr",
                        },
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0

    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        IpRoute.flush(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "dst": "37.50.154.22",
                            "table": 9163,
                            "protocol": "ksruhkev",
                            "type": "abhyjycd",
                            "scope": "utrzwinr",
                            "options": "iogfyncr",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "dst": "2.192.188.186",
                            "table": 610,
                            "protocol": "icolfkfc",
                            "type": "khveasmy",
                            "scope": "pqhqotta",
                            "options": "dlizefsr",
                        }
                    ],
                }
            ],
            device_obj={"test_dev1": dv1, "test_dev2": dv2},
        )
    )
    print(out)
    # check if the command was formed
    assert "command" in out[0]["test_dev1"].keys()
    assert "command" in out[1]["test_dev2"].keys()
    # check if the result was formed
    assert "result" in out[0]["test_dev1"].keys()
    assert "result" in out[1]["test_dev2"].keys()
    # check the rc
    assert out[0]["test_dev1"]["rc"] == 0
    assert out[1]["test_dev2"]["rc"] == 0