summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/trex_console2
-rwxr-xr-xsrc/console/trex_console.py3
-rw-r--r--src/console/trex_rpc_client.py24
-rwxr-xr-xsrc/console/trex_status.py13
-rw-r--r--src/rpc-server/src/trex_rpc_server.cpp2
5 files changed, 30 insertions, 14 deletions
diff --git a/scripts/trex_console b/scripts/trex_console
new file mode 100755
index 00000000..6a79d54a
--- /dev/null
+++ b/scripts/trex_console
@@ -0,0 +1,2 @@
+#!/bin/bash
+/usr/bin/python ../src/console/trex_console.py
diff --git a/src/console/trex_console.py b/src/console/trex_console.py
index ca4c7e86..15022e06 100755
--- a/src/console/trex_console.py
+++ b/src/console/trex_console.py
@@ -15,6 +15,7 @@ class TrexConsole(cmd.Cmd):
self.intro = "\n-=TRex Console V1.0=-\n"
self.rpc_client = rpc_client
self.verbose = False
+
rc, msg = self.rpc_client.query_rpc_server()
if rc:
@@ -96,7 +97,7 @@ class TrexConsole(cmd.Cmd):
def main ():
# RPC client
try:
- rpc_client = RpcClient(5050)
+ rpc_client = RpcClient("localhost", 5050)
rpc_client.connect()
except Exception as e:
print "\n*** " + str(e) + "\n"
diff --git a/src/console/trex_rpc_client.py b/src/console/trex_rpc_client.py
index 04dd7727..4562cf23 100644
--- a/src/console/trex_rpc_client.py
+++ b/src/console/trex_rpc_client.py
@@ -5,6 +5,23 @@ from time import sleep
class RpcClient():
+ def __init__ (self, server, port):
+ self.context = zmq.Context()
+
+ self.port = port
+ self.server = server
+ # Socket to talk to server
+ self.transport = "tcp://{0}:{1}".format(server, port)
+
+ self.verbose = False
+
+ def get_connection_details (self):
+ rc = {}
+ rc['server'] = self.server
+ rc['port'] = self.port
+
+ return rc
+
def create_jsonrpc_v2 (self, method_name, params = {}, id = None):
msg = {}
msg["jsonrpc"] = "2.0"
@@ -79,13 +96,6 @@ class RpcClient():
def query_rpc_server (self):
return self.invoke_rpc_method("rpc_get_reg_cmds")
- def __init__ (self, port):
- self.context = zmq.Context()
-
- # Socket to talk to server
- self.transport = "tcp://localhost:{0}".format(port)
-
- self.verbose = False
def set_verbose (self, mode):
self.verbose = mode
diff --git a/src/console/trex_status.py b/src/console/trex_status.py
index a17c2589..20d70534 100755
--- a/src/console/trex_status.py
+++ b/src/console/trex_status.py
@@ -91,11 +91,14 @@ class TrexStatus():
self.info_panel.clear()
- self.info_panel.getwin().addstr(3, 2, "{:<30} {:30}".format("Version:", self.server_status["general"]["version"]))
- self.info_panel.getwin().addstr(4, 2, "{:<30} {:30}".format("Build:",
+ connection_details = self.rpc_client.get_connection_details()
+
+ self.info_panel.getwin().addstr(3, 2, "{:<30} {:30}".format("Server:", connection_details['server'] + ":" + str(connection_details['port'])))
+ self.info_panel.getwin().addstr(4, 2, "{:<30} {:30}".format("Version:", self.server_status["general"]["version"]))
+ self.info_panel.getwin().addstr(5, 2, "{:<30} {:30}".format("Build:",
self.server_status["general"]["build_date"] + " @ " + self.server_status["general"]["build_time"] + " by " + self.server_status["general"]["version_user"]))
- self.info_panel.getwin().addstr(5, 2, "{:<30} {:30}".format("Server Uptime:", self.server_status["general"]["uptime"]))
+ self.info_panel.getwin().addstr(6, 2, "{:<30} {:30}".format("Server Uptime:", self.server_status["general"]["uptime"]))
#self.ft_panel.clear()
#ft_section_y = 3
@@ -250,7 +253,7 @@ class TrexStatus():
self.add_log_event("Pinging RPC server")
rc, msg = self.rpc_client.ping_rpc_server()
if rc:
- self.add_log_event("Server replied")
+ self.add_log_event("Server replied: '{0}'".format(msg))
else:
self.add_log_event("Failed to get reply")
@@ -268,7 +271,7 @@ class TrexStatus():
panel.update_panels();
self.stdscr.refresh()
- sleep(0.2)
+ sleep(0.1)
def show_trex_status_internal (stdscr, rpc_client):
diff --git a/src/rpc-server/src/trex_rpc_server.cpp b/src/rpc-server/src/trex_rpc_server.cpp
index 17eeec6d..139614e5 100644
--- a/src/rpc-server/src/trex_rpc_server.cpp
+++ b/src/rpc-server/src/trex_rpc_server.cpp
@@ -75,7 +75,7 @@ get_current_date_time() {
struct tm tstruct;
char buf[80];
tstruct = *localtime(&now);
- strftime(buf, sizeof(buf), "%d-%b-%Y / %X", &tstruct);
+ strftime(buf, sizeof(buf), "%b %d %Y @ %X", &tstruct);
return buf;
}