removed some prints and a fix for error handling on add_streams
authorimarom <[email protected]>
Sun, 13 Mar 2016 15:37:36 +0000 (17:37 +0200)
committerimarom <[email protected]>
Sun, 13 Mar 2016 15:37:36 +0000 (17:37 +0200)
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py
scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_types.py

index 186771d..0f8940a 100644 (file)
@@ -1942,8 +1942,8 @@ class STLClient(object):
         try:
             profile = STLProfile.load(opts.file[0])
         except STLError as e:
-            print format_text("\nError while loading profile '{0}'\n".format(opts.file[0]), 'bold')
-            print e.brief() + "\n"
+            self.logger.log(format_text("\nError while loading profile '{0}'\n".format(opts.file[0]), 'bold'))
+            self.logger.log(e.brief() + "\n")
             return
 
 
@@ -2205,7 +2205,7 @@ class STLClient(object):
             self.start(ports = opts.ports, duration = opts.duration, force = opts.force)
 
         except STLError as e:
-            print e.brief()
+            stl.logger.log(e.brief())
             return
 
         return True
@@ -2229,7 +2229,7 @@ class STLClient(object):
         try:
             self.set_port_attr(opts.ports, opts.prom)
         except STLError as e:
-            print e.brief()
+            stl.logger.log(brief())
             return
 
     
index 1ffeffe..ab368d7 100644 (file)
@@ -229,7 +229,7 @@ class Port(object):
 
         ret = RC()
         for i, single_rc in enumerate(rc):
-            if single_rc:
+            if single_rc.rc:
                 stream_id = batch[i].params['stream_id']
                 next_id   = batch[i].params['stream']['next_stream_id']
                 self.streams[stream_id] = {'next_id' : next_id,
@@ -238,11 +238,12 @@ class Port(object):
                                            'rate' : streams_list[i].get_rate()}
 
                 ret.add(RC_OK(data = stream_id))
-
+            else:
+                ret.add(RC(*single_rc))
 
         self.state = self.STATE_STREAMS if (len(self.streams) > 0) else self.STATE_IDLE
 
-        return ret if rc else self.err(str(rc))
+        return ret if ret else self.err(str(ret))
 
 
 
index 496bea1..bd48f93 100644 (file)
@@ -5,7 +5,7 @@ from trex_stl_exceptions import *
 import types
 
 RpcCmdData = namedtuple('RpcCmdData', ['method', 'params'])
-TupleRC    = namedtuple('RC', ['rc', 'data', 'is_warn'])
+TupleRC    = namedtuple('RCT', ['rc', 'data', 'is_warn'])
 
 class RpcResponseStatus(namedtuple('RpcResponseStatus', ['success', 'id', 'msg'])):
         __slots__ = ()