X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fnetwork_services%2Futils.py;h=d52e27c15f6270ed1eb5b2e6e94431a17dd3d788;hb=a65eb4e43179dc4d75d0e2cf158cc73b9ad9a3b8;hp=cb71a602929e886be12f9b70bc66c6f2a3b4ba72;hpb=5420dd71763226d78fb1ff486b78918432c73e49;p=yardstick.git diff --git a/yardstick/network_services/utils.py b/yardstick/network_services/utils.py index cb71a6029..d52e27c15 100644 --- a/yardstick/network_services/utils.py +++ b/yardstick/network_services/utils.py @@ -30,7 +30,10 @@ OPTS = [ help='bin_path for VNFs location.'), cfg.StrOpt('trex_path', default=os.path.join(NSB_ROOT, 'trex/scripts'), - help='trex automation lib pathh.'), + help='trex automation lib path.'), + cfg.StrOpt('trex_client_lib', + default=os.path.join(NSB_ROOT, 'trex_client/stl'), + help='trex python library path.'), ] CONF.register_opts(OPTS, group="nsb") @@ -45,17 +48,19 @@ def get_nsb_option(option, default=None): return default -def provision_tool(connection, tool_path): +def provision_tool(connection, tool_path, tool_file=None): """ verify if the tool path exits on the node, if not push the local binary to remote node :return - Tool path """ + if tool_file: + tool_path = os.path.join(tool_path, tool_file) bin_path = get_nsb_option("bin_path") - exit_status, stdout = connection.execute("which %s" % tool_path)[:2] + exit_status = connection.execute("which %s > /dev/null 2>&1" % tool_path)[0] if exit_status == 0: - return encodeutils.safe_decode(stdout, incoming='utf-8').rstrip() + return encodeutils.safe_decode(tool_path, incoming='utf-8').rstrip() logging.warning("%s not found on %s, will try to copy from localhost", tool_path, connection.host)