X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FTrafficScriptExecutor.py;h=8faa084ca1cbbb196fa918b077389b813e475b17;hb=e08706e85b412b1307df3789fdbe747b43c2bd95;hp=a9a733bbdfdc9e2340e8196c42cad80d9620d3a2;hpb=d68951ac245150eeefa6e0f4156e4c1b5c9e9325;p=csit.git diff --git a/resources/libraries/python/TrafficScriptExecutor.py b/resources/libraries/python/TrafficScriptExecutor.py index a9a733bbdf..8faa084ca1 100644 --- a/resources/libraries/python/TrafficScriptExecutor.py +++ b/resources/libraries/python/TrafficScriptExecutor.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2020 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -55,11 +55,11 @@ class TrafficScriptExecutor: """ ssh = SSH() ssh.connect(node) + module_name = script_file_name[:-3].replace('/', '.') cmd = f"cd {Constants.REMOTE_FW_DIR}; virtualenv -p $(which python3) " \ f"--system-site-packages --never-download env && " \ f"export PYTHONPATH=${{PWD}}; . ${{PWD}}/env/bin/activate; " \ - f"resources/traffic_scripts/{script_file_name} {script_args}" - + f"cd GPL; python -m traffic_scripts.{module_name} {script_args}" ret_code, stdout, stderr = ssh.exec_command_sudo( f'sh -c "{TrafficScriptExecutor._escape(cmd)}"', timeout=timeout )