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(CONST.dir_functest_test,
28 CONST.refstack_tempest_conf_path)
30 def generate_tempestconf(self):
32 openstack_utils.source_credentials(CONST.openstack_creds)
33 img_flavor_dict = conf_utils.create_tempest_resources(
34 use_custom_images=True, use_custom_flavors=True)
35 conf_utils.configure_tempest_defcore(
36 self.DEPLOYMENT_DIR, img_flavor_dict)
37 except Exception as e:
38 logger.error("error with generating refstack client "
39 "reference tempest conf file: %s", e)
43 self.generate_tempestconf()
44 logger.info("a reference tempest conf file generated "
45 "at %s", self.confpath)
46 except Exception as e:
47 logger.error('Error with run: %s', e)
50 if __name__ == '__main__':
52 tempestconf = TempestConf()