7 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
8 FUNCTEST_DIR=/home/opnfv/functest
10 # Prepare OpenStack credentials volume
11 if [[ ${INSTALLER_TYPE} == 'joid' ]]; then
12 rc_file=$LAB_CONFIG/admin-openrc
13 elif [[ ${INSTALLER_TYPE} == 'compass' && ${BRANCH} == 'master' ]]; then
14 cacert_file_vol="-v ${HOME}/os_cacert:${FUNCTEST_DIR}/conf/os_cacert"
15 echo "export OS_CACERT=${FUNCTEST_DIR}/conf/os_cacert" >> ${HOME}/opnfv-openrc.sh
16 rc_file=${HOME}/opnfv-openrc.sh
18 rc_file=${HOME}/opnfv-openrc.sh
20 rc_file_vol="-v ${rc_file}:${FUNCTEST_DIR}/conf/openstack.creds"
23 # Set iptables rule to allow forwarding return traffic for container
24 if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then
25 sudo iptables -I FORWARD -j RETURN
29 [[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt
32 echo "Functest: Start Docker and prepare environment"
34 echo "Functest: Download images that will be used by test cases"
35 images_dir="${HOME}/opnfv/functest/images"
36 download_script=${WORKSPACE}/functest/ci/download_images.sh
37 if [[ ! -f ${download_script} ]]; then
38 # to support Danube as well
39 wget https://git.opnfv.org/functest/plain/functest/ci/download_images.sh -O ${download_script} 2> ${redirect}
41 chmod +x ${download_script}
42 ${download_script} ${images_dir} ${DEPLOY_SCENARIO} ${HOST_ARCH} 2> ${redirect}
44 images_vol="-v ${images_dir}:${FUNCTEST_DIR}/images"
46 dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}"
47 mkdir -p ${dir_result}
48 sudo rm -rf ${dir_result}/*
49 results_vol="-v ${dir_result}:${FUNCTEST_DIR}/results"
51 test -f ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG} && custom_params=$(cat ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG})
53 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
54 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
55 -e BUILD_TAG=${BUILD_TAG} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
57 if [[ ${INSTALLER_TYPE} == 'compass' && ${DEPLOY_SCENARIO} == *'os-nosdn-openo-ha'* ]]; then
58 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
59 openo_msb_port=${openo_msb_port:-80}
60 openo_msb_endpoint="$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \
61 'mysql -ucompass -pcompass -Dcompass -e "select package_config from cluster;" \
62 | sed s/,/\\n/g | grep openo_ip | cut -d \" -f 4'):$openo_msb_port"
64 envs=${env}" -e OPENO_MSB_ENDPOINT=${openo_msb_endpoint}"
67 volumes="${images_vol} ${results_vol} ${sshkey_vol} ${rc_file_vol} ${cacert_file_vol}"
71 if [ ${FUNCTEST_SUITE_NAME} == 'healthcheck' ]; then
74 tiers=(healthcheck smoke features vnf)
77 cmd_opt='prepare_env start && run_tests -r -t all'
79 for tier in ${tiers[@]}; do
80 FUNCTEST_IMAGE=opnfv/functest-${tier}
81 echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE} ..."
82 docker pull ${FUNCTEST_IMAGE}>/dev/null
83 cmd="docker run ${envs} ${volumes} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
84 echo "Running Functest tier '${tier}'. CMD: ${cmd}"