diff options
author | 2016-03-24 20:00:27 +0200 | |
---|---|---|
committer | 2016-03-24 20:00:27 +0200 | |
commit | 59f00264f39dfb95a62401776b4ed8c433682fa7 (patch) | |
tree | 96b5411f17faed9f62aa9e4722b29d767d502b1b /scripts/automation/trex_control_plane/stl/trex_stl_lib | |
parent | 4e8ce34a9ef6b8883cfed47f77c9b753e1cf4248 (diff) |
gather stateful client to stf folder, create trex_client package
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/trex_stl_lib')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py | 9 | ||||
-rwxr-xr-x | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py | 6 |
2 files changed, 9 insertions, 6 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py index c614c4bd..d6d66ec3 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_ext.py @@ -7,11 +7,14 @@ import platform TREX_STL_EXT_PATH = os.environ.get('TREX_STL_EXT_PATH') # take default -if not TREX_STL_EXT_PATH: +if not TREX_STL_EXT_PATH or not os.path.exists(TREX_STL_EXT_PATH): CURRENT_PATH = os.path.dirname(os.path.realpath(__file__)) + TREX_STL_EXT_PATH = os.path.normpath(os.path.join(CURRENT_PATH, os.pardir, 'external_libs')) +if not os.path.exists(TREX_STL_EXT_PATH): # ../../../../external_libs - TREX_STL_EXT_PATH = os.path.abspath(os.path.join(CURRENT_PATH, os.pardir, os.pardir, os.pardir, os.pardir, 'external_libs')) - + TREX_STL_EXT_PATH = os.path.normpath(os.path.join(CURRENT_PATH, os.pardir, os.pardir, os.pardir, os.pardir, 'external_libs')) +if not os.path.exists(TREX_STL_EXT_PATH): + raise Exception('Could not determine path of external_libs, try setting TREX_STL_EXT_PATH variable') # the modules required # py-dep requires python2/python3 directories diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py index 9387c3a6..b506137b 100755 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_hltapi.py @@ -174,7 +174,7 @@ import socket import copy from collections import defaultdict -from trex_stl_lib.api import * +from .api import * from .trex_stl_types import * from .utils.common import get_number @@ -249,7 +249,7 @@ def print_brief_stats(res): title_str = ' '*3 tx_str = 'TX:' rx_str = 'RX:' - for port_id, stat in res.iteritems(): + for port_id, stat in res.items(): if type(port_id) is not int: continue title_str += ' '*10 + 'Port%s' % port_id @@ -663,7 +663,7 @@ class CTRexHltApi(object): stats = self.trex_client.get_stats(port_handle) except Exception as e: return HLT_ERR('Could not retrieve stats: %s' % e if isinstance(e, STLError) else traceback.format_exc()) - for port_id, stat_dict in stats.iteritems(): + for port_id, stat_dict in stats.items(): if is_integer(port_id): hlt_stats_dict[port_id] = { 'aggregate': { |