2 ACTUALFEATURES="odl-integration-all"
4 echo "Kill any controller running"
5 ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
10 echo "Downloading the distribution..."
11 wget --progress=dot:mega "${ACTUAL_BUNDLE_URL}"
13 echo "Extracting the new controller..."
16 echo "Configuring the startup features..."
17 FEATURESCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg"
18 # Add test feature repo if Karaf 4.
19 sed -ie "s%mvn:org.opendaylight.integration/features-index/${BUNDLEVERSION}/xml/features%mvn:org.opendaylight.integration/features-index/${BUNDLEVERSION}/xml/features,mvn:org.opendaylight.integration/features-test/${BUNDLEVERSION}/xml/features%g" "${FEATURESCONF}"
20 # Add test feature repo if Karaf 3.
21 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}"
22 # Feature is instaled later.
25 echo "Configuring the log..."
26 LOGCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg"
27 sed -ie 's/log4j.appender.out.maxBackupIndex=10/log4j.appender.out.maxBackupIndex=1/g' "${LOGCONF}"
28 # FIXME: Make log size limit configurable from build parameter.
29 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=30GB/g' "${LOGCONF}"
32 echo "Configure the repos..."
33 REPOCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.url.mvn.cfg"
34 sed -ie '/http/d' "${REPOCONF}"
35 sed -ie '$s/...$//' "${REPOCONF}"
38 echo "Configure max memory..."
39 MEMCONF="${WORKSPACE}/${BUNDLEFOLDER}/bin/setenv"
40 sed -ie "s/2048m/${CONTROLLERMEM}/g" "${MEMCONF}"
43 if [ "${JDKVERSION}" == 'openjdk8' ]; then
44 echo "Setting the JRE Version to 8"
45 # dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start.
46 # sudo /usr/sbin/alternatives --set java /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.60-2.b27.el7_1.x86_64/jre/bin/java
47 export JAVA_HOME='/usr/lib/jvm/java-1.8.0'
48 elif [ "${JDKVERSION}" == 'openjdk7' ]; then
49 echo "Setting the JRE Version to 7"
50 # dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start.
51 # sudo /usr/sbin/alternatives --set java /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85-2.6.1.2.el7_1.x86_64/jre/bin/java
52 export JAVA_HOME='/usr/lib/jvm/java-1.7.0'
54 readlink -e "${JAVA_HOME}/bin/java"
55 echo "Default JDK Version, JAVA_HOME should override"
58 echo "Redirecting karaf console output to karaf_console.log"
59 export KARAF_REDIRECT="${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log"
61 echo "Starting controller..."
62 ${WORKSPACE}/${BUNDLEFOLDER}/bin/start
64 echo "Waiting for controller to come up..."
65 # Silence the chatty output during the loop.
68 # Bug 9044 workaround: use bin/client instead of Linux ssh command.
69 CLIENT="${WORKSPACE}/${BUNDLEFOLDER}/bin/client"
71 # Is there a way to both print output and store RC without manipulating the e flag?
73 ${CLIENT} "feature:list -i"
76 if [[ "${RC}" == "0" ]]; then
79 elif (( "${COUNT}" > 600 )); then
80 echo Timeout Karaf DOWN
81 echo "Dumping Karaf log..."
82 cat "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"
83 echo "Listing all open ports on controller system"
88 COUNT=$(( ${COUNT} + 1 ))
90 if [[ $(($COUNT % 5)) == 0 ]]; then
91 echo already waited ${COUNT} seconds...
95 # Un-silence the chatty output.
98 echo "Installing all features..."
99 $CLIENT feature:install ${ACTUALFEATURES} || echo $? > "${WORKSPACE}/error.txt"
101 echo "killing karaf process..."
102 ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
105 echo "Fetching Karaf logs"
106 # TODO: Move instead of copy? Gzip?
107 cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" .
108 cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" .
111 if [ -f "${WORKSPACE}/error.txt" ]; then
112 echo "Failed to deploy offline"
115 echo "Offline test: PASS"
118 # vim: ts=4 sw=4 sts=4 et ft=sh :