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\": \"admin\"/\"password\": \"${PASS}\"/" ${BASEDIR}/integration/test/csit/suites/openstack/neutron/__init__.robot
61 if source $BASEDIR/venv/bin/activate; then
62 echo -e "${green}Python virtualenv activated.${nc}"
64 echo -e "${red}ERROR${nc}"
68 # add custom tests to suite, if there are more custom tests needed this will be reworked
69 echo -e "${green}Copy custom tests to suite.${nc}"
70 cp -vf $BASEDIR/custom_tests/neutron/* $BASEDIR/integration/test/csit/suites/openstack/neutron/
72 # List of tests are specified in test_list.txt
73 # those are relative paths to test directories from integartion suite
74 echo -e "${green}Executing chosen tests.${nc}"
79 [[ ${line:0:1} == "#" ]] && continue
81 [[ -z "${line}" ]] && continue
83 echo -e "${light_green}Starting test: $line ${nc}"
84 pybot -v OPENSTACK:${NEUTRON_IP} -v PORT:${ODL_PORT} -v CONTROLLER:${ODL_IP} ${BASEDIR}/$line
85 mkdir -p $BASEDIR/logs/${test_num}
86 mv log.html $BASEDIR/logs/${test_num}/
87 mv report.html $BASEDIR/logs/${test_num}/
88 mv output.xml $BASEDIR/logs/${test_num}/
92 echo -e "${green}Deactivate venv.${nc}"
95 # Now we can copy output.xml, log.html and report.xml files generated by robot.