summaryrefslogtreecommitdiffstats
path: root/VNFs
diff options
context:
space:
mode:
Diffstat (limited to 'VNFs')
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/config_file3
-rwxr-xr-xVNFs/DPPD-PROX/helper-scripts/rapid/createrapid.py4
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml2
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml1
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py1
-rwxr-xr-xVNFs/DPPD-PROX/helper-scripts/rapid/stackdeployment.py47
6 files changed, 35 insertions, 23 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/config_file b/VNFs/DPPD-PROX/helper-scripts/rapid/config_file
index 612f639f..b5aeb3a9 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/config_file
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/config_file
@@ -3,7 +3,6 @@ cloud_name = openstackL6
stack_name = rapid
heat_template= openstack-rapid.yaml
heat_param = params_rapid.yaml
-keypair_name = rapid_rsa_key
-user = rapid
+user = centos
dataplane_subnet_mask = 24
;push_gateway = http://192.168.36.61:9091/metrics/job/
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/createrapid.py b/VNFs/DPPD-PROX/helper-scripts/rapid/createrapid.py
index 2ff503ae..af1da307 100755
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/createrapid.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/createrapid.py
@@ -42,11 +42,10 @@ class RapidStackManager(object):
stack_name = rapid_stack_params['stack_name']
heat_template = rapid_stack_params['heat_template']
heat_param = rapid_stack_params['heat_param']
- keypair_name = rapid_stack_params['keypair_name']
user = rapid_stack_params['user']
dataplane_subnet_mask = rapid_stack_params['dataplane_subnet_mask']
deployment = StackDeployment(cloud_name)
- deployment.deploy(stack_name, keypair_name, heat_template, heat_param)
+ deployment.deploy(stack_name, heat_template, heat_param)
deployment.generate_env_file(user, dataplane_subnet_mask)
def main():
@@ -58,7 +57,6 @@ def main():
#stack_name = 'rapid'
#heat_template = 'openstack-rapid.yaml'
#heat_param = 'params_rapid.yaml'
- #keypair_name = 'prox_key'
#user = 'centos'
RapidStackManager.deploy_stack(rapid_stack_params)
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml
index 5915ed2b..92c0406e 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/openstack-rapid.yaml
@@ -10,7 +10,7 @@ parameters:
public_net_name: {description: Public network to allocate (floating) IPs to VMs', type: string, default: admin_floating_net}
mgmt_net_name: {description: Name of PROX mgmt network to be created, type: string, default: admin_internal_net}
PROX_image: {description: Image name to use for PROX, type: string, default: rapidVM}
- PROX_key: {description: DO NOT CHANGE THIS DEFAULT KEY NAME, type: string, default: rapid_key}
+ PROX_key: {description: DO NOT CHANGE THIS DEFAULT KEY NAME, type: string, default: rapid_rsa_key}
my_availability_zone: {description: availability_zone for Hosting VMs, type: string, default: nova}
security_group: {description: Security Group to use, type: string, default: prox_security_group}
PROXType1VM_count: {description: Total number of testVMs to create, type: number, default: 2}
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml
index 9663fc36..fbef2f54 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/params_rapid.yaml
@@ -2,6 +2,7 @@ parameters:
public_net_name: admin_floating_net
data_net_name: dataplane-network
PROX_image: rapidVM
+ PROX_key: rapid_rsa_key
my_availability_zone: nova
security_group: prox_security_group
PROXType1VM_count: 3
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py
index 36a9f78e..16cf9190 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py
@@ -370,6 +370,7 @@ class RapidTest(object):
iteration_data['avg_bg_rate'] = None
#Stop generating
self.gen_machine.stop_gen_cores()
+ self.gen_machine.stop_latency_cores()
iteration_data['r'] += 1
iteration_data['lat_avg'] = old_div(iteration_data['lat_avg'], float(tot_lat_measurement_duration))
iteration_data['lat_used'] = old_div(iteration_data['lat_used'], float(tot_lat_measurement_duration))
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/stackdeployment.py b/VNFs/DPPD-PROX/helper-scripts/rapid/stackdeployment.py
index 6374b843..7038ab66 100755
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/stackdeployment.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/stackdeployment.py
@@ -102,21 +102,20 @@ class StackDeployment(object):
env_file.write('dp_mac1 = {}\n'.format(str(self.dp_macs[count])))
env_file.write('\n')
env_file.write('[ssh]\n')
- env_file.write('key = {}\n'.format(self.private_key_filename))
+ env_file.write('key = {}\n'.format(self.key_name))
env_file.write('user = {}\n'.format(user))
env_file.write('\n')
env_file.write('[Varia]\n')
env_file.write('vim = OpenStack\n')
env_file.write('stack = {}\n'.format(self.stack.stack_name))
- def create_stack(self, stack_name, stack_file_path, param_file):
+ def create_stack(self, stack_name, stack_file_path, heat_parameters):
files, template = template_utils.process_template_path(stack_file_path)
- heat_parameters = open(param_file)
- temp_params = yaml.load(heat_parameters,Loader=yaml.BaseLoader)
- heat_parameters.close()
- stack_created = self.heatclient.stacks.create(stack_name=stack_name, template=template,
- parameters=temp_params["parameters"], files=files)
- stack = self.heatclient.stacks.get(stack_created['stack']['id'], resolve_outputs=True)
+ stack_created = self.heatclient.stacks.create(stack_name = stack_name,
+ template = template, parameters = heat_parameters,
+ files = files)
+ stack = self.heatclient.stacks.get(stack_created['stack']['id'],
+ resolve_outputs=True)
# Poll at 5 second intervals, until the status is no longer 'BUILD'
while stack.stack_status == 'CREATE_IN_PROGRESS':
print('waiting..')
@@ -128,11 +127,22 @@ class StackDeployment(object):
RapidLog.exception('Error in stack deployment')
def create_key(self):
- keypair = self.nova_client.keypairs.create(name=self.key_name)
+ if os.path.exists(self.key_name):
+ public_key_file = "{}.pub".format(self.key_name)
+ if not os.path.exists(public_key_file):
+ RapidLog.critical('Keypair {}.pub does not exist'.format(
+ self.key_name))
+ with open(public_key_file, mode='rb') as public_file:
+ public_key = public_file.read()
+ else:
+ public_key = None
+ keypair = self.nova_client.keypairs.create(name = self.key_name,
+ public_key = public_key)
# Create a file for writing that can only be read and written by owner
- fp = os.open(self.private_key_filename, os.O_WRONLY | os.O_CREAT, 0o600)
- with os.fdopen(fp, 'w') as f:
- f.write(keypair.private_key)
+ if not os.path.exists(self.key_name):
+ fp = os.open(self.key_name, os.O_WRONLY | os.O_CREAT, 0o600)
+ with os.fdopen(fp, 'w') as f:
+ f.write(keypair.private_key)
RapidLog.info('Keypair {} created'.format(self.key_name))
def IsDeployed(self, stack_name):
@@ -150,14 +160,17 @@ class StackDeployment(object):
return True
return False
- def deploy(self, stack_name, keypair_name, heat_template, heat_param):
- self.key_name = keypair_name
- #self.private_key_filename = '{}.pem'.format(keypair_name)
- self.private_key_filename = keypair_name
+ def deploy(self, stack_name, heat_template, heat_param):
+ heat_parameters_file = open(heat_param)
+ heat_parameters = yaml.load(heat_parameters_file,
+ Loader=yaml.BaseLoader)['parameters']
+ heat_parameters_file.close()
+ self.key_name = heat_parameters['PROX_key']
if not self.IsDeployed(stack_name):
if not self.IsKey():
self.create_key()
- self.stack = self.create_stack(stack_name, heat_template, heat_param)
+ self.stack = self.create_stack(stack_name, heat_template,
+ heat_parameters)
def generate_env_file(self, user = 'centos', dataplane_subnet_mask = '24'):
self.generate_paramDict()