Change MININET to TOOLS_SYSTEM_IP in get-slave-addresses.sh
[releng/builder.git] / jjb / integration / include-raw-integration-start-cluster-run-test.sh
1 # Activate robotframework virtualenv
2 source $WORKSPACE/venv-robotframework/bin/activate
3
4 echo "#################################################"
5 echo "##         Verify Cluster is UP                ##"
6 echo "#################################################"
7
8 cat > ${WORKSPACE}/verify-cluster-is-up.sh <<EOF
9
10 CONTROLLERID="member-\$1"
11 ODL_SYSTEM_IP_PATH=\$2
12
13 echo "Waiting for controller to come up..."
14 COUNT="0"
15 while true; do
16     RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
17     echo \$RESP
18     SHARD="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/jolokia/read/org.opendaylight.controller:Category=Shards,name=\$CONTROLLERID-shard-inventory-config,type=DistributedConfigDatastore)"
19     echo \$SHARD
20     if ([[ \$RESP == *"200"* ]] && [[ \$SHARD  == *'"status":200'* ]]); then
21         echo Controller is UP
22         break
23     elif (( "\$COUNT" > "600" )); then
24         echo Timeout Controller DOWN
25         echo "Dumping Karaf log..."
26         cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
27         exit 1
28     else
29         COUNT=\$(( \${COUNT} + 5 ))
30         sleep 5
31         echo waiting \$COUNT secs...
32     fi
33 done
34
35 echo "Checking OSGi bundles..."
36 sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
37
38 EOF
39
40 ODL_SYSTEM_IPS=(${ODL_SYSTEM_1_IP} ${ODL_SYSTEM_2_IP} ${ODL_SYSTEM_3_IP})
41 for i in "${!ODL_SYSTEM_IPS[@]}"
42 do
43     echo "Verifying member-$((i+1)) with IP address ${ODL_SYSTEM_IPS[$i]} is UP"
44     scp ${WORKSPACE}/verify-cluster-is-up.sh ${ODL_SYSTEM_IPS[$i]}:/tmp
45     ssh ${ODL_SYSTEM_IPS[$i]} "bash /tmp/verify-cluster-is-up.sh $((i+1)) ${ODL_SYSTEM_IPS[$i]}"
46 done
47
48 echo "Cool down for 1 min :)..."
49 sleep 60
50
51 echo "Changing the testplan path..."
52 cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt
53 cat testplan.txt
54
55 SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' )
56
57 echo "Starting Robot test suites ${SUITES} ..."
58 pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \
59 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} -v CONTROLLER:${ODL_SYSTEM_IP} -v CONTROLLER1:${ODL_SYSTEM_2_IP} \
60 -v CONTROLLER2:${ODL_SYSTEM_3_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
61 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} -v CONTROLLER_USER:${USER} -v ODL_SYSTEM_USER:${USER} \
62 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} -v TOOLS_SYSTEM_3_IP:${TOOLS_SYSTEM_3_IP} \
63 -v TOOLS_SYSTEM_USER:${USER} \
64 -v MININET:${TOOLS_SYSTEM_IP} -v MININET1:${TOOLS_SYSTEM_2_IP} -v MININET2:${TOOLS_SYSTEM_3_IP} -v MININET_USER:${USER} \
65 -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
66
67 echo "Fetching Karaf log"
68 scp $ODL_SYSTEM_IP:/tmp/$BUNDLEFOLDER/data/log/karaf.log controller0-karaf.log
69 scp $ODL_SYSTEM_2_IP:/tmp/$BUNDLEFOLDER/data/log/karaf.log controller1-karaf.log
70 scp $ODL_SYSTEM_3_IP:/tmp/$BUNDLEFOLDER/data/log/karaf.log controller2-karaf.log
71
72 # vim: ts=4 sw=4 sts=4 et ft=sh :
73