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 -t|--test run specific set of tests
19 <test_name> one or more of the following: vping,odl,rally,tempest. Separated by comma.
24 $(basename "$0") --test vping,odl
25 $(basename "$0") --offline -t tempest,rally"
28 # Support for Functest offline
29 # NOTE: Still not 100% working when running the tests
31 arr_test=(vping odl rally tempest vims)
36 echo "----------------------------------------------"
37 echo "------------- Running $i test case "
38 echo "----------------------------------------------"
41 info "Running vPing test..."
42 python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py --debug ${FUNCTEST_REPO_DIR}/ -r
45 info "Running ODL test..."
46 if [ $INSTALLER_TYPE == "fuel" ]; then
47 odl_ip=$(keystone catalog --service network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
48 neutron_ip=$(keystone catalog --service identity | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
49 usr_name=$(env | grep OS | grep OS_USERNAME | cut -f2 -d'=')
50 pass=$(env | grep OS | grep OS_PASSWORD | cut -f2 -d'=')
52 ODL_PORT=$odl_port ODL_IP=$odl_ip NEUTRON_IP=$neutron_ip USR_NAME=$usr_name PASS=$pass \
53 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
54 elif [ $INSTALLER_TYPE == "foreman" ]; then
56 ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
58 error "INSTALLER_TYPE not valid."
62 odl_logs="${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/logs"
63 if [ -d ${odl_logs} ]; then
64 cp -Rf ${odl_logs} ${FUNCTEST_CONF_DIR}/ODL/
68 info "Running Tempest smoke tests..."
69 rally verify start smoke
71 # save tempest.conf for further troubleshooting
72 tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf"
73 if [ -f ${tempest_conf} ]; then
74 cp $tempest_conf ${FUNCTEST_CONF_DIR}
78 info "Running vIMS test..."
79 python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py --debug ${FUNCTEST_REPO_DIR}/
82 info "Running Rally benchmark suite..."
83 python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py --debug ${FUNCTEST_REPO_DIR}/ all
107 echo "unknown option $1 $2"
111 shift # past argument or value
115 source ${BASEDIR}/common.sh
118 # Check that the given tests are correct
119 if [ "${TEST}" != "" ]; then
120 arr_test_exec=(${TEST//,/ })
121 for i in "${arr_test_exec[@]}"; do
122 if [[ " ${arr_test[*]} " != *" $i "* ]]; then
123 error "Unknown test: $i. Available tests are: ${arr_test[@]}"
126 info "Tests to execute: ${TEST}."
129 if [ $offline == false ]; then
135 # Check that the functest environment has been installed
136 if [ ! -f ${FUNCTEST_CONF_DIR}/env_active ]; then
137 error "The Functest environment is not installed. \
138 Please run prepare_env.sh before running this script...."
143 info "Sourcing Credentials ${FUNCTEST_CONF_DIR}/openstack.creds to run the tests.."
144 source ${FUNCTEST_CONF_DIR}/openstack.creds
148 if [ "${TEST}" != "" ]; then
149 for i in "${arr_test_exec[@]}"; do
153 info "Executing all the tests"
154 for i in "${arr_test[@]}"; do