diff options
Diffstat (limited to 'testcases/functest_utils.py')
-rw-r--r-- | testcases/functest_utils.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/testcases/functest_utils.py b/testcases/functest_utils.py index e76ef991b..ed9e36c89 100644 --- a/testcases/functest_utils.py +++ b/testcases/functest_utils.py @@ -88,6 +88,12 @@ def get_instance_by_name(nova_client, instance_name): except: return None +def create_flavor(nova_client, flavor_name, ram, disk, vcpus): + try: + flavor = nova_client.flavors.create(flavor_name,ram,vcpus,disk) + except: + return None + return flavor.id def get_flavor_id(nova_client, flavor_name): flavors = nova_client.flavors.list(detailed=True) @@ -652,11 +658,25 @@ def get_installer_type(logger=None): except KeyError: if logger: logger.error("Impossible to retrieve the installer type") - installer = "Unkown" + installer = "Unknown_installer" return installer +def get_scenario(logger=None): + """ + Get scenario + """ + try: + scenario = os.environ['DEPLOY_SCENARIO'] + except KeyError: + if logger: + logger.error("Impossible to retrieve the scenario") + scenario = "Unknown_scenario" + + return scenario + + def get_pod_name(logger=None): """ Get PoD Name from env variable NODE_NAME @@ -671,12 +691,12 @@ def get_pod_name(logger=None): def push_results_to_db(db_url, case_name, logger, pod_name, - git_version, payload): + version, payload): url = db_url + "/results" installer = get_installer_type(logger) params = {"project_name": "functest", "case_name": case_name, "pod_name": pod_name, "installer": installer, - "version": git_version, "details": payload} + "version": version, "details": payload} headers = {'Content-Type': 'application/json'} try: |