summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/client
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-11-13 14:21:55 +0200
committerimarom <imarom@cisco.com>2015-11-13 14:28:05 +0200
commit57e67fd2ae248039951798978cc8c1c219c3d752 (patch)
treeac91e49ed2969025f40a34a049ca6623fc30fe68 /scripts/automation/trex_control_plane/client
parent513581840e5787e73161de049aa59552f23e719d (diff)
few mods
few fixes TUI is not working yet... need to fix more stuff a checkpoint for now
Diffstat (limited to 'scripts/automation/trex_control_plane/client')
-rwxr-xr-xscripts/automation/trex_control_plane/client/trex_stateless_client.py47
1 files changed, 33 insertions, 14 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 93b36f82..011c9426 100755
--- a/scripts/automation/trex_control_plane/client/trex_stateless_client.py
+++ b/scripts/automation/trex_control_plane/client/trex_stateless_client.py
@@ -50,15 +50,18 @@ class RC:
def err (self):
return all([x.data if not x.rc else "" for x in self.rc_list])
- def annotate (self, desc):
- print format_text('\n{:<40}'.format(desc), 'bold'),
+ def annotate (self, desc = None):
+ if desc:
+ print format_text('\n{:<40}'.format(desc), 'bold'),
if self.bad():
# print all the errors
+ print ""
for x in self.rc_list:
if not x.rc:
print format_text("\n{0}".format(x.data), 'bold')
+ print ""
print format_text("[FAILED]\n", 'red', 'bold')
@@ -274,16 +277,15 @@ class CTRexStatelessClient(object):
############# helper functions section ##############
- def validate_port_list(self, port_id):
- if isinstance(port_id, list) or isinstance(port_id, set):
- # check each item of the sequence
- return all([self._is_ports_valid(port)
- for port in port_id])
- elif (isinstance(port_id, int)) and (port_id >= 0) and (port_id <= self.get_port_count()):
- return True
- else:
+ def validate_port_list(self, port_id_list):
+ if not isinstance(port_id_list, list):
+ print type(port_id_list)
return False
+ # check each item of the sequence
+ return all([ (port_id >= 0) and (port_id < self.get_port_count())
+ for port_id in port_id_list ])
+
# some preprocessing for port argument
def __ports (self, port_id_list):
@@ -355,6 +357,8 @@ class CTRexStatelessClient(object):
def disconnect(self):
self.connected = False
self.comm_link.disconnect()
+ return RC_OK()
+
########### cached queries (no server traffic) ###########
@@ -384,6 +388,9 @@ class CTRexStatelessClient(object):
def get_connection_port (self):
return self.comm_link.port
+ def get_connection_ip (self):
+ return self.comm_link.server
+
def get_acquired_ports(self):
return [port.port_id for port in self.ports if port.is_acquired()]
@@ -543,10 +550,22 @@ class CTRexStatelessClient(object):
######################### Console (high level) API #########################
+ def cmd_ping (self):
+ rc = self.ping()
+ rc.annotate("Pinging the server on '{0}' port '{1}': ".format(self.get_connection_ip(), self.get_connection_port()))
+ return rc
+
+ def cmd_connect (self):
+ rc = self.connect()
+ rc.annotate()
+ return rc
+
+ def cmd_disconnect (self):
+ rc = self.disconnect()
+ rc.annotate()
+ return rc
+
# reset
- # acquire, stop, remove streams and clear stats
- #
- #
def cmd_reset (self):
@@ -631,7 +650,7 @@ class CTRexStatelessClient(object):
return True
-
+ #################################
# ------ private classes ------ #
class CCommLink(object):
"""describes the connectivity of the stateless client method"""