4 # Author: Jose Lausuch (jose.lausuch@ericsson.com)
5 # Morgan Richomme (morgan.richomme@orange.com)
6 # Installs the Functest framework within the Docker container
7 # and run the tests automatically
10 # All rights reserved. This program and the accompanying materials
11 # are made available under the terms of the Apache License, Version 2.0
12 # which accompanies this distribution, and is available at
13 # http://www.apache.org/licenses/LICENSE-2.0
16 usage="Script to trigger the tests automatically.
19 bash $(basename "$0") [-h|--help] [-t <test_name>]
22 -h|--help show this help text
23 -r|--report push results to database (false by default)
24 -s|--serial run Tempest tests in one thread
25 -t|--test run specific test case
32 # Get the list of runnable tests
33 # Check if we are in CI mode
35 if [[ "${CI_DEBUG,,}" == "true" ]];then
39 FUNCTEST_REPO_DIR=${repos_dir}/functest/
40 FUNCTEST_CONF_DIR=/home/opnfv/functest/conf/
44 keystone_ip=$(openstack catalog show identity |grep publicURL| cut -f3 -d"/" | cut -f1 -d":")
45 neutron_ip=$(openstack catalog show network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
48 if [ "$INSTALLER_TYPE" == "fuel" ]; then
50 elif [ "$INSTALLER_TYPE" == "apex" ]; then
52 elif [ "$INSTALLER_TYPE" == "joid" ]; then
53 odl_ip=$SDN_CONTROLLER
56 elif [ "$INSTALLER_TYPE" == "compass" ]; then
59 odl_ip=$SDN_CONTROLLER
66 if [ $serial == "true" ]; then
72 ${FUNCTEST_REPO_DIR}/testcases/OpenStack/healthcheck/healthcheck.sh
75 python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/vPing/vPing_ssh.py $report
78 python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/vPing/vPing_userdata.py $report
82 ODL_PORT=$odl_port ODL_IP=$odl_ip KEYSTONE_IP=$keystone_ip NEUTRON_IP=$neutron_ip USR_NAME=${OS_USERNAME} PASS=${OS_PASSWORD} \
83 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/start_tests.sh
85 # push results to the DB in case of CI
86 if [[ "$report" == "-r" &&
87 -n "$DEPLOY_SCENARIO" && "$DEPLOY_SCENARIO" != "none" &&
88 -n "$INSTALLER_TYPE" && "$INSTALLER_TYPE" != "none" ]] &&
89 env | grep NODE_NAME > /dev/null; then
90 odl_logs="/home/opnfv/functest/results/odl/logs/2"
91 odl_path="${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/"
92 node_name=$(env | grep NODE_NAME | cut -f2 -d'=')
93 python ${odl_path}/odlreport2db.py -x ${odl_logs}/output.xml -i ${INSTALLER_TYPE} -p ${node_name} -s ${DEPLOY_SCENARIO}
96 "tempest_smoke_serial")
97 python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/run_tempest.py \
98 $clean_flag -s -m smoke $report
100 "tempest_full_parallel")
101 python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/tempest/run_tempest.py \
102 $serial_flag $clean_flag -m full $report
105 python ${FUNCTEST_REPO_DIR}/testcases/vIMS/vIMS.py $clean_flag $report
108 python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/rally/run_rally-cert.py $clean_flag all $report
111 python ${FUNCTEST_REPO_DIR}/testcases/OpenStack/rally/run_rally-cert.py \
112 $clean_flag --sanity all $report
115 python ${FUNCTEST_REPO_DIR}/testcases/features/bgpvpn.py
118 python ${FUNCTEST_REPO_DIR}/testcases/Controllers/ONOS/Teston/onosfunctest.py
121 python ${FUNCTEST_REPO_DIR}/testcases/features/promise.py $report
122 sleep 10 # to let the instances terminate
125 python ${FUNCTEST_REPO_DIR}/testcases/features/doctor.py
128 # suite under rewritting for colorado
129 # no need to run anything until refactoring done
130 # ${repos_dir}/ovno/Testcases/RunTests.sh
133 echo "Sourcing Credentials ${FUNCTEST_CONF_DIR}/stackrc for undercloud .."
134 source ${FUNCTEST_CONF_DIR}/stackrc
135 python ${FUNCTEST_REPO_DIR}/testcases/security_scan/security_scan.py --config ${FUNCTEST_REPO_DIR}/testcases/security_scan/config.ini
138 python ${FUNCTEST_REPO_DIR}/testcases/features/copper.py
141 # TODO put the link to Moon script to be run (if test runnable) here
142 ${repos_dir}/moon/tests/run_tests.sh
145 echo "The test case '${test_name}' does not exist."
149 if [[ $? != 0 ]]; then exit 1
176 echo "unknown option $1 $2"
180 shift # past argument or value
185 echo "Sourcing Credentials ${FUNCTEST_CONF_DIR}/openstack.creds to run the test.."
186 source ${FUNCTEST_CONF_DIR}/openstack.creds