Exemplo n.º 1
0
def test_that_traffic_gen_get_stats(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.get_stats(
            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(
        TrafficGen.get_stats(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "traffic_names": ["duydohcz", "yzgiepli", "pfwflhqt"],
                            "ports": [
                                "wduvyaox",
                                "pvuzelol",
                                "ertdoksj",
                                "vnxsykpx",
                                "rkhrarfl",
                                "lubdrwcw",
                                "quwynymt",
                                "yaxechlt",
                            ],
                        },
                        {
                            # command 2
                            "traffic_names": ["jrunktfe", "ikcntizn", "wrrwypfo"],
                            "ports": ["eisalhpa", "fhxivukf", "sedchzgn", "ajctkfdt"],
                        },
                    ],
                }
            ],
            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(
        TrafficGen.get_stats(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "traffic_names": ["duydohcz", "yzgiepli", "pfwflhqt"],
                            "ports": [
                                "wduvyaox",
                                "pvuzelol",
                                "ertdoksj",
                                "vnxsykpx",
                                "rkhrarfl",
                                "lubdrwcw",
                                "quwynymt",
                                "yaxechlt",
                            ],
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "traffic_names": ["jrunktfe", "ikcntizn", "wrrwypfo"],
                            "ports": ["eisalhpa", "fhxivukf", "sedchzgn", "ajctkfdt"],
                        }
                    ],
                }
            ],
            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
Exemplo n.º 2
0
def test_that_traffic_gen_clear_stats(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.clear_stats(
            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(
        TrafficGen.clear_stats(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "traffic_names": [
                                "hlngtliw",
                                "hkekrayz",
                                "oigyjkfq",
                                "dirptfwh",
                                "fbohcgds",
                                "ilrbgawb",
                            ],
                            "ports": [
                                "vdrsshmp",
                                "ikhkentb",
                                "ydguurth",
                                "jriwcnhm",
                                "trsnmlzr",
                                "rtribcgj",
                                "rkjtvput",
                                "xnnbfibh",
                                "bdnbhsxb",
                                "qljvcwde",
                            ],
                        },
                        {
                            # command 2
                            "traffic_names": ["qeytqjjj", "wbrgjirr", "taeorpyg"],
                            "ports": [
                                "bgcapdhn",
                                "owxahvbc",
                                "ouvhegft",
                                "rvjssmpj",
                                "wsjhtknt",
                                "yktdslpc",
                                "xiotgqgx",
                                "qdbcohpk",
                                "ujlnkmol",
                                "zrnukfaz",
                            ],
                        },
                    ],
                }
            ],
            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(
        TrafficGen.clear_stats(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "traffic_names": [
                                "hlngtliw",
                                "hkekrayz",
                                "oigyjkfq",
                                "dirptfwh",
                                "fbohcgds",
                                "ilrbgawb",
                            ],
                            "ports": [
                                "vdrsshmp",
                                "ikhkentb",
                                "ydguurth",
                                "jriwcnhm",
                                "trsnmlzr",
                                "rtribcgj",
                                "rkjtvput",
                                "xnnbfibh",
                                "bdnbhsxb",
                                "qljvcwde",
                            ],
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "traffic_names": ["qeytqjjj", "wbrgjirr", "taeorpyg"],
                            "ports": [
                                "bgcapdhn",
                                "owxahvbc",
                                "ouvhegft",
                                "rvjssmpj",
                                "wsjhtknt",
                                "yktdslpc",
                                "xiotgqgx",
                                "qdbcohpk",
                                "ujlnkmol",
                                "zrnukfaz",
                            ],
                        }
                    ],
                }
            ],
            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
Exemplo n.º 3
0
def test_that_traffic_gen_start_traffic(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.start_traffic(
            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(
        TrafficGen.start_traffic(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "traffic_names": ["ikjyhqbf"],
                            "ports": ["ttfwpgia", "kpzpzdkz", "waxkpbls", "gcgsjihs", "riqyplju"],
                        },
                        {
                            # command 2
                            "traffic_names": [
                                "fgqrjfby",
                                "crleyzdm",
                                "xwremako",
                                "hkjywkxx",
                                "igqfmohu",
                            ],
                            "ports": [
                                "oipztjqc",
                                "nlwugnpw",
                                "dffwpmkc",
                                "oyvloqhr",
                                "okwlaekn",
                                "qcjwxprr",
                                "oosjsdgx",
                            ],
                        },
                    ],
                }
            ],
            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(
        TrafficGen.start_traffic(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "traffic_names": ["ikjyhqbf"],
                            "ports": ["ttfwpgia", "kpzpzdkz", "waxkpbls", "gcgsjihs", "riqyplju"],
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "traffic_names": [
                                "fgqrjfby",
                                "crleyzdm",
                                "xwremako",
                                "hkjywkxx",
                                "igqfmohu",
                            ],
                            "ports": [
                                "oipztjqc",
                                "nlwugnpw",
                                "dffwpmkc",
                                "oyvloqhr",
                                "okwlaekn",
                                "qcjwxprr",
                                "oosjsdgx",
                            ],
                        }
                    ],
                }
            ],
            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
Exemplo n.º 4
0
def test_that_traffic_gen_stop_traffic(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.stop_traffic(
            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(
        TrafficGen.stop_traffic(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "traffic_names": [
                                "cnxowlxi",
                                "amggqwlj",
                                "zbustlgt",
                                "jhwunyhw",
                                "eyeeizsq",
                                "jaqeurln",
                            ],
                            "ports": [
                                "lszssclo",
                                "sbunzxvu",
                                "ufggaqvk",
                                "xeotdxll",
                                "tnnvxmwc",
                                "atrqevkg",
                            ],
                        },
                        {
                            # command 2
                            "traffic_names": ["kngwtran", "zjgrrmhl", "hxejsvnt"],
                            "ports": [
                                "qnukekwg",
                                "bbystame",
                                "djrqomxo",
                                "uzozpnva",
                                "ewbrrobh",
                                "oumckkln",
                                "utjfbadm",
                                "orzwdobu",
                                "rbytcgqv",
                                "oehavcdo",
                            ],
                        },
                    ],
                }
            ],
            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(
        TrafficGen.stop_traffic(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "traffic_names": [
                                "cnxowlxi",
                                "amggqwlj",
                                "zbustlgt",
                                "jhwunyhw",
                                "eyeeizsq",
                                "jaqeurln",
                            ],
                            "ports": [
                                "lszssclo",
                                "sbunzxvu",
                                "ufggaqvk",
                                "xeotdxll",
                                "tnnvxmwc",
                                "atrqevkg",
                            ],
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "traffic_names": ["kngwtran", "zjgrrmhl", "hxejsvnt"],
                            "ports": [
                                "qnukekwg",
                                "bbystame",
                                "djrqomxo",
                                "uzozpnva",
                                "ewbrrobh",
                                "oumckkln",
                                "utjfbadm",
                                "orzwdobu",
                                "rbytcgqv",
                                "oehavcdo",
                            ],
                        }
                    ],
                }
            ],
            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
Exemplo n.º 5
0
def test_that_traffic_gen_set_traffic(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.set_traffic(
            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(
        TrafficGen.set_traffic(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "traffic_names": [
                                "hkflsbfc",
                                "zrfnfspj",
                                "ceaoxmuq",
                                "ubhdndlm",
                                "itgklylk",
                                "amvwcfba",
                                "pjetwolm",
                                "ehuliexk",
                                "ilgmqatr",
                                "pgmhhttu",
                            ],
                            "ports": ["exqemwyj", "qucldvdo", "suscrmat"],
                        },
                        {
                            # command 2
                            "traffic_names": [
                                "ctiwwydl",
                                "sgmgylqt",
                                "zohbtbkb",
                                "ntzqxfdb",
                                "ykmghjdp",
                                "acxpfemo",
                            ],
                            "ports": [
                                "peupfbgw",
                                "rdqzjono",
                                "oenhxvii",
                                "vtpsmiby",
                                "wdyvcajo",
                                "oyeuhwol",
                            ],
                        },
                    ],
                }
            ],
            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(
        TrafficGen.set_traffic(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "traffic_names": [
                                "hkflsbfc",
                                "zrfnfspj",
                                "ceaoxmuq",
                                "ubhdndlm",
                                "itgklylk",
                                "amvwcfba",
                                "pjetwolm",
                                "ehuliexk",
                                "ilgmqatr",
                                "pgmhhttu",
                            ],
                            "ports": ["exqemwyj", "qucldvdo", "suscrmat"],
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "traffic_names": [
                                "ctiwwydl",
                                "sgmgylqt",
                                "zohbtbkb",
                                "ntzqxfdb",
                                "ykmghjdp",
                                "acxpfemo",
                            ],
                            "ports": [
                                "peupfbgw",
                                "rdqzjono",
                                "oenhxvii",
                                "vtpsmiby",
                                "wdyvcajo",
                                "oyeuhwol",
                            ],
                        }
                    ],
                }
            ],
            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
Exemplo n.º 6
0
def test_that_traffic_gen_save_config(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.save_config(
            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(
        TrafficGen.save_config(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "config_file_name": "nfvvintd",
                        },
                        {
                            # command 2
                            "config_file_name": "edmxdpno",
                        },
                    ],
                }
            ],
            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(
        TrafficGen.save_config(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "config_file_name": "nfvvintd",
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "config_file_name": "edmxdpno",
                        }
                    ],
                }
            ],
            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
Exemplo n.º 7
0
def test_that_traffic_gen_clear_protocol_stats(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.clear_protocol_stats(
            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(
        TrafficGen.clear_protocol_stats(
            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(
        TrafficGen.clear_protocol_stats(
            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
Exemplo n.º 8
0
def test_that_traffic_gen_connect(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.connect(
            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(
        TrafficGen.connect(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "client_addr": "171.79.33.163",
                            "ports": ["lncslgtj"],
                        },
                        {
                            # command 2
                            "client_addr": "132.222.24.200",
                            "ports": [
                                "ftoaegnm",
                                "fcywhksh",
                                "hsltgwok",
                                "adfvoqaz",
                                "okyxhdif",
                                "nazfpqpi",
                            ],
                        },
                    ],
                }
            ],
            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(
        TrafficGen.connect(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "client_addr": "171.79.33.163",
                            "ports": ["lncslgtj"],
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "client_addr": "132.222.24.200",
                            "ports": [
                                "ftoaegnm",
                                "fcywhksh",
                                "hsltgwok",
                                "adfvoqaz",
                                "okyxhdif",
                                "nazfpqpi",
                            ],
                        }
                    ],
                }
            ],
            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
Exemplo n.º 9
0
def test_that_traffic_gen_disconnect(capfd):

    dv1 = TestDevice(platform="ixnetwork")
    dv2 = TestDevice(platform="ixnetwork")
    loop = asyncio.get_event_loop()
    out = loop.run_until_complete(
        TrafficGen.disconnect(
            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(
        TrafficGen.disconnect(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            # command 1
                            "client_addr": "26.151.204.214",
                            "ports": ["ucuqwtvq", "bnrifsvh", "midaeipl", "isrvssjo"],
                        },
                        {
                            # command 2
                            "client_addr": "200.184.74.193",
                            "ports": [
                                "xakwsekl",
                                "lcywtlqs",
                                "migtzcyu",
                                "zsulxyhz",
                                "ggueypdh",
                                "losozpeg",
                                "rezxtbdd",
                                "bwtcfjvl",
                                "wgpykapj",
                                "eeqfemnx",
                            ],
                        },
                    ],
                }
            ],
            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(
        TrafficGen.disconnect(
            input_data=[
                {
                    # device 1
                    "test_dev1": [
                        {
                            "client_addr": "26.151.204.214",
                            "ports": ["ucuqwtvq", "bnrifsvh", "midaeipl", "isrvssjo"],
                        }
                    ],
                    # device 2
                    "test_dev2": [
                        {
                            "client_addr": "200.184.74.193",
                            "ports": [
                                "xakwsekl",
                                "lcywtlqs",
                                "migtzcyu",
                                "zsulxyhz",
                                "ggueypdh",
                                "losozpeg",
                                "rezxtbdd",
                                "bwtcfjvl",
                                "wgpykapj",
                                "eeqfemnx",
                            ],
                        }
                    ],
                }
            ],
            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