2 # Script requires that test environment is created already
3 # it includes python2.7 virtual env with robot packages and git
4 # use create_env.sh script for creating python virtualenv
9 light_green='\033[1;32m'
11 nc='\033[0m' # No Color
13 usage="Script for starting ODL tests. Tests to be executed are specified in test_list.txt file.
16 [var=value] bash $(basename "$0") [-h]
19 -h show this help text
20 var one of the following: ODL_IP, ODL_PORT, USR_NAME, PASS, NEUTRON_IP
21 value new value for var
24 ODL_IP=oscontro1 ODL_PORT=8080 bash $(basename "$0")"
26 while getopts ':h' option; do
31 \?) printf "illegal option: -%s\n" "$OPTARG" >&2
38 echo -e "${green}Current environment parameters for ODL suite.${nc}"
39 # Following vars might be also specified as CLI params
41 ODL_IP=${ODL_IP:-'192.168.1.5'}
42 ODL_PORT=${ODL_PORT:-8081}
43 USR_NAME=${USR_NAME:-'neutron'}
44 PASS=${PASS:-'octopus'}
45 NEUTRON_IP=${NEUTRON_IP:-192.168.0.68}
48 echo -e "${green}Cloning ODL integration git repo.${nc}"
49 if [ -d ${BASEDIR}/integration ]; then
50 cd ${BASEDIR}/integration
55 git clone https://github.com/opendaylight/integration.git ${BASEDIR}/integration
58 # Change openstack password for admin tenant in neutron suite
59 sed -i "s/\"password\": \".*\"/\"password\": \"${PASS}\"/" ${BASEDIR}/integration/test/csit/suites/openstack/neutron/__init__.robot
61 # Add Start Suite and Teardown Suite
62 sed -i "/^Documentation.*/a Suite Teardown Stop Suite" ${BASEDIR}/integration/test/csit/suites/openstack/neutron/__init__.robot
63 sed -i "/^Documentation.*/a Suite Setup Start Suite" ${BASEDIR}/integration/test/csit/suites/openstack/neutron/__init__.robot
65 if source $BASEDIR/venv/bin/activate; then
66 echo -e "${green}Python virtualenv activated.${nc}"
68 echo -e "${red}ERROR${nc}"
72 # add custom tests to suite, if there are more custom tests needed this will be reworked
73 echo -e "${green}Copy custom tests to suite.${nc}"
74 cp -vf $BASEDIR/custom_tests/neutron/* $BASEDIR/integration/test/csit/suites/openstack/neutron/
76 # List of tests are specified in test_list.txt
77 # those are relative paths to test directories from integartion suite
78 echo -e "${green}Executing chosen tests.${nc}"
83 [[ ${line:0:1} == "#" ]] && continue
85 [[ -z "${line}" ]] && continue
88 echo -e "${light_green}Starting test: $line ${nc}"
89 pybot -v OPENSTACK:${NEUTRON_IP} -v PORT:${ODL_PORT} -v CONTROLLER:${ODL_IP} ${BASEDIR}/$line
90 mkdir -p $BASEDIR/logs/${test_num}
91 mv log.html $BASEDIR/logs/${test_num}/
92 mv report.html $BASEDIR/logs/${test_num}/
93 mv output.xml $BASEDIR/logs/${test_num}/
94 done < ${BASEDIR}/test_list.txt
96 # create final report which includes all partial test reports
97 for i in $(seq $test_num); do
98 rebot_params="$rebot_params $BASEDIR/logs/$i/output.xml"
101 echo -e "${green}Final report is located:${nc}"
105 echo -e "${green}Deactivate venv.${nc}"