git config --global http.sslVerify false \
&& \
git clone https://git.opnfv.org/dovetail ${REPOS_DIR} \
-&& \
- mkdir -p ${REPOS_DIR}/results \
&& \
pip install -U pip \
&& \
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:
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/
- "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:
@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'])
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
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 = ""
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'
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)
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