aboutsummaryrefslogtreecommitdiffstats
path: root/functest/utils
diff options
context:
space:
mode:
Diffstat (limited to 'functest/utils')
-rw-r--r--functest/utils/config.py15
-rw-r--r--functest/utils/env.py19
-rw-r--r--functest/utils/functest_constants.py21
-rw-r--r--functest/utils/functest_utils.py20
-rwxr-xr-xfunctest/utils/openstack_clean.py8
-rwxr-xr-xfunctest/utils/openstack_snapshot.py7
6 files changed, 48 insertions, 42 deletions
diff --git a/functest/utils/config.py b/functest/utils/config.py
index 4cee6349..84166c1d 100644
--- a/functest/utils/config.py
+++ b/functest/utils/config.py
@@ -11,20 +11,25 @@ class Config(object):
try:
with open(self.config_functest) as f:
self.functest_yaml = yaml.safe_load(f)
- self.parse(None, self.functest_yaml)
+ self._parse(None, self.functest_yaml)
except:
raise Exception('Parse {} failed'.format(self.config_functest))
+ self._set_others()
- def parse(self, attr_now, left_parametes):
+ def _parse(self, attr_now, left_parametes):
for param_n, param_v in left_parametes.iteritems():
- attr_further = self.get_attr_further(attr_now, param_n)
+ attr_further = self._get_attr_further(attr_now, param_n)
if not isinstance(param_v, dict):
self.__setattr__(attr_further, param_v)
else:
- self.parse(attr_further, param_v)
+ self._parse(attr_further, param_v)
- def get_attr_further(self, attr_now, next):
+ def _get_attr_further(self, attr_now, next):
return attr_now if next == 'general' else (
'{}_{}'.format(attr_now, next) if attr_now else next)
+ def _set_others(self):
+ self.env_active = os.path.join(self.dir_functest_conf, "env_active")
+
+
CONF = Config()
diff --git a/functest/utils/env.py b/functest/utils/env.py
index 86b2be3d..fa5245fb 100644
--- a/functest/utils/env.py
+++ b/functest/utils/env.py
@@ -1,4 +1,5 @@
import os
+import re
default_envs = {
'NODE_NAME': 'unknown_pod',
@@ -7,7 +8,9 @@ default_envs = {
'DEPLOY_TYPE': 'virt',
'INSTALLER_TYPE': None,
'INSTALLER_IP': None,
- 'BUILD_TAG': None
+ 'BUILD_TAG': None,
+ 'OS_ENDPOINT_TYPE': None,
+ 'OS_AUTH_URL': None
}
@@ -19,6 +22,20 @@ class Environment(object):
for k, v in default_envs.iteritems():
if k not in os.environ:
self.__setattr__(k, v)
+ self._set_ci_run()
+ self._set_ci_loop()
+
+ def _set_ci_run(self):
+ if self.BUILD_TAG:
+ self.IS_CI_RUN = True
+ else:
+ self.IS_CI_RUN = False
+
+ def _set_ci_loop(self):
+ if self.BUILD_TAG and re.search("daily", self.BUILD_TAG):
+ self.CI_LOOP = "daily"
+ else:
+ self.CI_LOOP = "weekly"
ENV = Environment()
diff --git a/functest/utils/functest_constants.py b/functest/utils/functest_constants.py
index a39d33ac..dd2caf05 100644
--- a/functest/utils/functest_constants.py
+++ b/functest/utils/functest_constants.py
@@ -7,8 +7,9 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
import os
-import functest.utils.functest_utils as ft_utils
+
import functest.utils.functest_logger as ft_logger
+import functest.utils.functest_utils as ft_utils
logger = ft_logger.Logger("functest_constants").getLogger()
@@ -61,7 +62,7 @@ def get_value(functest_config_key, env_variable):
HOME = get_value('general.dir.dir_home', 'HOME')
-REPOS_DIR = get_value('general.dir.dir_repos', 'REPOS_DIR')
+REPOS_DIR = get_value('general.dir.repos', 'REPOS_DIR')
FUNCTEST_BASE_DIR = get_value('general.dir.functest',
'FUNCTEST_BASE_DIR')
FUNCTEST_REPO_DIR = get_value('general.dir.repo_functest',
@@ -78,7 +79,7 @@ FUNCTEST_TESTCASES_YAML = get_value('general.functest.testcases_yaml',
'FUNCTEST_TESTCASES_YAML')
RALLY_DEPLOYMENT_NAME = get_value('rally.deployment_name',
'RALLY_DEPLOYMENT_NAME')
-TEMPEST_REPO_DIR = get_value('general.dir.dir_repo_tempest',
+TEMPEST_REPO_DIR = get_value('general.dir.repo_tempest',
'TEMPEST_REPO_DIR')
ENV_FILE = os.path.join(FUNCTEST_CONF_DIR, "env_active")
@@ -87,11 +88,11 @@ OPENSTACK_CREDS = get_value('general.openstack.creds', 'creds')
OPENSTACK_SNAPSHOT_FILE = get_value('general.openstack.snapshot_file',
'OPENSTACK_SNAPSHOT_FILE')
-DOMINO_REPO_DIR = get_value('general.dir.dir_repo_domino',
+DOMINO_REPO_DIR = get_value('general.dir.repo_domino',
'DOMINO_REPO_DIR')
-SDNVPN_REPO_DIR = get_value('general.dir.dir_repo_sdnvpn',
+SDNVPN_REPO_DIR = get_value('general.dir.repo_sdnvpn',
'SDNVPN_REPO_DIR')
-SFC_REPO_DIR = get_value('general.dir.dir_repo_sfc',
+SFC_REPO_DIR = get_value('general.dir.repo_sfc',
'SFC_REPO_DIR')
ONOS_SFC_IMAGE_NAME = get_value('onos_sfc.image_name',
@@ -111,7 +112,7 @@ RALLY_PRIVATE_SUBNET_NAME = get_value('rally.subnet_name',
RALLY_PRIVATE_SUBNET_CIDR = get_value('rally.subnet_cidr',
'RALLY_PRIVATE_SUBNET_CIDR')
RALLY_ROUTER_NAME = get_value('rally.router_name', 'RALLY_ROUTER_NAME')
-RALLY_INSTALLATION_DIR = get_value('general.dir.dir_rally_inst',
+RALLY_INSTALLATION_DIR = get_value('general.dir.rally_inst',
'RALLY_INSTALLATION_DIR')
GLANCE_IMAGE_NAME = get_value('general.openstack.image_name',
'GLANCE_IMAGE_NAME')
@@ -149,7 +150,7 @@ TEMPEST_USE_CUSTOM_IMAGES = get_value('tempest.use_custom_images',
'TEMPEST_USE_CUSTOM_IMAGES')
TEMPEST_USE_CUSTOM_FLAVORS = get_value('tempest.use_custom_flavors',
'TEMPEST_USE_CUSTOM_FLAVORS')
-TEMPEST_TEST_LIST_DIR = get_value('general.dir.dir_tempest_cases',
+TEMPEST_TEST_LIST_DIR = get_value('general.dir.tempest_cases',
'TEMPEST_TEST_LIST_DIR')
NAME_VM_1 = get_value('vping.vm_name_1', 'NAME_VM_1')
NAME_VM_2 = get_value('vping.vm_name_2', 'NAME_VM_2')
@@ -219,7 +220,7 @@ PROMISE_ROUTER_NAME = get_value('promise.router_name',
'PROMISE_ROUTER_NAME')
DOCTOR_REPO_DIR = get_value('general.dir.dir_repo_doctor',
'DOCTOR_REPO_DIR')
-COPPER_REPO_DIR = get_value('general.dir.dir_repo_copper',
+COPPER_REPO_DIR = get_value('general.dir.repo_copper',
'COPPER_REPO_DIR')
EXAMPLE_INSTANCE_NAME = get_value('example.example_vm_name',
'EXAMPLE_INSTANCE_NAME')
@@ -260,5 +261,5 @@ CW_DEPLOYMENT_NAME = get_value('vIMS.clearwater.deployment-name',
CW_INPUTS = get_value('vIMS.clearwater.inputs', 'CW_INPUTS')
CW_REQUIERMENTS = get_value('vIMS.clearwater.requierments',
'CW_REQUIERMENTS')
-PARSER_REPO_DIR = get_value('general.dir.dir_repo_parser',
+PARSER_REPO_DIR = get_value('general.dir.repo_parser',
'PARSER_REPO_DIR')
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index e4845c62..3145f573 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -321,26 +321,6 @@ def execute_command(cmd, info=False, error_msg="",
return returncode
-def get_deployment_dir():
- """
- Returns current Rally deployment directory
- """
- deployment_name = get_functest_config('rally.deployment_name')
- rally_dir = get_functest_config('general.dir.dir_rally_inst')
- cmd = ("rally deployment list | awk '/" + deployment_name +
- "/ {print $2}'")
- p = subprocess.Popen(cmd, shell=True,
- stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT)
- deployment_uuid = p.stdout.readline().rstrip()
- if deployment_uuid == "":
- logger.error("Rally deployment not found.")
- exit(-1)
- deployment_dir = (rally_dir + "/tempest/for-deployment-" +
- deployment_uuid)
- return deployment_dir
-
-
def get_dict_by_test(testname):
with open(get_testcases_file_dir()) as f:
testcases_yaml = yaml.safe_load(f)
diff --git a/functest/utils/openstack_clean.py b/functest/utils/openstack_clean.py
index c08568bd..b1ad9664 100755
--- a/functest/utils/openstack_clean.py
+++ b/functest/utils/openstack_clean.py
@@ -23,14 +23,16 @@
#
import time
+
+import yaml
+
import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
-import yaml
-import functest.utils.functest_constants as ft_constants
+from functest.utils.constants import CONST
logger = ft_logger.Logger("openstack_clean").getLogger()
-OS_SNAPSHOT_FILE = ft_constants.OPENSTACK_SNAPSHOT_FILE
+OS_SNAPSHOT_FILE = CONST.openstack_snapshot_file
def separator():
diff --git a/functest/utils/openstack_snapshot.py b/functest/utils/openstack_snapshot.py
index 5b50ffa5..c59492cf 100755
--- a/functest/utils/openstack_snapshot.py
+++ b/functest/utils/openstack_snapshot.py
@@ -20,15 +20,16 @@
# http://www.apache.org/licenses/LICENSE-2.0
#
+import yaml
+
import functest.utils.functest_logger as ft_logger
import functest.utils.openstack_utils as os_utils
-import yaml
-import functest.utils.functest_constants as ft_constants
+from functest.utils.constants import CONST
logger = ft_logger.Logger("openstack_snapshot").getLogger()
-OS_SNAPSHOT_FILE = ft_constants.OPENSTACK_SNAPSHOT_FILE
+OS_SNAPSHOT_FILE = CONST.openstack_snapshot_file
def separator():