summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/stl/console/trex_tui.py
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2016-04-11 01:47:32 +0300
committerYaroslav Brustinov <ybrustin@cisco.com>2016-04-11 01:47:32 +0300
commitaf49c70aaaecb897c7d3b4bddb18f504d32b0546 (patch)
tree4b30e6a2533379fd3febd512aab4e6bc359c7ba7 /scripts/automation/trex_control_plane/stl/console/trex_tui.py
parent9b790cd6df9545ad69515560f6af62a6638a4093 (diff)
hltapi stream stats, port tx/rx graphs at console
Diffstat (limited to 'scripts/automation/trex_control_plane/stl/console/trex_tui.py')
-rw-r--r--scripts/automation/trex_control_plane/stl/console/trex_tui.py32
1 files changed, 24 insertions, 8 deletions
diff --git a/scripts/automation/trex_control_plane/stl/console/trex_tui.py b/scripts/automation/trex_control_plane/stl/console/trex_tui.py
index 88c53d10..a842e172 100644
--- a/scripts/automation/trex_control_plane/stl/console/trex_tui.py
+++ b/scripts/automation/trex_control_plane/stl/console/trex_tui.py
@@ -2,7 +2,7 @@ import termios
import sys
import os
import time
-from collections import OrderedDict
+from collections import OrderedDict, deque
import datetime
if sys.version_info > (3,0):
@@ -40,6 +40,7 @@ class TrexTUIPanel(object):
self.mng = mng
self.name = name
self.stateless_client = mng.stateless_client
+ self.is_graph = False
def show (self):
raise NotImplementedError("must implement this")
@@ -75,7 +76,7 @@ class TrexTUIDashBoard(TrexTUIPanel):
def get_key_actions (self):
- allowed = {}
+ allowed = OrderedDict()
allowed['c'] = self.key_actions['c']
@@ -152,19 +153,26 @@ class TrexTUIPort(TrexTUIPanel):
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['t'] = {'action': self.action_toggle_graph, 'legend': 'toggle graph', 'show': True}
def show (self):
- stats = self.stateless_client._get_formatted_stats([self.port_id])
- # print stats to screen
- for stat_type, stat_data in stats.items():
- text_tables.print_table_with_header(stat_data.text_table, stat_type)
+ if self.mng.tui.is_graph is False:
+ stats = self.stateless_client._get_formatted_stats([self.port_id])
+ # print stats to screen
+ for stat_type, stat_data in stats.items():
+ text_tables.print_table_with_header(stat_data.text_table, stat_type)
+ else:
+ stats = self.stateless_client._get_formatted_stats([self.port_id], stats_mask = trex_stl_stats.GRAPH_PORT_COMPACT)
+ for stat_type, stat_data in stats.items():
+ text_tables.print_table_with_header(stat_data.text_table, stat_type)
def get_key_actions (self):
- allowed = {}
+ allowed = OrderedDict()
allowed['c'] = self.key_actions['c']
+ allowed['t'] = self.key_actions['t']
if self.stateless_client.is_all_ports_acquired():
return allowed
@@ -180,7 +188,14 @@ class TrexTUIPort(TrexTUIPanel):
return allowed
- # actions
+ def action_toggle_graph(self):
+ try:
+ self.mng.tui.is_graph = not self.mng.tui.is_graph
+ except Exception:
+ pass
+
+ return ""
+
def action_pause (self):
try:
self.stateless_client.pause(ports = [self.port_id])
@@ -399,6 +414,7 @@ class TrexTUI():
STATE_ACTIVE = 0
STATE_LOST_CONT = 1
STATE_RECONNECT = 2
+ is_graph = False
def __init__ (self, stateless_client):
self.stateless_client = stateless_client