2 ACTUALFEATURES="odl-integration-all"
4 if [[ ! -z "${CONTROLLERFEATURES}" ]]; then
5 ACTUALFEATURES="odl-integration-all,${CONTROLLERFEATURES}"
8 echo "Kill any controller running"
9 ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
11 echo "Clean Existing distribution"
12 rm -rf ${BUNDLEFOLDER}
14 echo "Fetch the distribution..."
15 if [[ -z "${BUNDLE_PATH}" ]]; then
16 wget --progress=dot:mega "${ACTUAL_BUNDLE_URL}"
21 echo "Extracting the new controller..."
24 echo "Configuring the startup features..."
25 FEATURESCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg"
26 FEATURE_TEST_STRING="features-test"
27 if [[ "$KARAF_VERSION" == "karaf3" ]]; then
28 FEATURE_TEST_STRING="features-integration-test"
31 sed -ie "s%\(featuresRepositories= \|featuresRepositories = \)%featuresRepositories = mvn:org.opendaylight.integration/${FEATURE_TEST_STRING}/${BUNDLE_VERSION}/xml/features,%g" ${FEATURESCONF}
33 if [[ ! -z "${REPO_URL}" ]]; then
34 sed -ie "s%featuresRepositories = %featuresRepositories = ${REPO_URL},%g" ${FEATURESCONF}
37 # Add actual boot features.
38 sed -ie "s/\(featuresBoot= \|featuresBoot = \)/featuresBoot = ${ACTUALFEATURES},/g" "${FEATURESCONF}"
41 echo "Configuring the log..."
42 LOGCONF="${WORKSPACE}/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg"
43 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/g' "${LOGCONF}"
46 echo "Configure max memory..."
47 MEMCONF="${WORKSPACE}/${BUNDLEFOLDER}/bin/setenv"
48 sed -ie "s/2048m/${CONTROLLERMEM}/g" "${MEMCONF}"
51 echo "Listing all open ports on controller system"
54 if [ "${JDKVERSION}" == 'openjdk8' ]; then
55 echo "Setting the JRE Version to 8"
56 # dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start.
57 # 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
58 export JAVA_HOME='/usr/lib/jvm/java-1.8.0'
59 elif [ "${JDKVERSION}" == 'openjdk7' ]; then
60 echo "Setting the JRE Version to 7"
61 # dynamic_verify does not allow sudo, JAVA_HOME should be enough for karaf start.
62 # 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
63 export JAVA_HOME='/usr/lib/jvm/java-1.7.0'
65 readlink -e "${JAVA_HOME}/bin/java"
66 echo "JDK Version should be overriden by JAVA_HOME"
69 echo "Redirecting karaf console output to karaf_console.log"
70 export KARAF_REDIRECT="${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log"
71 mkdir -p ${WORKSPACE}/${BUNDLEFOLDER}/data/log
73 echo "Starting controller..."
74 ${WORKSPACE}/${BUNDLEFOLDER}/bin/start
76 function dump_log_and_exit {
77 echo "Dumping first 500K bytes of karaf log..."
78 head --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"
79 echo "Dumping last 500K bytes of karaf log..."
80 tail --bytes=500K "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"
81 cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" .
82 cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" .
86 echo "Waiting up to 5 minutes for controller to come up, checking every 5 seconds..."
89 COUNT=$(( ${COUNT} + 5 ))
91 echo "already waited ${COUNT} seconds..."
92 if grep --quiet 'org.opendaylight.infrautils.ready-impl.*System ready' "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"; then
93 echo "Controller is UP"
95 elif (( "${COUNT}" > "300" )); then
96 echo "Timeout Controller DOWN"
101 # echo "Checking OSGi bundles..."
102 # sshpass seems to fail with new karaf version
103 # sshpass -p karaf ${WORKSPACE}/${BUNDLEFOLDER}/bin/client -u karaf 'bundle:list'
105 echo "Listing all open ports on controller system"
108 function exit_on_log_file_message {
109 echo "looking for \"$1\" in karaf.log file"
110 if grep --quiet "$1" "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log"; then
111 echo ABORTING: found "$1"
115 echo "looking for \"$1\" in karaf_console.log file"
116 if grep --quiet "$1" "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log"; then
117 echo ABORTING: found "$1"
122 exit_on_log_file_message 'Error installing boot feature repository'
123 exit_on_log_file_message 'BindException: Address already in use'
124 exit_on_log_file_message 'server is unhealthy'
126 echo "Fetching Karaf logs"
127 # TODO: Move instead of copy? Gzip?
128 cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf.log" .
129 cp "${WORKSPACE}/${BUNDLEFOLDER}/data/log/karaf_console.log" .
131 echo "Kill controller"
132 ps axf | grep karaf | grep -v grep | awk '{print "kill -9 " $1}' | sh
134 echo "Bug 4628: Detecting misplaced config files"
135 pushd "${WORKSPACE}/${BUNDLEFOLDER}" || exit
136 XMLS_FOUND="$(echo *.xml)"
138 if [ "$XMLS_FOUND" != "*.xml" ]; then
139 echo "Bug 4628 confirmed."
140 ## TODO: Uncomment the following when ODL is fixed, to guard against regression.
143 echo "Bug 4628 not detected."
146 # vim: ts=4 sw=4 sts=4 et ft=sh :