diff options
author | 2016-01-04 23:31:31 +0200 | |
---|---|---|
committer | 2016-01-04 23:31:31 +0200 | |
commit | 629b54c4c9df9c718d818a004ecf15c2cf6c770a (patch) | |
tree | 7dfc3c64c7561032d690ce6188130e80d344054e /scripts/automation/trex_control_plane/client_utils | |
parent | 3757099103ed1bf56f85ccf5bb861a331287cbbb (diff) | |
parent | 857bdcf05a920b99e1cf180c700176b04801da00 (diff) |
Merge branch 'master' into dan_stateless
Diffstat (limited to 'scripts/automation/trex_control_plane/client_utils')
3 files changed, 45 insertions, 4 deletions
diff --git a/scripts/automation/trex_control_plane/client_utils/external_packages.py b/scripts/automation/trex_control_plane/client_utils/external_packages.py index 3c6eb449..3982a1b2 100755 --- a/scripts/automation/trex_control_plane/client_utils/external_packages.py +++ b/scripts/automation/trex_control_plane/client_utils/external_packages.py @@ -7,15 +7,16 @@ CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) ROOT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir)) # path to trex_control_plane directory PATH_TO_PYTHON_LIB = os.path.abspath(os.path.join(ROOT_PATH, os.pardir, os.pardir, 'external_libs')) -CLIENT_UTILS_MODULES = ['zmq', - 'dpkt-1.8.6', +CLIENT_UTILS_MODULES = ['dpkt-1.8.6', 'PyYAML-3.01/lib', 'texttable-0.8.4' ] def import_client_utils_modules(): + # must be in a higher priority sys.path.insert(0, PATH_TO_PYTHON_LIB) + sys.path.append(ROOT_PATH) import_module_list(CLIENT_UTILS_MODULES) @@ -27,5 +28,41 @@ def import_module_list(modules_list): fix_path = os.path.normcase(full_path) sys.path.insert(1, full_path) + + import_platform_dirs() + + + +def import_platform_dirs (): + # handle platform dirs + + # try fedora 18 first and then cel5.9 + # we are using the ZMQ module to determine the right platform + + full_path = os.path.join(PATH_TO_PYTHON_LIB, 'platform/fedora18') + fix_path = os.path.normcase(full_path) + sys.path.insert(0, full_path) + try: + # try to import and delete it from the namespace + import zmq + del zmq + return + except: + pass + + full_path = os.path.join(PATH_TO_PYTHON_LIB, 'platform/cel59') + fix_path = os.path.normcase(full_path) + sys.path.insert(0, full_path) + try: + # try to import and delete it from the namespace + import zmq + del zmq + return + + except: + raise Exception("unable to determine platform type for ZMQ import") + + + import_client_utils_modules() diff --git a/scripts/automation/trex_control_plane/client_utils/parsing_opts.py b/scripts/automation/trex_control_plane/client_utils/parsing_opts.py index 6f9b4c6d..5cb06604 100755 --- a/scripts/automation/trex_control_plane/client_utils/parsing_opts.py +++ b/scripts/automation/trex_control_plane/client_utils/parsing_opts.py @@ -70,7 +70,10 @@ def match_multiplier_common(val, strict_abs = True): op = None else: match = re.match("^(\d+(\.\d+)?)(bps|kbps|mbps|gbps|pps|kpps|mpps|%?)([\+\-])?$", val) - op = match.group(4) + if match: + op = match.group(4) + else: + op = None result = {} diff --git a/scripts/automation/trex_control_plane/client_utils/yaml_utils.py b/scripts/automation/trex_control_plane/client_utils/yaml_utils.py index 60630a04..825d6fc9 100755 --- a/scripts/automation/trex_control_plane/client_utils/yaml_utils.py +++ b/scripts/automation/trex_control_plane/client_utils/yaml_utils.py @@ -14,7 +14,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ - +import traceback +import sys import external_packages import yaml |