7 check_os_deployment() {
8 FUNCTEST_IMAGE=opnfv/functest-healthcheck:${DOCKER_TAG}
9 cmd="docker run --rm --privileged=true ${volumes} ${FUNCTEST_IMAGE} check_deployment"
12 if [ ${ret_value} != 0 ]; then
13 echo "ERROR: Problem while checking OpenStack deployment."
16 echo "OpenStack deployment OK."
24 if [[ ${BRANCH##*/} == "master" ]]; then
25 cmd_opt="run_tests -r -t all"
26 [[ $BUILD_TAG =~ "suite" ]] && cmd_opt="run_tests -t all"
28 cmd_opt="prepare_env start && run_tests -r -t all"
29 [[ $BUILD_TAG =~ "suite" ]] && cmd_opt="prepare_env start && run_tests -t all"
31 ret_val_file="${HOME}/opnfv/functest/results/${BRANCH##*/}/return_value"
32 echo 0 > ${ret_val_file}
34 for tier in ${tiers[@]}; do
35 FUNCTEST_IMAGE=opnfv/functest-${tier}:${DOCKER_TAG}
36 echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE} ..."
37 docker pull ${FUNCTEST_IMAGE}>/dev/null
38 cmd="docker run --rm --privileged=true ${envs} ${volumes} ${TESTCASE_OPTIONS} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
39 echo "Running Functest tier '${tier}'. CMD: ${cmd}"
42 if [ ${ret_value} != 0 ]; then
43 echo ${ret_value} > ${ret_val_file}
44 if [ ${tier} == 'healthcheck' ]; then
45 echo "Healthcheck tier failed. Exiting Functest..."
54 if [[ ${BRANCH##*/} == "master" ]]; then
55 cmd_opt="run_tests -t ${test_name}"
57 cmd_opt="prepare_env start && run_tests -t ${test_name}"
59 ret_val_file="${HOME}/opnfv/functest/results/${BRANCH##*/}/return_value"
60 echo 0 > ${ret_val_file}
61 # Determine which Functest image should be used for the test case
63 connection_check|api_check|snaps_health_check)
64 FUNCTEST_IMAGE=opnfv/functest-healthcheck:${DOCKER_TAG} ;;
65 vping_ssh|vping_userdata|tempest_smoke_serial|rally_sanity|refstack_defcore|odl|odl_netvirt|snaps_smoke)
66 FUNCTEST_IMAGE=opnfv/functest-smoke:${DOCKER_TAG} ;;
67 tempest_full_parallel|rally_full)
68 FUNCTEST_IMAGE=opnfv/functest-components:${DOCKER_TAG} ;;
69 cloudify_ims|orchestra_openims|orchestra_clearwaterims|vyos_vrouter)
70 FUNCTEST_IMAGE=opnfv/functest-vnf:${DOCKER_TAG} ;;
71 promise|doctor-notification|bgpvpn|functest-odl-sfc|domino-multinode|barometercollectd|fds)
72 FUNCTEST_IMAGE=opnfv/functest-features:${DOCKER_TAG} ;;
74 FUNCTEST_IMAGE=opnfv/functest-parser:${DOCKER_TAG} ;;
76 echo "Unkown test case $test_name"
80 echo "Functest: Pulling Functest Docker image ${FUNCTEST_IMAGE} ..."
81 docker pull ${FUNCTEST_IMAGE}>/dev/null
82 cmd="docker run --rm --privileged=true ${envs} ${volumes} ${TESTCASE_OPTIONS} ${FUNCTEST_IMAGE} /bin/bash -c '${cmd_opt}'"
83 echo "Running Functest test case '${test_name}'. CMD: ${cmd}"
86 if [ ${ret_value} != 0 ]; then
87 echo ${ret_value} > ${ret_val_file}
92 [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
93 FUNCTEST_DIR=/home/opnfv/functest
95 [[ $BUILD_TAG =~ "virtual" ]] && DEPLOY_TYPE=virt
97 DOCKER_TAG=`[[ ${BRANCH##*/} == "master" ]] && echo "latest" || echo ${BRANCH##*/}`
99 # Prepare OpenStack credentials volume
100 rc_file=${HOME}/opnfv-openrc.sh
102 if [[ ${INSTALLER_TYPE} == 'joid' ]]; then
103 rc_file=$LAB_CONFIG/admin-openrc
104 elif [[ ${INSTALLER_TYPE} == 'compass' ]]; then
105 cacert_file_vol="-v ${HOME}/os_cacert:${FUNCTEST_DIR}/conf/os_cacert"
106 echo "export OS_CACERT=${FUNCTEST_DIR}/conf/os_cacert" >> ${HOME}/opnfv-openrc.sh
107 elif [[ ${INSTALLER_TYPE} == 'fuel' && ${DEPLOY_TYPE} == 'baremetal' ]]; then
108 cacert_file_vol="-v ${HOME}/os_cacert:/etc/ssl/certs/mcp_os_cacert"
110 rc_file_vol="-v ${rc_file}:${FUNCTEST_DIR}/conf/openstack.creds"
113 # Set iptables rule to allow forwarding return traffic for container
114 if ! sudo iptables -C FORWARD -j RETURN 2> ${redirect} || ! sudo iptables -L FORWARD | awk 'NR==3' | grep RETURN 2> ${redirect}; then
115 sudo iptables -I FORWARD -j RETURN
118 echo "Functest: Start Docker and prepare environment"
120 echo "Functest: Download images that will be used by test cases"
121 images_dir="${HOME}/opnfv/functest/images"
122 download_script=${WORKSPACE}/functest/ci/download_images.sh
123 if [[ ! -f ${download_script} ]]; then
124 # to support Danube as well
125 wget https://git.opnfv.org/functest/plain/functest/ci/download_images.sh -O ${download_script} 2> ${redirect}
127 chmod +x ${download_script}
128 ${download_script} ${images_dir} ${DEPLOY_SCENARIO} ${HOST_ARCH} 2> ${redirect}
130 images_vol="-v ${images_dir}:${FUNCTEST_DIR}/images"
132 dir_result="${HOME}/opnfv/functest/results/${BRANCH##*/}"
133 mkdir -p ${dir_result}
134 sudo rm -rf ${dir_result}/*
135 results_vol="-v ${dir_result}:${FUNCTEST_DIR}/results"
137 test -f ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG} && custom_params=$(cat ${HOME}/opnfv/functest/custom/params_${DOCKER_TAG})
139 envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
140 -e NODE_NAME=${NODE_NAME} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO} \
141 -e BUILD_TAG=${BUILD_TAG} -e DEPLOY_TYPE=${DEPLOY_TYPE}"
143 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
146 if [ "${INSTALLER_TYPE}" == 'fuel' ]; then
147 COMPUTE_ARCH=$(ssh -l ubuntu ${INSTALLER_IP} -i ${SSH_KEY} ${ssh_options} \
148 "sudo salt 'cmp*' grains.get cpuarch --out yaml | awk '{print \$2; exit}'")
149 envs="${envs} -e POD_ARCH=${COMPUTE_ARCH}"
152 volumes="${images_vol} ${results_vol} ${sshkey_vol} ${rc_file_vol} ${cacert_file_vol}"
157 if [[ ${DEPLOY_SCENARIO} =~ ^os-.* ]]; then
158 [[ ${BRANCH##*/} == "master" ]] && check_os_deployment
159 if [ ${FUNCTEST_MODE} == 'testcase' ]; then
160 echo "FUNCTEST_MODE=testcase, FUNCTEST_SUITE_NAME=${FUNCTEST_SUITE_NAME}"
161 run_test ${FUNCTEST_SUITE_NAME}
162 elif [ ${FUNCTEST_MODE} == 'tier' ]; then
163 echo "FUNCTEST_MODE=tier, FUNCTEST_TIER=${FUNCTEST_TIER}"
164 tiers=(${FUNCTEST_TIER})
167 if [ ${DEPLOY_TYPE} == 'baremetal' ]; then
168 tiers=(healthcheck smoke features vnf parser)
170 tiers=(healthcheck smoke features)
175 echo "k8 deployment has not been supported by functest yet"