X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FHoststackUtil.py;h=7e6ba569137e54de1c6b3b06f256010766e3d8d9;hp=e797c3c206540e5f45fbe1ab50cddcb9d7aae34b;hb=6da5a6920171682bd5bf6a77517bedfef91cbd0e;hpb=9377c956a86e42727039d9dab8879c10c9399f4c diff --git a/resources/libraries/python/HoststackUtil.py b/resources/libraries/python/HoststackUtil.py index e797c3c206..7e6ba56913 100644 --- a/resources/libraries/python/HoststackUtil.py +++ b/resources/libraries/python/HoststackUtil.py @@ -35,7 +35,6 @@ class HoststackUtil(): 'args' - command arguments. :rtype: dict """ - # TODO: Use a python class instead of dictionary for the return type proto = vpp_echo_attributes[u"uri_protocol"] addr = vpp_echo_attributes[u"uri_ip4_addr"] port = vpp_echo_attributes[u"uri_port"] @@ -71,7 +70,6 @@ class HoststackUtil(): 'args' - command arguments. :rtype: dict """ - # TODO: Use a python class instead of dictionary for the return type iperf3_cmd = {} iperf3_cmd[u"env_vars"] = f"VCL_CONFIG={Constants.REMOTE_FW_DIR}/" \ f"{Constants.RESOURCES_TPL_VCL}/" \ @@ -86,6 +84,7 @@ class HoststackUtil(): ip_address = f" {iperf3_attributes[u'ip_address']}" if u"ip_address" \ in iperf3_attributes else u"" iperf3_cmd[u"name"] = u"iperf3" + # TODO: Use OptionString library. iperf3_cmd[u"args"] = f"--{iperf3_attributes[u'role']}{ip_address} " \ f"--interval 0{json_results} " \ f"--version{iperf3_attributes[u'ip_version']}" @@ -100,6 +99,13 @@ class HoststackUtil(): if u"time" in iperf3_attributes: iperf3_cmd[u"args"] += \ f" --time {iperf3_attributes[u'time']}" + if iperf3_attributes[u"udp"]: + iperf3_cmd[u"args"] += u" --udp" + iperf3_cmd[u"args"] += \ + f" --bandwidth {iperf3_attributes[u'bandwidth']}" + if iperf3_attributes[u"length"] > 0: + iperf3_cmd[u"args"] += \ + f" --length {iperf3_attributes[u'length']}" return iperf3_cmd @staticmethod