diff options
Diffstat (limited to 'functest/opnfv_tests/openstack/tempest')
8 files changed, 943 insertions, 1043 deletions
diff --git a/functest/opnfv_tests/openstack/tempest/conf_utils.py b/functest/opnfv_tests/openstack/tempest/conf_utils.py deleted file mode 100644 index e61ab8138..000000000 --- a/functest/opnfv_tests/openstack/tempest/conf_utils.py +++ /dev/null @@ -1,352 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2015 All rights reserved -# This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -import ConfigParser -import logging -import fileinput -import os -import pkg_resources -import shutil -import subprocess - -import yaml - -from functest.utils.constants import CONST -import functest.utils.functest_utils as ft_utils - - -IMAGE_ID_ALT = None -FLAVOR_ID_ALT = None -RALLY_CONF_PATH = "/etc/rally/rally.conf" -RALLY_AARCH64_PATCH_PATH = pkg_resources.resource_filename( - 'functest', 'ci/rally_aarch64_patch.conf') -GLANCE_IMAGE_PATH = os.path.join( - CONST.__getattribute__('dir_functest_images'), - CONST.__getattribute__('openstack_image_file_name')) -TEMPEST_RESULTS_DIR = os.path.join(CONST.__getattribute__('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_DEFCORE = pkg_resources.resource_filename( - 'functest', - 'opnfv_tests/openstack/tempest/custom_tests/defcore_req.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') -REFSTACK_RESULTS_DIR = os.path.join(CONST.__getattribute__('dir_results'), - 'refstack') -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 = CONST.__getattribute__('INSTALLER_TYPE') -CI_INSTALLER_IP = CONST.__getattribute__('INSTALLER_IP') - -""" logging configuration """ -logger = logging.getLogger(__name__) - - -def create_rally_deployment(): - # set the architecture to default - pod_arch = os.getenv("POD_ARCH", None) - arch_filter = ['aarch64'] - - if pod_arch and pod_arch in arch_filter: - logger.info("Apply aarch64 specific to rally config...") - with open(RALLY_AARCH64_PATCH_PATH, "r") as f: - rally_patch_conf = f.read() - - for line in fileinput.input(RALLY_CONF_PATH, inplace=1): - print line, - if "cirros|testvm" in line: - print rally_patch_conf - - logger.info("Creating Rally environment...") - - cmd = "rally deployment destroy opnfv-rally" - ft_utils.execute_command(cmd, error_msg=( - "Deployment %s does not exist." - % CONST.__getattribute__('rally_deployment_name')), - verbose=False) - - cmd = ("rally deployment create --fromenv --name={0}" - .format(CONST.__getattribute__('rally_deployment_name'))) - error_msg = "Problem while creating Rally deployment" - ft_utils.execute_command_raise(cmd, error_msg=error_msg) - - cmd = "rally deployment check" - error_msg = "OpenStack not responding or faulty Rally deployment." - ft_utils.execute_command_raise(cmd, error_msg=error_msg) - - -def create_verifier(): - logger.info("Create verifier from existing repo...") - cmd = ("rally verify delete-verifier --id '{0}' --force").format( - CONST.__getattribute__('tempest_verifier_name')) - ft_utils.execute_command(cmd, error_msg=( - "Verifier %s does not exist." - % CONST.__getattribute__('tempest_verifier_name')), - verbose=False) - cmd = ("rally verify create-verifier --source {0} " - "--name {1} --type tempest --system-wide" - .format(CONST.__getattribute__('dir_repo_tempest'), - CONST.__getattribute__('tempest_verifier_name'))) - ft_utils.execute_command_raise(cmd, - error_msg='Problem while creating verifier') - - -def get_verifier_id(): - """ - Returns verifier id for current Tempest - """ - create_rally_deployment() - create_verifier() - cmd = ("rally verify list-verifiers | awk '/" + - CONST.__getattribute__('tempest_verifier_name') + - "/ {print $2}'") - p = subprocess.Popen(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - deployment_uuid = p.stdout.readline().rstrip() - if deployment_uuid == "": - logger.error("Tempest verifier not found.") - raise Exception('Error with command:%s' % cmd) - return deployment_uuid - - -def get_verifier_deployment_id(): - """ - Returns deployment id for active Rally deployment - """ - cmd = ("rally deployment list | awk '/" + - CONST.__getattribute__('rally_deployment_name') + - "/ {print $2}'") - p = subprocess.Popen(cmd, shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - deployment_uuid = p.stdout.readline().rstrip() - if deployment_uuid == "": - logger.error("Rally deployment not found.") - raise Exception('Error with command:%s' % cmd) - return deployment_uuid - - -def get_verifier_repo_dir(verifier_id): - """ - Returns installed verifier repo directory for Tempest - """ - if not verifier_id: - verifier_id = get_verifier_id() - - return os.path.join(CONST.__getattribute__('dir_rally_inst'), - 'verification', - 'verifier-{}'.format(verifier_id), - 'repo') - - -def get_verifier_deployment_dir(verifier_id, deployment_id): - """ - Returns Rally deployment directory for current verifier - """ - if not verifier_id: - verifier_id = get_verifier_id() - - if not deployment_id: - deployment_id = get_verifier_deployment_id() - - return os.path.join(CONST.__getattribute__('dir_rally_inst'), - 'verification', - 'verifier-{}'.format(verifier_id), - 'for-deployment-{}'.format(deployment_id)) - - -def backup_tempest_config(conf_file): - """ - Copy config file to tempest results directory - """ - if not os.path.exists(TEMPEST_RESULTS_DIR): - os.makedirs(TEMPEST_RESULTS_DIR) - shutil.copyfile(conf_file, - os.path.join(TEMPEST_RESULTS_DIR, 'tempest.conf')) - - -def configure_tempest(deployment_dir, 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, image_id, flavor_id, - compute_cnt) - - -def configure_tempest_defcore(deployment_dir, image_id, flavor_id, - image_id_alt, flavor_id_alt, tenant_id): - """ - Add/update needed parameters into tempest.conf file - """ - conf_file = configure_verifier(deployment_dir) - configure_tempest_update_params(conf_file, image_id, flavor_id) - - logger.debug("Updating selected tempest.conf parameters for defcore...") - config = ConfigParser.RawConfigParser() - config.read(conf_file) - config.set('DEFAULT', 'log_file', '{}/tempest.log'.format(deployment_dir)) - config.set('oslo_concurrency', 'lock_path', - '{}/lock_files'.format(deployment_dir)) - generate_test_accounts_file(tenant_id=tenant_id) - config.set('auth', 'test_accounts_file', TEST_ACCOUNTS_FILE) - config.set('scenario', 'img_dir', '{}'.format(deployment_dir)) - config.set('scenario', 'img_file', 'tempest-image') - config.set('compute', 'image_ref', image_id) - config.set('compute', 'image_ref_alt', image_id_alt) - config.set('compute', 'flavor_ref', flavor_id) - config.set('compute', 'flavor_ref_alt', flavor_id_alt) - - with open(conf_file, 'wb') as config_file: - config.write(config_file) - - confpath = pkg_resources.resource_filename( - 'functest', - 'opnfv_tests/openstack/refstack_client/refstack_tempest.conf') - shutil.copyfile(conf_file, confpath) - - -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': - CONST.__getattribute__('tempest_identity_tenant_name'), - 'tenant_id': str(tenant_id), - 'username': CONST.__getattribute__('tempest_identity_user_name'), - 'password': - CONST.__getattribute__('tempest_identity_user_password') - } - ] - - with open(TEST_ACCOUNTS_FILE, "w") as f: - yaml.dump(accounts_list, f, default_flow_style=False) - - -def configure_tempest_update_params(tempest_conf_file, image_id=None, - flavor_id=None, compute_cnt=1): - """ - Add/update needed parameters into tempest.conf file - """ - logger.debug("Updating selected tempest.conf parameters...") - config = ConfigParser.RawConfigParser() - config.read(tempest_conf_file) - config.set( - 'compute', - 'fixed_network_name', - CONST.__getattribute__('tempest_private_net_name')) - config.set('compute', 'volume_device_name', - CONST.__getattribute__('tempest_volume_device_name')) - - if image_id is not None: - config.set('compute', 'image_ref', image_id) - if IMAGE_ID_ALT is not None: - config.set('compute', 'image_ref_alt', IMAGE_ID_ALT) - if CONST.__getattribute__('tempest_use_custom_flavors'): - if flavor_id is not None: - config.set('compute', 'flavor_ref', flavor_id) - if FLAVOR_ID_ALT is not None: - config.set('compute', 'flavor_ref_alt', FLAVOR_ID_ALT) - if compute_cnt > 1: - # enable multinode tests - config.set('compute', 'min_compute_nodes', compute_cnt) - config.set('compute-feature-enabled', 'live_migration', True) - - config.set('identity', 'region', - CONST.__getattribute__('OS_REGION_NAME')) - identity_api_version = os.getenv( - "OS_IDENTITY_API_VERSION", os.getenv("IDENTITY_API_VERSION")) - if (identity_api_version == '3'): - auth_version = 'v3' - else: - auth_version = 'v2' - config.set('identity', 'auth_version', auth_version) - config.set( - 'validation', 'ssh_timeout', - CONST.__getattribute__('tempest_validation_ssh_timeout')) - config.set('object-storage', 'operator_role', - CONST.__getattribute__('tempest_object_storage_operator_role')) - - if CONST.__getattribute__('OS_ENDPOINT_TYPE') is not None: - config.set('identity', 'v3_endpoint_type', - CONST.__getattribute__('OS_ENDPOINT_TYPE')) - - if (identity_api_version == '3'): - config.set('identity-feature-enabled', 'api_v2', False) - - if CONST.__getattribute__('OS_ENDPOINT_TYPE') is not None: - sections = config.sections() - services_list = ['compute', - 'volume', - 'image', - 'network', - 'data-processing', - 'object-storage', - 'orchestration'] - for service in services_list: - if service not in sections: - config.add_section(service) - config.set(service, 'endpoint_type', - CONST.__getattribute__('OS_ENDPOINT_TYPE')) - - logger.debug('Add/Update required params defined in tempest_conf.yaml ' - 'into tempest.conf file') - with open(TEMPEST_CONF_YAML) as f: - conf_yaml = yaml.safe_load(f) - if conf_yaml: - sections = config.sections() - for section in conf_yaml: - if section not in sections: - config.add_section(section) - sub_conf = conf_yaml.get(section) - for key, value in sub_conf.items(): - config.set(section, key, value) - - with open(tempest_conf_file, 'wb') as config_file: - config.write(config_file) - - backup_tempest_config(tempest_conf_file) - - -def configure_verifier(deployment_dir): - """ - Execute rally verify configure-verifier, which generates tempest.conf - """ - tempest_conf_file = os.path.join(deployment_dir, "tempest.conf") - if os.path.isfile(tempest_conf_file): - logger.debug("Verifier is already configured.") - logger.debug("Reconfiguring the current verifier...") - cmd = "rally verify configure-verifier --reconfigure" - else: - logger.info("Configuring the verifier...") - cmd = "rally verify configure-verifier" - ft_utils.execute_command(cmd) - - logger.debug("Looking for tempest.conf file...") - if not os.path.isfile(tempest_conf_file): - logger.error("Tempest configuration file %s NOT found." - % tempest_conf_file) - raise Exception("Tempest configuration file %s NOT found." - % tempest_conf_file) - else: - return tempest_conf_file diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt deleted file mode 100644 index bb1aed339..000000000 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt +++ /dev/null @@ -1,2 +0,0 @@ - -- diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml new file mode 100644 index 000000000..43a77fa3c --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.yaml @@ -0,0 +1,19 @@ +--- +- + scenarios: + - os-ovn-nofeature-ha + - os-ovn-nofeature-noha + tests: + - neutron_tempest_plugin.api.admin.test_dhcp_agent_scheduler + - neutron_tempest_plugin.api.admin.test_ports.PortTestCasesResourceRequest.test_port_resource_request + - neutron_tempest_plugin.api.admin.test_ports.PortTestCasesResourceRequest.test_port_resource_request_empty + - neutron_tempest_plugin.api.admin.test_ports.PortTestCasesResourceRequest.test_port_resource_request_inherited_policy + - neutron_tempest_plugin.api.admin.test_ports.PortTestCasesResourceRequest.test_port_resource_request_no_provider_net_conflict + - neutron_tempest_plugin.api.test_ports.PortsTestJSON.test_create_update_port_with_dns_name + - patrole_tempest_plugin.tests.api.network.test_availability_zones_rbac.AvailabilityZoneExtRbacTest.test_list_availability_zone_rbac + - patrole_tempest_plugin.tests.api.network.test_agents_rbac.DHCPAgentSchedulersRbacTest.test_add_dhcp_agent_to_network + - patrole_tempest_plugin.tests.api.network.test_agents_rbac.DHCPAgentSchedulersRbacTest.test_delete_network_from_dhcp_agent + - patrole_tempest_plugin.tests.api.network.test_agents_rbac.DHCPAgentSchedulersRbacTest.test_list_networks_hosted_by_one_dhcp_agent + - patrole_tempest_plugin.tests.api.network.test_networks_rbac.NetworksRbacTest.test_create_network_provider_network_type + - patrole_tempest_plugin.tests.api.network.test_networks_rbac.NetworksRbacTest.test_create_network_provider_segmentation_id + - tempest.api.network.admin.test_dhcp_agent_scheduler diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt deleted file mode 100644 index fbbee2ffc..000000000 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/defcore_req.txt +++ /dev/null @@ -1,249 +0,0 @@ -# Set of DefCore tempest test cases not flagged and required. It only contains OpenStack core (no object storage) -# The approved guidelines (2016.08) are valid for Kilo, Liberty, Mitaka and Newton releases of OpenStack -# The list can be generated using the Rest API from RefStack project: -# https://refstack.openstack.org/api/v1/guidelines/2017.01/tests?target=compute&type=required&alias=true&flag=false -tempest.api.compute.images.test_images_oneserver.ImagesOneServerTestJSON.test_create_delete_image[id-3731d080-d4c5-4872-b41a-64d0d0021314] -tempest.api.compute.images.test_images_oneserver.ImagesOneServerTestJSON.test_create_image_specify_multibyte_character_image_name[id-3b7c6fe4-dfe7-477c-9243-b06359db51e6] -tempest.api.compute.servers.test_create_server.ServersTestJSON.test_host_name_is_same_as_server_name[id-ac1ad47f-984b-4441-9274-c9079b7a0666] -tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f] -tempest.api.compute.servers.test_create_server.ServersTestJSON.test_list_servers_with_detail[id-585e934c-448e-43c4-acbf-d06a9b899997] -tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_created_server_vcpus[id-cbc0f52f-05aa-492b-bdc1-84b575ca294b] -tempest.api.compute.servers.test_create_server.ServersTestJSON.test_verify_server_details[id-5de47127-9977-400a-936f-abcfbec1218f] -tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_host_name_is_same_as_server_name[id-ac1ad47f-984b-4441-9274-c9079b7a0666] -tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers[id-9a438d88-10c6-4bcd-8b5b-5b6e25e1346f] -tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_list_servers_with_detail[id-585e934c-448e-43c4-acbf-d06a9b899997] -tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_created_server_vcpus[id-cbc0f52f-05aa-492b-bdc1-84b575ca294b] -tempest.api.compute.servers.test_create_server.ServersTestManualDisk.test_verify_server_details[id-5de47127-9977-400a-936f-abcfbec1218f] -tempest.api.compute.servers.test_delete_server.DeleteServersTestJSON.test_delete_active_server[id-925fdfb4-5b13-47ea-ac8a-c36ae6fddb05] -tempest.api.compute.servers.test_instance_actions.InstanceActionsTestJSON.test_get_instance_action[id-aacc71ca-1d70-4aa5-bbf6-0ff71470e43c] -tempest.api.compute.servers.test_instance_actions.InstanceActionsTestJSON.test_list_instance_actions[id-77ca5cc5-9990-45e0-ab98-1de8fead201a] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_flavor[id-80c574cc-0925-44ba-8602-299028357dd9] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_image[id-b3304c3b-97df-46d2-8cd3-e2b6659724e7] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_server_name[id-f9eb2b70-735f-416c-b260-9914ac6181e4] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_filter_by_server_status[id-de2612ab-b7dd-4044-b0b1-d2539601911f] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_detailed_limit_results[id-67aec2d0-35fe-4503-9f92-f13272b867ed] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_active_status[id-ca78e20e-fddb-4ce6-b7f7-bcbf8605e66e] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_flavor[id-573637f5-7325-47bb-9144-3476d0416908] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_image[id-05e8a8e7-9659-459a-989d-92c2f501f4ba] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_limit[id-614cdfc1-d557-4bac-915b-3e67b48eee76] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_server_name[id-9b067a7b-7fee-4f6a-b29c-be43fe18fc5a] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filter_by_server_status[id-ca78e20e-fddb-4ce6-b7f7-bcbf8605e66e] -tempest.api.compute.servers.test_list_server_filters.ListServerFiltersTestJSON.test_list_servers_filtered_by_name_wildcard[id-e9f624ee-92af-4562-8bec-437945a18dcb] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_changes_since_future_date[id-74745ad8-b346-45b5-b9b8-509d7447fc1f] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_changes_since_invalid_date[id-87d12517-e20a-4c9c-97b6-dd1628d6d6c9] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits[id-12c80a9f-2dec-480e-882b-98ba15757659] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits_greater_than_actual_count[id-d47c17fb-eebd-4287-8e95-f20a7e627b18] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits_pass_negative_value[id-62610dd9-4713-4ee0-8beb-fd2c1aa7f950] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_limits_pass_string[id-679bc053-5e70-4514-9800-3dfab1a380a6] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_non_existing_flavor[id-5913660b-223b-44d4-a651-a0fbfd44ca75] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_non_existing_image[id-ff01387d-c7ad-47b4-ae9e-64fa214638fe] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_by_non_existing_server_name[id-e2c77c4a-000a-4af3-a0bd-629a328bde7c] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_detail_server_is_deleted[id-93055106-2d34-46fe-af68-d9ddbf7ee570] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_status_non_existing[id-fcdf192d-0f74-4d89-911f-1ec002b822c4] -tempest.api.compute.servers.test_list_servers_negative.ListServersNegativeTestJSON.test_list_servers_with_a_deleted_server[id-24a26f1a-1ddc-4eea-b0d7-a90cc874ad8f] -tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_lock_unlock_server[id-80a8094c-211e-440a-ab88-9e59d556c7ee] -tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard[id-2cb1baf6-ac8d-4429-bf0d-ba8a0ba53e32] -tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_rebuild_server[id-aaa6cdf3-55a7-461a-add9-1c8596b9a07c] -tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_stop_start_server[id-af8eafd4-38a7-4a4b-bdbc-75145a580560] -tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_delete_server_metadata_item[id-127642d6-4c7b-4486-b7cd-07265a378658] -tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_get_server_metadata_item[id-3043c57d-7e0e-49a6-9a96-ad569c265e6a] -tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_list_server_metadata[id-479da087-92b3-4dcf-aeb3-fd293b2d14ce] -tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_set_server_metadata[id-211021f6-21de-4657-a68f-908878cfe251] -tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_set_server_metadata_item[id-58c02d4f-5c67-40be-8744-d3fa5982eb1c] -tempest.api.compute.servers.test_server_metadata.ServerMetadataTestJSON.test_update_server_metadata[id-344d981e-0c33-4997-8a5d-6c1d803e4134] -tempest.api.compute.servers.test_servers.ServersTestJSON.test_create_server_with_admin_password[id-b92d5ec7-b1dd-44a2-87e4-45e888c46ef0] -tempest.api.compute.servers.test_servers.ServersTestJSON.test_create_specify_keypair[id-f9e15296-d7f9-4e62-b53f-a04e89160833] -tempest.api.compute.servers.test_servers.ServersTestJSON.test_create_with_existing_server_name[id-8fea6be7-065e-47cf-89b8-496e6f96c699] -tempest.api.compute.servers.test_servers.ServersTestJSON.test_update_access_server_address[id-89b90870-bc13-4b73-96af-f9d4f2b70077] -tempest.api.compute.servers.test_servers.ServersTestJSON.test_update_server_name[id-5e6ccff8-349d-4852-a8b3-055df7988dd2] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_numeric_server_name[id-fd57f159-68d6-4c2a-902b-03070828a87e] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_server_metadata_exceeds_length_limit[id-7fc74810-0bd2-4cd7-8244-4f33a9db865a] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_server_name_length_exceeds_256[id-c3e0fb12-07fc-4d76-a22e-37409887afe8] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_with_invalid_flavor[id-18f5227f-d155-4429-807c-ccb103887537] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_with_invalid_image[id-fcba1052-0a50-4cf3-b1ac-fae241edf02f] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_create_with_invalid_network_uuid[id-4e72dc2d-44c5-4336-9667-f7972e95c402] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_delete_server_pass_id_exceeding_length_limit[id-f4d7279b-5fd2-4bf2-9ba4-ae35df0d18c5] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_delete_server_pass_negative_id[id-75f79124-277c-45e6-a373-a1d6803f4cc4] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_get_non_existent_server[id-3436b02f-1b1e-4f03-881e-c6a602327439] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_invalid_ip_v6_address[id-5226dd80-1e9c-4d8a-b5f9-b26ca4763fd0] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_reboot_non_existent_server[id-d4c023a0-9c55-4747-9dd5-413b820143c7] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_rebuild_deleted_server[id-98fa0458-1485-440f-873b-fe7f0d714930] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_rebuild_non_existent_server[id-d86141a7-906e-4731-b187-d64a2ea61422] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_rebuild_reboot_deleted_server[id-98fa0458-1485-440f-873b-fe7f0d714930] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_server_name_blank[id-dbbfd247-c40c-449e-8f6c-d2aa7c7da7cf] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_stop_non_existent_server[id-a31460a9-49e1-42aa-82ee-06e0bb7c2d03] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_update_name_of_non_existent_server[id-aa8eed43-e2cb-4ebf-930b-da14f6a21d81] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_update_server_name_length_exceeds_256[id-5c8e244c-dada-4590-9944-749c455b431f] -tempest.api.compute.servers.test_servers_negative.ServersNegativeTestJSON.test_update_server_set_empty_name[id-38204696-17c6-44da-9590-40f87fb5a899] -tempest.api.compute.test_quotas.QuotasTestJSON.test_get_default_quotas[id-9bfecac7-b966-4f47-913f-1a9e2c12134a] -tempest.api.compute.test_quotas.QuotasTestJSON.test_get_quotas[id-f1ef0a97-dbbb-4cca-adc5-c9fbc4f76107] -tempest.api.compute.test_versions.TestVersions.test_list_api_versions[id-6c0a0990-43b6-4529-9b61-5fd8daf7c55c] -tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_attach_detach_volume[id-52e9045a-e90d-4c0d-9087-79d657faffff] -tempest.api.compute.volumes.test_attach_volume.AttachVolumeTestJSON.test_list_get_volume_attachments[id-7fa563fe-f0f7-43eb-9e22-a1ece036b513] -tempest.api.identity.v3.TestApiDiscovery.test_api_media_types[id-657c1970-4722-4189-8831-7325f3bc4265] -tempest.api.identity.v3.TestApiDiscovery.test_api_version_resources[id-b9232f5e-d9e5-4d97-b96c-28d3db4de1bd] -tempest.api.identity.v3.TestApiDiscovery.test_api_version_statuses[id-8879a470-abfb-47bb-bb8d-5a7fd279ad1e] -tempest.api.identity.v3.test_api_discovery.TestApiDiscovery.test_api_media_types[id-657c1970-4722-4189-8831-7325f3bc4265] -tempest.api.identity.v3.test_api_discovery.TestApiDiscovery.test_api_version_resources[id-b9232f5e-d9e5-4d97-b96c-28d3db4de1bd] -tempest.api.identity.v3.test_api_discovery.TestApiDiscovery.test_api_version_statuses[id-8879a470-abfb-47bb-bb8d-5a7fd279ad1e] -tempest.api.identity.v3.test_tokens.TokensV3Test.test_create_token[id-6f8e4436-fc96-4282-8122-e41df57197a9] -tempest.api.image.v2.test_images.BasicOperationsImagesTest.test_delete_image[id-f848bb94-1c6e-45a4-8726-39e3a5b23535] -tempest.api.image.v2.test_images.BasicOperationsImagesTest.test_update_image[id-f66891a7-a35c-41a8-b590-a065c2a1caa6] -tempest.api.image.v2.test_images.ListImagesTest.test_get_image_schema[id-622b925c-479f-4736-860d-adeaf13bc371] -tempest.api.image.v2.test_images.ListImagesTest.test_get_images_schema[id-25c8d7b2-df21-460f-87ac-93130bcdc684] -tempest.api.image.v2.test_images.ListImagesTest.test_index_no_params[id-1e341d7a-90a9-494c-b143-2cdf2aeb6aee] -tempest.api.image.v2.test_images.ListImagesTest.test_list_images_param_container_format[id-9959ca1d-1aa7-4b7a-a1ea-0fff0499b37e] -tempest.api.image.v2.test_images.ListImagesTest.test_list_images_param_disk_format[id-4a4735a7-f22f-49b6-b0d9-66e1ef7453eb] -tempest.api.image.v2.test_images.ListImagesTest.test_list_images_param_limit[id-e914a891-3cc8-4b40-ad32-e0a39ffbddbb] -tempest.api.image.v2.test_images.ListImagesTest.test_list_images_param_min_max_size[id-4ad8c157-971a-4ba8-aa84-ed61154b1e7f] -tempest.api.image.v2.test_images.ListImagesTest.test_list_images_param_size[id-cf1b9a48-8340-480e-af7b-fe7e17690876] -tempest.api.image.v2.test_images.ListImagesTest.test_list_images_param_status[id-7fc9e369-0f58-4d05-9aa5-0969e2d59d15] -tempest.api.image.v2.test_images.ListImagesTest.test_list_images_param_visibility[id-7a95bb92-d99e-4b12-9718-7bc6ab73e6d2] -tempest.api.image.v2.test_images.ListImagesTest.test_list_no_params[id-1e341d7a-90a9-494c-b143-2cdf2aeb6aee] -tempest.api.image.v2.test_images.ListUserImagesTest.test_get_image_schema[id-622b925c-479f-4736-860d-adeaf13bc371] -tempest.api.image.v2.test_images.ListUserImagesTest.test_get_images_schema[id-25c8d7b2-df21-460f-87ac-93130bcdc684] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_images_param_container_format[id-9959ca1d-1aa7-4b7a-a1ea-0fff0499b37e] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_images_param_disk_format[id-4a4735a7-f22f-49b6-b0d9-66e1ef7453eb] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_images_param_limit[id-e914a891-3cc8-4b40-ad32-e0a39ffbddbb] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_images_param_min_max_size[id-4ad8c157-971a-4ba8-aa84-ed61154b1e7f] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_images_param_size[id-cf1b9a48-8340-480e-af7b-fe7e17690876] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_images_param_status[id-7fc9e369-0f58-4d05-9aa5-0969e2d59d15] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_images_param_visibility[id-7a95bb92-d99e-4b12-9718-7bc6ab73e6d2] -tempest.api.image.v2.test_images.ListUserImagesTest.test_list_no_params[id-1e341d7a-90a9-494c-b143-2cdf2aeb6aee] -tempest.api.image.v2.test_images_negative.ImagesNegativeTest.test_delete_image_null_id[id-32248db1-ab88-4821-9604-c7c369f1f88c] -tempest.api.image.v2.test_images_negative.ImagesNegativeTest.test_delete_non_existing_image[id-6fe40f1c-57bd-4918-89cc-8500f850f3de] -tempest.api.image.v2.test_images_negative.ImagesNegativeTest.test_get_delete_deleted_image[id-e57fc127-7ba0-4693-92d7-1d8a05ebcba9] -tempest.api.image.v2.test_images_negative.ImagesNegativeTest.test_get_image_null_id[id-ef45000d-0a72-4781-866d-4cb7bf2562ad] -tempest.api.image.v2.test_images_negative.ImagesNegativeTest.test_get_non_existent_image[id-668743d5-08ad-4480-b2b8-15da34f81d9f] -tempest.api.image.v2.test_images_tags.ImagesTagsTest.test_update_delete_tags_for_image[id-10407036-6059-4f95-a2cd-cbbbee7ed329] -tempest.api.image.v2.test_images_tags_negative.ImagesTagsNegativeTest.test_delete_non_existing_tag[id-39c023a2-325a-433a-9eea-649bf1414b19] -tempest.api.image.v2.test_images_tags_negative.ImagesTagsNegativeTest.test_update_tags_for_non_existing_image[id-8cd30f82-6f9a-4c6e-8034-c1b51fba43d9] -tempest.api.network.test_networks.NetworksTest.test_create_delete_subnet_all_attributes[id-a4d9ec4c-0306-4111-a75c-db01a709030b] -tempest.api.network.test_networks.NetworksTest.test_create_delete_subnet_with_allocation_pools[id-bec949c4-3147-4ba6-af5f-cd2306118404] -tempest.api.network.test_networks.NetworksTest.test_create_delete_subnet_with_dhcp_enabled[id-94ce038d-ff0a-4a4c-a56b-09da3ca0b55d] -tempest.api.network.test_networks.NetworksTest.test_create_delete_subnet_with_gw[id-9393b468-186d-496d-aa36-732348cd76e7] -tempest.api.network.test_networks.NetworksTest.test_create_delete_subnet_with_gw_and_allocation_pools[id-8217a149-0c6c-4cfb-93db-0486f707d13f] -tempest.api.network.test_networks.NetworksTest.test_create_delete_subnet_with_host_routes_and_dns_nameservers[id-d830de0a-be47-468f-8f02-1fd996118289] -tempest.api.network.test_networks.NetworksTest.test_create_delete_subnet_without_gateway[id-d2d596e2-8e76-47a9-ac51-d4648009f4d3] -tempest.api.network.test_networks.NetworksTest.test_create_update_delete_network_subnet[id-0e269138-0da6-4efc-a46d-578161e7b221] -tempest.api.network.test_networks.NetworksTest.test_delete_network_with_subnet[id-f04f61a9-b7f3-4194-90b2-9bcf660d1bfe] -tempest.api.network.test_networks.NetworksTest.test_list_networks[id-f7ffdeda-e200-4a7a-bcbe-05716e86bf43] -tempest.api.network.test_networks.NetworksTest.test_list_networks_fields[id-6ae6d24f-9194-4869-9c85-c313cb20e080] -tempest.api.network.test_networks.NetworksTest.test_list_subnets[id-db68ba48-f4ea-49e9-81d1-e367f6d0b20a] -tempest.api.network.test_networks.NetworksTest.test_list_subnets_fields[id-842589e3-9663-46b0-85e4-7f01273b0412] -tempest.api.network.test_networks.NetworksTest.test_show_network[id-2bf13842-c93f-4a69-83ed-717d2ec3b44e] -tempest.api.network.test_networks.NetworksTest.test_show_network_fields[id-867819bb-c4b6-45f7-acf9-90edcf70aa5e] -tempest.api.network.test_networks.NetworksTest.test_show_subnet[id-bd635d81-6030-4dd1-b3b9-31ba0cfdf6cc] -tempest.api.network.test_networks.NetworksTest.test_show_subnet_fields[id-270fff0b-8bfc-411f-a184-1e8fd35286f0] -tempest.api.network.test_networks.NetworksTest.test_update_subnet_gw_dns_host_routes_dhcp[id-3d3852eb-3009-49ec-97ac-5ce83b73010a] -tempest.api.network.test_networks.NetworksTestJSON.test_create_delete_subnet_all_attributes[id-a4d9ec4c-0306-4111-a75c-db01a709030b] -tempest.api.network.test_networks.NetworksTestJSON.test_create_delete_subnet_with_allocation_pools[id-bec949c4-3147-4ba6-af5f-cd2306118404] -tempest.api.network.test_networks.NetworksTestJSON.test_create_delete_subnet_with_dhcp_enabled[id-94ce038d-ff0a-4a4c-a56b-09da3ca0b55d] -tempest.api.network.test_networks.NetworksTestJSON.test_create_delete_subnet_with_gw[id-9393b468-186d-496d-aa36-732348cd76e7] -tempest.api.network.test_networks.NetworksTestJSON.test_create_delete_subnet_with_gw_and_allocation_pools[id-8217a149-0c6c-4cfb-93db-0486f707d13f] -tempest.api.network.test_networks.NetworksTestJSON.test_create_delete_subnet_with_host_routes_and_dns_nameservers[id-d830de0a-be47-468f-8f02-1fd996118289] -tempest.api.network.test_networks.NetworksTestJSON.test_create_delete_subnet_without_gateway[id-d2d596e2-8e76-47a9-ac51-d4648009f4d3] -tempest.api.network.test_networks.NetworksTestJSON.test_create_update_delete_network_subnet[id-0e269138-0da6-4efc-a46d-578161e7b221] -tempest.api.network.test_networks.NetworksTestJSON.test_delete_network_with_subnet[id-f04f61a9-b7f3-4194-90b2-9bcf660d1bfe] -tempest.api.network.test_networks.NetworksTestJSON.test_list_networks[id-f7ffdeda-e200-4a7a-bcbe-05716e86bf43] -tempest.api.network.test_networks.NetworksTestJSON.test_list_networks_fields[id-6ae6d24f-9194-4869-9c85-c313cb20e080] -tempest.api.network.test_networks.NetworksTestJSON.test_list_subnets[id-db68ba48-f4ea-49e9-81d1-e367f6d0b20a] -tempest.api.network.test_networks.NetworksTestJSON.test_list_subnets_fields[id-842589e3-9663-46b0-85e4-7f01273b0412] -tempest.api.network.test_networks.NetworksTestJSON.test_show_network[id-2bf13842-c93f-4a69-83ed-717d2ec3b44e] -tempest.api.network.test_networks.NetworksTestJSON.test_show_network_fields[id-867819bb-c4b6-45f7-acf9-90edcf70aa5e] -tempest.api.network.test_networks.NetworksTestJSON.test_show_subnet[id-bd635d81-6030-4dd1-b3b9-31ba0cfdf6cc] -tempest.api.network.test_networks.NetworksTestJSON.test_show_subnet_fields[id-270fff0b-8bfc-411f-a184-1e8fd35286f0] -tempest.api.network.test_networks.NetworksTestJSON.test_update_subnet_gw_dns_host_routes_dhcp[id-3d3852eb-3009-49ec-97ac-5ce83b73010a] -tempest.api.network.test_ports.PortsTestJSON.test_create_bulk_port[id-67f1b811-f8db-43e2-86bd-72c074d4a42c] -tempest.api.network.test_ports.PortsTestJSON.test_create_port_in_allowed_allocation_pools[id-0435f278-40ae-48cb-a404-b8a087bc09b1] -tempest.api.network.test_ports.PortsTestJSON.test_create_update_delete_port[id-c72c1c0c-2193-4aca-aaa4-b1442640f51c] -tempest.api.network.test_ports.PortsTestJSON.test_list_ports[id-cf95b358-3e92-4a29-a148-52445e1ac50e] -tempest.api.network.test_ports.PortsTestJSON.test_list_ports_fields[id-ff7f117f-f034-4e0e-abff-ccef05c454b4] -tempest.api.network.test_ports.PortsTestJSON.test_show_port[id-c9a685bd-e83f-499c-939f-9f7863ca259f] -tempest.api.network.test_ports.PortsTestJSON.test_show_port_fields[id-45fcdaf2-dab0-4c13-ac6c-fcddfb579dbd] -tempest.api.network.test_ports.PortsTestJSON.test_update_port_with_security_group_and_extra_attributes[id-58091b66-4ff4-4cc1-a549-05d60c7acd1a] -tempest.api.network.test_ports.PortsTestJSON.test_update_port_with_two_security_groups_and_extra_attributes[id-edf6766d-3d40-4621-bc6e-2521a44c257d] -tempest.api.network.test_security_groups.SecGroupTest.test_create_list_update_show_delete_security_group[id-bfd128e5-3c92-44b6-9d66-7fe29d22c802] -tempest.api.network.test_security_groups.SecGroupTest.test_create_security_group_rule_with_additional_args[id-87dfbcf9-1849-43ea-b1e4-efa3eeae9f71] -tempest.api.network.test_security_groups.SecGroupTest.test_create_security_group_rule_with_icmp_type_code[id-c9463db8-b44d-4f52-b6c0-8dbda99f26ce] -tempest.api.network.test_security_groups.SecGroupTest.test_create_security_group_rule_with_protocol_integer_value[id-0a307599-6655-4220-bebc-fd70c64f2290] -tempest.api.network.test_security_groups.SecGroupTest.test_create_security_group_rule_with_remote_group_id[id-c2ed2deb-7a0c-44d8-8b4c-a5825b5c310b] -tempest.api.network.test_security_groups.SecGroupTest.test_create_security_group_rule_with_remote_ip_prefix[id-16459776-5da2-4634-bce4-4b55ee3ec188] -tempest.api.network.test_security_groups.SecGroupTest.test_create_show_delete_security_group_rule[id-cfb99e0e-7410-4a3d-8a0c-959a63ee77e9] -tempest.api.network.test_security_groups.SecGroupTest.test_list_security_groups[id-e30abd17-fef9-4739-8617-dc26da88e686] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_additional_default_security_group_fails[id-2323061e-9fbf-4eb0-b547-7e8fafc90849] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_duplicate_security_group_rule_fails[id-8fde898f-ce88-493b-adc9-4e4692879fc5] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_security_group_rule_with_bad_ethertype[id-5666968c-fff3-40d6-9efc-df1c8bd01abb] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_security_group_rule_with_bad_protocol[id-981bdc22-ce48-41ed-900a-73148b583958] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_security_group_rule_with_bad_remote_ip_prefix[id-5f8daf69-3c5f-4aaa-88c9-db1d66f68679] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_security_group_rule_with_invalid_ports[id-0d9c7791-f2ad-4e2f-ac73-abf2373b0d2d] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_security_group_rule_with_non_existent_remote_groupid[id-4bf786fd-2f02-443c-9716-5b98e159a49a] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_create_security_group_rule_with_non_existent_security_group[id-be308db6-a7cf-4d5c-9baf-71bafd73f35e] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_delete_non_existent_security_group[id-1f1bb89d-5664-4956-9fcd-83ee0fa603df] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_show_non_existent_security_group[id-424fd5c3-9ddc-486a-b45f-39bf0c820fc6] -tempest.api.network.test_security_groups_negative.NegativeSecGroupTest.test_show_non_existent_security_group_rule[id-4c094c09-000b-4e41-8100-9617600c02a6] -tempest.api.volume.test_availability_zone.AvailabilityZoneV2TestJSON.test_get_availability_zone_list[id-01f1ae88-eba9-4c6b-a011-6f7ace06b725] -tempest.api.volume.test_extensions.ExtensionsV2TestJSON.test_list_extensions[id-94607eb0-43a5-47ca-82aa-736b41bd2e2c] -tempest.api.volume.test_snapshot_metadata.SnapshotV2MetadataTestJSON.test_create_get_delete_snapshot_metadata[id-a2f20f99-e363-4584-be97-bc33afb1a56c] -tempest.api.volume.test_snapshot_metadata.SnapshotV2MetadataTestJSON.test_crud_snapshot_metadata[id-a2f20f99-e363-4584-be97-bc33afb1a56c] -tempest.api.volume.test_snapshot_metadata.SnapshotV2MetadataTestJSON.test_update_snapshot_metadata_item[id-e8ff85c5-8f97-477f-806a-3ac364a949ed] -tempest.api.volume.test_volume_metadata.VolumesV2MetadataTest.test_create_get_delete_volume_metadata[id-6f5b125b-f664-44bf-910f-751591fe5769] -tempest.api.volume.test_volume_metadata.VolumesV2MetadataTest.test_crud_volume_metadata[id-6f5b125b-f664-44bf-910f-751591fe5769] -tempest.api.volume.test_volume_metadata.VolumesV2MetadataTest.test_update_volume_metadata_item[id-862261c5-8df4-475a-8c21-946e50e36a20] -tempest.api.volume.test_volumes_actions.VolumesV2ActionsTest.test_attach_detach_volume_to_instance[id-fff42874-7db5-4487-a8e1-ddda5fb5288d] -tempest.api.volume.test_volumes_actions.VolumesV2ActionsTest.test_get_volume_attachment[id-9516a2c8-9135-488c-8dd6-5677a7e5f371] -tempest.api.volume.test_volumes_actions.VolumesV2ActionsTest.test_reserve_unreserve_volume[id-92c4ef64-51b2-40c0-9f7e-4749fbaaba33] -tempest.api.volume.test_volumes_actions.VolumesV2ActionsTest.test_volume_bootable[id-63e21b4c-0a0c-41f6-bfc3-7c2816815599] -tempest.api.volume.test_volumes_actions.VolumesV2ActionsTest.test_volume_readonly_update[id-fff74e1e-5bd3-4b33-9ea9-24c103bc3f59] -tempest.api.volume.test_volumes_get.VolumesV2GetTest.test_volume_create_get_update_delete[id-27fb0e9f-fb64-41dd-8bdb-1ffa762f0d51] -tempest.api.volume.test_volumes_get.VolumesV2GetTest.test_volume_create_get_update_delete_as_clone[id-3f591b4a-7dc6-444c-bd51-77469506b3a1] -tempest.api.volume.test_volumes_get.VolumesV2GetTest.test_volume_create_get_update_delete_from_image[id-54a01030-c7fc-447c-86ee-c1182beae638] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list[id-0b6ddd39-b948-471f-8038-4787978747c4] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_by_name[id-a28e8da4-0b56-472f-87a8-0f4d3f819c02] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_details_by_name[id-2de3a6d4-12aa-403b-a8f2-fdeb42a89623] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_param_display_name_and_status[id-777c87c1-2fc4-4883-8b8e-5c0b951d1ec8] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_with_detail_param_display_name_and_status[id-856ab8ca-6009-4c37-b691-be1065528ad4] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_with_detail_param_metadata[id-1ca92d3c-4a8e-4b43-93f5-e4c7fb3b291d] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_with_details[id-adcbb5a7-5ad8-4b61-bd10-5380e111a877] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_with_param_metadata[id-b5ebea1b-0603-40a0-bb41-15fcd0a53214] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volumes_list_by_availability_zone[id-c0cfa863-3020-40d7-b587-e35f597d5d87] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volumes_list_by_status[id-39654e13-734c-4dab-95ce-7613bf8407ce] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volumes_list_details_by_availability_zone[id-e1b80d13-94f0-4ba2-a40e-386af29f8db1] -tempest.api.volume.test_volumes_list.VolumesV2ListTestJSON.test_volumes_list_details_by_status[id-2943f712-71ec-482a-bf49-d5ca06216b9f] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_attach_volumes_with_nonexistent_volume_id[id-f5e56b0a-5d02-43c1-a2a7-c9b792c2e3f6] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_with_invalid_size[id-1ed83a8a-682d-4dfb-a30e-ee63ffd6c049] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_with_nonexistent_snapshot_id[id-0c36f6ae-4604-4017-b0a9-34fdc63096f9] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_with_nonexistent_source_volid[id-47c73e08-4be8-45bb-bfdf-0c4e79b88344] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_with_nonexistent_volume_type[id-10254ed8-3849-454e-862e-3ab8e6aa01d2] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_with_out_passing_size[id-9387686f-334f-4d31-a439-33494b9e2683] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_with_size_negative[id-8b472729-9eba-446e-a83b-916bdb34bef7] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_with_size_zero[id-41331caa-eaf4-4001-869d-bc18c1869360] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_create_volume_without_passing_size[id-9387686f-334f-4d31-a439-33494b9e2683] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_delete_invalid_volume_id[id-1f035827-7c32-4019-9240-b4ec2dbd9dfd] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_delete_volume_without_passing_volume_id[id-441a1550-5d44-4b30-af0f-a6d402f52026] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_detach_volumes_with_invalid_volume_id[id-9f9c24e4-011d-46b5-b992-952140ce237a] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_get_invalid_volume_id[id-30799cfd-7ee4-446c-b66c-45b383ed211b] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_get_volume_without_passing_volume_id[id-c6c3db06-29ad-4e91-beb0-2ab195fe49e3] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_list_volumes_detail_with_invalid_status[id-ba94b27b-be3f-496c-a00e-0283b373fa75] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_list_volumes_detail_with_nonexistent_name[id-9ca17820-a0e7-4cbd-a7fa-f4468735e359] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_list_volumes_with_invalid_status[id-143b279b-7522-466b-81be-34a87d564a7c] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_list_volumes_with_nonexistent_name[id-0f4aa809-8c7b-418f-8fb3-84c7a5dfc52f] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_reserve_volume_with_negative_volume_status[id-449c4ed2-ecdd-47bb-98dc-072aeccf158c] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_reserve_volume_with_nonexistent_volume_id[id-ac6084c0-0546-45f9-b284-38a367e0e0e2] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_unreserve_volume_with_nonexistent_volume_id[id-eb467654-3dc1-4a72-9b46-47c29d22654c] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_update_volume_with_empty_volume_id[id-72aeca85-57a5-4c1f-9057-f320f9ea575b] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_update_volume_with_invalid_volume_id[id-e66e40d6-65e6-4e75-bdc7-636792fa152d] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_update_volume_with_nonexistent_volume_id[id-0186422c-999a-480e-a026-6a665744c30c] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_volume_delete_nonexistent_volume_id[id-555efa6e-efcd-44ef-8a3b-4a7ca4837a29] -tempest.api.volume.test_volumes_negative.VolumesV2NegativeTest.test_volume_get_nonexistent_volume_id[id-f131c586-9448-44a4-a8b0-54ca838aa43e] -tempest.api.volume.test_volumes_snapshots.VolumesV2SnapshotTestJSON.test_snapshot_create_get_list_update_delete[id-2a8abbe4-d871-46db-b049-c41f5af8216e] -tempest.api.volume.test_volumes_snapshots.VolumesV2SnapshotTestJSON.test_snapshots_list_details_with_params[id-220a1022-1fcd-4a74-a7bd-6b859156cda2] -tempest.api.volume.test_volumes_snapshots.VolumesV2SnapshotTestJSON.test_snapshots_list_with_params[id-59f41f43-aebf-48a9-ab5d-d76340fab32b] -tempest.api.volume.test_volumes_snapshots.VolumesV2SnapshotTestJSON.test_volume_from_snapshot[id-677863d1-3142-456d-b6ac-9924f667a7f4] -tempest.api.volume.test_volumes_snapshots_list.VolumesV2SnapshotListTestJSON.test_snapshots_list_details_with_params[id-220a1022-1fcd-4a74-a7bd-6b859156cda2] -tempest.api.volume.test_volumes_snapshots_list.VolumesV2SnapshotListTestJSON.test_snapshots_list_with_params[id-59f41f43-aebf-48a9-ab5d-d76340fab32b] -tempest.api.volume.test_volumes_snapshots_negative.VolumesV2SnapshotNegativeTestJSON.test_create_snapshot_with_nonexistent_volume_id[id-e3e466af-70ab-4f4b-a967-ab04e3532ea7] -tempest.api.volume.test_volumes_snapshots_negative.VolumesV2SnapshotNegativeTestJSON.test_create_snapshot_without_passing_volume_id[id-bb9da53e-d335-4309-9c15-7e76fd5e4d6d] -tempest.api.volume.v2.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_details_pagination[id-e9138a2c-f67b-4796-8efa-635c196d01de] -tempest.api.volume.v2.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_details_with_multiple_params[id-2a7064eb-b9c3-429b-b888-33928fc5edd3] -tempest.api.volume.v2.test_volumes_list.VolumesV2ListTestJSON.test_volume_list_pagination[id-af55e775-8e4b-4feb-8719-215c43b0238c] diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml new file mode 100644 index 000000000..e53b577b2 --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml @@ -0,0 +1,15 @@ +--- +- + scenarios: + - os-* + tests: + - neutron_tempest_plugin.api.admin.test_floating_ips_admin_actions.FloatingIPAdminTestJSON.test_associate_floating_ip_with_port_from_another_project + - neutron_tempest_plugin.api.admin.test_quotas.QuotasTest.test_detail_quotas + - neutron_tempest_plugin.api.admin.test_quotas.QuotasTest.test_quotas + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_floatingip_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_network_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_port_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_router_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_security_group_rule_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_security_group_when_quotas_is_full + - neutron_tempest_plugin.api.admin.test_quotas_negative.QuotasAdminNegativeTestJSON.test_create_subnet_when_quotas_is_full diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml index b47a9736a..0ee4ab613 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml @@ -1,13 +1,104 @@ -# This is an empty configuration file to be filled up with the desired options -# to generate a custom tempest.conf -# Examples: -# network-feature-enabled: -# port_security: True - -# volume-feature-enabled: -# api_v1: False - -# validation: -# image_ssh_user: root -# ssh_timeout: 300 - +--- +compute: + min_microversion: '2.44' + max_microversion: latest +compute-feature-enabled: + attach_encrypted_volume: false + block_migration_for_live_migration: false + block_migrate_cinder_iscsi: false + change_password: false + cold_migration: true + config_drive: true + console_output: true + disk_config: true + enable_instance_password: true + hostname_fqdn_sanitization: true + interface_attach: true + live_migration: true + live_migrate_back_and_forth: false + metadata_service: true + pause: true + personality: false + rdp_console: false + rescue: true + resize: true + scheduler_available_filters: "AvailabilityZoneFilter,ComputeFilter,\ + ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,\ + ServerGroupAffinityFilter,SameHostFilter,DifferentHostFilter" + serial_console: false + shelve: true + snapshot: true + spice_console: false + suspend: true + swap_volume: false + vnc_console: true + volume_backed_live_migration: false + volume_multiattach: false +identity: + auth_version: v3 + user_unique_last_password_count: 2 + user_lockout_duration: 10 + user_lockout_failure_attempts: 2 +identity-feature-enabled: + trust: true + api_v2: false + api_v2_admin: false + security_compliance: true + federation: false + external_idp: false + project_tags: true + application_credentials: true + access_rules: true +image-feature-enabled: + api_v2: true + api_v1: false + import_image: false +network-feature-enabled: + port_admin_state_change: true + port_security: true +placement: + max_microversion: latest +validation: + image_ssh_user: cirros + ssh_timeout: 196 + ip_version_for_ssh: 4 + run_validation: true +volume: + max_microversion: latest + storage_protocol: ceph + manage_volume_ref: source-name,volume-%s + manage_snapshot_ref: source-name,snapshot-%s +volume-feature-enabled: + multi_backend: false + backup: true + snapshot: true + clone: true + manage_snapshot: true + manage_volume: true + extend_attached_volume: true + extend_attached_encrypted_volume: false + consistency_group: false + volume_revert: true +load_balancer: + test_with_ipv6: false +neutron_plugin_options: + agent_availability_zone: nova + available_type_drivers: flat,geneve,vlan,gre,local,vxlan + provider_vlans: public, + create_shared_resources: true +object-storage-feature-enabled: + discoverable_apis: "account_quotas,formpost,bulk_upload,bulk_delete,\ + tempurl,crossdomain,container_quotas,staticweb,account_quotas,slo" + object_versioning: true + discoverability: true + tempurl_digest_hashlib: sha1 +heat_plugin: + skip_functional_test_list: EncryptionVolTypeTest + skip_scenario_test_list: "AodhAlarmTest,SoftwareConfigIntegrationTest,\ + VolumeBackupRestoreIntegrationTest,CfnInitIntegrationTest,\ + LoadBalancerTest" + auth_version: 3 +heat_features_enabled: + multi_cloud: false +rbac: + enable_rbac: true diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml new file mode 100644 index 000000000..6b09d8e5a --- /dev/null +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/tempest_conf_ovn.yaml @@ -0,0 +1,104 @@ +--- +compute: + min_microversion: '2.44' + max_microversion: latest +compute-feature-enabled: + attach_encrypted_volume: false + block_migration_for_live_migration: false + block_migrate_cinder_iscsi: false + change_password: false + cold_migration: true + config_drive: true + console_output: true + disk_config: true + enable_instance_password: true + hostname_fqdn_sanitization: true + interface_attach: true + live_migration: true + live_migrate_back_and_forth: false + metadata_service: true + pause: true + personality: false + rdp_console: false + rescue: true + resize: true + scheduler_available_filters: "AvailabilityZoneFilter,ComputeFilter,\ + ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,\ + ServerGroupAffinityFilter,SameHostFilter,DifferentHostFilter" + serial_console: false + shelve: true + snapshot: true + spice_console: false + suspend: true + swap_volume: false + vnc_console: true + volume_backed_live_migration: false + volume_multiattach: false +identity: + auth_version: v3 + user_unique_last_password_count: 2 + user_lockout_duration: 10 + user_lockout_failure_attempts: 2 +identity-feature-enabled: + trust: true + api_v2: false + api_v2_admin: false + security_compliance: true + federation: false + external_idp: false + project_tags: true + application_credentials: true + access_rules: true +image-feature-enabled: + api_v2: true + api_v1: false + import_image: false +network-feature-enabled: + port_admin_state_change: true + port_security: true +placement: + max_microversion: latest +validation: + image_ssh_user: cirros + ssh_timeout: 196 + ip_version_for_ssh: 4 + run_validation: true +volume: + max_microversion: latest + storage_protocol: ceph + manage_volume_ref: source-name,volume-%s + manage_snapshot_ref: source-name,snapshot-%s +volume-feature-enabled: + multi_backend: false + backup: true + snapshot: true + clone: true + manage_snapshot: true + manage_volume: true + extend_attached_volume: true + extend_attached_encrypted_volume: false + consistency_group: false + volume_revert: true +load_balancer: + test_with_ipv6: false +neutron_plugin_options: + agent_availability_zone: nova + available_type_drivers: flat,geneve,vlan,local + provider_vlans: public, + create_shared_resources: true +object-storage-feature-enabled: + discoverable_apis: "account_quotas,formpost,bulk_upload,bulk_delete,\ + tempurl,crossdomain,container_quotas,staticweb,account_quotas,slo" + object_versioning: true + discoverability: true + tempurl_digest_hashlib: sha1 +heat_plugin: + skip_functional_test_list: EncryptionVolTypeTest + skip_scenario_test_list: "AodhAlarmTest,SoftwareConfigIntegrationTest,\ + VolumeBackupRestoreIntegrationTest,CfnInitIntegrationTest,\ + LoadBalancerTest" + auth_version: 3 +heat_features_enabled: + multi_cloud: false +rbac: + enable_rbac: true diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index 5481b13b1..7233ffd60 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -8,493 +8,767 @@ # http://www.apache.org/licenses/LICENSE-2.0 # +"""Tempest testcases implementation.""" + from __future__ import division +import json import logging import os import re import shutil import subprocess import time -import uuid +import pkg_resources +from six.moves import configparser +from xtesting.core import testcase import yaml -from functest.core import testcase -from functest.opnfv_tests.openstack.snaps import snaps_utils -from functest.opnfv_tests.openstack.tempest import conf_utils -from functest.utils.constants import CONST -import functest.utils.functest_utils as ft_utils +from functest.core import singlevm +from functest.opnfv_tests.openstack.rally import rally +from functest.utils import config +from functest.utils import env +from functest.utils import functest_utils + +LOGGER = logging.getLogger(__name__) + + +class TempestCommon(singlevm.VmReady2): + # pylint: disable=too-many-instance-attributes,too-many-public-methods + """TempestCommon testcases implementation class.""" + + visibility = 'public' + filename_alt = '/home/opnfv/functest/images/cirros-0.6.1-x86_64-disk.img' + shared_network = True + tempest_conf_yaml = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/tempest/custom_tests/tempest_conf.yaml') + 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.yaml') + tempest_public_blacklist = pkg_resources.resource_filename( + 'functest', + 'opnfv_tests/openstack/tempest/custom_tests/public_blacklist.yaml') -from snaps.config.flavor import FlavorConfig -from snaps.config.network import NetworkConfig, SubnetConfig -from snaps.config.project import ProjectConfig -from snaps.config.user import UserConfig + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'tempest' + super().__init__(**kwargs) + assert self.orig_cloud + assert self.cloud + assert self.project + if self.orig_cloud.get_role("admin"): + self.role_name = "admin" + elif self.orig_cloud.get_role("Admin"): + self.role_name = "Admin" + else: + raise Exception("Cannot detect neither admin nor Admin") + self.orig_cloud.grant_role( + self.role_name, user=self.project.user.id, + project=self.project.project.id, + domain=self.project.domain.id) + self.orig_cloud.grant_role( + self.role_name, user=self.project.user.id, + domain=self.project.domain.id) + self.deployment_id = None + self.verifier_id = None + self.verifier_repo_dir = None + self.deployment_dir = None + self.verification_id = None + self.res_dir = os.path.join( + getattr(config.CONF, 'dir_results'), self.case_name) + self.raw_list = os.path.join(self.res_dir, 'test_raw_list.txt') + self.list = os.path.join(self.res_dir, 'test_list.txt') + self.conf_file = None + self.image_alt = None + self.flavor_alt = None + self.services = [] + try: + self.services = kwargs['run']['args']['services'] + except Exception: # pylint: disable=broad-except + pass + self.neutron_extensions = [] + try: + self.neutron_extensions = kwargs['run']['args'][ + 'neutron_extensions'] + except Exception: # pylint: disable=broad-except + pass + self.deny_skipping = kwargs.get("deny_skipping", False) + self.tests_count = kwargs.get("tests_count", 0) + + def check_services(self): + """Check the mandatory services.""" + for service in self.services: + try: + self.cloud.search_services(service)[0] + except Exception: # pylint: disable=broad-except + self.is_skipped = True + break -from snaps.openstack import create_flavor -from snaps.openstack.create_flavor import OpenStackFlavor -from snaps.openstack.tests import openstack_tests -from snaps.openstack.utils import deploy_utils + def check_extensions(self): + """Check the mandatory network extensions.""" + extensions = self.cloud.get_network_extensions() + for network_extension in self.neutron_extensions: + if network_extension not in extensions: + LOGGER.warning( + "Cannot find Neutron extension: %s", network_extension) + self.is_skipped = True + break + def check_requirements(self): + self.check_services() + self.check_extensions() + if self.is_skipped: + self.project.clean() -""" logging configuration """ -logger = logging.getLogger(__name__) + @staticmethod + def read_file(filename): + """Read file and return content as a stripped list.""" + with open(filename, encoding='utf-8') as src: + return [line.strip() for line in src.readlines()] + @staticmethod + def get_verifier_result(verif_id): + """Retrieve verification results.""" + result = { + 'num_tests': 0, + 'num_success': 0, + 'num_failures': 0, + 'num_skipped': 0 + } + cmd = ["rally", "verify", "show", "--uuid", verif_id] + LOGGER.info("Showing result for a verification: '%s'.", cmd) + with subprocess.Popen( + cmd, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) as proc: + for line in proc.stdout: + LOGGER.info(line.decode("utf-8").rstrip()) + new_line = line.decode("utf-8").replace(' ', '').split('|') + if 'Tests' in new_line: + break + if 'Testscount' in new_line: + result['num_tests'] = int(new_line[2]) + elif 'Success' in new_line: + result['num_success'] = int(new_line[2]) + elif 'Skipped' in new_line: + result['num_skipped'] = int(new_line[2]) + elif 'Failures' in new_line: + result['num_failures'] = int(new_line[2]) + return result -class TempestCommon(testcase.TestCase): + @staticmethod + def backup_tempest_config(conf_file, res_dir): + """ + Copy config file to tempest results directory + """ + if not os.path.exists(res_dir): + os.makedirs(res_dir) + shutil.copyfile(conf_file, + os.path.join(res_dir, 'tempest.conf')) - def __init__(self, **kwargs): - super(TempestCommon, self).__init__(**kwargs) - self.resources = TempestResourcesManager(**kwargs) - self.MODE = "" - self.OPTION = "" - self.VERIFIER_ID = conf_utils.get_verifier_id() - self.VERIFIER_REPO_DIR = conf_utils.get_verifier_repo_dir( - self.VERIFIER_ID) - self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id() - self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir( - self.VERIFIER_ID, self.DEPLOYMENT_ID) - self.VERIFICATION_ID = None + @staticmethod + def create_verifier(): + """Create new verifier""" + LOGGER.info("Create verifier from existing repo...") + cmd = ['rally', 'verify', 'delete-verifier', + '--id', str(getattr(config.CONF, 'tempest_verifier_name')), + '--force'] + try: + output = subprocess.check_output(cmd) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) + except subprocess.CalledProcessError: + pass + + cmd = ['rally', 'verify', 'create-verifier', + '--source', str(getattr(config.CONF, 'dir_repo_tempest')), + '--name', str(getattr(config.CONF, 'tempest_verifier_name')), + '--type', 'tempest', '--system-wide'] + output = subprocess.check_output(cmd) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) + return TempestCommon.get_verifier_id() @staticmethod - def read_file(filename): - with open(filename) as src: - return [line.strip() for line in src.readlines()] + def get_verifier_id(): + """ + Returns verifier id for current Tempest + """ + cmd = ("rally verify list-verifiers | awk '/" + + getattr(config.CONF, 'tempest_verifier_name') + + "/ {print $2}'") + with subprocess.Popen( + cmd, shell=True, stdout=subprocess.PIPE, + stderr=subprocess.DEVNULL) as proc: + verifier_uuid = proc.stdout.readline().rstrip() + return verifier_uuid.decode("utf-8") - def generate_test_list(self, verifier_repo_dir): - logger.debug("Generating test case list...") - if self.MODE == 'defcore': - shutil.copyfile( - conf_utils.TEMPEST_DEFCORE, conf_utils.TEMPEST_RAW_LIST) - elif self.MODE == 'custom': - if os.path.isfile(conf_utils.TEMPEST_CUSTOM): + @staticmethod + def get_verifier_repo_dir(verifier_id): + """ + Returns installed verifier repo directory for Tempest + """ + return os.path.join(getattr(config.CONF, 'dir_rally_inst'), + 'verification', + f'verifier-{verifier_id}', + 'repo') + + @staticmethod + def get_verifier_deployment_dir(verifier_id, deployment_id): + """ + Returns Rally deployment directory for current verifier + """ + return os.path.join(getattr(config.CONF, 'dir_rally_inst'), + 'verification', + f'verifier-{verifier_id}', + f'for-deployment-{deployment_id}') + + @staticmethod + def update_tempest_conf_file(conf_file, rconfig): + """Update defined paramters into tempest config file""" + with open(TempestCommon.tempest_conf_yaml, encoding='utf-8') as yfile: + conf_yaml = yaml.safe_load(yfile) + if conf_yaml: + sections = rconfig.sections() + for section in conf_yaml: + if section not in sections: + rconfig.add_section(section) + sub_conf = conf_yaml.get(section) + for key, value in sub_conf.items(): + rconfig.set(section, key, value) + + with open(conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + @staticmethod + def configure_tempest_update_params( + tempest_conf_file, image_id=None, flavor_id=None, + compute_cnt=1, image_alt_id=None, flavor_alt_id=None, + admin_role_name='admin', cidr='192.168.120.0/24', + domain_id='default'): + # pylint: disable=too-many-branches,too-many-arguments + # pylint: disable=too-many-statements,too-many-locals + """ + Add/update needed parameters into tempest.conf file + """ + LOGGER.debug("Updating selected tempest.conf parameters...") + rconfig = configparser.RawConfigParser() + rconfig.read(tempest_conf_file) + 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_alt_id is not None: + rconfig.set('compute', 'image_ref_alt', image_alt_id) + if flavor_id is not None: + rconfig.set('compute', 'flavor_ref', flavor_id) + if flavor_alt_id is not None: + rconfig.set('compute', 'flavor_ref_alt', flavor_alt_id) + if compute_cnt > 1: + # enable multinode tests + rconfig.set('compute', 'min_compute_nodes', compute_cnt) + rconfig.set('compute-feature-enabled', 'live_migration', True) + if os.environ.get('OS_REGION_NAME'): + rconfig.set('identity', 'region', os.environ.get('OS_REGION_NAME')) + rconfig.set('identity', 'admin_role', admin_role_name) + rconfig.set('identity', 'default_domain_id', domain_id) + if not rconfig.has_section('network'): + rconfig.add_section('network') + rconfig.set('network', 'default_network', cidr) + rconfig.set('network', 'project_network_cidr', cidr) + rconfig.set('network', 'project_networks_reachable', False) + rconfig.set( + 'identity', 'v3_endpoint_type', + os.environ.get('OS_INTERFACE', 'public')) + + sections = rconfig.sections() + services_list = [ + 'compute', 'volume', 'image', 'network', 'data-processing', + 'object-storage', 'orchestration'] + for service in services_list: + if service not in sections: + rconfig.add_section(service) + rconfig.set(service, 'endpoint_type', + os.environ.get('OS_INTERFACE', 'public')) + + LOGGER.debug('Add/Update required params defined in tempest_conf.yaml ' + 'into tempest.conf file') + TempestCommon.update_tempest_conf_file(tempest_conf_file, rconfig) + + @staticmethod + def configure_verifier(deployment_dir): + """ + Execute rally verify configure-verifier, which generates tempest.conf + """ + cmd = ['rally', 'verify', 'configure-verifier', '--reconfigure', + '--id', str(getattr(config.CONF, 'tempest_verifier_name'))] + output = subprocess.check_output(cmd) + LOGGER.info("%s\n%s", " ".join(cmd), output.decode("utf-8")) + + LOGGER.debug("Looking for tempest.conf file...") + tempest_conf_file = os.path.join(deployment_dir, "tempest.conf") + if not os.path.isfile(tempest_conf_file): + LOGGER.error("Tempest configuration file %s NOT found.", + tempest_conf_file) + return None + return tempest_conf_file + + def generate_test_list(self, **kwargs): + """Generate test list based on the test mode.""" + LOGGER.debug("Generating test case list...") + self.backup_tempest_config(self.conf_file, '/etc') + if kwargs.get('mode') == 'custom': + if os.path.isfile(self.tempest_custom): shutil.copyfile( - conf_utils.TEMPEST_CUSTOM, conf_utils.TEMPEST_RAW_LIST) + self.tempest_custom, self.list) else: - raise Exception("Tempest test list file %s NOT found." - % conf_utils.TEMPEST_CUSTOM) + raise Exception( + f"Tempest test list file {self.tempest_custom} NOT found.") else: - if self.MODE == 'smoke': - testr_mode = "smoke" - elif self.MODE == 'full': - testr_mode = "" - else: - testr_mode = 'tempest.api.' + self.MODE - cmd = ("cd {0};" - "testr list-tests {1} > {2};" - "cd -;".format(verifier_repo_dir, - testr_mode, - conf_utils.TEMPEST_RAW_LIST)) - ft_utils.execute_command(cmd) - - def apply_tempest_blacklist(self): - logger.debug("Applying tempest blacklist...") - cases_file = self.read_file(conf_utils.TEMPEST_RAW_LIST) - result_file = open(conf_utils.TEMPEST_LIST, 'w') - black_tests = [] - try: - installer_type = CONST.__getattribute__('INSTALLER_TYPE') - deploy_scenario = CONST.__getattribute__('DEPLOY_SCENARIO') - if (bool(installer_type) * bool(deploy_scenario)): - # if INSTALLER_TYPE and DEPLOY_SCENARIO are set we read the - # file - black_list_file = open(conf_utils.TEMPEST_BLACKLIST) - black_list_yaml = yaml.safe_load(black_list_file) - black_list_file.close() - for item in black_list_yaml: - scenarios = item['scenarios'] - installers = item['installers'] - if (deploy_scenario in scenarios and - installer_type in installers): - tests = item['tests'] - for test in tests: - black_tests.append(test) - break - except Exception: + testr_mode = kwargs.get( + 'mode', r'^tempest\.(api|scenario).*\[.*\bsmoke\b.*\]$') + cmd = (f"(cd {self.verifier_repo_dir}; " + f"stestr list '{testr_mode}' > {self.list} 2>/dev/null)") + output = subprocess.check_output(cmd, shell=True) + LOGGER.info("%s\n%s", cmd, output.decode("utf-8")) + os.remove('/etc/tempest.conf') + + def apply_tempest_blacklist(self, black_list): + """Exclude blacklisted test cases.""" + LOGGER.debug("Applying tempest blacklist...") + if os.path.exists(self.raw_list): + os.remove(self.raw_list) + os.rename(self.list, self.raw_list) + cases_file = self.read_file(self.raw_list) + with open(self.list, 'w', encoding='utf-8') as result_file: black_tests = [] - logger.debug("Tempest blacklist file does not exist.") - - for cases_line in cases_file: - for black_tests_line in black_tests: - if black_tests_line in cases_line: - break - else: - result_file.write(str(cases_line) + '\n') - result_file.close() - - def run_verifier_tests(self): - self.OPTION += (" --load-list {} --detailed" - .format(conf_utils.TEMPEST_LIST)) - - cmd_line = "rally verify start " + self.OPTION - logger.info("Starting Tempest test suite: '%s'." % cmd_line) - - header = ("Tempest environment:\n" - " SUT: %s\n Scenario: %s\n Node: %s\n Date: %s\n" % - (CONST.__getattribute__('INSTALLER_TYPE'), - CONST.__getattribute__('DEPLOY_SCENARIO'), - CONST.__getattribute__('NODE_NAME'), - time.strftime("%a %b %d %H:%M:%S %Z %Y"))) - - f_stdout = open( - os.path.join(conf_utils.TEMPEST_RESULTS_DIR, "tempest.log"), 'w+') - f_stderr = open( - os.path.join(conf_utils.TEMPEST_RESULTS_DIR, - "tempest-error.log"), 'w+') - f_env = open(os.path.join(conf_utils.TEMPEST_RESULTS_DIR, - "environment.log"), 'w+') - f_env.write(header) - - p = subprocess.Popen( - cmd_line, shell=True, - stdout=subprocess.PIPE, - stderr=f_stderr, - bufsize=1) - - with p.stdout: - for line in iter(p.stdout.readline, b''): - if re.search("\} tempest\.", line): - logger.info(line.replace('\n', '')) - elif re.search('Starting verification', line): - logger.info(line.replace('\n', '')) - first_pos = line.index("UUID=") + len("UUID=") - last_pos = line.index(") for deployment") - self.VERIFICATION_ID = line[first_pos:last_pos] - logger.debug('Verification UUID: %s', self.VERIFICATION_ID) - f_stdout.write(line) - p.wait() - - f_stdout.close() - f_stderr.close() - f_env.close() - - def parse_verifier_result(self): - if self.VERIFICATION_ID is None: + try: + deploy_scenario = env.get('DEPLOY_SCENARIO') + if bool(deploy_scenario): + # if DEPLOY_SCENARIO is set we read the file + with open(black_list, encoding='utf-8') as black_list_file: + black_list_yaml = yaml.safe_load(black_list_file) + black_list_file.close() + for item in black_list_yaml: + scenarios = item['scenarios'] + in_it = rally.RallyBase.in_iterable_re + if in_it(deploy_scenario, scenarios): + tests = item['tests'] + black_tests.extend(tests) + except Exception: # pylint: disable=broad-except + black_tests = [] + LOGGER.debug("Tempest blacklist file does not exist.") + + for cases_line in cases_file: + for black_tests_line in black_tests: + if re.search(black_tests_line, cases_line): + break + else: + result_file.write(str(cases_line) + '\n') + + def run_verifier_tests(self, **kwargs): + """Execute tempest test cases.""" + cmd = ["rally", "verify", "start", "--load-list", + self.list] + cmd.extend(kwargs.get('option', [])) + LOGGER.info("Starting Tempest test suite: '%s'.", cmd) + + with open( + os.path.join(self.res_dir, "tempest.log"), 'w+', + encoding='utf-8') as f_stdout: + with subprocess.Popen( + cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + bufsize=1) as proc: + with proc.stdout: + for line in iter(proc.stdout.readline, b''): + if re.search(r"\} tempest\.", line.decode("utf-8")): + LOGGER.info(line.rstrip()) + elif re.search(r'(?=\(UUID=(.*)\))', + line.decode("utf-8")): + self.verification_id = re.search( + r'(?=\(UUID=(.*)\))', + line.decode("utf-8")).group(1) + f_stdout.write(line.decode("utf-8")) + proc.wait() + + if self.verification_id is None: raise Exception('Verification UUID not found') + LOGGER.info('Verification UUID: %s', self.verification_id) - cmd_line = "rally verify show --uuid {}".format(self.VERIFICATION_ID) - logger.info("Showing result for a verification: '%s'." % cmd_line) - p = subprocess.Popen(cmd_line, - shell=True, - stdout=subprocess.PIPE, - stderr=subprocess.STDOUT) - for line in p.stdout: - new_line = line.replace(' ', '').split('|') - if 'Tests' in new_line: - break - - logger.info(line) - if 'Testscount' in new_line: - num_tests = new_line[2] - elif 'Success' in new_line: - num_success = new_line[2] - elif 'Skipped' in new_line: - num_skipped = new_line[2] - elif 'Failures' in new_line: - num_failures = new_line[2] + shutil.copy( + f"{self.deployment_dir}/tempest.log", + f"{self.res_dir}/tempest.debug.log") + def parse_verifier_result(self): + """Parse and save test results.""" + stat = self.get_verifier_result(self.verification_id) try: - num_executed = int(num_tests) - int(num_skipped) + num_executed = stat['num_tests'] - stat['num_skipped'] try: - self.result = 100 * int(num_success) / int(num_executed) + self.result = 100 * stat['num_success'] / num_executed except ZeroDivisionError: self.result = 0 - if int(num_tests) > 0: - logger.info("All tests have been skipped") + if stat['num_tests'] > 0: + LOGGER.info("All tests have been skipped") else: - logger.error("No test has been executed") + LOGGER.error("No test has been executed") return - with open(os.path.join(conf_utils.TEMPEST_RESULTS_DIR, - "tempest.log"), 'r') as logfile: + with open(os.path.join(self.res_dir, "rally.log"), + 'r', encoding='utf-8') as logfile: output = logfile.read() success_testcases = [] - for match in re.findall('.*\{0\} (.*?)[. ]*success ', output): + for match in re.findall(r'.*\{\d{1,2}\} (.*?) \.{3} success ', + output): success_testcases.append(match) failed_testcases = [] - for match in re.findall('.*\{0\} (.*?)[. ]*fail ', output): + for match in re.findall(r'.*\{\d{1,2}\} (.*?) \.{3} fail', + output): failed_testcases.append(match) skipped_testcases = [] - for match in re.findall('.*\{0\} (.*?)[. ]*skip:', output): + for match in re.findall(r'.*\{\d{1,2}\} (.*?) \.{3} skip(?::| )', + output): skipped_testcases.append(match) - self.details = {"tests": int(num_tests), - "failures": int(num_failures), + self.details = {"tests_number": stat['num_tests'], + "success_number": stat['num_success'], + "skipped_number": stat['num_skipped'], + "failures_number": stat['num_failures'], "success": success_testcases, - "errors": failed_testcases, - "skipped": skipped_testcases} - except Exception: + "skipped": skipped_testcases, + "failures": failed_testcases} + except Exception: # pylint: disable=broad-except self.result = 0 - logger.info("Tempest %s success_rate is %s%%" - % (self.case_name, self.result)) + LOGGER.info("Tempest %s success_rate is %s%%", + self.case_name, self.result) + + def update_rally_regex(self, rally_conf='/etc/rally/rally.conf'): + """Set image name as tempest img_name_regex""" + rconfig = configparser.RawConfigParser() + rconfig.read(rally_conf) + if not rconfig.has_section('openstack'): + rconfig.add_section('openstack') + rconfig.set('openstack', 'img_name_regex', f'^{self.image.name}$') + with open(rally_conf, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + def update_default_role(self, rally_conf='/etc/rally/rally.conf'): + """Detect and update the default role if required""" + role = self.get_default_role(self.cloud) + if not role: + return + rconfig = configparser.RawConfigParser() + rconfig.read(rally_conf) + if not rconfig.has_section('openstack'): + rconfig.add_section('openstack') + rconfig.set('openstack', 'swift_operator_role', role.name) + with open(rally_conf, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) - def run(self): + @staticmethod + def clean_rally_conf(rally_conf='/etc/rally/rally.conf'): + """Clean Rally config""" + rconfig = configparser.RawConfigParser() + rconfig.read(rally_conf) + if rconfig.has_option('openstack', 'img_name_regex'): + rconfig.remove_option('openstack', 'img_name_regex') + if rconfig.has_option('openstack', 'swift_operator_role'): + rconfig.remove_option('openstack', 'swift_operator_role') + with open(rally_conf, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + def update_auth_section(self): + """Update auth section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section("auth"): + rconfig.add_section("auth") + if env.get("NEW_USER_ROLE").lower() != "member": + tempest_roles = [] + if rconfig.has_option("auth", "tempest_roles"): + tempest_roles = functest_utils.convert_ini_to_list( + rconfig.get("auth", "tempest_roles")) + rconfig.set( + 'auth', 'tempest_roles', + functest_utils.convert_list_to_ini( + [env.get("NEW_USER_ROLE")] + tempest_roles)) + if not json.loads(env.get("USE_DYNAMIC_CREDENTIALS").lower()): + rconfig.set('auth', 'use_dynamic_credentials', False) + account_file = os.path.join( + getattr(config.CONF, 'dir_functest_data'), 'accounts.yaml') + assert os.path.exists( + account_file), f"{account_file} doesn't exist" + rconfig.set('auth', 'test_accounts_file', account_file) + if env.get('NO_TENANT_NETWORK').lower() == 'true': + rconfig.set('auth', 'create_isolated_networks', False) + with open(self.conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + def update_network_section(self): + """Update network section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if self.ext_net: + if not rconfig.has_section('network'): + rconfig.add_section('network') + rconfig.set('network', 'public_network_id', self.ext_net.id) + rconfig.set('network', 'floating_network_name', self.ext_net.name) + rconfig.set('network-feature-enabled', 'floating_ips', True) + else: + if not rconfig.has_section('network-feature-enabled'): + rconfig.add_section('network-feature-enabled') + rconfig.set('network-feature-enabled', 'floating_ips', False) + with open(self.conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + def update_compute_section(self): + """Update compute section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('compute'): + rconfig.add_section('compute') + rconfig.set( + 'compute', 'fixed_network_name', + self.network.name if self.network else env.get("EXTERNAL_NETWORK")) + with open(self.conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + def update_validation_section(self): + """Update validation section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('validation'): + rconfig.add_section('validation') + rconfig.set( + 'validation', 'connect_method', + 'floating' if self.ext_net else 'fixed') + rconfig.set( + 'validation', 'network_for_ssh', + self.network.name if self.network else env.get("EXTERNAL_NETWORK")) + with open(self.conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + def update_scenario_section(self): + """Update scenario section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + filename = getattr( + config.CONF, f'{self.case_name}_image', self.filename) + if not rconfig.has_section('scenario'): + rconfig.add_section('scenario') + rconfig.set('scenario', 'img_file', filename) + rconfig.set('scenario', 'img_disk_format', getattr( + config.CONF, f'{self.case_name}_image_format', + self.image_format)) + extra_properties = self.extra_properties.copy() + if env.get('IMAGE_PROPERTIES'): + extra_properties.update( + functest_utils.convert_ini_to_dict( + env.get('IMAGE_PROPERTIES'))) + extra_properties.update( + getattr(config.CONF, f'{self.case_name}_extra_properties', {})) + rconfig.set( + 'scenario', 'img_properties', + functest_utils.convert_dict_to_ini(extra_properties)) + with open(self.conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + + def update_dashboard_section(self): + """Update dashboard section in tempest.conf""" + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if env.get('DASHBOARD_URL'): + if not rconfig.has_section('dashboard'): + rconfig.add_section('dashboard') + rconfig.set('dashboard', 'dashboard_url', env.get('DASHBOARD_URL')) + else: + rconfig.set('service_available', 'horizon', False) + with open(self.conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + def configure(self, **kwargs): # pylint: disable=unused-argument + """ + Create all openstack resources for tempest-based testcases and write + tempest.conf. + """ + if not os.path.exists(self.res_dir): + os.makedirs(self.res_dir) + self.deployment_id = rally.RallyBase.create_rally_deployment( + environ=self.project.get_environ()) + if not self.deployment_id: + raise Exception("Deployment create failed") + self.verifier_id = self.create_verifier() + if not self.verifier_id: + raise Exception("Verifier create failed") + self.verifier_repo_dir = self.get_verifier_repo_dir( + self.verifier_id) + self.deployment_dir = self.get_verifier_deployment_dir( + self.verifier_id, self.deployment_id) + + compute_cnt = self.count_hypervisors() if self.count_hypervisors( + ) <= 10 else 10 + self.image_alt = self.publish_image_alt() + self.flavor_alt = self.create_flavor_alt() + LOGGER.debug("flavor: %s", self.flavor_alt) + + self.conf_file = self.configure_verifier(self.deployment_dir) + if not self.conf_file: + raise Exception("Tempest verifier configuring failed") + self.configure_tempest_update_params( + self.conf_file, + image_id=self.image.id, + flavor_id=self.flavor.id, + compute_cnt=compute_cnt, + image_alt_id=self.image_alt.id, + flavor_alt_id=self.flavor_alt.id, + admin_role_name=self.role_name, cidr=self.cidr, + domain_id=self.project.domain.id) + self.update_auth_section() + self.update_network_section() + self.update_compute_section() + self.update_validation_section() + self.update_scenario_section() + self.update_dashboard_section() + self.backup_tempest_config(self.conf_file, self.res_dir) + + def run(self, **kwargs): self.start_time = time.time() try: - if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): - os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) - resources = self.resources.create() - compute_cnt = snaps_utils.get_active_compute_cnt( - self.resources.os_creds) - conf_utils.configure_tempest( - self.DEPLOYMENT_DIR, - image_id=resources.get("image_id"), - flavor_id=resources.get("flavor_id"), - compute_cnt=compute_cnt) - self.generate_test_list(self.VERIFIER_REPO_DIR) - self.apply_tempest_blacklist() - self.run_verifier_tests() + assert super().run( + **kwargs) == testcase.TestCase.EX_OK + if not os.path.exists(self.res_dir): + os.makedirs(self.res_dir) + self.update_rally_regex() + self.update_default_role() + rally.RallyBase.update_rally_logs(self.res_dir) + shutil.copy("/etc/rally/rally.conf", self.res_dir) + self.configure(**kwargs) + self.generate_test_list(**kwargs) + self.apply_tempest_blacklist(TempestCommon.tempest_blacklist) + if env.get('PUBLIC_ENDPOINT_ONLY').lower() == 'true': + self.apply_tempest_blacklist( + TempestCommon.tempest_public_blacklist) + self.run_verifier_tests(**kwargs) self.parse_verifier_result() + rally.RallyBase.verify_report( + os.path.join(self.res_dir, "tempest-report.html"), + self.verification_id) + rally.RallyBase.verify_report( + os.path.join(self.res_dir, "tempest-report.xml"), + self.verification_id, "junit-xml") res = testcase.TestCase.EX_OK - except Exception as e: - logger.error('Error with run: %s' % e) + except Exception: # pylint: disable=broad-except + LOGGER.exception('Error with run') + self.result = 0 res = testcase.TestCase.EX_RUN_ERROR - finally: - self.resources.cleanup() - self.stop_time = time.time() return res - -class TempestSmokeSerial(TempestCommon): - - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = 'tempest_smoke_serial' - TempestCommon.__init__(self, **kwargs) - self.MODE = "smoke" - self.OPTION = "--concurrency 1" - - -class TempestSmokeParallel(TempestCommon): - - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = 'tempest_smoke_parallel' - TempestCommon.__init__(self, **kwargs) - self.MODE = "smoke" - self.OPTION = "" - - -class TempestFullParallel(TempestCommon): - - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = 'tempest_full_parallel' - TempestCommon.__init__(self, **kwargs) - self.MODE = "full" - - -class TempestCustom(TempestCommon): - - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = 'tempest_custom' - TempestCommon.__init__(self, **kwargs) - self.MODE = "custom" - self.OPTION = "--concurrency 1" - - -class TempestDefcore(TempestCommon): - - def __init__(self, **kwargs): - if "case_name" not in kwargs: - kwargs["case_name"] = 'tempest_defcore' - TempestCommon.__init__(self, **kwargs) - self.MODE = "defcore" - self.OPTION = "--concurrency 1" - - -class TempestResourcesManager(object): + def clean(self): + """ + Cleanup all OpenStack objects. Should be called on completion. + """ + self.clean_rally_conf() + rally.RallyBase.clean_rally_logs() + if self.image_alt: + self.cloud.delete_image(self.image_alt) + if self.flavor_alt: + self.orig_cloud.delete_flavor(self.flavor_alt.id) + super().clean() + + def is_successful(self): + """The overall result of the test.""" + skips = self.details.get("skipped_number", 0) + if skips > 0 and self.deny_skipping: + return testcase.TestCase.EX_TESTCASE_FAILED + if self.tests_count and ( + self.details.get("tests_number", 0) != self.tests_count): + return testcase.TestCase.EX_TESTCASE_FAILED + return super().is_successful() + + +class TempestHeat(TempestCommon): + """Tempest Heat testcase implementation class.""" + + filename_alt = ('/home/opnfv/functest/images/' + 'Fedora-Cloud-Base-30-1.2.x86_64.qcow2') + flavor_alt_ram = 512 + flavor_alt_vcpus = 1 + flavor_alt_disk = 4 def __init__(self, **kwargs): - self.os_creds = None - if 'os_creds' in kwargs: - self.os_creds = kwargs['os_creds'] + super().__init__(**kwargs) + self.user2 = self.orig_cloud.create_user( + name=f'{self.case_name}-user2_{self.project.guid}', + password=self.project.password, + domain_id=self.project.domain.id) + self.orig_cloud.grant_role( + self.role_name, user=self.user2.id, + project=self.project.project.id, domain=self.project.domain.id) + if not self.orig_cloud.get_role("heat_stack_owner"): + self.role = self.orig_cloud.create_role("heat_stack_owner") + self.orig_cloud.grant_role( + "heat_stack_owner", user=self.user2.id, + project=self.project.project.id, + domain=self.project.domain.id) + + def configure(self, **kwargs): + assert self.user2 + super().configure(**kwargs) + rconfig = configparser.RawConfigParser() + rconfig.read(self.conf_file) + if not rconfig.has_section('heat_plugin'): + rconfig.add_section('heat_plugin') + # It fails if region and domain ids are unset + rconfig.set( + 'heat_plugin', 'region', + os.environ.get('OS_REGION_NAME', 'RegionOne')) + rconfig.set('heat_plugin', 'auth_url', os.environ["OS_AUTH_URL"]) + rconfig.set('heat_plugin', 'project_domain_id', self.project.domain.id) + rconfig.set('heat_plugin', 'user_domain_id', self.project.domain.id) + rconfig.set( + 'heat_plugin', 'project_domain_name', self.project.domain.name) + rconfig.set( + 'heat_plugin', 'user_domain_name', self.project.domain.name) + rconfig.set('heat_plugin', 'username', self.user2.name) + rconfig.set('heat_plugin', 'password', self.project.password) + rconfig.set('heat_plugin', 'project_name', self.project.project.name) + rconfig.set('heat_plugin', 'admin_username', self.project.user.name) + rconfig.set('heat_plugin', 'admin_password', self.project.password) + rconfig.set( + 'heat_plugin', 'admin_project_name', self.project.project.name) + rconfig.set('heat_plugin', 'image_ref', self.image_alt.id) + rconfig.set('heat_plugin', 'instance_type', self.flavor_alt.id) + rconfig.set('heat_plugin', 'minimal_image_ref', self.image.id) + rconfig.set('heat_plugin', 'minimal_instance_type', self.flavor.id) + if self.ext_net: + rconfig.set( + 'heat_plugin', 'floating_network_name', self.ext_net.name) + if self.network: + rconfig.set('heat_plugin', 'fixed_network_name', self.network.name) + rconfig.set('heat_plugin', 'fixed_subnet_name', self.subnet.name) + rconfig.set('heat_plugin', 'network_for_ssh', self.network.name) else: - self.os_creds = openstack_tests.get_credentials( - os_env_file=CONST.__getattribute__('openstack_creds')) - - self.guid = '-' + str(uuid.uuid4()) - - self.creators = list() - - if hasattr(CONST, 'snaps_images_cirros'): - self.cirros_image_config = CONST.__getattribute__( - 'snaps_images_cirros') - else: - self.cirros_image_config = None - - def create(self, use_custom_images=False, use_custom_flavors=False, - create_project=False): - if create_project: - logger.debug("Creating project (tenant) for Tempest suite") - project_name = CONST.__getattribute__( - 'tempest_identity_tenant_name') + self.guid - project_creator = deploy_utils.create_project( - self.os_creds, ProjectConfig( - name=project_name, - description=CONST.__getattribute__( - 'tempest_identity_tenant_description'))) - if (project_creator is None or - project_creator.get_project() is None): - raise Exception("Failed to create tenant") - project_id = project_creator.get_project().id - self.creators.append(project_creator) - - logger.debug("Creating user for Tempest suite") - user_creator = deploy_utils.create_user( - self.os_creds, UserConfig( - name=CONST.__getattribute__( - 'tempest_identity_user_name') + self.guid, - password=CONST.__getattribute__( - 'tempest_identity_user_password'), - project_name=project_name)) - if user_creator is None or user_creator.get_user() is None: - raise Exception("Failed to create user") - user_id = user_creator.get_user().id - self.creators.append(user_creator) - else: - project_name = None - project_id = None - user_id = None - - logger.debug("Creating private network for Tempest suite") - - tempest_network_type = None - tempest_physical_network = None - tempest_segmentation_id = None - - if hasattr(CONST, 'tempest_network_type'): - tempest_network_type = CONST.__getattribute__( - 'tempest_network_type') - if hasattr(CONST, 'tempest_physical_network'): - tempest_physical_network = CONST.__getattribute__( - 'tempest_physical_network') - if hasattr(CONST, 'tempest_segmentation_id'): - tempest_segmentation_id = CONST.__getattribute__( - 'tempest_segmentation_id') - - network_creator = deploy_utils.create_network( - self.os_creds, NetworkConfig( - name=CONST.__getattribute__( - 'tempest_private_net_name') + self.guid, - project_name=project_name, - network_type=tempest_network_type, - physical_network=tempest_physical_network, - segmentation_id=tempest_segmentation_id, - subnet_settings=[SubnetConfig( - name=CONST.__getattribute__( - 'tempest_private_subnet_name') + self.guid, - cidr=CONST.__getattribute__('tempest_private_subnet_cidr')) - ])) - if network_creator is None or network_creator.get_network() is None: - raise Exception("Failed to create private network") - self.creators.append(network_creator) - - image_id = None - image_id_alt = None - flavor_id = None - flavor_id_alt = None - - logger.debug("Creating image for Tempest suite") - image_base_name = CONST.__getattribute__( - 'openstack_image_name') + self.guid - os_image_settings = openstack_tests.cirros_image_settings( - image_base_name, public=True, - image_metadata=self.cirros_image_config) - logger.debug("Creating image for Tempest suite") - image_creator = deploy_utils.create_image( - self.os_creds, os_image_settings) - if image_creator is None: - raise Exception('Failed to create image') - self.creators.append(image_creator) - image_id = image_creator.get_image().id - - if use_custom_images: - logger.debug("Creating 2nd image for Tempest suite") - image_base_name_alt = CONST.__getattribute__( - 'openstack_image_name_alt') + self.guid - os_image_settings_alt = openstack_tests.cirros_image_settings( - image_base_name_alt, public=True, - image_metadata=self.cirros_image_config) - logger.debug("Creating 2nd image for Tempest suite") - image_creator_alt = deploy_utils.create_image( - self.os_creds, os_image_settings_alt) - if image_creator_alt is None: - raise Exception('Failed to create image') - self.creators.append(image_creator_alt) - image_id_alt = image_creator_alt.get_image().id - - if (CONST.__getattribute__('tempest_use_custom_flavors') == 'True' or - use_custom_flavors): - logger.info("Creating flavor for Tempest suite") - scenario = CONST.__getattribute__('DEPLOY_SCENARIO') - flavor_metadata = None - if 'ovs' in scenario or 'fdio' in scenario: - flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE - flavor_creator = OpenStackFlavor( - self.os_creds, FlavorConfig( - name=CONST.__getattribute__( - 'openstack_flavor_name') + self.guid, - ram=CONST.__getattribute__('openstack_flavor_ram'), - disk=CONST.__getattribute__('openstack_flavor_disk'), - vcpus=CONST.__getattribute__('openstack_flavor_vcpus'), - metadata=flavor_metadata)) - flavor = flavor_creator.create() - if flavor is None: - raise Exception('Failed to create flavor') - self.creators.append(flavor_creator) - flavor_id = flavor.id - - if use_custom_flavors: - logger.info("Creating 2nd flavor for Tempest suite") - scenario = CONST.__getattribute__('DEPLOY_SCENARIO') - flavor_metadata_alt = None - if 'ovs' in scenario or 'fdio' in scenario: - flavor_metadata_alt = create_flavor.MEM_PAGE_SIZE_LARGE - CONST.__setattr__('openstack_flavor_ram', 1024) - flavor_creator_alt = OpenStackFlavor( - self.os_creds, FlavorConfig( - name=CONST.__getattribute__( - 'openstack_flavor_name_alt') + self.guid, - ram=CONST.__getattribute__('openstack_flavor_ram'), - disk=CONST.__getattribute__('openstack_flavor_disk'), - vcpus=CONST.__getattribute__('openstack_flavor_vcpus'), - metadata=flavor_metadata_alt)) - flavor_alt = flavor_creator_alt.create() - if flavor_alt is None: - raise Exception('Failed to create flavor') - self.creators.append(flavor_creator_alt) - flavor_id_alt = flavor_alt.id - - print("RESOURCES CREATE: image_id: %s, image_id_alt: %s, " - "flavor_id: %s, flavor_id_alt: %s" % ( - image_id, image_id_alt, flavor_id, flavor_id_alt,)) - - result = { - 'image_id': image_id, - 'image_id_alt': image_id_alt, - 'flavor_id': flavor_id, - 'flavor_id_alt': flavor_id_alt - } - - if create_project: - result['project_id'] = project_id - result['tenant_id'] = project_id # for compatibility - result['user_id'] = user_id - - return result - - def cleanup(self): + LOGGER.warning( + 'No tenant network created. ' + 'Trying EXTERNAL_NETWORK as a fallback') + rconfig.set( + 'heat_plugin', 'fixed_network_name', + env.get("EXTERNAL_NETWORK")) + rconfig.set( + 'heat_plugin', 'network_for_ssh', env.get("EXTERNAL_NETWORK")) + with open(self.conf_file, 'w', encoding='utf-8') as config_file: + rconfig.write(config_file) + self.backup_tempest_config(self.conf_file, self.res_dir) + + def clean(self): """ Cleanup all OpenStack objects. Should be called on completion. """ - for creator in reversed(self.creators): - try: - creator.clean() - except Exception as e: - logger.error('Unexpected error cleaning - %s', e) + super().clean() + if self.user2: + self.orig_cloud.delete_user(self.user2.id) |