From 903b855393acd411e85b25e6b2df1158d9fe2856 Mon Sep 17 00:00:00 2001 From: imarom Date: Sun, 22 Nov 2015 11:07:40 +0200 Subject: TUI back online --- .../trex_control_plane/client/trex_stateless_client.py | 18 ++++++++++++++++++ .../trex_control_plane/console/trex_console.py | 5 ++--- .../trex_control_plane/console/trex_status.py | 16 ++++------------ 3 files changed, 24 insertions(+), 15 deletions(-) (limited to 'scripts/automation/trex_control_plane') 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 dd11fb67..164cdb90 100755 --- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py +++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py @@ -277,6 +277,17 @@ class Port(object): return self.ok() + # get a specific stream + def get_stream (self, stream_id): + if stream_id in self.streams: + return self.streams[stream_id] + else: + return None + + def get_all_streams (self): + return self.streams + + # start traffic def start (self, mul, duration): if self.state == self.STATE_DOWN: @@ -393,6 +404,13 @@ class CTRexStatelessClient(object): if not rc: return RC_ERR(data) + # version + rc, data = self.transmit("get_version") + if not rc: + return RC_ERR(data) + + self.server_version = data + # cache system info rc, data = self.transmit("get_system_info") if not rc: diff --git a/scripts/automation/trex_control_plane/console/trex_console.py b/scripts/automation/trex_control_plane/console/trex_console.py index ea2f5f12..995965fd 100755 --- a/scripts/automation/trex_control_plane/console/trex_console.py +++ b/scripts/automation/trex_control_plane/console/trex_console.py @@ -197,8 +197,6 @@ class TRexConsole(TRexGeneralCmd): if rc.bad(): return - def do_test (self, line): - print self.stateless_client.get_acquired_ports() # set verbose on / off def do_verbose(self, line): @@ -252,7 +250,7 @@ class TRexConsole(TRexGeneralCmd): return TRexConsole.tree_autocomplete(s[l - 1]) def do_start(self, line): - '''Start selected traffic in specified ports on TRex\n''' + '''Start selected traffic in specified port(s) on TRex\n''' self.stateless_client.cmd_start_line(line) @@ -262,6 +260,7 @@ class TRexConsole(TRexGeneralCmd): ############# stop def do_stop(self, line): + '''stops port(s) transmitting traffic\n''' self.stateless_client.cmd_stop_line(line) diff --git a/scripts/automation/trex_control_plane/console/trex_status.py b/scripts/automation/trex_control_plane/console/trex_status.py index a54b718e..869812a1 100644 --- a/scripts/automation/trex_control_plane/console/trex_status.py +++ b/scripts/automation/trex_control_plane/console/trex_status.py @@ -398,13 +398,9 @@ class TrexStatus(): self.general_stats = stateless_client.get_stats_async().get_general_stats() # fetch server info - rc, self.server_sys_info = self.stateless_client.get_system_info() - if not rc: - return + self.server_sys_info = self.stateless_client.get_system_info() - rc, self.server_version = self.stateless_client.get_version() - if not rc: - return + self.server_version = self.stateless_client.get_version() # list of owned ports self.owned_ports_list = self.stateless_client.get_acquired_ports() @@ -416,9 +412,7 @@ class TrexStatus(): self.owned_ports[str(port_id)] = {} self.owned_ports[str(port_id)]['streams'] = {} - rc, stream_list = self.stateless_client.get_all_streams(port_id) - if not rc: - raise Exception("unable to get streams") + stream_list = self.stateless_client.get_all_streams(port_id) self.owned_ports[str(port_id)] = stream_list @@ -481,9 +475,7 @@ class TrexStatus(): self.owned_ports[str(port_id)] = {} self.owned_ports[str(port_id)]['streams'] = {} - rc, stream_list = self.stateless_client.get_all_streams(port_id) - if not rc: - raise Exception("unable to get streams") + stream_list = self.stateless_client.get_all_streams(port_id) self.owned_ports[str(port_id)] = stream_list -- cgit 1.2.3-korg