summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-12-08 08:42:08 -0500
committerimarom <imarom@cisco.com>2015-12-08 08:42:08 -0500
commit8713749a155b8d1a7e140d073f0092e3b62cacac (patch)
treeb806eeea8abab0fbf95788595f3283020dc4d30c
parentfeb152b7d5eb531d439a4950d27cbc44031daf92 (diff)
a minor fix to the TUI (pause/resume all ports)
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py4
-rw-r--r--scripts/automation/trex_control_plane/console/trex_tui.py40
2 files changed, 34 insertions, 10 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 0a583f46..f23e801c 100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -75,7 +75,7 @@ class RC():
print format_text("[SUCCESS]\n", 'green', 'bold')
-def RC_OK(data = None):
+def RC_OK(data = ""):
return RC(True, data)
def RC_ERR (err):
return RC(False, err)
@@ -189,7 +189,7 @@ class Port(object):
def err(self, msg):
return RC_ERR("port {0} : {1}".format(self.port_id, msg))
- def ok(self, data = None):
+ def ok(self, data = "ACK"):
return RC_OK(data)
def get_speed_bps (self):
diff --git a/scripts/automation/trex_control_plane/console/trex_tui.py b/scripts/automation/trex_control_plane/console/trex_tui.py
index e835ed24..3b64a02f 100644
--- a/scripts/automation/trex_control_plane/console/trex_tui.py
+++ b/scripts/automation/trex_control_plane/console/trex_tui.py
@@ -51,24 +51,43 @@ class TrexTUIDashBoard(TrexTUIPanel):
# actions
def action_pause (self):
rc = self.stateless_client.pause_traffic(self.mng.acquired_ports)
- if rc.good():
- return "paused traffic on all ports"
+
+ ports_succeeded = []
+ for rc_single, port_id in zip(rc.rc_list, self.mng.acquired_ports):
+ if rc_single.rc:
+ ports_succeeded.append(port_id)
+
+ if len(ports_succeeded) > 0:
+ return "paused traffic on port(s): {0}".format(ports_succeeded)
else:
return ""
+
def action_resume (self):
rc = self.stateless_client.resume_traffic(self.mng.acquired_ports)
- if rc.good():
- return "resumed traffic on all ports"
+
+ ports_succeeded = []
+ for rc_single, port_id in zip(rc.rc_list, self.mng.acquired_ports):
+ if rc_single.rc:
+ ports_succeeded.append(port_id)
+
+ if len(ports_succeeded) > 0:
+ return "resumed traffic on port(s): {0}".format(ports_succeeded)
else:
return ""
+
def action_raise (self):
mul = {'type': 'percentage', 'value': 5, 'op': 'add'}
rc = self.stateless_client.update_traffic(mul, self.mng.acquired_ports)
- if rc.good():
- return "raised B/W by 5% on all ports"
+ ports_succeeded = []
+ for rc_single, port_id in zip(rc.rc_list, self.mng.acquired_ports):
+ if rc_single.rc:
+ ports_succeeded.append(port_id)
+
+ if len(ports_succeeded) > 0:
+ return "raised B/W by %5 on port(s): {0}".format(ports_succeeded)
else:
return ""
@@ -76,8 +95,13 @@ class TrexTUIDashBoard(TrexTUIPanel):
mul = {'type': 'percentage', 'value': 5, 'op': 'sub'}
rc = self.stateless_client.update_traffic(mul, self.mng.acquired_ports)
- if rc.good():
- return "lowered B/W by 5% on all ports"
+ ports_succeeded = []
+ for rc_single, port_id in zip(rc.rc_list, self.mng.acquired_ports):
+ if rc_single.rc:
+ ports_succeeded.append(port_id)
+
+ if len(ports_succeeded) > 0:
+ return "lowered B/W by %5 on port(s): {0}".format(ports_succeeded)
else:
return ""