summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/Dockerfile2
-rw-r--r--dovetail/conf/cmd_config.yml7
-rw-r--r--dovetail/conf/dovetail_config.yml12
-rw-r--r--dovetail/conf/yardstick_config.yml2
-rw-r--r--dovetail/container.py33
-rwxr-xr-xdovetail/run.py24
-rw-r--r--dovetail/test_runner.py2
7 files changed, 51 insertions, 31 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 499624f8..0401af71 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -29,8 +29,6 @@ RUN \
&& \
git clone https://git.opnfv.org/dovetail ${REPOS_DIR} \
&& \
- mkdir -p ${REPOS_DIR}/results \
-&& \
pip install -U pip \
&& \
pip install -r ${REPOS_DIR}/requirements.txt \
diff --git a/dovetail/conf/cmd_config.yml b/dovetail/conf/cmd_config.yml
index da8c4732..aa27f293 100644
--- a/dovetail/conf/cmd_config.yml
+++ b/dovetail/conf/cmd_config.yml
@@ -29,13 +29,6 @@ cli:
path:
- 'functest/docker_tag'
help: 'Overwrite tag for functest docker container (e.g. stable or latest)'
- openrc:
- flags:
- - '--openrc'
- - '-o'
- path:
- - 'openrc'
- help: 'Openstack Credential file location'
control:
testsuite:
flags:
diff --git a/dovetail/conf/dovetail_config.yml b/dovetail/conf/dovetail_config.yml
index 934ff6a6..36b31401 100644
--- a/dovetail/conf/dovetail_config.yml
+++ b/dovetail/conf/dovetail_config.yml
@@ -5,7 +5,17 @@ report_dest: 'file'
result_file: 'results.json'
# OPENSTACK Credential file
-openrc: '/home/opnfv/dovetail/openrc.sh'
+env_file: 'env_config.sh'
+
+# POD info file
+pod_file: 'pod.yaml'
+
+# JUMPSERVER private key used in pod_file to login hosts
+# If use password to login hosts, there's no need to provide the private key
+pri_key: 'id_rsa'
+
+# SDNVPN offline image
+sdnvpn_image: 'ubuntu-16.04-server-cloudimg-amd64-disk1.img'
COMPLIANCE_PATH: compliance/
TESTCASE_PATH: testcase/
diff --git a/dovetail/conf/yardstick_config.yml b/dovetail/conf/yardstick_config.yml
index ae59a9ec..bc207d7f 100644
--- a/dovetail/conf/yardstick_config.yml
+++ b/dovetail/conf/yardstick_config.yml
@@ -16,7 +16,7 @@ yardstick:
- "cd /home/opnfv/repos/yardstick && source tests/ci/prepare_env.sh &&
yardstick -d task start tests/opnfv/test_cases/{{validate_testcase}}.yaml
--output-file /home/opnfv/yardstick/results/{{validate_testcase}}.out
- --task-args '{'file': '/home/opnfv/userconfig/pod.yaml'}'"
+ --task-args '{'file': '/home/opnfv/userconfig/pre_config/pod.yaml'}'"
post_condition:
- ''
result:
diff --git a/dovetail/container.py b/dovetail/container.py
index d91c184b..c0a925e9 100644
--- a/dovetail/container.py
+++ b/dovetail/container.py
@@ -49,7 +49,8 @@ class Container(object):
@classmethod
def openrc_volume(cls, type):
dovetail_config = dt_cfg.dovetail_config
- dovetail_config['openrc'] = os.path.abspath(dovetail_config['openrc'])
+ dovetail_config['openrc'] = os.path.join(dovetail_config['config_dir'],
+ dovetail_config['env_file'])
if os.path.isfile(dovetail_config['openrc']):
openrc = ' -v %s:%s ' % (dovetail_config['openrc'],
dovetail_config[type]['openrc'])
@@ -106,9 +107,22 @@ class Container(object):
log_vol = '-v %s:%s ' % (dovetail_config['result_dir'],
dovetail_config["yardstick"]['result']['log'])
- key_path = os.path.join(dovetail_config['userconfig_dir'], 'id_rsa')
- key_con_path = dovetail_config["yardstick"]['result']['key_path']
- key_vol = '-v %s:%s ' % (key_path, key_con_path)
+
+ # for yardstick, support pod.yaml configuration
+ pod_file = os.path.join(dovetail_config['config_dir'],
+ dovetail_config['pod_file'])
+ if not os.path.isfile(pod_file):
+ cls.logger.error("File %s doesn't exist.", pod_file)
+ return None
+ key_file = os.path.join(dovetail_config['config_dir'],
+ dovetail_config['pri_key'])
+ key_container_path = dovetail_config["yardstick"]['result']['key_path']
+ if not os.path.isfile(key_file):
+ cls.logger.debug("Key file %s is not found, maybe can use passwd "
+ "method in %s to do HA test.", key_file, pod_file)
+ key_vol = ''
+ else:
+ key_vol = '-v %s:%s ' % (key_file, key_container_path)
return "%s %s %s" % (envs, log_vol, key_vol)
@classmethod
@@ -137,17 +151,8 @@ class Container(object):
return None
# for refstack, support user self_defined configuration
- # for yardstick, support pod.yaml configuration
- pod_file = os.path.join(dovetail_config['userconfig_dir'], 'pod.yaml')
- if type.lower() == "yardstick" and not os.path.exists(pod_file):
- cls.logger.error("File %s doesn't exist.", pod_file)
- return None
- key_file = os.path.join(dovetail_config['userconfig_dir'], 'id_rsa')
- if type.lower() == "yardstick" and not os.path.exists(key_file):
- cls.logger.debug("File %s doesn't exist.", key_file)
- cls.logger.debug("Can just use password in %s.", pod_file)
config_volume = \
- ' -v %s:%s ' % (dovetail_config['userconfig_dir'],
+ ' -v %s:%s ' % (os.getenv("DOVETAIL_HOME"),
dovetail_config[type]['config']['dir'])
hosts_config = ""
diff --git a/dovetail/run.py b/dovetail/run.py
index 5b4dca8e..521379d7 100755
--- a/dovetail/run.py
+++ b/dovetail/run.py
@@ -181,23 +181,36 @@ def clean_results_dir():
def get_result_path():
- dovetail_home = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ try:
+ dovetail_home = os.environ["DOVETAIL_HOME"]
+ except Exception:
+ print("ERROR: mandatory env variable 'DOVETAIL_HOME' is not found, "
+ "please set in env_config.sh and source this file before "
+ "running.")
+ return None
result_path = os.path.join(dovetail_home, 'results')
dt_cfg.dovetail_config['result_dir'] = result_path
+ pre_config_path = os.path.join(dovetail_home, 'pre_config')
+ dt_cfg.dovetail_config['config_dir'] = pre_config_path
+ return dovetail_home
-def get_userconfig_path():
+def copy_userconfig_files(logger):
dovetail_home = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
userconfig_path = os.path.join(dovetail_home, 'userconfig')
- dt_cfg.dovetail_config['userconfig_dir'] = userconfig_path
+ pre_config_path = dt_cfg.dovetail_config['config_dir']
+ if not os.path.isdir(pre_config_path):
+ os.makedirs(pre_config_path)
+ cmd = 'sudo cp -r %s/* %s' % (userconfig_path, pre_config_path)
+ dt_utils.exec_cmd(cmd, logger, exit_on_error=False)
def main(*args, **kwargs):
"""Dovetail compliance test entry!"""
build_tag = "daily-master-%s" % str(uuid.uuid4())
dt_cfg.dovetail_config['build_tag'] = build_tag
- get_result_path()
- get_userconfig_path()
+ if not get_result_path():
+ return
clean_results_dir()
if kwargs['debug']:
os.environ['DEBUG'] = 'true'
@@ -207,6 +220,7 @@ def main(*args, **kwargs):
logger.info('Dovetail compliance: %s!', (kwargs['testsuite']))
logger.info('================================================')
logger.info('Build tag: %s', dt_cfg.dovetail_config['build_tag'])
+ copy_userconfig_files(logger)
dt_utils.check_docker_version(logger)
validate_input(kwargs, dt_cfg.dovetail_config['validate_input'], logger)
configs = filter_config(kwargs, logger)
diff --git a/dovetail/test_runner.py b/dovetail/test_runner.py
index 0482c2ca..cbc7e2d3 100644
--- a/dovetail/test_runner.py
+++ b/dovetail/test_runner.py
@@ -40,7 +40,7 @@ class DockerRunner(object):
src_path = os.path.join(file_path, src_file)
if exist_file:
file_path = dt_cfg.dovetail_config[self.type]['config']['dir']
- src_path = os.path.join(file_path, exist_file)
+ src_path = os.path.join(file_path, 'pre_config', exist_file)
Container.pre_copy(container_id, src_path, dest_path)
return dest_path