diff options
Diffstat (limited to 'scripts/automation/trex_control_plane')
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py | 9 | ||||
-rw-r--r-- | scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py | 28 |
2 files changed, 20 insertions, 17 deletions
diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py index 50566853..04dd77ec 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_client.py @@ -227,7 +227,7 @@ class AsyncEventHandler(object): ev = "Port {0} job done".format(port_id) # call the handler - self.__async_event_port_stopped(port_id) + self.__async_event_port_job_done(port_id) show_event = True # port was stolen... @@ -264,6 +264,9 @@ class AsyncEventHandler(object): # private functions + def __async_event_port_job_done (self, port_id): + self.client.ports[port_id].async_event_port_job_done() + def __async_event_port_stopped (self, port_id): self.client.ports[port_id].async_event_port_stopped() @@ -1332,7 +1335,6 @@ class STLClient(object): :parameters: ports : list ports to execute the command - :raises: + :exc:`STLError` @@ -1354,7 +1356,6 @@ class STLClient(object): if not rc: raise STLError(rc) - """ update traffic on port(s) @@ -1433,8 +1434,6 @@ class STLClient(object): if not rc: raise STLError(rc) - - """ resume traffic on port(s) diff --git a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py index 6aa18847..4529efa9 100644 --- a/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py +++ b/scripts/automation/trex_control_plane/stl/trex_stl_lib/trex_stl_port.py @@ -334,7 +334,7 @@ class Port(object): "mul": mul, "duration": duration, "force": force} - + rc = self.transmit("start_traffic", params) if rc.bad(): return self.err(rc.err()) @@ -363,7 +363,6 @@ class Port(object): if rc.bad(): return self.err(rc.err()) - # only valid state after stop self.state = self.STATE_STREAMS return self.ok() @@ -383,7 +382,6 @@ class Port(object): if rc.bad(): return self.err(rc.err()) - # only valid state after stop self.state = self.STATE_PAUSE return self.ok() @@ -400,11 +398,12 @@ class Port(object): params = {"handler": self.handler, "port_id": self.port_id} + # only valid state after stop + rc = self.transmit("resume_traffic", params) if rc.bad(): return self.err(rc.err()) - # only valid state after stop self.state = self.STATE_TX return self.ok() @@ -591,21 +590,26 @@ class Port(object): - ################# events handler ###################### - def async_event_port_stopped (self): + ################# events handler ###################### + def async_event_port_job_done (self): self.state = self.STATE_STREAMS - - def async_event_port_started (self): - self.state = self.STATE_TX - + # rest of the events are used for TUI / read only sessions + def async_event_port_stopped (self): + if not self.is_acquired(): + self.state = self.STATE_STREAMS def async_event_port_paused (self): - self.state = self.STATE_PAUSE + if not self.is_acquired(): + self.state = self.STATE_PAUSE + def async_event_port_started (self): + if not self.is_acquired(): + self.state = self.STATE_TX def async_event_port_resumed (self): - self.state = self.STATE_TX + if not self.is_acquired(): + self.state = self.STATE_TX def async_event_forced_acquired (self): self.handler = None |