summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerenaFeng <feng.xiaowei@zte.com.cn>2016-12-22 17:51:15 +0800
committerSerenaFeng <feng.xiaowei@zte.com.cn>2016-12-26 08:56:05 +0800
commite4fea1c639b3f04998595bac43c7a45dea5c4c73 (patch)
treef0b1b58a440ec3477f3694b0a16639b6fd14038c
parent016c5aee944227e07f244839d3d518a3b33a82c8 (diff)
refactor rally using new constants provider
JIRA: FUNCTEST-673 Change-Id: I4b542a7693aaf7dd037e0e55dee3f22dda8df27a Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
-rwxr-xr-xfunctest/ci/config_functest.yaml2
-rwxr-xr-xfunctest/opnfv_tests/openstack/rally/run_rally-cert.py33
-rw-r--r--functest/utils/functest_constants.py2
-rw-r--r--functest/utils/functest_utils.py5
4 files changed, 20 insertions, 22 deletions
diff --git a/functest/ci/config_functest.yaml b/functest/ci/config_functest.yaml
index a63530df1..0eaf51417 100755
--- a/functest/ci/config_functest.yaml
+++ b/functest/ci/config_functest.yaml
@@ -3,7 +3,7 @@ general:
# Relative to the path where the repo is cloned:
vping: functest/opnfv_tests/openstack/vping
dir_odl: functest/opnfv_tests/sdn/odl
- dir_rally: functest/opnfv_tests/openstack/rally
+ rally: functest/opnfv_tests/openstack/rally
tempest_cases: functest/opnfv_tests/openstack/tempest/custom_tests
dir_vIMS: functest/opnfv_tests/vnf/ims
dir_onos: functest/opnfv_tests/sdn/onos/teston
diff --git a/functest/opnfv_tests/openstack/rally/run_rally-cert.py b/functest/opnfv_tests/openstack/rally/run_rally-cert.py
index 6d8f01602..ec22b52d8 100755
--- a/functest/opnfv_tests/openstack/rally/run_rally-cert.py
+++ b/functest/opnfv_tests/openstack/rally/run_rally-cert.py
@@ -15,20 +15,20 @@
#
""" tests configuration """
+import argparse
import json
import os
import re
import subprocess
import time
-import argparse
import iniparse
import yaml
+from functest.utils.constants import CONST
import functest.utils.functest_logger as ft_logger
import functest.utils.functest_utils as ft_utils
import functest.utils.openstack_utils as os_utils
-import functest.utils.functest_constants as ft_constants
tests = ['authenticate', 'glance', 'cinder', 'heat', 'keystone',
'neutron', 'nova', 'quotas', 'requests', 'vm', 'all']
@@ -71,8 +71,7 @@ else:
""" logging configuration """
logger = ft_logger.Logger("run_rally-cert").getLogger()
-RALLY_DIR = os.path.join(ft_constants.FUNCTEST_REPO_DIR,
- ft_constants.RALLY_RELATIVE_PATH)
+RALLY_DIR = os.path.join(CONST.dir_repo_functest, CONST.dir_rally)
RALLY_SCENARIO_DIR = os.path.join(RALLY_DIR, "scenario")
SANITY_MODE_DIR = os.path.join(RALLY_SCENARIO_DIR, "sanity")
FULL_MODE_DIR = os.path.join(RALLY_SCENARIO_DIR, "full")
@@ -87,19 +86,19 @@ TENANTS_AMOUNT = 3
ITERATIONS_AMOUNT = 10
CONCURRENCY = 4
-RESULTS_DIR = os.path.join(ft_constants.FUNCTEST_RESULTS_DIR, 'rally')
-TEMPEST_CONF_FILE = os.path.join(ft_constants.FUNCTEST_RESULTS_DIR,
+RESULTS_DIR = os.path.join(CONST.dir_results, 'rally')
+TEMPEST_CONF_FILE = os.path.join(CONST.dir_results,
'tempest/tempest.conf')
-RALLY_PRIVATE_NET_NAME = ft_constants.RALLY_PRIVATE_NET_NAME
-RALLY_PRIVATE_SUBNET_NAME = ft_constants.RALLY_PRIVATE_SUBNET_NAME
-RALLY_PRIVATE_SUBNET_CIDR = ft_constants.RALLY_PRIVATE_SUBNET_CIDR
-RALLY_ROUTER_NAME = ft_constants.RALLY_ROUTER_NAME
+RALLY_PRIVATE_NET_NAME = CONST.rally_network_name
+RALLY_PRIVATE_SUBNET_NAME = CONST.rally_subnet_name
+RALLY_PRIVATE_SUBNET_CIDR = CONST.rally_subnet_cidr
+RALLY_ROUTER_NAME = CONST.rally_router_name
-GLANCE_IMAGE_NAME = ft_constants.GLANCE_IMAGE_NAME
-GLANCE_IMAGE_FILENAME = ft_constants.GLANCE_IMAGE_FILENAME
-GLANCE_IMAGE_FORMAT = ft_constants.GLANCE_IMAGE_FORMAT
-GLANCE_IMAGE_PATH = os.path.join(ft_constants.FUNCTEST_DATA_DIR,
+GLANCE_IMAGE_NAME = CONST.openstack_image_name
+GLANCE_IMAGE_FILENAME = CONST.openstack_image_file_name
+GLANCE_IMAGE_FORMAT = CONST.openstack_image_disk_format
+GLANCE_IMAGE_PATH = os.path.join(CONST.dir_functest_data,
GLANCE_IMAGE_FILENAME)
CINDER_VOLUME_TYPE_NAME = "volume_test"
@@ -181,7 +180,7 @@ def build_task_args(test_file_name):
net_id = GlobalVariables.network_dict['net_id']
task_args['netid'] = str(net_id)
- auth_url = ft_constants.OS_AUTH_URL
+ auth_url = CONST.OS_AUTH_URL
if auth_url is not None:
task_args['request_url'] = auth_url.rsplit(":", 1)[0]
else:
@@ -271,8 +270,8 @@ def excl_scenario():
with open(BLACKLIST_FILE, 'r') as black_list_file:
black_list_yaml = yaml.safe_load(black_list_file)
- installer_type = ft_constants.CI_INSTALLER_TYPE
- deploy_scenario = ft_constants.CI_SCENARIO
+ installer_type = CONST.INSTALLER_TYPE
+ deploy_scenario = CONST.DEPLOY_SCENARIO
if (bool(installer_type) * bool(deploy_scenario)):
if 'scenario' in black_list_yaml.keys():
for item in black_list_yaml['scenario']:
diff --git a/functest/utils/functest_constants.py b/functest/utils/functest_constants.py
index dd2caf054..3cdcad67a 100644
--- a/functest/utils/functest_constants.py
+++ b/functest/utils/functest_constants.py
@@ -103,7 +103,7 @@ ONOS_SFC_RELATIVE_PATH = get_value('general.dir.dir_onos_sfc',
'ONOS_SFC_RELATIVE_PATH')
ONOS_SFC_IMAGE_BASE_URL = get_value('onos_sfc.image_base_url',
'ONOS_SFC_IMAGE_BASE_URL')
-RALLY_RELATIVE_PATH = get_value('general.dir.dir_rally',
+RALLY_RELATIVE_PATH = get_value('general.dir.rally',
'RALLY_RELATIVE_PATH')
RALLY_PRIVATE_NET_NAME = get_value('rally.network_name',
'RALLY_PRIVATE_NET_NAME')
diff --git a/functest/utils/functest_utils.py b/functest/utils/functest_utils.py
index 3145f573c..1879e6943 100644
--- a/functest/utils/functest_utils.py
+++ b/functest/utils/functest_utils.py
@@ -7,12 +7,14 @@
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
#
+import functools
import json
import os
import re
import shutil
import subprocess
import sys
+import time
import urllib2
from datetime import datetime as dt
@@ -21,9 +23,6 @@ import requests
import yaml
from git import Repo
-import time
-import functools
-
import functest.utils.functest_logger as ft_logger
logger = ft_logger.Logger("functest_utils").getLogger()