summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/client_utils
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2015-12-14 04:47:35 -0500
committerimarom <imarom@cisco.com>2015-12-14 04:48:15 -0500
commitbae48d6cf8dd59158ffcb488391af8a96fc2e037 (patch)
treeff85ec461453c6a3a6bee5c080dd67b61990eca2 /scripts/automation/trex_control_plane/client_utils
parentca565fd24f0336d704410d69fe67b70405f2a38c (diff)
TUI v2.0 - now no flickering, state machine for lost of connectivity
and TUI can be started in xterm using tui -x
Diffstat (limited to 'scripts/automation/trex_control_plane/client_utils')
-rwxr-xr-xscripts/automation/trex_control_plane/client_utils/jsonrpc_client.py13
-rwxr-xr-xscripts/automation/trex_control_plane/client_utils/parsing_opts.py18
2 files changed, 23 insertions, 8 deletions
diff --git a/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py b/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py
index 3de0bb5f..ce98fbc6 100755
--- a/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py
+++ b/scripts/automation/trex_control_plane/client_utils/jsonrpc_client.py
@@ -47,7 +47,7 @@ class BatchMessage(object):
# JSON RPC v2.0 client
class JsonRpcClient(object):
- def __init__ (self, default_server, default_port):
+ def __init__ (self, default_server, default_port, prn_func = None):
self.verbose = False
self.connected = False
@@ -56,6 +56,8 @@ class JsonRpcClient(object):
self.server = default_server
self.id_gen = general_utils.random_id_gen()
+ self.prn_func = prn_func
+
def get_connection_details (self):
rc = {}
rc['server'] = self.server
@@ -201,7 +203,8 @@ class JsonRpcClient(object):
else:
return False, "Not connected to server"
- def connect(self, server=None, port=None):
+
+ def connect(self, server = None, port = None, prn_func = None):
if self.connected:
self.disconnect()
@@ -213,7 +216,11 @@ class JsonRpcClient(object):
# Socket to talk to server
self.transport = "tcp://{0}:{1}".format(self.server, self.port)
- print "\nConnecting To RPC Server On {0}".format(self.transport)
+ msg = "\nConnecting To RPC Server On {0}".format(self.transport)
+ if self.prn_func:
+ self.prn_func(msg)
+ else:
+ print msg
self.socket = self.context.socket(zmq.REQ)
try:
diff --git a/scripts/automation/trex_control_plane/client_utils/parsing_opts.py b/scripts/automation/trex_control_plane/client_utils/parsing_opts.py
index 7ac9e312..6f9b4c6d 100755
--- a/scripts/automation/trex_control_plane/client_utils/parsing_opts.py
+++ b/scripts/automation/trex_control_plane/client_utils/parsing_opts.py
@@ -21,12 +21,13 @@ STREAM_FROM_PATH_OR_FILE = 9
DURATION = 10
FORCE = 11
DRY_RUN = 12
-TOTAL = 13
+XTERM = 13
+TOTAL = 14
-GLOBAL_STATS = 14
-PORT_STATS = 15
-PORT_STATUS = 16
-STATS_MASK = 17
+GLOBAL_STATS = 50
+PORT_STATS = 51
+PORT_STATUS = 52
+STATS_MASK = 53
# list of ArgumentGroup types
MUTEX = 1
@@ -210,6 +211,13 @@ OPTIONS_DB = {MULTIPLIER: ArgumentPack(['-m', '--multiplier'],
'default': False,
'help': "Dry run - no traffic will be injected"}),
+
+ XTERM: ArgumentPack(['-x', '--xterm'],
+ {'action': 'store_true',
+ 'dest': 'xterm',
+ 'default': False,
+ 'help': "Starts TUI in xterm window"}),
+
GLOBAL_STATS: ArgumentPack(['-g'],
{'action': 'store_true',
'help': "Fetch only global statistics"}),