diff options
Diffstat (limited to 'functest/opnfv_tests/openstack')
3 files changed, 89 insertions, 47 deletions
diff --git a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py index 597ece3e..37aa9e39 100755 --- a/functest/opnfv_tests/openstack/refstack_client/refstack_client.py +++ b/functest/opnfv_tests/openstack/refstack_client/refstack_client.py @@ -14,10 +14,10 @@ import time from functest.core import testcase from functest.opnfv_tests.openstack.tempest import conf_utils -from functest.utils import openstack_utils from functest.utils.constants import CONST import functest.utils.functest_logger as ft_logger import functest.utils.functest_utils as ft_utils +from tempest_conf import TempestConf """ logging configuration """ logger = ft_logger.Logger("refstack_defcore").getLogger() @@ -35,12 +35,6 @@ class RefstackClient(testcase.TestCase): self.CONF_PATH) self.defcorelist = os.path.join(self.FUNCTEST_TEST, self.DEFCORE_LIST) - 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) def source_venv(self): @@ -143,28 +137,18 @@ class RefstackClient(testcase.TestCase): logger.info("Testcase %s success_rate is %s%%, is marked as %s" % (self.case_name, success_rate, self.criteria)) - def defcore_env_prepare(self): - try: - img_flavor_dict = conf_utils.create_tempest_resources( - use_custom_images=True, use_custom_flavors=True) - conf_utils.configure_tempest_defcore( - self.DEPLOYMENT_DIR, img_flavor_dict) - self.source_venv() - res = testcase.TestCase.EX_OK - except KeyError as e: - logger.error("defcore prepare env error with: %s", e) - res = testcase.TestCase.EX_RUN_ERROR - - return res - def run(self): + '''used for functest command line, + functest testcase run refstack_defcore''' self.start_time = time.time() if not os.path.exists(conf_utils.REFSTACK_RESULTS_DIR): os.makedirs(conf_utils.REFSTACK_RESULTS_DIR) try: - self.defcore_env_prepare() + tempestconf = TempestConf() + tempestconf.generate_tempestconf() + self.source_venv() self.run_defcore_default() self.parse_refstack_result() res = testcase.TestCase.EX_OK @@ -175,18 +159,31 @@ class RefstackClient(testcase.TestCase): self.stop_time = time.time() return res + def _prep_test(self): + '''Check that the config file exists.''' + if not os.path.isfile(self.confpath): + logger.error("Conf file not valid: %s" % self.confpath) + if not os.path.isfile(self.testlist): + logger.error("testlist file not valid: %s" % self.testlist) + def main(self, **kwargs): + '''used for manually running, + python refstack_client.py -c <tempest_conf_path> + --testlist <testlist_path> + can generate a reference tempest.conf by + python tempest_conf.py + ''' try: - tempestconf = kwargs['config'] - testlist = kwargs['testlist'] + self.confpath = kwargs['config'] + self.testlist = kwargs['testlist'] except KeyError as e: logger.error("Cannot run refstack client. Please check " "%s", e) return self.EX_RUN_ERROR try: - openstack_utils.source_credentials(CONST.openstack_creds) - self.defcore_env_prepare() - self.run_defcore(tempestconf, testlist) + self.source_venv() + self._prep_test() + self.run_defcore(self.confpath, self.testlist) res = testcase.TestCase.EX_OK except Exception as e: logger.error('Error with run: %s', e) diff --git a/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py new file mode 100755 index 00000000..5624ed79 --- /dev/null +++ b/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# matthew.lijun@huawei.com +# 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 sys + +from functest.core import testcase +from functest.opnfv_tests.openstack.tempest import conf_utils +from functest.utils import openstack_utils +from functest.utils.constants import CONST +import functest.utils.functest_logger as ft_logger + +""" logging configuration """ +logger = ft_logger.Logger("refstack_defcore").getLogger() + + +class TempestConf(object): + def __init__(self): + 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) + + def generate_tempestconf(self): + try: + openstack_utils.source_credentials(CONST.openstack_creds) + img_flavor_dict = conf_utils.create_tempest_resources( + use_custom_images=True, use_custom_flavors=True) + conf_utils.configure_tempest_defcore( + self.DEPLOYMENT_DIR, img_flavor_dict) + except KeyError as e: + logger.error("defcore prepare env error with: %s", e) + + def main(self): + try: + self.generate_tempestconf() + res = testcase.TestCase.EX_OK + except Exception as e: + logger.error('Error with run: %s', e) + res = testcase.TestCase.EX_RUN_ERROR + + return res + +if __name__ == '__main__': + tempestconf = TempestConf() + result = tempestconf.main() + if result != testcase.TestCase.EX_OK: + sys.exit(result) diff --git a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt index 43edabc1..0da92cd8 100644 --- a/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt +++ b/functest/opnfv_tests/openstack/tempest/custom_tests/blacklist.txt @@ -27,11 +27,7 @@ scenarios: - os-onos-nofeature-ha - os-onos-nofeature-noha - - os-onos-sfc-ha - - os-onos-sfc-noha installers: - - fuel - - apex - compass tests: - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard @@ -41,22 +37,6 @@ - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern - - scenarios: - - os-onos-nofeature-ha - - os-onos-nofeature-noha - - os-onos-sfc-ha - - os-onos-sfc-noha - installers: - - joid - tests: - - tempest.api.object_storage - - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard - - tempest.scenario.test_network_basic_ops.TestNetworkBasicOps.test_network_basic_ops - - tempest.scenario.test_server_basic_ops.TestServerBasicOps.test_server_basic_ops - - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPattern.test_volume_boot_pattern - - tempest.scenario.test_volume_boot_pattern.TestVolumeBootPatternV2.test_volume_boot_pattern - -- # https://bugs.launchpad.net/tempest/+bug/1577632 scenarios: - os-odl_l2-nofeature-ha @@ -71,3 +51,15 @@ - fuel 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 + - os-odl-gluon-noha + - os-odl_l2-bgpvpn-ha + installers: + - apex + - fuel + tests: + - tempest.api.compute.servers.test_server_actions.ServerActionsTestJSON.test_reboot_server_hard |