3 # matthew.lijun@huawei.com
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
10 from functest.core import testcase
11 from functest.opnfv_tests.openstack.tempest import conf_utils
12 from functest.utils import openstack_utils
13 from functest.utils.constants import CONST
14 import functest.utils.functest_logger as ft_logger
16 """ logging configuration """
17 logger = ft_logger.Logger("refstack_defcore").getLogger()
20 class TempestConf(object):
22 self.VERIFIER_ID = conf_utils.get_verifier_id()
23 self.VERIFIER_REPO_DIR = conf_utils.get_verifier_repo_dir(
25 self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id()
26 self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir(
27 self.VERIFIER_ID, self.DEPLOYMENT_ID)
29 def generate_tempestconf(self):
31 openstack_utils.source_credentials(CONST.openstack_creds)
32 img_flavor_dict = conf_utils.create_tempest_resources(
33 use_custom_images=True, use_custom_flavors=True)
34 conf_utils.configure_tempest_defcore(
35 self.DEPLOYMENT_DIR, img_flavor_dict)
37 logger.error("defcore prepare env error with: %s", e)
41 self.generate_tempestconf()
42 res = testcase.TestCase.EX_OK
43 except Exception as e:
44 logger.error('Error with run: %s', e)
45 res = testcase.TestCase.EX_RUN_ERROR
49 if __name__ == '__main__':
50 tempestconf = TempestConf()
51 result = tempestconf.main()
52 if result != testcase.TestCase.EX_OK: