summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/console
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automation/trex_control_plane/console')
-rwxr-xr-xscripts/automation/trex_control_plane/console/trex_console.py9
-rw-r--r--scripts/automation/trex_control_plane/console/trex_tui.py29
2 files changed, 29 insertions, 9 deletions
diff --git a/scripts/automation/trex_control_plane/console/trex_console.py b/scripts/automation/trex_control_plane/console/trex_console.py
index 8d52b2a4..9140977a 100755
--- a/scripts/automation/trex_control_plane/console/trex_console.py
+++ b/scripts/automation/trex_control_plane/console/trex_console.py
@@ -238,12 +238,12 @@ class TRexConsole(TRexGeneralCmd):
elif line == "on":
self.verbose = True
- self.stateless_client.set_verbose(True)
+ self.stateless_client.set_verbose(self.stateless_client.VERBOSE_HIGH)
print format_text("\nverbose set to on\n", 'green', 'bold')
elif line == "off":
self.verbose = False
- self.stateless_client.set_verbose(False)
+ self.stateless_client.set_verbose(self.stateless_client.VERBOSE_REGULAR)
print format_text("\nverbose set to off\n", 'green', 'bold')
else:
@@ -424,8 +424,11 @@ class TRexConsole(TRexGeneralCmd):
def do_tui (self, line):
'''Shows a graphical console\n'''
- self.do_verbose('off')
+ save_verbose = self.stateless_client.get_verbose()
+
+ self.stateless_client.set_verbose(self.stateless_client.VERBOSE_SILENCE)
self.tui.show()
+ self.stateless_client.set_verbose(save_verbose)
# quit function
def do_quit(self, line):
diff --git a/scripts/automation/trex_control_plane/console/trex_tui.py b/scripts/automation/trex_control_plane/console/trex_tui.py
index ea271985..c44efe15 100644
--- a/scripts/automation/trex_control_plane/console/trex_tui.py
+++ b/scripts/automation/trex_control_plane/console/trex_tui.py
@@ -33,16 +33,18 @@ class TrexTUIDashBoard(TrexTUIPanel):
super(TrexTUIDashBoard, self).__init__(mng, "dashboard")
self.key_actions = OrderedDict()
- self.key_actions['p'] = {'action': self.action_pause, 'legend': 'pause', 'show': True}
+
+ self.key_actions['c'] = {'action': self.action_clear, 'legend': 'clear', 'show': True}
+ self.key_actions['p'] = {'action': self.action_pause, 'legend': 'pause', 'show': True}
self.key_actions['r'] = {'action': self.action_resume, 'legend': 'resume', 'show': True}
- self.key_actions['+'] = {'action': self.action_raise, 'legend': 'up 5%', 'show': True}
- self.key_actions['-'] = {'action': self.action_lower, 'legend': 'low 5%', 'show': True}
+ self.key_actions['+'] = {'action': self.action_raise, 'legend': 'up 5%', 'show': True}
+ self.key_actions['-'] = {'action': self.action_lower, 'legend': 'low 5%', 'show': True}
self.ports = self.stateless_client.get_acquired_ports()
def show (self):
- stats = self.stateless_client.cmd_stats(self.ports, trex_stats.ALL_STATS_OPTS)
+ stats = self.stateless_client.cmd_stats(self.ports, trex_stats.COMPACT)
# print stats to screen
for stat_type, stat_data in stats.iteritems():
text_tables.print_table_with_header(stat_data.text_table, stat_type)
@@ -51,6 +53,8 @@ class TrexTUIDashBoard(TrexTUIPanel):
def get_key_actions (self):
allowed = {}
+ allowed['c'] = self.key_actions['c']
+
if len(self.stateless_client.get_transmitting_ports()) > 0:
allowed['p'] = self.key_actions['p']
allowed['+'] = self.key_actions['+']
@@ -121,6 +125,11 @@ class TrexTUIDashBoard(TrexTUIPanel):
return ""
+ def action_clear (self):
+ self.stateless_client.cmd_clear(self.mng.acquired_ports)
+ return "cleared all stats"
+
+
# port panel
class TrexTUIPort(TrexTUIPanel):
def __init__ (self, mng, port_id):
@@ -130,6 +139,8 @@ class TrexTUIPort(TrexTUIPanel):
self.port = self.mng.stateless_client.get_port(port_id)
self.key_actions = OrderedDict()
+
+ self.key_actions['c'] = {'action': self.action_clear, 'legend': 'clear', 'show': True}
self.key_actions['p'] = {'action': self.action_pause, 'legend': 'pause', 'show': True}
self.key_actions['r'] = {'action': self.action_resume, 'legend': 'resume', 'show': True}
self.key_actions['+'] = {'action': self.action_raise, 'legend': 'up 5%', 'show': True}
@@ -138,7 +149,7 @@ class TrexTUIPort(TrexTUIPanel):
def show (self):
- stats = self.stateless_client.cmd_stats([self.port_id], trex_stats.ALL_STATS_OPTS)
+ stats = self.stateless_client.cmd_stats([self.port_id], trex_stats.COMPACT)
# print stats to screen
for stat_type, stat_data in stats.iteritems():
text_tables.print_table_with_header(stat_data.text_table, stat_type)
@@ -147,6 +158,8 @@ class TrexTUIPort(TrexTUIPanel):
allowed = {}
+ allowed['c'] = self.key_actions['c']
+
if self.port.state == self.port.STATE_TX:
allowed['p'] = self.key_actions['p']
allowed['+'] = self.key_actions['+']
@@ -191,6 +204,10 @@ class TrexTUIPort(TrexTUIPanel):
else:
return ""
+ def action_clear (self):
+ self.stateless_client.cmd_clear([self.port_id])
+ return "port {0}: cleared stats".format(self.port_id)
+
# log
class TrexTUILog():
def __init__ (self):
@@ -239,7 +256,7 @@ class TrexTUIPanelManager():
def generate_legend (self):
- self.legend = "{:<12}".format("browse:")
+ self.legend = "\n{:<12}".format("browse:")
for k, v in self.key_actions.iteritems():
if v['show']: