2 # it includes python2.7 virtual env with robot packages and git
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
11 RESULTS_DIR='/home/opnfv/functest/results/odl/'
12 REPO_DIR='/home/opnfv/repos/odl_test'
13 #TODO: read this form config_functest.yaml
17 light_green='\033[1;32m'
19 nc='\033[0m' # No Color
21 usage="Script for starting ODL tests. Tests to be executed are specified in test_list.txt file.
24 [var=value] bash $(basename "$0") [-h]
27 -h show this help text
28 var one of the following: ODL_IP, ODL_PORT, USR_NAME, PASS, NEUTRON_IP
29 value new value for var
32 ODL_IP=oscontro1 ODL_PORT=8080 bash $(basename "$0")"
34 while getopts ':h' option; do
39 \?) printf "illegal option: -%s\n" "$OPTARG" >&2
46 echo -e "${green}Current environment parameters for ODL suite.${nc}"
47 # Following vars might be also specified as CLI params
49 ODL_IP=${ODL_IP:-'192.168.1.5'}
50 ODL_PORT=${ODL_PORT:-8081}
51 USR_NAME=${USR_NAME:-'neutron'}
52 PASS=${PASS:-'octopus'}
53 NEUTRON_IP=${NEUTRON_IP:-192.168.0.68}
54 KEYSTONE_IP=${KEYSTONE_IP:-192.168.0.69}
57 init_file=${REPO_DIR}/csit/suites/openstack/neutron/__init__.robot
58 # Change openstack password for admin tenant in neutron suite
59 sed -i "s/\"password\": \".*\"/\"password\": \"${PASS}\"/" $init_file
61 # Add Start Suite and Teardown Suite
62 if [[ ! `grep 'Suite Teardown' ${init_file}` ]]; then
63 sed -i "/^Documentation.*/a Suite Teardown Stop Suite" $init_file
64 sed -i "/^Documentation.*/a Suite Setup Start Suite" $init_file
67 # add custom tests to suite, if there are more custom tests needed this will be reworked
68 echo -e "${green}Copy custom tests to suite.${nc}"
69 cp -vf ${BASEDIR}/custom_tests/neutron/* ${REPO_DIR}/csit/suites/openstack/neutron/
71 # List of tests are specified in test_list.txt
72 # those are relative paths to test directories from integartion suite
73 echo -e "${green}Executing chosen tests.${nc}"
78 [[ ${line:0:1} == "#" ]] && continue
80 [[ -z "${line}" ]] && continue
83 echo -e "${light_green}Starting test: $line ${nc}"
84 pybot -v OPENSTACK:${KEYSTONE_IP} -v NEUTRON:${NEUTRON_IP} -v PORT:${ODL_PORT} -v CONTROLLER:${ODL_IP} ${REPO_DIR}/$line
85 mkdir -p $RESULTS_DIR/logs/${test_num}
86 mv log.html $RESULTS_DIR/logs/${test_num}/
87 mv report.html $RESULTS_DIR/logs/${test_num}/
88 mv output.xml $RESULTS_DIR/logs/${test_num}/
89 done < ${BASEDIR}/test_list.txt
91 # create final report which includes all partial test reports
92 for i in $(seq $test_num); do
93 rebot_params="$rebot_params $RESULTS_DIR/logs/$i/output.xml"
96 echo -e "${green}Final report is located:${nc}"