1 export 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 export BUNDLEVERSION=`xpath distribution/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 export BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
21 export BUNDLE="distribution-karaf-${TIMESTAMP}.zip"
22 export ACTUALBUNDLEURL="${NEXUSPATH}/${BUNDLEVERSION}/${BUNDLE}"
24 export ACTUALBUNDLEURL="${BUNDLEURL}"
25 export BUNDLE="${BUNDLEURL##*/}"
26 export BUNDLEVERSION="$(basename $(dirname $BUNDLEURL))"
27 export 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 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
37 echo "scriptplan exists!!!"
38 echo "Changing the scriptplan path..."
39 cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
41 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
42 echo "Executing ${line}..."
47 cat > ${WORKSPACE}/controller-script.sh <<EOF
49 echo "Changing to /tmp"
52 echo "Downloading the distribution..."
53 wget --no-verbose '${ACTUALBUNDLEURL}'
55 echo "Extracting the new controller..."
58 echo "Configuring the startup features..."
59 FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
60 sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
61 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}
64 echo "Configuring the log..."
65 LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
66 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/g' \${LOGCONF}
69 echo "Configure max memory..."
70 MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv
71 sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' \${MEMCONF}
74 echo "Starting controller..."
75 /tmp/${BUNDLEFOLDER}/bin/start
77 echo "Waiting for controller to come up..."
80 RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
82 if [[ \$RESP == *"200"* ]]; then
85 elif (( "\$COUNT" > "600" )); then
86 echo Timeout Controller DOWN
87 echo "Dumping Karaf log..."
88 cat /tmp/${BUNDLEFOLDER}/data/log/karaf.log
91 COUNT=\$(( \${COUNT} + 5 ))
93 echo waiting \$COUNT secs...
97 echo "Cool down for 1 min :)..."
100 echo "Checking OSGi bundles..."
101 sshpass -p karaf /tmp/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
105 scp ${WORKSPACE}/controller-script.sh ${CONTROLLER0}:/tmp
106 ssh ${CONTROLLER0} 'bash /tmp/controller-script.sh'
108 echo "Changing the testplan path..."
109 cat ${WORKSPACE}/test/csit/testplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > testplan.txt
112 SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' )
114 echo "Starting Robot test suites ${SUITES} ..."
115 pybot -N ${TESTPLAN} -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \
116 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} -v CONTROLLER:${CONTROLLER0} -v CONTROLLER_USER:${USER} \
117 -v MININET:${MININET0} -v MININET1:${MININET1} -v MININET2:${MININET2} -v MININET_USER:${USER} \
118 -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
120 echo "Fetching Karaf log"
121 scp ${CONTROLLER0}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log .
123 # vim: ts=4 sw=4 sts=4 et ft=sh :