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
11 from functest.opnfv_tests.openstack.tempest import conf_utils
12 from functest.utils import openstack_utils
13 from functest.utils.constants import CONST
15 """ logging configuration """
16 logger = logging.getLogger(__name__)
19 class TempestConf(object):
21 self.VERIFIER_ID = conf_utils.get_verifier_id()
22 self.VERIFIER_REPO_DIR = conf_utils.get_verifier_repo_dir(
24 self.DEPLOYMENT_ID = conf_utils.get_verifier_deployment_id()
25 self.DEPLOYMENT_DIR = conf_utils.get_verifier_deployment_dir(
26 self.VERIFIER_ID, self.DEPLOYMENT_ID)
27 self.confpath = os.path.join(
28 CONST.__getattribute__('dir_functest_test'),
29 CONST.__getattribute__('refstack_tempest_conf_path'))
31 def generate_tempestconf(self):
33 openstack_utils.source_credentials(
34 CONST.__getattribute__('openstack_creds'))
35 img_flavor_dict = conf_utils.create_tempest_resources(
36 use_custom_images=True, use_custom_flavors=True)
37 conf_utils.configure_tempest_defcore(
38 self.DEPLOYMENT_DIR, img_flavor_dict)
39 except Exception as e:
40 logger.error("error with generating refstack client "
41 "reference tempest conf file: %s", e)
45 self.generate_tempestconf()
46 logger.info("a reference tempest conf file generated "
47 "at %s", self.confpath)
48 except Exception as e:
49 logger.error('Error with run: %s', e)
52 if __name__ == '__main__':
54 tempestconf = TempestConf()