X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=functest%2Fopnfv_tests%2Fopenstack%2Ftempest%2Fconf_utils.py;h=d6b1eb401970cc8422de74f9abdd261a965b1984;hb=c9fd7ceab29ff755aa8a9ee1bcb6ab958e5e0420;hp=fbf9c739b682b80b62fe20370b0d956c51141729;hpb=8ea8434a1d02d57f61c34113b676d9f8f2530dde;p=functest.git diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py index fbf9c739b..d6b1eb401 100644 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ b/functest/opnfv_tests/openstack/tempest/conf_utils.py @@ -33,19 +33,12 @@ RALLY_AARCH64_PATCH_PATH = pkg_resources.resource_filename( GLANCE_IMAGE_PATH = os.path.join( getattr(config.CONF, 'dir_functest_images'), getattr(config.CONF, 'openstack_image_file_name')) -TEMPEST_RESULTS_DIR = os.path.join( - getattr(config.CONF, 'dir_results'), 'tempest') TEMPEST_CUSTOM = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/test_list.txt') TEMPEST_BLACKLIST = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/blacklist.txt') -TEMPEST_RAW_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_raw_list.txt') -TEMPEST_LIST = os.path.join(TEMPEST_RESULTS_DIR, 'test_list.txt') TEMPEST_CONF_YAML = pkg_resources.resource_filename( 'functest', 'opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml') -TEST_ACCOUNTS_FILE = pkg_resources.resource_filename( - 'functest', - 'opnfv_tests/openstack/tempest/custom_tests/test_accounts.yaml') CI_INSTALLER_TYPE = env.get('INSTALLER_TYPE') @@ -93,8 +86,7 @@ def create_verifier(): getattr(config.CONF, 'tempest_verifier_name')) ft_utils.execute_command(cmd, error_msg=( "Verifier %s does not exist." - % getattr(config.CONF, 'tempest_verifier_name')), - verbose=False) + % getattr(config.CONF, 'tempest_verifier_name')), verbose=False) cmd = ("rally verify create-verifier --source {0} " "--name {1} --type tempest --system-wide" .format(getattr(config.CONF, 'dir_repo_tempest'), @@ -168,45 +160,14 @@ def get_verifier_deployment_dir(verifier_id, deployment_id): 'for-deployment-{}'.format(deployment_id)) -def backup_tempest_config(conf_file): +def backup_tempest_config(conf_file, res_dir): """ Copy config file to tempest results directory """ - if not os.path.exists(TEMPEST_RESULTS_DIR): - os.makedirs(TEMPEST_RESULTS_DIR) + if not os.path.exists(res_dir): + os.makedirs(res_dir) shutil.copyfile(conf_file, - os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf')) - - -def configure_tempest(deployment_dir, network_name=None, image_id=None, - flavor_id=None, compute_cnt=None): - """ - Calls rally verify and updates the generated tempest.conf with - given parameters - """ - conf_file = configure_verifier(deployment_dir) - configure_tempest_update_params(conf_file, network_name, image_id, - flavor_id, compute_cnt) - - -def generate_test_accounts_file(tenant_id): - """ - Add needed tenant and user params into test_accounts.yaml - """ - - LOGGER.debug("Add needed params into test_accounts.yaml...") - accounts_list = [ - { - 'tenant_name': getattr( - config.CONF, 'tempest_identity_tenant_name'), - 'tenant_id': str(tenant_id), - 'username': getattr(config.CONF, 'tempest_identity_user_name'), - 'password': getattr(config.CONF, 'tempest_identity_user_password') - } - ] - - with open(TEST_ACCOUNTS_FILE, "w") as tfile: - yaml.dump(accounts_list, tfile, default_flow_style=False) + os.path.join(res_dir, 'tempest.conf')) def update_tempest_conf_file(conf_file, rconfig): @@ -226,10 +187,10 @@ def update_tempest_conf_file(conf_file, rconfig): rconfig.write(config_file) -def configure_tempest_update_params(tempest_conf_file, network_name=None, - image_id=None, flavor_id=None, - compute_cnt=1): - # pylint: disable=too-many-branches +def configure_tempest_update_params(tempest_conf_file, res_dir, + network_name=None, image_id=None, + flavor_id=None, compute_cnt=1): + # pylint: disable=too-many-branches, too-many-arguments """ Add/update needed parameters into tempest.conf file """ @@ -237,12 +198,7 @@ def configure_tempest_update_params(tempest_conf_file, network_name=None, rconfig = ConfigParser.RawConfigParser() rconfig.read(tempest_conf_file) rconfig.set('compute', 'fixed_network_name', network_name) - if CI_INSTALLER_TYPE == 'fuel': - # backward compatibility till Fuel jobs set the right env var - rconfig.set('compute', 'volume_device_name', 'vdc') - else: - rconfig.set( - 'compute', 'volume_device_name', env.get('VOLUME_DEVICE_NAME')) + rconfig.set('compute', 'volume_device_name', env.get('VOLUME_DEVICE_NAME')) if image_id is not None: rconfig.set('compute', 'image_ref', image_id) if IMAGE_ID_ALT is not None: @@ -275,6 +231,8 @@ def configure_tempest_update_params(tempest_conf_file, network_name=None, rconfig.set('identity', 'v3_endpoint_type', os.environ.get('OS_ENDPOINT_TYPE')) + rconfig.set('network-feature-enabled', 'api_extensions', 'all') + if os.environ.get('OS_ENDPOINT_TYPE') is not None: sections = rconfig.sections() services_list = [ @@ -290,7 +248,7 @@ def configure_tempest_update_params(tempest_conf_file, network_name=None, 'into tempest.conf file') update_tempest_conf_file(tempest_conf_file, rconfig) - backup_tempest_config(tempest_conf_file) + backup_tempest_config(tempest_conf_file, res_dir) def configure_verifier(deployment_dir):