9 cmd_opt="prepare_env start && run_tests -r -t all"
10 [[ $BUILD_TAG =~ "suite" ]] && cmd_opt="prepare_env start && run_tests -t all"
11 ret_val_file="${HOME}/opnfv/functest/results/${BRANCH##*/}/return_value"
12 echo 0 > ${ret_val_file}
14 for tier in ${tiers[@]}; do
15 FUNCTEST_IMAGE=opnfv/functest-${tier}:${DOCKER_TAG}
16 echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE} ..."
17 docker pull ${FUNCTEST_IMAGE}>/dev/null
18 cmd="docker run --privileged=true ${envs} ${volumes} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
19 echo "Running Functest tier '${tier}'. CMD: ${cmd}"
22 if [ ${ret_value} != 0 ]; then
23 echo ${ret_value} > ${ret_val_file}
30 cmd_opt="prepare_env start && run_tests -r -t ${test_name}"
31 [[ $BUILD_TAG =~ "suite" ]] && cmd_opt="prepare_env start && run_tests -t ${test_name}"
32 ret_val_file="${HOME}/opnfv/functest/results/${BRANCH##*/}/return_value"
33 echo 0 > ${ret_val_file}
34 # Determine which Functest image should be used for the test case
36 connection_check|api_check|snaps_health_check)
37 FUNCTEST_IMAGE=opnfv/functest-healthcheck:${DOCKER_TAG} ;;
38 vping_ssh|vping_userdata|tempest_smoke_serial|rally_sanity|refstack_defcore|odl|odl_netvirt|fds|snaps_smoke)
39 FUNCTEST_IMAGE=opnfv/functest-smoke:${DOCKER_TAG} ;;
40 tempest_full_parallel|tempest_custom|rally_full)
41 FUNCTEST_IMAGE=opnfv/functest-components:${DOCKER_TAG} ;;
42 cloudify_ims|orchestra_openims|orchestra_clearwaterims|vyos_vrouter)
43 FUNCTEST_IMAGE=opnfv/functest-vnf:${DOCKER_TAG} ;;
44 promise|doctor-notification|bgpvpn|functest-odl-sfc|domino-multinode|barometercollectd)
45 FUNCTEST_IMAGE=opnfv/functest-features:${DOCKER_TAG} ;;
47 FUNCTEST_IMAGE=opnfv/functest-parser:${DOCKER_TAG} ;;
49 echo "Unkown test case $test_name"
53 echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE} ..."
54 docker pull ${FUNCTEST_IMAGE}>/dev/null
55 cmd="docker run --privileged=true ${envs} ${volumes} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
56 echo "Running Functest test case '${test_name}'. CMD: ${cmd}"
59 if [ ${ret_value} != 0 ]; then
60 echo ${ret_value} > ${ret_val_file}
65 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
66 FUNCTEST_DIR=/home/opnfv/functest
68 [[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt
70 DOCKER_TAG=${DOCKER_TAG:-latest}
72 # Prepare OpenStack credentials volume
73 rc_file=${HOME}/opnfv-openrc.sh
75 if [[ ${INSTALLER_TYPE} == 'joid' ]]; then
76 rc_file=$LAB_CONFIG/admin-openrc
77 elif [[ ${INSTALLER_TYPE} == 'compass' ]]; then
78 cacert_file_vol="-v ${HOME}/os_cacert:${FUNCTEST_DIR}/conf/os_cacert"
79 echo "export OS_CACERT=${FUNCTEST_DIR}/conf/os_cacert" >> ${HOME}/opnfv-openrc.sh
80 elif [[ ${INSTALLER_TYPE} == 'fuel' && ${DEPLOY_TYPE} == 'baremetal' ]]; then
81 cacert_file_vol="-v ${HOME}/os_cacert:/etc/ssl/certs/mcp_os_cacert"
83 rc_file_vol="-v ${rc_file}:${FUNCTEST_DIR}/conf/openstack.creds"
86 # Set iptables rule to allow forwarding return traffic for container
87 if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then
88 sudo iptables -I FORWARD -j RETURN
91 echo "Functest: Start Docker and prepare environment"
93 echo "Functest: Download images that will be used by test cases"
94 images_dir="${HOME}/opnfv/functest/images"
95 download_script=${WORKSPACE}/functest/ci/download_images.sh
96 if [[ ! -f ${download_script} ]]; then
97 # to support Danube as well
98 wget https://git.opnfv.org/functest/plain/functest/ci/download_images.sh -O ${download_script} 2> ${redirect}
100 chmod +x ${download_script}
101 ${download_script} ${images_dir} ${DEPLOY_SCENARIO} ${HOST_ARCH} 2> ${redirect}
103 images_vol="-v ${images_dir}:${FUNCTEST_DIR}/images"
105 dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}"
106 mkdir -p ${dir_result}
107 sudo rm -rf ${dir_result}/*
108 results_vol="-v ${dir_result}:${FUNCTEST_DIR}/results"
110 test -f ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG} && custom_params=$(cat ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG})
112 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
113 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
114 -e BUILD_TAG=${BUILD_TAG} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
116 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
119 if [ "${INSTALLER_TYPE}" == 'fuel' ]; then
120 COMPUTE_ARCH=$(ssh -l ubuntu ${INSTALLER_IP} -i ${SSH_KEY} ${ssh_options} \
121 "sudo salt 'cmp*' grains.get cpuarch --out yaml | awk '{print \$2; exit}'")
122 envs="${envs} -e POD_ARCH=${COMPUTE_ARCH}"
125 volumes="${images_vol} ${results_vol} ${sshkey_vol} ${rc_file_vol} ${cacert_file_vol}"
130 if [[ ${DEPLOY_SCENARIO} =~ ^os-.* ]]; then
131 if [ ${FUNCTEST_MODE} == 'testcase' ]; then
132 echo "FUNCTEST_MODE=testcase, FUNCTEST_SUITE_NAME=${FUNCTEST_SUITE_NAME}"
133 run_test ${FUNCTEST_SUITE_NAME}
134 elif [ ${FUNCTEST_MODE} == 'tier' ]; then
135 echo "FUNCTEST_MODE=tier, FUNCTEST_TIER=${FUNCTEST_TIER}"
136 tiers=(${FUNCTEST_TIER})
139 if [ ${DEPLOY_TYPE} == 'baremetal' ]; then
140 tiers=(healthcheck smoke features vnf parser)
142 tiers=(healthcheck smoke features)
147 echo "k8 deployment has not been supported by functest yet"