Merge "Use functest repo variable"
[functest.git] / functest / utils / functest_utils.py
index c149185..38a60d4 100644 (file)
 
 from __future__ import print_function
 import logging
-import os
 import re
 import shutil
 import subprocess
 import sys
 
-import pkg_resources
 import dns.resolver
 from six.moves import urllib
 import yaml
 
 from functest.utils import constants
+from functest.utils import env
 
 LOGGER = logging.getLogger(__name__)
 
@@ -91,8 +90,8 @@ def get_ci_envvars():
     Get the CI env variables
     """
     ci_env_var = {
-        "installer": os.environ.get('INSTALLER_TYPE'),
-        "scenario": os.environ.get('DEPLOY_SCENARIO')}
+        "installer": env.get('INSTALLER_TYPE'),
+        "scenario": env.get('DEPLOY_SCENARIO')}
     return ci_env_var
 
 
@@ -135,28 +134,6 @@ def execute_command(cmd, info=False, error_msg="",
     return returncode
 
 
-def get_dict_by_test(testname):
-    # pylint: disable=bad-continuation
-    with open(pkg_resources.resource_filename(
-            'functest', 'ci/testcases.yaml')) as tyaml:
-        testcases_yaml = yaml.safe_load(tyaml)
-
-    for dic_tier in testcases_yaml.get("tiers"):
-        for dic_testcase in dic_tier['testcases']:
-            if dic_testcase['case_name'] == testname:
-                return dic_testcase
-
-    LOGGER.error('Project %s is not defined in testcases.yaml', testname)
-    return None
-
-
-def get_criteria_by_test(testname):
-    tdict = get_dict_by_test(testname)
-    if tdict:
-        return tdict['criteria']
-    return None
-
-
 # ----------------------------------------------------------
 #
 #               YAML UTILS
@@ -180,14 +157,13 @@ def get_parameter_from_yaml(parameter, yfile):
 
 
 def get_functest_config(parameter):
-    yaml_ = constants.CONST.__getattribute__('CONFIG_FUNCTEST_YAML')
+    yaml_ = constants.CONFIG_FUNCTEST_YAML
     return get_parameter_from_yaml(parameter, yaml_)
 
 
 def get_functest_yaml():
     # pylint: disable=bad-continuation
-    with open(constants.CONST.__getattribute__(
-            'CONFIG_FUNCTEST_YAML')) as yaml_fd:
+    with open(constants.CONFIG_FUNCTEST_YAML) as yaml_fd:
         functest_yaml = yaml.safe_load(yaml_fd)
     return functest_yaml