X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=testcases%2Fconfig_functest.py;h=70a7d6cd6abb0fb097d60080727374903e817517;hb=79a23744af12da7163e3a142dd44f60d46cbfd41;hp=d0788d30f4d8d7f02e0e60b0381991da77b22be3;hpb=768b803ca6cbf20d448e360fad3b50bed6bcf76d;p=functest.git diff --git a/testcases/config_functest.py b/testcases/config_functest.py index d0788d30f..70a7d6cd6 100755 --- a/testcases/config_functest.py +++ b/testcases/config_functest.py @@ -43,7 +43,7 @@ if not os.path.exists(REPO_PATH): exit(-1) sys.path.append(REPO_PATH + "testcases/") -with open(REPO_PATH+"testcases/config_functest.yaml") as f: +with open("/home/opnfv/functest/conf/config_functest.yaml") as f: functest_yaml = yaml.safe_load(f) f.close() @@ -55,12 +55,13 @@ RALLY_REPO_DIR = functest_yaml.get("general").get("directories").get("dir_repo_r RALLY_INSTALLATION_DIR = functest_yaml.get("general").get("directories").get("dir_rally_inst") RALLY_RESULT_DIR = functest_yaml.get("general").get("directories").get("dir_rally_res") VPING_DIR = REPO_PATH + functest_yaml.get("general").get("directories").get("dir_vping") +VIMS_TEST_DIR = functest_yaml.get("general").get("directories").get("dir_repo_vims_test") ODL_DIR = REPO_PATH + functest_yaml.get("general").get("directories").get("dir_odl") DATA_DIR = functest_yaml.get("general").get("directories").get("dir_functest_data") # Tempest/Rally configuration details -DEPLOYMENT_MAME = "opnfv-rally" -RALLY_COMMIT = functest_yaml.get("general").get("openstack").get("rally_stable_commit") +DEPLOYMENT_MAME = functest_yaml.get("rally").get("deployment_name") +RALLY_COMMIT = functest_yaml.get("general").get("repositories").get("rally_commit") #Image (cirros) IMAGE_FILE_NAME = functest_yaml.get("general").get("openstack").get("image_file_name") @@ -108,23 +109,38 @@ def action_start(): logger.info("Private network '%s' already existing in the deployment." % private_net['name']) - logger.info("Installing Rally...") if not install_rally(): logger.error("There has been a problem while installing Rally.") action_clean() exit(-1) - logger.info("Configuring Tempest...") - if not configure_tempest(): - logger.error("There has been a problem while configuring Tempest.") - action_clean() - exit(-1) + logger.info("Installing Ruby libraries for vIMS testcase...") + # Install ruby libraries for vims test-case + script = 'source /etc/profile.d/rvm.sh; ' + script += 'cd ' + VIMS_TEST_DIR + '; ' + script += 'rvm autolibs enable ;' + script += 'rvm install 1.9.3; ' + script += 'rvm use 1.9.3;' + script += 'bundle install' + + cmd = "/bin/bash -c '" + script + "'" + if os.environ.get("CI_DEBUG") == "false": + functest_utils.execute_command(cmd) + else: + functest_utils.execute_command(cmd,logger) # Create result folder under functest if necessary if not os.path.exists(RALLY_RESULT_DIR): os.makedirs(RALLY_RESULT_DIR) + try: + logger.info("CI: Generate the list of executable tests.") + runnable_test = functest_utils.generateTestcaseList(functest_yaml) + logger.info("List of runnable tests generated: %s" % runnable_test) + except: + logger.error("Impossible to generate the list of runnable tests") + exit(0) @@ -195,7 +211,7 @@ def action_clean(): logger.debug("Cleaning up the OpenStack deployment...") cmd='python ' + REPO_PATH + \ - '/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py -d ' + '/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py --debug' functest_utils.execute_command(cmd,logger) logger.info("Functest environment clean!") @@ -208,7 +224,10 @@ def install_rally(): logger.debug("Executing %s/install_rally.sh..." %RALLY_REPO_DIR) install_script = RALLY_REPO_DIR + "/install_rally.sh --yes" cmd = 'sudo ' + install_script - functest_utils.execute_command(cmd,logger) + if os.environ.get("CI_DEBUG") == "false": + functest_utils.execute_command(cmd) + else: + functest_utils.execute_command(cmd,logger) logger.debug("Creating Rally environment...") cmd = "rally deployment create --fromenv --name="+DEPLOYMENT_MAME @@ -231,41 +250,6 @@ def install_rally(): return True -def configure_tempest(): - """ - Add/update needed parameters into tempest.conf file generated by Rally - """ - - creds_neutron = functest_utils.get_credentials("neutron") - neutron_client = neutronclient.Client(**creds_neutron) - - logger.debug("Generating tempest.conf file...") - cmd = "rally verify genconfig" - functest_utils.execute_command(cmd,logger) - - logger.debug("Resolving deployment UUID...") - cmd = "rally deployment list | awk '/"+DEPLOYMENT_MAME+"/ {print $2}'" - p = subprocess.Popen(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT); - deployment_uuid = p.stdout.readline().rstrip() - if deployment_uuid == "": - logger.debug(" Rally deployment NOT found") - return False - - logger.debug("Finding tempest.conf file...") - tempest_conf_file = RALLY_INSTALLATION_DIR+"/tempest/for-deployment-" \ - +deployment_uuid+"/tempest.conf" - - logger.debug(" Updating fixed_network_name...") - fixed_network = functest_utils.get_network_list(neutron_client)[0]['name'] - if fixed_network != None: - cmd = "crudini --set "+tempest_conf_file+" compute fixed_network_name "+fixed_network - functest_utils.execute_command(cmd,logger) - - return True - - def check_rally(): """ Check if Rally is installed and properly configured @@ -296,6 +280,13 @@ def create_private_neutron_net(neutron): if not network_id: return False logger.debug("Network '%s' created successfully" % network_id) + + logger.info('Updating neutron network %s...' % NEUTRON_PRIVATE_NET_NAME) + if functest_utils.update_neutron_net(neutron, network_id, shared=True): + logger.debug("Network '%s' updated successfully" % network_id) + else: + logger.info('Updating neutron network %s failed' % network_id) + logger.debug('Creating Subnet....') subnet_id = functest_utils. \ create_neutron_subnet(neutron,