diff options
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py')
-rw-r--r-- | VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py | 17 |
1 files changed, 9 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 4a0bcb82..8466c856 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py @@ -24,7 +24,7 @@ class RapidMachine(object): """ Class to deal with a PROX instance (VM, bare metal, container) """ - def __init__(self, key, user, vim, rundir, machine_params): + def __init__(self, key, user, vim, rundir, machine_params, configonly): self.name = machine_params['name'] self.ip = machine_params['admin_ip'] self.key = key @@ -32,6 +32,7 @@ class RapidMachine(object): self.rundir = rundir self.dp_ports = [] self.dpdk_port_index = [] + self.configonly = configonly index = 1 while True: ip_key = 'dp_ip{}'.format(index) @@ -48,13 +49,13 @@ class RapidMachine(object): self.vim = vim def __del__(self): - if self.machine_params['prox_socket']: + if ((not self.configonly) and 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, configonly): + def devbind(self): # 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) @@ -62,7 +63,7 @@ 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)) - if ((not configonly) and self.machine_params['prox_launch_exit']): + if ((not self.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)) @@ -95,15 +96,15 @@ 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, configonly=False, autostart=''): + def start_prox(self, 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.devbind() 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']): + if ((not self.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)) @@ -111,7 +112,7 @@ class RapidMachine(object): RapidLog.debug("Finished PROX on {}: {}".format(self.name, cmd)) def close_prox(self): - if self.machine_params['prox_socket'] and self.machine_params['prox_launch_exit']: + if (not self.configonly) and self.machine_params['prox_socket'] and self.machine_params['prox_launch_exit']: self.socket.quit() def connect_prox(self): |