diff options
Diffstat (limited to 'functest/opnfv_tests/openstack')
13 files changed, 113 insertions, 87 deletions
diff --git a/functest/opnfv_tests/openstack/rally/rally.py b/functest/opnfv_tests/openstack/rally/rally.py index e7411c51..e07e2a8d 100644 --- a/functest/opnfv_tests/openstack/rally/rally.py +++ b/functest/opnfv_tests/openstack/rally/rally.py @@ -56,8 +56,8 @@ class RallyBase(testcase.TestCase): RALLY_PRIVATE_SUBNET_CIDR = CONST.rally_subnet_cidr RALLY_ROUTER_NAME = CONST.rally_router_name - def __init__(self, case_name=''): - super(RallyBase, self).__init__(case_name) + def __init__(self, **kwargs): + super(RallyBase, self).__init__(**kwargs) self.mode = '' self.summary = [] self.scenario_dir = '' @@ -500,12 +500,12 @@ class RallyBase(testcase.TestCase): 'nb tests': total_nb_tests, 'nb success': success_rate}}) - self.criteria = ft_utils.check_success_rate( + self.result = ft_utils.check_success_rate( self.case_name, success_rate) self.details = payload logger.info("Rally '%s' success_rate is %s%%, is marked as %s" - % (self.case_name, success_rate, self.criteria)) + % (self.case_name, success_rate, self.result)) def _clean_up(self): if self.volume_type: @@ -536,8 +536,10 @@ class RallyBase(testcase.TestCase): class RallySanity(RallyBase): - def __init__(self, case_name="rally_sanity"): - super(RallySanity, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "rally_sanity" + super(RallySanity, self).__init__(**kwargs) self.mode = 'sanity' self.test_name = 'all' self.smoke = True @@ -545,8 +547,10 @@ class RallySanity(RallyBase): class RallyFull(RallyBase): - def __init__(self, case_name="rally_full"): - super(RallyFull, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "rally_full" + super(RallyFull, self).__init__(**kwargs) self.mode = 'full' self.test_name = 'all' self.smoke = False diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 441abfee..2f2fc00f 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -25,8 +25,10 @@ logger = ft_logger.Logger("refstack_defcore").getLogger() class RefstackClient(testcase.TestCase): - def __init__(self, case_name="refstack_defcore"): - super(RefstackClient, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "refstack_defcore" + super(RefstackClient, self).__init__(**kwargs) self.FUNCTEST_TEST = CONST.dir_functest_test self.CONF_PATH = CONST.refstack_tempest_conf_path self.DEFCORE_LIST = CONST.refstack_defcore_list @@ -131,10 +133,10 @@ class RefstackClient(testcase.TestCase): except Exception: success_rate = 0 - self.criteria = ft_utils.check_success_rate( + self.result = ft_utils.check_success_rate( self.case_name, success_rate) logger.info("Testcase %s success_rate is %s%%, is marked as %s" - % (self.case_name, success_rate, self.criteria)) + % (self.case_name, success_rate, self.result)) def run(self): '''used for functest command line, @@ -169,7 +171,7 @@ class RefstackClient(testcase.TestCase): '''used for manually running, python refstack_client.py -c <tempest_conf_path> --testlist <testlist_path> - can generate a reference tempest.conf by + can generate a reference refstack_tempest.conf by python tempest_conf.py ''' try: @@ -204,7 +206,7 @@ class RefstackClientParser(object): self.parser = argparse.ArgumentParser() self.parser.add_argument( '-c', '--config', - help='the file path of tempest.conf', + help='the file path of refstack_tempest.conf', default=self.confpath) self.parser.add_argument( '-t', '--testlist', diff --git a/functest/opnfv_tests/openstack/snaps/api_check.py b/functest/opnfv_tests/openstack/snaps/api_check.py index dea1ca75..50f67094 100644 --- a/functest/opnfv_tests/openstack/snaps/api_check.py +++ b/functest/opnfv_tests/openstack/snaps/api_check.py @@ -11,7 +11,6 @@ from snaps import test_suite_builder from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \ SnapsTestRunner -from functest.utils.constants import CONST class ApiCheck(SnapsTestRunner): @@ -20,13 +19,15 @@ class ApiCheck(SnapsTestRunner): that exercise many of the OpenStack APIs within Keystone, Glance, Neutron, and Nova """ - def __init__(self, case_name="api_check"): - super(ApiCheck, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "api_check" + super(ApiCheck, self).__init__(**kwargs) self.suite = unittest.TestSuite() test_suite_builder.add_openstack_api_tests( - self.suite, - CONST.openstack_creds, - self.ext_net_name, - use_keystone=CONST.snaps_use_keystone) + suite=self.suite, + os_creds=self.os_creds, + ext_net_name=self.ext_net_name, + use_keystone=self.use_keystone) diff --git a/functest/opnfv_tests/openstack/snaps/connection_check.py b/functest/opnfv_tests/openstack/snaps/connection_check.py index 57b74d4c..f2753aea 100644 --- a/functest/opnfv_tests/openstack/snaps/connection_check.py +++ b/functest/opnfv_tests/openstack/snaps/connection_check.py @@ -11,7 +11,6 @@ from snaps import test_suite_builder from functest.opnfv_tests.openstack.snaps.snaps_test_runner import \ SnapsTestRunner -from functest.utils.constants import CONST class ConnectionCheck(SnapsTestRunner): @@ -20,13 +19,15 @@ class ConnectionCheck(SnapsTestRunner): that simply obtain the different OpenStack clients and may perform simple queries """ - def __init__(self, case_name="connection_check"): - super(ConnectionCheck, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "connection_check" + super(ConnectionCheck, self).__init__(**kwargs) self.suite = unittest.TestSuite() test_suite_builder.add_openstack_client_tests( - self.suite, - CONST.openstack_creds, - self.ext_net_name, - use_keystone=CONST.snaps_use_keystone) + suite=self.suite, + os_creds=self.os_creds, + ext_net_name=self.ext_net_name, + use_keystone=self.use_keystone) diff --git a/functest/opnfv_tests/openstack/snaps/health_check.py b/functest/opnfv_tests/openstack/snaps/health_check.py index 6b3cfdd0..c057eb2b 100644 --- a/functest/opnfv_tests/openstack/snaps/health_check.py +++ b/functest/opnfv_tests/openstack/snaps/health_check.py @@ -21,18 +21,20 @@ class HealthCheck(SnapsTestRunner): creates a VM with a single port with an IPv4 address that is assigned by DHCP. This test then validates the expected IP with the actual """ - def __init__(self, case_name="snaps_health_check"): - super(HealthCheck, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "snaps_health_check" + super(HealthCheck, self).__init__(**kwargs) self.suite = unittest.TestSuite() image_custom_config = None if hasattr(CONST, 'snaps_health_check'): - image_custom_config = CONST.snaps_health_check - + image_custom_config = CONST.__getattribute__('snaps_health_check') self.suite.addTest( OSIntegrationTestCase.parameterize( - SimpleHealthCheck, CONST.openstack_creds, self.ext_net_name, - use_keystone=CONST.snaps_use_keystone, + SimpleHealthCheck, os_creds=self.os_creds, + ext_net_name=self.ext_net_name, + use_keystone=self.use_keystone, flavor_metadata=self.flavor_metadata, image_metadata=image_custom_config)) diff --git a/functest/opnfv_tests/openstack/snaps/smoke.py b/functest/opnfv_tests/openstack/snaps/smoke.py index 45fa6de8..2c6fc255 100644 --- a/functest/opnfv_tests/openstack/snaps/smoke.py +++ b/functest/opnfv_tests/openstack/snaps/smoke.py @@ -21,30 +21,31 @@ class SnapsSmoke(SnapsTestRunner): that exercise many of the OpenStack APIs within Keystone, Glance, Neutron, and Nova """ - def __init__(self): - super(SnapsSmoke, self).__init__() + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "snaps_smoke" + super(SnapsSmoke, self).__init__(**kwargs) self.suite = unittest.TestSuite() - self.case_name = "snaps_smoke" - use_fip = CONST.snaps_use_floating_ips # The snaps smoke test uses the same config as the # snaps_health_check suite, so reuse it here image_custom_config = None if hasattr(CONST, 'snaps_health_check'): - image_custom_config = CONST.snaps_health_check + image_custom_config = CONST.__getattribute__('snaps_health_check') # Tests requiring floating IPs leverage files contained within the # SNAPS repository and are found relative to that path - if use_fip: - snaps_dir = CONST.dir_repo_snaps + '/snaps' + if self.use_fip: + snaps_dir = os.path.join(CONST.__getattribute__('dir_repo_snaps'), + 'snaps') os.chdir(snaps_dir) test_suite_builder.add_openstack_integration_tests( - self.suite, - CONST.openstack_creds, - self.ext_net_name, - use_keystone=CONST.snaps_use_keystone, + suite=self.suite, + os_creds=self.os_creds, + ext_net_name=self.ext_net_name, + use_keystone=self.use_keystone, flavor_metadata=self.flavor_metadata, image_metadata=image_custom_config, - use_floating_ips=use_fip) + use_floating_ips=self.use_fip) diff --git a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py index 044a0bb0..8a68cad9 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_test_runner.py @@ -5,12 +5,13 @@ # # http://www.apache.org/licenses/LICENSE-2.0 -from functest.utils import functest_logger as ft_logger from functest.core.pytest_suite_runner import PyTestSuiteRunner from functest.opnfv_tests.openstack.snaps import snaps_utils from functest.utils import functest_utils +from functest.utils.constants import CONST from snaps.openstack import create_flavor +from snaps.openstack.tests import openstack_tests class SnapsTestRunner(PyTestSuiteRunner): @@ -19,15 +20,20 @@ class SnapsTestRunner(PyTestSuiteRunner): creates a VM with a single port with an IPv4 address that is assigned by DHCP. This test then validates the expected IP with the actual """ - def __init__(self, case_name=''): - super(SnapsTestRunner, self).__init__(case_name) + def __init__(self, **kwargs): + super(SnapsTestRunner, self).__init__(**kwargs) - self.ext_net_name = snaps_utils.get_ext_net_name() - self.logger = ft_logger.Logger(self.project_name).getLogger() + self.os_creds = openstack_tests.get_credentials( + os_env_file=CONST.__getattribute__('openstack_creds'), + proxy_settings_str=None, ssh_proxy_cmd=None) + + self.ext_net_name = snaps_utils.get_ext_net_name(self.os_creds) + self.use_fip = CONST.__getattribute__('snaps_use_floating_ips') + self.use_keystone = CONST.__getattribute__('snaps_use_keystone') scenario = functest_utils.get_scenario() self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_ANY if 'ovs' in scenario or 'fdio' in scenario: self.flavor_metadata = create_flavor.MEM_PAGE_SIZE_LARGE - self.logger.info("Using flavor metatdata '%s'" % self.flavor_metadata) + self.logger.info("Using flavor metadata '%s'", self.flavor_metadata) diff --git a/functest/opnfv_tests/openstack/snaps/snaps_utils.py b/functest/opnfv_tests/openstack/snaps/snaps_utils.py index 4ea1a04a..327ba073 100644 --- a/functest/opnfv_tests/openstack/snaps/snaps_utils.py +++ b/functest/opnfv_tests/openstack/snaps/snaps_utils.py @@ -5,19 +5,15 @@ # # http://www.apache.org/licenses/LICENSE-2.0 -from snaps.openstack.tests import openstack_tests from snaps.openstack.utils import neutron_utils -from functest.utils.constants import CONST - -def get_ext_net_name(): +def get_ext_net_name(os_creds): """ Returns the first external network name + :param: os_creds: an instance of snaps OSCreds object :return: """ - os_env_file = CONST.openstack_creds - os_creds = openstack_tests.get_credentials(os_env_file=os_env_file) neutron = neutron_utils.neutron_client(os_creds) ext_nets = neutron_utils.get_external_networks(neutron) return ext_nets[0]['network']['name'] diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt index 0da92cd8..026b24f4 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt @@ -52,7 +52,7 @@ tests: - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops - +- # https://bugs.opendaylight.org/show_bug.cgi?id=5586 scenarios: - os-odl-bgpvpn-ha @@ -60,6 +60,5 @@ - os-odl_l2-bgpvpn-ha installers: - apex - - fuel tests: - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard diff --git a/functest/opnfv_tests/openstack/tempest/tempest.py b/functest/opnfv_tests/openstack/tempest/tempest.py index c3184e35..e6c6b44f 100644 --- a/functest/opnfv_tests/openstack/tempest/tempest.py +++ b/functest/opnfv_tests/openstack/tempest/tempest.py @@ -28,8 +28,8 @@ logger = ft_logger.Logger("Tempest").getLogger() class TempestCommon(testcase.TestCase): - def __init__(self, case_name=''): - super(TempestCommon, self).__init__(case_name) + def __init__(self, **kwargs): + super(TempestCommon, self).__init__(**kwargs) self.MODE = "" self.OPTION = "" self.VERIFIER_ID = conf_utils.get_verifier_id() @@ -200,19 +200,17 @@ class TempestCommon(testcase.TestCase): except Exception: success_rate = 0 - self.criteria = ft_utils.check_success_rate( + self.result = ft_utils.check_success_rate( self.case_name, success_rate) logger.info("Tempest %s success_rate is %s%%, is marked as %s" - % (self.case_name, success_rate, self.criteria)) + % (self.case_name, success_rate, self.result)) def run(self): self.start_time = time.time() - - if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): - os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) - try: + if not os.path.exists(conf_utils.TEMPEST_RESULTS_DIR): + os.makedirs(conf_utils.TEMPEST_RESULTS_DIR) image_and_flavor = conf_utils.create_tempest_resources() conf_utils.configure_tempest( self.DEPLOYMENT_DIR, @@ -234,31 +232,39 @@ class TempestCommon(testcase.TestCase): class TempestSmokeSerial(TempestCommon): - def __init__(self, case_name='tempest_smoke_serial'): - TempestCommon.__init__(self, case_name) + 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, case_name='tempest_smoke_parallel'): - TempestCommon.__init__(self, case_name) + 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, case_name="tempest_full_parallel"): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'tempest_full_parallel' + TempestCommon.__init__(self, **kwargs) self.MODE = "full" class TempestMultisite(TempestCommon): - def __init__(self, case_name="multisite"): - TempestCommon.__init__(self, case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = 'multisite' + TempestCommon.__init__(self, **kwargs) self.MODE = "feature_multisite" self.OPTION = "--concurrency 1" conf_utils.install_verifier_ext(CONST.dir_repo_kingbird) @@ -266,15 +272,19 @@ class TempestMultisite(TempestCommon): class TempestCustom(TempestCommon): - def __init__(self, case_name="tempest_custom"): - TempestCommon.__init__(self, case_name) + 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, case_name="tempest_defcore"): - TempestCommon.__init__(self, case_name) + 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" diff --git a/functest/opnfv_tests/openstack/vping/vping_base.py b/functest/opnfv_tests/openstack/vping/vping_base.py index 64cb0004..8bf263eb 100644 --- a/functest/opnfv_tests/openstack/vping/vping_base.py +++ b/functest/opnfv_tests/openstack/vping/vping_base.py @@ -18,8 +18,8 @@ from functest.utils.constants import CONST class VPingBase(testcase.TestCase): - def __init__(self, case_name=''): - super(VPingBase, self).__init__(case_name) + def __init__(self, **kwargs): + super(VPingBase, self).__init__(**kwargs) self.logger = None self.functest_repo = CONST.dir_repo_functest self.repo = CONST.dir_vping @@ -273,7 +273,7 @@ class VPingBase(testcase.TestCase): self.details = {'timestart': start_time, 'duration': duration, 'status': test_status} - self.criteria = test_status + self.result = test_status @staticmethod def pMsg(msg): diff --git a/functest/opnfv_tests/openstack/vping/vping_ssh.py b/functest/opnfv_tests/openstack/vping/vping_ssh.py index a68b0ff7..c26c4e0c 100755 --- a/functest/opnfv_tests/openstack/vping/vping_ssh.py +++ b/functest/opnfv_tests/openstack/vping/vping_ssh.py @@ -24,8 +24,10 @@ import functest.core.testcase as testcase class VPingSSH(vping_base.VPingBase): - def __init__(self, case_name='vping_ssh'): - super(VPingSSH, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "vping_ssh" + super(VPingSSH, self).__init__(**kwargs) self.logger = ft_logger.Logger(self.case_name).getLogger() def do_vping(self, vm, test_ip): diff --git a/functest/opnfv_tests/openstack/vping/vping_userdata.py b/functest/opnfv_tests/openstack/vping/vping_userdata.py index e9b86998..1b00ca23 100755 --- a/functest/opnfv_tests/openstack/vping/vping_userdata.py +++ b/functest/opnfv_tests/openstack/vping/vping_userdata.py @@ -18,8 +18,10 @@ import vping_base class VPingUserdata(vping_base.VPingBase): - def __init__(self, case_name='vping_userdata'): - super(VPingUserdata, self).__init__(case_name) + def __init__(self, **kwargs): + if "case_name" not in kwargs: + kwargs["case_name"] = "vping_userdata" + super(VPingUserdata, self).__init__(**kwargs) self.logger = ft_logger.Logger(self.case_name).getLogger() def boot_vm_preparation(self, config, vmname, test_ip): |