A secret and public key pair is available in the rapid directory:
rapid_rsa_key and rapid_rsa_key.pub. createrapid.py is now modified to
upload this key into OpenStack if the keypair does not already exist in
OpenStack. Which keypair to use is now only defined in
params_rapid.yaml. You can still define a key pair with a different name
in params_rapid.yaml. If the secret and public key files are not
available, a new keypair will be created and the secret key file will be
saved. The name of the secret key file is the name as the OpenStack
keypair name. The name of the public file is the same, with the pub
extension.
Change-Id: Ib8b5e4bf3a3d3138216698dc588a6908248220c0
Signed-off-by: Luc Provoost <luc.provoost@intel.com>
stack_name = rapid
heat_template= openstack-rapid.yaml
heat_param = params_rapid.yaml
stack_name = rapid
heat_template= openstack-rapid.yaml
heat_param = params_rapid.yaml
-keypair_name = rapid_rsa_key
-user = rapid
dataplane_subnet_mask = 24
;push_gateway = http://192.168.36.61:9091/metrics/job/
dataplane_subnet_mask = 24
;push_gateway = http://192.168.36.61:9091/metrics/job/
stack_name = rapid_stack_params['stack_name']
heat_template = rapid_stack_params['heat_template']
heat_param = rapid_stack_params['heat_param']
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)
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():
deployment.generate_env_file(user, dataplane_subnet_mask)
def main():
#stack_name = 'rapid'
#heat_template = 'openstack-rapid.yaml'
#heat_param = 'params_rapid.yaml'
#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)
#user = 'centos'
RapidStackManager.deploy_stack(rapid_stack_params)
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}
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}
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}
public_net_name: admin_floating_net\r
data_net_name: dataplane-network\r
PROX_image: rapidVM\r
public_net_name: admin_floating_net\r
data_net_name: dataplane-network\r
PROX_image: rapidVM\r
+ PROX_key: rapid_rsa_key\r
my_availability_zone: nova\r
security_group: prox_security_group\r
PROXType1VM_count: 3\r
my_availability_zone: nova\r
security_group: prox_security_group\r
PROXType1VM_count: 3\r
iteration_data['avg_bg_rate'] = None
#Stop generating
self.gen_machine.stop_gen_cores()
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))
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))
env_file.write('dp_mac1 = {}\n'.format(str(self.dp_macs[count])))
env_file.write('\n')
env_file.write('[ssh]\n')
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))
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)
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..')
# Poll at 5 second intervals, until the status is no longer 'BUILD'
while stack.stack_status == 'CREATE_IN_PROGRESS':
print('waiting..')
RapidLog.exception('Error in stack deployment')
def create_key(self):
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
# 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):
RapidLog.info('Keypair {} created'.format(self.key_name))
def IsDeployed(self, stack_name):
- 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()
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()
def generate_env_file(self, user = 'centos', dataplane_subnet_mask = '24'):
self.generate_paramDict()