summaryrefslogtreecommitdiffstats
path: root/src/console/trex_console.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/console/trex_console.py')
-rwxr-xr-xsrc/console/trex_console.py36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/console/trex_console.py b/src/console/trex_console.py
index 15022e06..584089ae 100755
--- a/src/console/trex_console.py
+++ b/src/console/trex_console.py
@@ -12,10 +12,14 @@ class TrexConsole(cmd.Cmd):
def __init__(self, rpc_client):
cmd.Cmd.__init__(self)
self.prompt = "TRex > "
- self.intro = "\n-=TRex Console V1.0=-\n"
+
+ self.intro = "\n-=TRex Console V1.0=-\n"
+ self.intro += "\nType 'help' or '?' for supported actions\n"
+
self.rpc_client = rpc_client
self.verbose = False
+ # before starting query the RPC server and add the methods
rc, msg = self.rpc_client.query_rpc_server()
if rc:
@@ -29,20 +33,22 @@ class TrexConsole(cmd.Cmd):
# set verbose on / off
def do_verbose (self, line):
- '''shows or set verbose mode\nusage: verbose [on/off]\n'''
+ '''\nshows or set verbose mode\nusage: verbose [on/off]\n'''
if line == "":
- print "verbose is " + ("on" if self.verbose else "off")
+ print "\nverbose is " + ("on\n" if self.verbose else "off\n")
+
elif line == "on":
self.verbose = True
self.rpc_client.set_verbose(True)
- print "verbose set to on\n"
+ print "\nverbose set to on\n"
elif line == "off":
self.verbose = False
self.rpc_client.set_verbose(False)
- print "verbose set to off\n"
+ print "\nverbose set to off\n"
+
else:
- print "please specify 'on' or 'off'\n"
+ print "\nplease specify 'on' or 'off'\n"
# query the server for registered commands
def do_query_server(self, line):
@@ -51,11 +57,11 @@ class TrexConsole(cmd.Cmd):
if not rc:
print "\n*** Failed to query RPC server: " + str(msg)
- print "RPC server supports the following commands: \n\n" + msg
+ print "\nRPC server supports the following commands: \n\n" + msg
def do_ping (self, line):
- '''pings the RPC server\n'''
- print "Pinging RPC server"
+ '''\npings the RPC server\n'''
+ print "\n-> Pinging RPC server"
rc, msg = self.rpc_client.ping_rpc_server()
if rc:
@@ -64,9 +70,9 @@ class TrexConsole(cmd.Cmd):
print "[FAILED]\n"
def do_rpc (self, line):
- '''Launches a RPC on the server\n'''
+ '''\nLaunches a RPC on the server\n'''
if line == "":
- print "Please provide method name\n"
+ print "\nUsage: [method name] [param 1] ...\n"
return
rc, msg = self.rpc_client.invoke_rpc_method(line)
@@ -81,7 +87,9 @@ class TrexConsole(cmd.Cmd):
return [x for x in self.supported_rpc if x.startswith(text)]
def do_status (self, line):
- '''Shows a graphical console\n'''
+ '''\nShows a graphical console\n'''
+
+ self.do_verbose('off')
trex_status.show_trex_status(self.rpc_client)
def do_quit(self, line):
@@ -89,10 +97,10 @@ class TrexConsole(cmd.Cmd):
return True
def default(self, line):
- print "'{0}' is an unrecognized command\n".format(line)
+ print "'{0}' is an unrecognized command. type 'help' or '?' for a list\n".format(line)
# aliasing
- do_EOF = do_q = do_quit
+ do_exit = do_EOF = do_q = do_quit
def main ():
# RPC client