2 ACTUALFEATURES="odl-integration-all"
3 BUNDLEVERSION=`xpath distribution/pom.xml '/project/version/text()' 2> /dev/null`
4 BUNDLEFOLDER="distribution-karaf-${BUNDLEVERSION}"
5 BUNDLE="${BUNDLEFOLDER}.zip"
6 BUNDLEURL="/tmp/r/org/opendaylight/integration/distribution-karaf/${BUNDLEVERSION}/${BUNDLE}"
8 echo "Kill any controller running"
9 ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
11 echo "Clean workspace"
14 echo "Copying the distribution..."
17 echo "Extracting the new controller..."
20 echo "Configuring the startup features..."
21 FEATURESCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
22 sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" ${FEATURESCONF}
23 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}
26 echo "Configuring the log..."
27 LOGCONF=${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
28 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/g' ${LOGCONF}
31 echo "Configure max memory..."
32 MEMCONF=${WORKSPACE}/${BUNDLEFOLDER}/bin/setenv
33 sed -ie "s/2048m/${CONTROLLERMEM}/g" ${MEMCONF}
36 echo "Listing all open ports on controller system"
39 echo "redirected karaf console output to karaf_console.log"
40 export KARAF_REDIRECT=${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log
42 echo "JDK Version ..."
45 echo "Starting controller..."
46 ${WORKSPACE}/${BUNDLEFOLDER}/bin/start
48 echo "Waiting for controller to come up..."
51 RESP="$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null || true )"
53 if [[ ${RESP} == *"200"* ]]; then
56 elif (( ${COUNT} > 600 )); then
57 echo Timeout Controller DOWN
58 echo "Dumping Karaf log..."
59 cat ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
60 echo "Listing all open ports on controller system"
64 COUNT=$(( ${COUNT} + 5 ))
66 echo waiting ${COUNT} secs...
70 echo "loading many features at once. Need to allow time for problems to show up in logs. cool down for 5 min ..."
73 echo "Checking OSGi bundles..."
74 sshpass -p karaf ${WORKSPACE}/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
76 echo "Listing all open ports on controller system"
79 function exit_on_log_file_message {
80 echo "looking for \"$1\" in karaf.log file"
81 if grep --quiet "$1" ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log; then
82 echo ABORTING: found "$1"
83 echo "Dumping first 500K bytes of karaf log..."
84 head --bytes=500K ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
85 echo "Dumping last 500K bytes of karaf log..."
86 tail --bytes=500K ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log
87 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log .
88 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log .
92 echo "looking for \"$1\" in karaf_console.log file"
93 if grep --quiet "$1" ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log; then
94 echo ABORTING: found "$1"
95 echo "Dumping first 500K bytes of karaf log..."
96 head --bytes=500K ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log
97 echo "Dumping last 500K bytes of karaf log..."
98 tail --bytes=500K ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log
99 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log .
100 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log .
105 exit_on_log_file_message 'BindException: Address already in use'
106 exit_on_log_file_message 'server is unhealthy'
108 echo "Fetching Karaf logs"
109 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log .
110 cp ${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log .
112 echo "Kill controller"
113 ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
115 echo "Detecting misplaced config files"
116 pushd "${WORKSPACE}/${BUNDLEFOLDER}"
117 XMLS_FOUND=`echo *.xml`
119 if [ "$XMLS_FOUND" != "*.xml" ]; then
120 echo "Bug 4628 confirmed."
121 ## TODO: Uncomment the following when ODL is fixed, to guard against regression.
124 echo "Bug 4628 not detected."
127 # vim: ts=4 sw=4 sts=4 et ft=sh :