aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
diff options
context:
space:
mode:
authorMatthewLi <matthew.lijun@huawei.com>2017-03-25 02:44:00 -0400
committerMatthewLi <matthew.lijun@huawei.com>2017-03-28 05:28:36 -0400
commit678d5f956b1af373f61f97187ff3e66fdb315654 (patch)
tree503c211ad6b48d18f5d72f41d16997136e2aa89d /functest/opnfv_tests/openstack/refstack_client/tempest_conf.py
parenta14250045fe6fb99bd8a707c59016cba3df4a851 (diff)
refstack client: manually running improvement
JIRA: FUNCTEST-758 1.python tempest_conf.py can generate a reference tempest.conf under /hom/opnfv/.../refstack_client this is based on "rally verify configure-verifier" surely, user can define his/her own tempest.conf by not using this 2.python refstack_client.py -c <tempest_conf_path> --testlist <testlist_file_path> if not given, will use default path, if file not exists, will have error Change-Id: I1ceecbe8fe86fbe0d53b736a0f3b9a9ae01f262f Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/refstack_client/tempest_conf.py')
-rwxr-xr-xfunctest/opnfv_tests/openstack/refstack_client/tempest_conf.py53
1 files changed, 53 insertions, 0 deletions
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..66876bbf
--- /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.TestcaseBase.EX_OK
+ except Exception as e:
+ logger.error('Error with run: %s', e)
+ res = testcase.TestcaseBase.EX_RUN_ERROR
+
+ return res
+
+if __name__ == '__main__':
+ tempestconf = TempestConf()
+ result = tempestconf.main()
+ if result != testcase.TestcaseBase.EX_OK:
+ sys.exit(result)