diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/automation/trex_control_plane/client/trex_stateless_client.py | 35 | ||||
-rw-r--r-- | scripts/automation/trex_control_plane/client/trex_stateless_sim.py | 8 | ||||
-rw-r--r-- | scripts/exp/stl_vm_split_client_var.erf-0.erf | bin | 11000 -> 11000 bytes | |||
-rw-r--r-- | scripts/exp/stl_vm_split_flow_var_big_range.erf-0.erf | bin | 11000 -> 11000 bytes | |||
-rw-r--r-- | scripts/exp/stl_vm_split_flow_var_inc.erf-0.erf | bin | 11000 -> 11000 bytes | |||
-rw-r--r-- | scripts/exp/stl_vm_split_flow_var_small_range.erf-0.erf | bin | 11000 -> 11000 bytes |
6 files changed, 26 insertions, 17 deletions
diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_client.py b/scripts/automation/trex_control_plane/client/trex_stateless_client.py index 78adbcc2..506decfe 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -25,6 +25,7 @@ from trex_port import Port from common.trex_types import * from common.trex_stl_exceptions import * from trex_async_client import CTRexAsyncClient +from yaml import YAMLError ############################ logger ############################# @@ -436,9 +437,6 @@ class STLClient(object): self.stats_generator = trex_stats.CTRexInfoGenerator(self.global_stats, self.ports) - # stream DB - self.streams_db = CStreamsDB() - ############# private functions - used by the class itself ########### @@ -1301,17 +1299,28 @@ class STLClient(object): if not rc: raise STLArgumentError('ports', ports, valid_values = self.get_all_ports()) - # load the YAML + + streams = None + + # try YAML try: - streams_pack = self.streams_db.load_yaml_file(filename) - except Exception as e: - raise STLError(str(e)) - - # HACK - convert the stream pack to simple streams - streams = [] - for stream in streams_pack.compiled: - s = HACKSTLStream(stream) - streams.append(s) + streams_db = CStreamsDB() + stream_list = streams_db.load_yaml_file(filename) + + # convert to new style stream object + streams = [HACKSTLStream(stream) for stream in stream_list.compiled] + except YAMLError: + # try python + try: + basedir = os.path.dirname(filename) + sys.path.append(basedir) + file = os.path.basename(filename).split('.')[0] + module = __import__(file, globals(), locals(), [], -1) + + streams = module.register().get_streams() + + except (AttributeError, ImportError): + raise STLError("bad format input file '{0}'".format(filename)) self.add_streams(streams, ports) diff --git a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py index 7f65996d..d8f6ed92 100644 --- a/scripts/automation/trex_control_plane/client/trex_stateless_sim.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_sim.py @@ -25,7 +25,7 @@ except ImportError: import client.outer_packages from common.trex_stl_exceptions import STLError -from yaml.scanner import ScannerError +from yaml import YAMLError from common.trex_streams import * from client_utils import parsing_opts @@ -103,7 +103,7 @@ class STLSim(object): # convert to new style stream object return [HACKSTLStream(stream) for stream in stream_list.compiled] - except ScannerError: + except YAMLError: pass # try python @@ -111,12 +111,12 @@ class STLSim(object): basedir = os.path.dirname(input_file) sys.path.append(basedir) - file = os.path.basename(input_file).split('.py')[0] + file = os.path.basename(input_file).split('.')[0] module = __import__(file, globals(), locals(), [], -1) return module.register().get_streams() - except AttributeError: + except (AttributeError, ImportError): pass raise STLError("bad format input file '{0}'".format(input_file)) diff --git a/scripts/exp/stl_vm_split_client_var.erf-0.erf b/scripts/exp/stl_vm_split_client_var.erf-0.erf Binary files differindex 12e68c09..a9f330fe 100644 --- a/scripts/exp/stl_vm_split_client_var.erf-0.erf +++ b/scripts/exp/stl_vm_split_client_var.erf-0.erf diff --git a/scripts/exp/stl_vm_split_flow_var_big_range.erf-0.erf b/scripts/exp/stl_vm_split_flow_var_big_range.erf-0.erf Binary files differindex 8f4fe297..8e62aca6 100644 --- a/scripts/exp/stl_vm_split_flow_var_big_range.erf-0.erf +++ b/scripts/exp/stl_vm_split_flow_var_big_range.erf-0.erf diff --git a/scripts/exp/stl_vm_split_flow_var_inc.erf-0.erf b/scripts/exp/stl_vm_split_flow_var_inc.erf-0.erf Binary files differindex 82025972..acd31a64 100644 --- a/scripts/exp/stl_vm_split_flow_var_inc.erf-0.erf +++ b/scripts/exp/stl_vm_split_flow_var_inc.erf-0.erf diff --git a/scripts/exp/stl_vm_split_flow_var_small_range.erf-0.erf b/scripts/exp/stl_vm_split_flow_var_small_range.erf-0.erf Binary files differindex 5dac9893..4cf58e67 100644 --- a/scripts/exp/stl_vm_split_flow_var_small_range.erf-0.erf +++ b/scripts/exp/stl_vm_split_flow_var_small_range.erf-0.erf |