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-23 14:45:23 +0200
committerLuc Provoost <luc.provoost@intel.com>2020-09-29 10:15:14 +0200
commit0d1b97e647224d3d977186523d45555bc819f42a (patch)
tree278e9ad8dbc3262dc07ea6b0a77defdc08cf7b4a /VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
parent80dfeb5c734cc4d681f467e853a541a8a91fe1cf (diff)
New PROX version, background traffic reporting
deploycentostools.sh is now installing a recent PROX version. When using background traffic, the tool is also reporting the total traffic that was handled by the NFVi stack, including foreground & background traffic. The use of the prox_socket and prox_launch_exit was also broken in a previous release and is now fixed. When setting prox_socket to false for a PROX instance, we will not create a socket connection to control that PROX instance. Setting this option to false is not meaningful for the generator PROX instances since we would not be able to control the behavior of the PROX generator during the test. You could use the generator against another non-PROX instance and then set prox_socket to false for that non-PROX instance. Default is true. prox_launch_exit is used to start and stop the PROX program inside the instance. Default is true. This is useful in case you want to start PROX manually to be able to inspect the PROX UI, but at the same time, let the rapid scripts control the testing. Change-Id: Ib5aa809f4be201859542769f5f55f4989dad97ef 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.py43
1 files changed, 24 insertions, 19 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
index a9f53083..4a0bcb82 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py
@@ -48,12 +48,13 @@ class RapidMachine(object):
self.vim = vim
def __del__(self):
- self._client.scp_get('/prox.log', './{}.prox.log'.format(self.name))
+ if self.machine_params['prox_socket']:
+ self._client.scp_get('/prox.log', './{}.prox.log'.format(self.name))
def get_cores(self):
return (self.machine_params['cores'])
- def devbind(self):
+ def devbind(self, configonly):
# Script to bind the right network interface to the poll mode driver
for index, dp_port in enumerate(self.dp_ports, start = 1):
DevBindFileName = self.rundir + '/devbind-{}-port{}.sh'.format(self.ip, index)
@@ -61,8 +62,9 @@ class RapidMachine(object):
cmd = 'sed -i \'s/MACADDRESS/' + dp_port['mac'] + '/\' ' + DevBindFileName
result = self._client.run_cmd(cmd)
RapidLog.debug('devbind.sh MAC updated for port {} on {} {}'.format(index, self.name, result))
- result = self._client.run_cmd(DevBindFileName)
- RapidLog.debug('devbind.sh running for port {} on {} {}'.format(index, self.name, result))
+ if ((not configonly) and self.machine_params['prox_launch_exit']):
+ result = self._client.run_cmd(DevBindFileName)
+ RapidLog.debug('devbind.sh running for port {} on {} {}'.format(index, self.name, result))
def generate_lua(self, vim, appendix = ''):
PROXConfigfile = open (self.machine_params['config_file'], 'r')
@@ -93,25 +95,28 @@ class RapidMachine(object):
self._client.scp_put(self.LuaFileName, self.rundir + '/parameters.lua')
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'])
- 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 start_prox(self, configonly=False, autostart=''):
+ if self.machine_params['prox_socket']:
+ self._client = prox_ctrl(self.ip, self.key, self.user)
+ self._client.connect()
+ if self.vim in ['OpenStack']:
+ self.devbind(configonly)
+ self.generate_lua(self.vim)
+ self._client.scp_put(self.machine_params['config_file'], '{}/{}'.format(self.rundir, self.machine_params['config_file']))
+ if ((not configonly) and self.machine_params['prox_launch_exit']):
+ cmd = 'sudo {}/prox {} -t -o cli -f {}/{}'.format(self.rundir, autostart, self.rundir, self.machine_params['config_file'])
+ 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()
+ if self.machine_params['prox_socket'] and self.machine_params['prox_launch_exit']:
+ self.socket.quit()
def connect_prox(self):
- self.socket = self._client.connect_socket()
+ if self.machine_params['prox_socket']:
+ self.socket = self._client.connect_socket()
def start(self):
self.socket.start(self.get_cores())