8 cmd_opt='prepare_env start && run_tests -r -t all'
9 ret_val_file="${HOME}/opnfv/functest/results/${BRANCH##*/}/return_value"
10 echo 0 > ${ret_val_file}
12 for tier in ${tiers[@]}; do
13 FUNCTEST_IMAGE=opnfv/functest-${tier}
14 echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE} ..."
15 docker pull ${FUNCTEST_IMAGE}>/dev/null
16 cmd="docker run --privileged=true ${envs} ${volumes} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
17 echo "Running Functest tier '${tier}'. CMD: ${cmd}"
20 if [ ${ret_value} != 0 ]; then
21 echo ${ret_value} > ${ret_val_file}
28 cmd_opt='prepare_env start && run_tests -r -t $test_name'
29 ret_val_file="${HOME}/opnfv/functest/results/${BRANCH##*/}/return_value"
30 echo 0 > ${ret_val_file}
31 # Determine which Functest image should be used for the test case
33 connection_check|api_check|snaps_health_check)
34 FUNCTEST_IMAGE=opnfv/functest-healthcheck
35 vping_ssh|vping_userdata|tempest_smoke_serial|rally_sanity|refstack_defcore|odl|odl_netvirt|fds|snaps_smoke)
36 FUNCTEST_IMAGE=opnfv/functest-smoke
37 tempest_full_parallel|tempest_custom|rally_full)
38 FUNCTEST_IMAGE=opnfv/functest-components
39 cloudify_ims|orchestra_openims|orchestra_clearwaterims|vyos_vrouter)
40 FUNCTEST_IMAGE=opnfv/functest-vnf
41 promise|doctor-notification|bgpvpn|functest-odl-sfc|domino-multinode|barometercollectd)
42 FUNCTEST_IMAGE=opnfv/functest-features
44 FUNCTEST_IMAGE=opnfv/functest-parser
46 echo "Unkown test case $test_name"
49 echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE} ..."
50 docker pull ${FUNCTEST_IMAGE}>/dev/null
51 cmd="docker run --privileged=true ${envs} ${volumes} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
52 echo "Running Functest test case '${test_name}'. CMD: ${cmd}"
55 if [ ${ret_value} != 0 ]; then
56 echo ${ret_value} > ${ret_val_file}
61 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
62 FUNCTEST_DIR=/home/opnfv/functest
64 [[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt
67 # Prepare OpenStack credentials volume
68 rc_file=${HOME}/opnfv-openrc.sh
70 if [[ ${INSTALLER_TYPE} == 'joid' ]]; then
71 rc_file=$LAB_CONFIG/admin-openrc
72 elif [[ ${INSTALLER_TYPE} == 'compass' && ${BRANCH} == 'master' ]]; then
73 cacert_file_vol="-v ${HOME}/os_cacert:${FUNCTEST_DIR}/conf/os_cacert"
74 echo "export OS_CACERT=${FUNCTEST_DIR}/conf/os_cacert" >> ${HOME}/opnfv-openrc.sh
75 elif [[ ${INSTALLER_TYPE} == 'fuel' && ${DEPLOY_TYPE} == 'baremetal' ]]; then
76 cacert_file_vol="-v ${HOME}/os_cacert:/etc/ssl/certs/mcp_os_cacert"
78 rc_file_vol="-v ${rc_file}:${FUNCTEST_DIR}/conf/openstack.creds"
81 # Set iptables rule to allow forwarding return traffic for container
82 if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then
83 sudo iptables -I FORWARD -j RETURN
86 echo "Functest: Start Docker and prepare environment"
88 echo "Functest: Download images that will be used by test cases"
89 images_dir="${HOME}/opnfv/functest/images"
90 download_script=${WORKSPACE}/functest/ci/download_images.sh
91 if [[ ! -f ${download_script} ]]; then
92 # to support Danube as well
93 wget https://git.opnfv.org/functest/plain/functest/ci/download_images.sh -O ${download_script} 2> ${redirect}
95 chmod +x ${download_script}
96 ${download_script} ${images_dir} ${DEPLOY_SCENARIO} ${HOST_ARCH} 2> ${redirect}
98 images_vol="-v ${images_dir}:${FUNCTEST_DIR}/images"
100 dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}"
101 mkdir -p ${dir_result}
102 sudo rm -rf ${dir_result}/*
103 results_vol="-v ${dir_result}:${FUNCTEST_DIR}/results"
105 test -f ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG} && custom_params=$(cat ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG})
107 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
108 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
109 -e BUILD_TAG=${BUILD_TAG} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
111 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
113 if [[ ${INSTALLER_TYPE} == 'compass' && ${DEPLOY_SCENARIO} == *'os-nosdn-openo-ha'* ]]; then
114 openo_msb_port=${openo_msb_port:-80}
115 openo_msb_endpoint="$(sshpass -p'root' ssh 2>/dev/null $ssh_options root@${installer_ip} \
116 'mysql -ucompass -pcompass -Dcompass -e "select package_config from cluster;" \
117 | sed s/,/\\n/g | grep openo_ip | cut -d \" -f 4'):$openo_msb_port"
119 envs=${env}" -e OPENO_MSB_ENDPOINT=${openo_msb_endpoint}"
122 if [ "${INSTALLER_TYPE}" == 'fuel' ] && [ "$BRANCH" != 'stable/danube' ]; then
123 COMPUTE_ARCH=$(ssh -l ubuntu ${INSTALLER_IP} -i ${SSH_KEY} ${ssh_options} \
124 "sudo salt 'cmp*' grains.get cpuarch --out yaml | awk '{print \$2; exit}'")
125 envs="${envs} -e POD_ARCH=${COMPUTE_ARCH}"
128 volumes="${images_vol} ${results_vol} ${sshkey_vol} ${rc_file_vol} ${cacert_file_vol}"
133 if [ ${FUNCTEST_MODE} == 'testcase' ]; then
134 run_test ${FUNCTEST_SUITE_NAME}
135 elif [ ${FUNCTEST_MODE} == 'tier' ]; then
136 tiers= (${FUNCTEST_TIER})
139 if [ ${DEPLOY_TYPE} == 'baremetal' ]; then
140 tiers=(healthcheck smoke features vnf parser)
142 tiers=(healthcheck smoke features)