summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/server
diff options
context:
space:
mode:
authorYaroslav Brustinov <ybrustin@cisco.com>2015-10-27 05:08:36 +0200
committerYaroslav Brustinov <ybrustin@cisco.com>2015-10-27 05:08:36 +0200
commita573adc6395c9ad8d96978508a07a654ef48c7a9 (patch)
tree4e33b057d3681e59deb05ada9d3581d233d62c0b /scripts/automation/trex_control_plane/server
parentffab8fdc68245ff525780554774e3a7615500e28 (diff)
fix call ./t-rex-64 --help for getting version
Diffstat (limited to 'scripts/automation/trex_control_plane/server')
-rwxr-xr-xscripts/automation/trex_control_plane/server/trex_server.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/automation/trex_control_plane/server/trex_server.py b/scripts/automation/trex_control_plane/server/trex_server.py
index ca53de81..7dee89e9 100755
--- a/scripts/automation/trex_control_plane/server/trex_server.py
+++ b/scripts/automation/trex_control_plane/server/trex_server.py
@@ -67,7 +67,6 @@ class CTRexServer(object):
self.start_lock = threading.Lock()
self.__reservation = None
self.zmq_monitor = ZmqMonitorSession(self.trex, self.trex_zmq_port) # intiate single ZMQ monitor thread for server usage
- logger.info(self.get_trex_version(base64 = False))
def add(self, x, y):
print "server function add ",x,y
@@ -100,6 +99,7 @@ class CTRexServer(object):
logger.info("current working dir is: {0}".format(self.TREX_PATH) )
logger.info("current files dir is : {0}".format(self.trex_files_path) )
logger.debug("Starting TRex server. Registering methods to process.")
+ logger.info(self.get_trex_version(base64 = False))
self.server = SimpleJSONRPCServer( (self.trex_host, self.trex_daemon_port) )
except socket.error as e:
if e.errno == errno.EADDRINUSE:
@@ -172,8 +172,10 @@ class CTRexServer(object):
try:
logger.info("Processing get_trex_version() command.")
if not self.trex_version:
- help_print = os.popen('cd {path}; ./t-rex-64 --help'.format(path=self.TREX_PATH), 'r').read()
- self.trex_version = binascii.b2a_base64('\n'.join(help_print.split('\n')[-5:-1]))
+ help_print = subprocess.Popen(['./t-rex-64', '--help'], cwd = self.TREX_PATH, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ help_print.wait()
+ help_print_stdout = help_print.stdout.read()
+ self.trex_version = binascii.b2a_base64('\n'.join(help_print_stdout.split('\n')[-5:-1]))
if base64:
return self.trex_version
else: