summaryrefslogtreecommitdiffstats
path: root/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@intel.com>2020-09-17 17:17:36 +0200
committerLuc Provoost <luc.provoost@intel.com>2020-09-17 17:19:14 +0200
commit163323cd8f9eec2390099ca4834827a28c46c6db (patch)
treec09882a97e525c6a5c98a505cad0262a7378c792 /VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
parentd092ffd38f9b5acafb740da11b5a2467ff972036 (diff)
Using python concurrent futures
Different PROX instances are now started in parallel. The script is starting multiple threads. Change-Id: Ia8785a792240d4e9b5d5d98174bc4c5d7ae5657c Signed-off-by: Luc Provoost <luc.provoost@intel.com>
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py')
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
index b89c0383..a9f53083 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
@@ -45,12 +45,7 @@ class RapidMachine(object):
break
self.rundir = rundir
self.machine_params = machine_params
- self._client = prox_ctrl(self.ip, self.key, self.user)
- self._client.connect()
- if vim in ['OpenStack']:
- self.devbind()
- self.generate_lua(vim)
- self._client.scp_put(self.machine_params['config_file'], '{}/{}'.format(self.rundir, machine_params['config_file']))
+ self.vim = vim
def __del__(self):
self._client.scp_get('/prox.log', './{}.prox.log'.format(self.name))
@@ -99,10 +94,23 @@ class RapidMachine(object):
self._client.scp_put('helper.lua', self.rundir + '/helper.lua')
def start_prox(self, autostart=''):
+ self._client = prox_ctrl(self.ip, self.key, self.user)
+ self._client.connect()
+ if self.vim in ['OpenStack']:
+ self.devbind()
+ self.generate_lua(self.vim)
+ self._client.scp_put(self.machine_params['config_file'], '{}/{}'.format(self.rundir, self.machine_params['config_file']))
if self.machine_params['prox_launch_exit']:
cmd = 'sudo {}/prox {} -t -o cli -f {}/{}'.format(self.rundir, autostart, self.rundir, self.machine_params['config_file'])
- result = self._client.fork_cmd(cmd, 'PROX Testing on {}'.format(self.name))
- RapidLog.debug("Starting PROX on {}: {}, {}".format(self.name, cmd, result))
+ RapidLog.debug("Starting PROX on {}: {}".format(self.name, cmd))
+ result = self._client.run_cmd(cmd, 'PROX Testing on {}'.format(self.name))
+ #RapidLog.debug("Finished PROX on {}: {}, {}".format(self.name, cmd, result))
+ RapidLog.debug("Finished PROX on {}: {}".format(self.name, cmd))
+
+ def close_prox(self):
+ self.socket.quit()
+
+ def connect_prox(self):
self.socket = self._client.connect_socket()
def start(self):