1 #@IgnoreInspection BashAddShebang
2 # Activate robotframework virtualenv
3 # ${ROBOT_VENV} comes from the include-raw-integration-install-robotframework.sh
5 source ${ROBOT_VENV}/bin/activate
7 echo "#################################################"
8 echo "## Verify Cluster is UP ##"
9 echo "#################################################"
11 cat > ${WORKSPACE}/verify-cluster-is-up.sh <<EOF
13 CONTROLLERID="member-\$1"
14 ODL_SYSTEM_IP_PATH=\$2
16 echo "Waiting for controller to come up..."
19 RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
21 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)"
23 if ([[ \$RESP == *"200"* ]] && [[ \$SHARD == *'"status":200'* ]]); then
26 elif (( "\$COUNT" > "600" )); then
27 echo Timeout Controller DOWN
28 echo "Dumping Karaf log..."
29 cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
30 echo "Listing all open ports on controller system"
34 COUNT=\$(( \${COUNT} + 5 ))
36 echo waiting \$COUNT secs...
40 echo "Checking OSGi bundles..."
41 sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
43 echo "Listing all open ports on controller system"
46 function exit_on_log_file_message {
47 echo "looking for \"\$1\" in log file"
48 if grep --quiet "\$1" /tmp/${BUNDLEFOLDER}/data/log/karaf.log; then
49 echo ABORTING: found "\$1"
50 echo "Dumping Karaf log..."
51 cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
56 exit_on_log_file_message 'BindException: Address already in use'
57 exit_on_log_file_message 'server is unhealthy'
61 for i in `seq 1 ${NUM_ODL_SYSTEM}`
63 CONTROLLERIP=ODL_SYSTEM_${i}_IP
64 echo "Verifying member-${i} with IP address ${!CONTROLLERIP} is UP"
65 scp ${WORKSPACE}/verify-cluster-is-up.sh ${!CONTROLLERIP}:/tmp
66 ssh ${!CONTROLLERIP} "bash /tmp/verify-cluster-is-up.sh ${i} ${!CONTROLLERIP}"
69 echo "Cool down for 1 min :)..."
72 echo "Changing the testplan path..."
73 cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt
76 SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' )
78 echo "Generating controller variables..."
79 for i in `seq 1 ${NUM_ODL_SYSTEM}`
81 CONTROLLERIP=ODL_SYSTEM_${i}_IP
82 odl_variables=${odl_variables}" -v ${CONTROLLERIP}:${!CONTROLLERIP}"
85 echo "Generating mininet variables..."
86 for i in `seq 1 ${NUM_TOOLS_SYSTEM}`
88 MININETIP=TOOLS_SYSTEM_${i}_IP
89 tools_variables=${tools_variables}" -v ${MININETIP}:${!MININETIP}"
92 echo "Starting Robot test suites ${SUITES} ..."
93 pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
94 -v CONTROLLER:${ODL_SYSTEM_IP} -v CONTROLLER1:${ODL_SYSTEM_2_IP} -v CONTROLLER2:${ODL_SYSTEM_3_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
95 ${odl_variables} -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} -v CONTROLLER_USER:${USER} -v ODL_SYSTEM_USER:${USER} -v \
96 TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} ${tools_variables} -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} -v TOOLS_SYSTEM_USER:${USER} \
97 -v MININET:${TOOLS_SYSTEM_IP} -v MININET1:${TOOLS_SYSTEM_2_IP} -v MININET2:${TOOLS_SYSTEM_3_IP} -v MININET_USER:${USER} \
98 -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
100 echo "Remove any Karaf log"
101 rm -f controller?-karaf.log
103 echo "Fetching Karaf log"
104 for i in `seq 1 ${NUM_ODL_SYSTEM}`
106 CONTROLLERIP=ODL_SYSTEM_${i}_IP
107 scp ${!CONTROLLERIP}:/tmp/$BUNDLEFOLDER/data/log/karaf.log controller${i}-karaf.log
110 # vim: ts=4 sw=4 sts=4 et ft=sh :