def _run_tempest(self, overcloud_auth_url, overcloud_admin_password, network_id, deployer_input, tempest_args, skipfile): os.chdir(self.tempest_run_dir) if not deployer_input: deployer_input = '/dev/null' utils.run_shell('/usr/share/openstack-tempest-kilo/tools/' 'configure-tempest-directory') utils.run_shell( './tools/config_tempest.py --out etc/tempest.conf ' '--network-id %(network_id)s ' '--deployer-input %(partial_config_file)s ' '--debug --create ' 'compute.allow_tenant_isolation true ' 'compute.build_timeout 500 ' 'compute.image_ssh_user cirros ' 'compute.ssh_user cirros ' 'identity.admin_password %(admin_password)s ' 'identity.uri %(auth_url)s ' 'network.build_timeout 500 ' 'network.tenant_network_cidr 192.168.0.0/24 ' 'object-storage.operator_role swiftoperator ' 'orchestration.stack_owner_role heat_stack_user ' 'scenario.ssh_user cirros ' 'volume.build_timeout 500' % { 'network_id': network_id, 'partial_config_file': deployer_input, 'auth_url': overcloud_auth_url, 'admin_password': overcloud_admin_password }) args = [ './tools/run-tests.sh', ] if tempest_args is not None: args.append(tempest_args) if skipfile is not None: args.extend(['--skip-file', skipfile]) utils.run_shell(' '.join(args))
def _run_tempest(self, overcloud_auth_url, overcloud_admin_password, network_id, deployer_input, tempest_args, skipfile): os.chdir(self.tempest_run_dir) if not deployer_input: deployer_input = '/dev/null' utils.run_shell('/usr/share/openstack-tempest-kilo/tools/' 'configure-tempest-directory') utils.run_shell('./tools/config_tempest.py --out etc/tempest.conf ' '--network-id %(network_id)s ' '--deployer-input %(partial_config_file)s ' '--debug --create ' 'compute.allow_tenant_isolation true ' 'compute.build_timeout 500 ' 'compute.image_ssh_user cirros ' 'compute.ssh_user cirros ' 'identity.admin_password %(admin_password)s ' 'identity.uri %(auth_url)s ' 'network.build_timeout 500 ' 'network.tenant_network_cidr 192.168.0.0/24 ' 'object-storage.operator_role swiftoperator ' 'orchestration.stack_owner_role heat_stack_user ' 'scenario.ssh_user cirros ' 'volume.build_timeout 500' % {'network_id': network_id, 'partial_config_file': deployer_input, 'auth_url': overcloud_auth_url, 'admin_password': overcloud_admin_password}) args = ['./tools/run-tests.sh', ] if tempest_args is not None: args.append(tempest_args) if skipfile is not None: args.extend(['--skip-file', skipfile]) utils.run_shell(' '.join(args))
def take_action(self, parsed_args): self.log.debug("take_action(%s)" % parsed_args) self.error_count = 0 with open(parsed_args.instackenv, 'r') as net_file: env_data = json.load(net_file) maclist = [] baremetal_ips = [] for node in env_data['nodes']: self.log.info("Checking node %s" % node['pm_addr']) try: if len(node['pm_password']) == 0: self.log.error('ERROR: Password 0 length.') self.error_count += 1 except Exception as e: self.log.error('ERROR: Password does not exist: %s', e) self.error_count += 1 try: if len(node['pm_user']) == 0: self.log.error('ERROR: User 0 length.') self.error_count += 1 except Exception as e: self.log.error('ERROR: User does not exist: %s', e) self.error_count += 1 try: if len(node['mac']) == 0: self.log.error('ERROR: MAC address 0 length.') self.error_count += 1 maclist.extend(node['mac']) except Exception as e: self.log.error('ERROR: MAC address does not exist: %s', e) self.error_count += 1 if node['pm_type'] == "pxe_ssh": self.log.debug("Identified virtual node") if node['pm_type'] == "pxe_ipmitool": self.log.debug("Identified baremetal node") cmd = ('ipmitool -R 1 -I lanplus -H %s -U %s -P %s chassis ' 'status' % (node['pm_addr'], node['pm_user'], node['pm_password'])) self.log.debug("Executing: %s", cmd) status = utils.run_shell(cmd) if status != 0: self.log.error('ERROR: ipmitool failed') self.error_count += 1 baremetal_ips.append(node['pm_addr']) if not utils.all_unique(baremetal_ips): self.log.error('ERROR: Baremetals IPs are not all unique.') self.error_count += 1 else: self.log.debug('Baremetal IPs are all unique.') if not utils.all_unique(maclist): self.log.error('ERROR: MAC addresses are not all unique.') self.error_count += 1 else: self.log.debug('MAC addresses are all unique.') if self.error_count == 0: print('SUCCESS: found 0 errors') else: print('FAILURE: found %d errors' % self.error_count)