4 # Author: Jose Lausuch (jose.lausuch@ericsson.com)
6 # Installs the Functest framework within the Docker container
7 # and run the tests automatically
10 usage="Script to trigger the tests automatically.
13 bash $(basename "$0") [--offline] [-h|--help] [-t <test_name>]
16 -o|--offline optional offline mode (experimental)
17 -h|--help show this help text
18 -r|--report push results to database (false by default)
19 -t|--test run specific set of tests
20 <test_name> one or more of the following: vping,odl,rally,tempest,vims,onos, promise. Separated by comma.
25 $(basename "$0") --test vping,odl
26 $(basename "$0") --offline -t tempest,rally"
29 # Support for Functest offline
30 # NOTE: Still not 100% working when running the tests
33 # Get the list of runnable tests
34 # Check if we are in CI mode
35 if [ -n "$DEPLOY_SCENARIO" ]; then
36 testcase=`cat /home/opnfv/functest/conf/testcase-list.txt`
37 arr_test=("$testcase")
39 arr_test=(vping odl tempest vims rally)
42 function clean_openstack(){
43 python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py \
49 echo "----------------------------------------------"
50 echo "------------- Running $i test case "
51 echo "----------------------------------------------"
54 info "Running vPing test..."
55 python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py \
59 info "Running ODL test..."
60 neutron_ip=$(keystone catalog --service identity | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
61 odl_ip=$(keystone catalog --service network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
62 usr_name=$(env | grep OS | grep OS_USERNAME | cut -f2 -d'=')
63 password=$(env | grep OS | grep OS_PASSWORD | cut -f2 -d'=')
65 if [ $INSTALLER_TYPE == "fuel" ]; then
67 elif [ $INSTALLER_TYPE == "apex" ]; then
69 elif [ $INSTALLER_TYPE == "joid" ]; then
71 elif [ $INSTALLER_TYPE == "compass" ]; then
74 error "INSTALLER_TYPE not valid."
77 ODL_PORT=$odl_port ODL_IP=$odl_ip NEUTRON_IP=$neutron_ip USR_NAME=$usr_name PASS=$password \
78 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
81 odl_logs="${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/logs"
82 if [ -d ${odl_logs} ]; then
83 cp -Rf ${odl_logs} ${FUNCTEST_CONF_DIR}/ODL/
87 info "Running Tempest tests..."
88 python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_tempest.py \
89 --debug -m custom ${report}
90 # save tempest.conf for further troubleshooting
91 tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf"
92 if [ -f ${tempest_conf} ]; then
93 cp $tempest_conf ${FUNCTEST_CONF_DIR}
98 info "Running vIMS test..."
99 python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py \
104 info "Running Rally benchmark suite..."
105 cinder type-create volume-test #provisional
106 python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py \
107 --debug all ${report}
108 cinder type-delete $(cinder type-list|grep test|awk '{print $2}')
113 info "Running BGPVPN Tempest test case..."
114 tempest_dir=$(find /root/.rally -type d -name for-deploy*)
116 # do the call of your test case here.
117 # the bgpvpn repo is cloned in $BGPVPN_REPO_DIR
118 # tempest is installed in $tempest_dir
120 # mkdir ${tempest_dir}/tempest/api/bgpvpn/
121 # cp ${BGPVPN_REPO_DIR}/networking_bgpvpn_tempest/<whatever you need> \
122 # ${tempest_dir}/tempest/api/bgpvpn/
123 # ${tempest_dir}/run_tempest.sh tempest.api.bgpvpn.<test_case_name>
126 info "Running ONOS test case..."
127 python ${FUNCTEST_REPO_DIR}/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
130 info "Running PROMISE test case..."
157 echo "unknown option $1 $2"
161 shift # past argument or value
165 source ${BASEDIR}/common.sh
168 # Check that the given tests are correct
169 if [ "${TEST}" != "" ]; then
170 arr_test_exec=(${TEST//,/ })
171 for i in "${arr_test_exec[@]}"; do
172 if [[ " ${arr_test[*]} " != *" $i "* ]]; then
173 error "Unknown test: $i. Available tests are: ${arr_test[@]}"
176 info "Tests to execute: ${TEST}."
179 if [ $offline == false ]; then
185 # Check that the functest environment has been installed
186 if [ ! -f ${FUNCTEST_CONF_DIR}/env_active ]; then
187 error "The Functest environment is not installed. \
188 Please run prepare_env.sh before running this script...."
193 info "Sourcing Credentials ${FUNCTEST_CONF_DIR}/openstack.creds to run the tests.."
194 source ${FUNCTEST_CONF_DIR}/openstack.creds
197 if [ "${TEST}" != "" ]; then
198 for i in "${arr_test_exec[@]}"; do
202 info "Executing all the tests"
203 for i in "${arr_test[@]}"; do