diff options
author | imarom <imarom@cisco.com> | 2015-11-25 07:39:39 -0500 |
---|---|---|
committer | imarom <imarom@cisco.com> | 2015-11-25 07:39:39 -0500 |
commit | b6ec2066653319b60385de1d4117165eb88890a1 (patch) | |
tree | 582bda39a6d04641b3fd9481ca23d6ede53e5a17 /scripts/automation/trex_control_plane/client | |
parent | 92dea3787ab7b2c9877af9cd539d42a6957f7da6 (diff) |
fixed a bug with default start command in the console
also added clear events and more types of events
Diffstat (limited to 'scripts/automation/trex_control_plane/client')
-rwxr-xr-x | scripts/automation/trex_control_plane/client/trex_stateless_client.py | 30 |
1 files changed, 28 insertions, 2 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 1d0ca606..149d2855 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -410,26 +410,49 @@ class CTRexStatelessClient(object): ev = "[event] - " + show_event = False + + # port started if (type == 0): port_id = int(data['port_id']) + ev += "Port {0} has started".format(port_id) + + # port stopped + elif (type == 1): + port_id = int(data['port_id']) ev += "Port {0} has stopped".format(port_id) + # call the handler self.async_event_port_stopped(port_id) + - elif (type == 1): + # server stopped + elif (type == 2): ev += "Server has stopped" self.async_event_server_stopped() + show_event = True + + # port finished traffic + elif (type == 3): + port_id = int(data['port_id']) + ev += "Port {0} job done".format(port_id) + + # call the handler + self.async_event_port_stopped(port_id) + show_event = True else: # unknown event - ignore return - print format_text("\n" + ev, 'bold') + if show_event: + print format_text("\n" + ev, 'bold') ts = time.time() st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S') self.events.append("{0} - ".format(st) + format_text(ev, 'bold')) + def async_event_port_stopped (self, port_id): self.ports[port_id].async_event_port_stopped() @@ -439,6 +462,9 @@ class CTRexStatelessClient(object): def get_events (self): return self.events + def clear_events (self): + self.events = [] + ############# helper functions section ############## def validate_port_list(self, port_id_list): |