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
9 if [ ${CONTROLLERSCOPE} == 'all' ]; then
10 ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}"
13 ACTUALFEATURES="${CONTROLLERFEATURES}"
16 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
17 echo "scriptplan exists!!!"
18 echo "Changing the scriptplan path..."
19 cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
21 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
22 echo "Executing ${line}..."
27 cat > ${WORKSPACE}/controller-script.sh <<EOF
29 echo "Changing to /tmp"
32 echo "Downloading the distribution..."
33 wget --no-verbose '${ACTUALBUNDLEURL}'
35 echo "Extracting the new controller..."
38 echo "Configuring the startup features..."
39 FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
40 sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
41 sed -ie "s%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features%mvn:org.opendaylight.integration/features-integration-index/${BUNDLEVERSION}/xml/features,mvn:org.opendaylight.integration/features-integration-test/${BUNDLEVERSION}/xml/features%g" \${FEATURESCONF}
44 echo "Configuring the log..."
45 LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
46 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/g' \${LOGCONF}
49 echo "Configure max memory..."
50 MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv
51 sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' \${MEMCONF}
54 echo "Listing all open ports on controller system"
57 echo "Starting controller..."
58 /tmp/${BUNDLEFOLDER}/bin/start
60 echo "Waiting for controller to come up..."
63 RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
65 if [[ \$RESP == *"200"* ]]; then
68 elif (( "\$COUNT" > "600" )); then
69 echo Timeout Controller DOWN
70 echo "Dumping Karaf log..."
71 cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
72 echo "Listing all open ports on controller system"
76 COUNT=\$(( \${COUNT} + 5 ))
78 echo waiting \$COUNT secs...
82 echo "Cool down for 1 min :)..."
85 echo "Checking OSGi bundles..."
86 sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
88 echo "Listing all open ports on controller system"
91 function exit_on_log_file_message {
92 echo "looking for \"\$1\" in log file"
93 if grep --quiet "\$1" /tmp/${BUNDLEFOLDER}/data/log/karaf.log; then
94 echo ABORTING: found "\$1"
95 echo "Dumping Karaf log..."
96 cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
101 exit_on_log_file_message 'BindException: Address already in use'
102 exit_on_log_file_message 'server is unhealthy'
106 scp ${WORKSPACE}/controller-script.sh ${ODL_SYSTEM_IP}:/tmp
107 ssh ${ODL_SYSTEM_IP} 'bash /tmp/controller-script.sh'
109 echo "Changing the testplan path..."
110 cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt
113 SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' )
115 echo "Starting Robot test suites ${SUITES} ..."
116 pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \
117 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
118 -v CONTROLLER:${ODL_SYSTEM_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} -v CONTROLLER_USER:${USER} -v ODL_SYSTEM_USER:${USER} \
119 -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} \
120 -v TOOLS_SYSTEM_USER:${USER} \
121 -v MININET:${TOOLS_SYSTEM_IP} -v MININET1:${TOOLS_SYSTEM_2_IP} -v MININET2:${TOOLS_SYSTEM_3_IP} -v MININET_USER:${USER} \
122 -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
124 echo "Fetching Karaf log"
125 scp ${ODL_SYSTEM_IP}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log .
127 # vim: ts=4 sw=4 sts=4 et ft=sh :