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. 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 arr_test=(vping odl tempest vims rally)
38 echo "----------------------------------------------"
39 echo "------------- Running $i test case "
40 echo "----------------------------------------------"
43 info "Running vPing test..."
44 python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py \
45 --debug ${FUNCTEST_REPO_DIR}/ ${report}
48 info "Running ODL test..."
49 if [ $INSTALLER_TYPE == "fuel" ]; then
50 odl_ip=$(keystone catalog --service network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
51 neutron_ip=$(keystone catalog --service identity | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
52 usr_name=$(env | grep OS | grep OS_USERNAME | cut -f2 -d'=')
53 pass=$(env | grep OS | grep OS_PASSWORD | cut -f2 -d'=')
55 ODL_PORT=$odl_port ODL_IP=$odl_ip NEUTRON_IP=$neutron_ip USR_NAME=$usr_name PASS=$pass \
56 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
57 elif [ $INSTALLER_TYPE == "foreman" ]; then
59 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
60 elif [ $INSTALLER_TYPE == "apex" ]; then
62 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
63 elif [ $INSTALLER_TYPE == "joid" ]; then
65 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
66 elif [ $INSTALLER_TYPE == "compass" ]; then
68 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
70 error "INSTALLER_TYPE not valid."
74 odl_logs="${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/logs"
75 if [ -d ${odl_logs} ]; then
76 cp -Rf ${odl_logs} ${FUNCTEST_CONF_DIR}/ODL/
80 info "Running Tempest smoke tests..."
81 python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_tempest.py \
82 --debug ${FUNCTEST_REPO_DIR}/ -m smoke ${report}
83 # save tempest.conf for further troubleshooting
84 tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf"
85 if [ -f ${tempest_conf} ]; then
86 cp $tempest_conf ${FUNCTEST_CONF_DIR}
90 info "Running vIMS test..."
91 python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py \
92 --debug ${FUNCTEST_REPO_DIR}/ ${report}
95 info "Running Rally benchmark suite..."
96 python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py \
97 --debug ${FUNCTEST_REPO_DIR}/ all ${report}
100 info "Running BGPVPN Tempest test case..."
101 tempest_dir=$(find /root/.rally -type d -name for-deploy*)
103 # do the call of your test case here.
104 # the bgpvpn repo is cloned in $BGPVPN_REPO_DIR
105 # tempest is installed in $tempest_dir
107 # mkdir ${tempest_dir}/tempest/api/bgpvpn/
108 # cp ${BGPVPN_REPO_DIR}/networking_bgpvpn_tempest/<whatever you need> \
109 # ${tempest_dir}/tempest/api/bgpvpn/
110 # ${tempest_dir}/run_tempest.sh tempest.api.bgpvpn.<test_case_name>
136 echo "unknown option $1 $2"
140 shift # past argument or value
144 source ${BASEDIR}/common.sh
147 # Check that the given tests are correct
148 if [ "${TEST}" != "" ]; then
149 arr_test_exec=(${TEST//,/ })
150 for i in "${arr_test_exec[@]}"; do
151 if [[ " ${arr_test[*]} " != *" $i "* ]]; then
152 error "Unknown test: $i. Available tests are: ${arr_test[@]}"
155 info "Tests to execute: ${TEST}."
158 if [ $offline == false ]; then
164 # Check that the functest environment has been installed
165 if [ ! -f ${FUNCTEST_CONF_DIR}/env_active ]; then
166 error "The Functest environment is not installed. \
167 Please run prepare_env.sh before running this script...."
172 info "Sourcing Credentials ${FUNCTEST_CONF_DIR}/openstack.creds to run the tests.."
173 source ${FUNCTEST_CONF_DIR}/openstack.creds
177 if [ "${TEST}" != "" ]; then
178 for i in "${arr_test_exec[@]}"; do
182 info "Executing all the tests"
183 for i in "${arr_test[@]}"; do