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_TEST_DIR=${repos_dir}/functest/functest/opnfv_tests
41 FUNCTEST_CONF_DIR=/home/opnfv/functest/conf
43 export PYTHONUNBUFFERED=1
46 keystone_ip=$(openstack catalog show identity |grep publicURL| cut -f3 -d"/" | cut -f1 -d":")
47 neutron_ip=$(openstack catalog show network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
50 if [ "$INSTALLER_TYPE" == "fuel" ]; then
52 elif [ "$INSTALLER_TYPE" == "apex" ]; then
53 odl_ip=$SDN_CONTROLLER_IP
55 elif [ "$INSTALLER_TYPE" == "joid" ]; then
56 odl_ip=$SDN_CONTROLLER
57 elif [ "$INSTALLER_TYPE" == "compass" ]; then
60 odl_ip=$SDN_CONTROLLER_IP
64 function sfc_prepare(){
65 ids=($(neutron security-group-list|grep default|awk '{print $2}'))
66 for id in ${ids[@]}; do
67 if ! neutron security-group-show $id|grep "22/tcp" &>/dev/null; then
68 neutron security-group-rule-create --protocol tcp \
69 --port-range-min 22 --port-range-max 22 --direction ingress $id
70 neutron security-group-rule-create --protocol tcp \
71 --port-range-min 22 --port-range-max 22 --direction egress $id
79 if [ $serial == "true" ]; then
85 ${FUNCTEST_TEST_DIR}/OpenStack/healthcheck/healthcheck.sh
89 [[ "$report" == "-r" ]] && args=-p
90 ${FUNCTEST_TEST_DIR}/Controllers/ODL/OpenDaylightTesting.py \
91 --keystoneip $keystone_ip --neutronip $neutron_ip \
92 --osusername ${OS_USERNAME} --ostenantname ${OS_TENANT_NAME} \
93 --ospassword ${OS_PASSWORD} \
94 --odlip $odl_ip --odlwebport $odl_port ${args}
96 "tempest_smoke_serial")
97 python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/run_tempest.py \
98 $clean_flag -s -m smoke $report
100 "tempest_full_parallel")
101 python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/run_tempest.py \
102 $serial_flag $clean_flag -m full $report
105 python ${FUNCTEST_TEST_DIR}/vnf/vIMS/vIMS.py $clean_flag $report
108 python ${FUNCTEST_TEST_DIR}/OpenStack/rally/run_rally-cert.py $clean_flag all $report
111 python ${FUNCTEST_TEST_DIR}/OpenStack/rally/run_rally-cert.py \
112 $clean_flag --sanity all $report
115 python ${FUNCTEST_TEST_DIR}/Controllers/ONOS/Teston/onosfunctest.py
118 python ${FUNCTEST_TEST_DIR}/Controllers/ONOS/Teston/onosfunctest.py -t sfc
121 python ${FUNCTEST_TEST_DIR}/features/promise.py $report
122 sleep 10 # to let the instances terminate
125 python ${FUNCTEST_TEST_DIR}/features/doctor.py $report
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 ${repos_dir}/securityscanning/security_scan.py --config ${repos_dir}/securityscanning/config.ini
138 python ${FUNCTEST_TEST_DIR}/features/copper.py $report
141 python ${repos_dir}/moon/tests/run_tests.py $report
144 python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/gen_tempest_conf.py
145 python ${FUNCTEST_TEST_DIR}/OpenStack/tempest/run_tempest.py \
146 $clean_flag -s -m feature_multisite $report \
147 -c ${FUNCTEST_TEST_DIR}/OpenStack/tempest/tempest_multisite.conf
150 ODL_SFC_DIR=${repos_dir}/sfc/tests/functest/odl-sfc
151 FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR} python ${ODL_SFC_DIR}/prepare_odl_sfc.py || exit $?
152 source ${ODL_SFC_DIR}/tackerc
153 python ${ODL_SFC_DIR}/sfc.py $report
156 python ${FUNCTEST_TEST_DIR}/vnf/vRNC/parser.py $report
159 echo "The test case '${test_name}' does not exist."
163 if [[ $? != 0 ]]; then exit 1
190 echo "unknown option $1 $2"
194 shift # past argument or value
199 echo "Sourcing Credentials ${FUNCTEST_CONF_DIR}/openstack.creds to run the test.."
200 source ${FUNCTEST_CONF_DIR}/openstack.creds
202 # ODL Boron workaround to create additional flow rules to allow port 22 TCP
203 if [[ $DEPLOY_SCENARIO == *"odl_l2-sfc"* ]]; then