summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/trex_stl_lib
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-02-09 09:02:04 -0500
committerimarom <imarom@cisco.com>2016-02-09 09:10:23 -0500
commita94f1cdde418a7e96fce6f9c5ec52da5bafbd4b9 (patch)
tree856a6b21ec5ee2ba16fdcc1ec721f0b6e0c8e087 /scripts/automation/trex_control_plane/stl/trex_stl_lib
parente8ba50a8940c1288011b434bb1a7df2159578d67 (diff)
YAML profiles fixup
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_sim.py9
-rw-r--r--scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py8
2 files changed, 14 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
index 1252b752..9cea3ea8 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_sim.py
@@ -140,7 +140,14 @@ class STLSim(object):
# handle YAMLs
for input_file in input_files:
- stream_list += STLClient.load_profile(input_file)
+ try:
+ profile = STLProfile.load(input_file)
+ except STLError as e:
+ print format_text("\nError while loading profile '{0}'\n".format(input_file), 'bold')
+ print e.brief() + "\n"
+ return
+
+ stream_list += profile.get_streams()
# load streams
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
index 8ad15a52..9c190dad 100644
--- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
+++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_streams.py
@@ -271,7 +271,7 @@ class YAMLLoader(object):
# hack the VM fields for now
if 'vm' in s_obj:
- stream.fields['vm'] = s_obj['vm']
+ stream.fields['vm'].update(s_obj['vm'])
return stream
@@ -281,7 +281,11 @@ class YAMLLoader(object):
# read YAML and pass it down to stream object
yaml_str = f.read()
- objects = yaml.load(yaml_str)
+ try:
+ objects = yaml.load(yaml_str)
+ except yaml.parser.ParserError as e:
+ raise STLError(str(e))
+
streams = [self.__parse_stream(object) for object in objects]
return streams