1 NEXUSURL_PREFIX=${ODLNEXUSPROXY:-https://nexus.opendaylight.org}
4 if [ ${CONTROLLERSCOPE} == 'all' ]; then
5 ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}"
8 ACTUALFEATURES="${CONTROLLERFEATURES}"
11 if [ ${BUNDLEURL} == 'last' ]; then
12 NEXUSPATH="${NEXUSURL_PREFIX}/content/repositories/opendaylight.snapshot/org/opendaylight/integration/distribution-karaf"
13 # Extract the BUNDLEVERSION from the pom.xml
14 BUNDLEVERSION=`xpath pom.xml '/project/version/text()' 2> /dev/null`
15 echo "Bundle version is ${BUNDLEVERSION}"
16 # Acquire the timestamp information from maven-metadata.xml
17 wget ${NEXUSPATH}/${BUNDLEVERSION}/maven-metadata.xml
18 TIMESTAMP=`xpath maven-metadata.xml "//snapshotVersion[extension='zip'][1]/value/text()" 2>/dev/null`
19 echo "Nexus timestamp is ${TIMESTAMP}"
20 BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
21 BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
22 ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
24 ACTUALBUNDLEURL="${BUNDLEURL}"
25 BUNDLE="${BUNDLEURL##*/}"
26 BUNDLEVERSION="$(basename $(dirname $BUNDLEURL))"
27 BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
30 echo "Distribution bundle URL is ${ACTUALBUNDLEURL}"
31 echo "Distribution bundle is ${BUNDLE}"
32 echo "Distribution bundle version is ${BUNDLEVERSION}"
33 echo "Distribution folder is ${BUNDLEFOLDER}"
34 echo "Nexus prefix is ${NEXUSURL_PREFIX}"
36 cat > ${WORKSPACE}/controller-script.sh <<EOF
38 echo "Changing to /tmp"
41 echo "Downloading the distribution..."
42 wget --no-verbose '${ACTUALBUNDLEURL}'
44 echo "Extracting the new controller..."
47 echo "Configuring the startup features..."
48 FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
49 sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
50 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}
53 echo "Configuring the log..."
54 LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
55 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/g' \${LOGCONF}
58 echo "Configure max memory..."
59 MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv
60 sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' \${MEMCONF}
63 echo "Starting controller..."
64 /tmp/${BUNDLEFOLDER}/bin/start
66 echo "Waiting for controller to come up..."
69 RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
71 if [[ \$RESP == *"200"* ]]; then
74 elif (( "\$COUNT" > "600" )); then
75 echo Timeout Controller DOWN
76 echo "Dumping Karaf log..."
77 cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
80 COUNT=\$(( \${COUNT} + 5 ))
82 echo waiting \$COUNT secs...
86 echo "Cool down for 1 min :)..."
89 echo "Checking OSGi bundles..."
90 sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
94 scp ${WORKSPACE}/controller-script.sh ${CONTROLLER0}:/tmp
95 ssh ${CONTROLLER0} 'bash /tmp/controller-script.sh'
97 echo "Changing the testplan path..."
98 cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt
101 SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' )
103 echo "Starting Robot test suites ${SUITES} ..."
104 pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \
105 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} -v CONTROLLER:${CONTROLLER0} \
106 -v MININET:${MININET0} -v MININET_USER:${USER} -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
108 echo "Fetching Karaf log"
109 scp ${CONTROLLER0}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log .
111 # vim: ts=4 sw=4 sts=4 et ft=sh :