X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Fintegration-deploy-controller-run-test.sh;h=021161e61d6a10646aaf01618dba9d0eae810bc1;hb=211eaee50a24c864af8d355417a1897dc7fc56db;hp=49ccb96256c0fbcfd2e6ddc6ae9e20bca06e0585;hpb=1e619e808c5b58b6d0c929776128eb24c364b35c;p=releng%2Fbuilder.git diff --git a/jjb/integration/integration-deploy-controller-run-test.sh b/jjb/integration/integration-deploy-controller-run-test.sh index 49ccb9625..021161e61 100644 --- a/jjb/integration/integration-deploy-controller-run-test.sh +++ b/jjb/integration/integration-deploy-controller-run-test.sh @@ -4,12 +4,7 @@ # script. # shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091 source ${ROBOT_VENV}/bin/activate - -FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg -CUSTOMPROP=/tmp/${BUNDLEFOLDER}/etc/custom.properties -LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg -MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv -CONTROLLERMEM="2048m" +source /tmp/common-functions.sh ${BUNDLEFOLDER} if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then echo "Configure cluster" @@ -20,16 +15,20 @@ fi if [ ${CONTROLLERSCOPE} == 'all' ]; then ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}" - CONTROLLERMEM="3072m" - COOLDOWN_PERIOD="180" + export CONTROLLERMEM="3072m" else ACTUALFEATURES="odl-infrautils-ready,${CONTROLLERFEATURES}" - COOLDOWN_PERIOD="60" fi # Some versions of jenkins job builder result in feature list containing spaces # and ending in newline. Remove all that. ACTUALFEATURES=`echo "${ACTUALFEATURES}" | tr -d '\n \r'` +echo "ACTUALFEATURES: ${ACTUALFEATURES}" + +# In the case that we want to install features via karaf shell, a space separated list of +# ACTUALFEATURES IS NEEDED +SPACE_SEPARATED_FEATURES=$(echo "${ACTUALFEATURES}" | tr ',' ' ') +echo "SPACE_SEPARATED_FEATURES: ${SPACE_SEPARATED_FEATURES}" if [ -f "${WORKSPACE}/test/csit/scriptplans/${TESTPLAN}" ]; then echo "scriptplan exists!!!" @@ -44,6 +43,8 @@ if [ -f "${WORKSPACE}/test/csit/scriptplans/${TESTPLAN}" ]; then fi cat > ${WORKSPACE}/configuration-script.sh <> ${LOGCONF} -# Add custom logging levels -# CONTROLLERDEBUGMAP is expected to be a key:value map of space separated values like "module:level module2:level2" -# where module is abbreviated and does not include org.opendaylight -unset IFS -if [ -n "${CONTROLLERDEBUGMAP}" ]; then - for kv in ${CONTROLLERDEBUGMAP}; do - module=\${kv%%:*} - level=\${kv#*:} - if [ -n \${module} ] && [ -n \${level} ]; then - echo "log4j.logger.org.opendaylight.\${module} = \${level}" >> ${LOGCONF} - fi - done -fi -cat ${LOGCONF} +configure_karaf_log "${KARAF_VERSION}" "${CONTROLLERDEBUGMAP}" -echo "Configure java home and max memory..." -sed -ie 's%^# export JAVA_HOME%export JAVA_HOME="\${JAVA_HOME:-${JAVA_HOME}}"%g' ${MEMCONF} -sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' ${MEMCONF} -cat ${MEMCONF} +set_java_vars "${JAVA_HOME}" "${CONTROLLERMEM}" "${MEMCONF}" echo "Listing all open ports on controller system..." netstat -pnatu -echo "Set Java version" -sudo /usr/sbin/alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 1 -sudo /usr/sbin/alternatives --set java ${JAVA_HOME}/bin/java -echo "JDK default version..." -java -version - -echo "Set JAVA_HOME" -export JAVA_HOME="${JAVA_HOME}" -# Did you know that in HERE documents, single quote is an ordinary character, but backticks are still executing? -JAVA_RESOLVED=\`readlink -e "\${JAVA_HOME}/bin/java"\` -echo "Java binary pointed at by JAVA_HOME: \${JAVA_RESOLVED}" - if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then # Copy shard file if exists @@ -136,49 +111,74 @@ if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then fi EOF +# cat > ${WORKSPACE}/configuration-script.sh < ${WORKSPACE}/startup-script.sh < ${WORKSPACE}/startup-script.sh < ${WORKSPACE}/post-startup-script.sh < "600" )); then - echo Timeout Controller DOWN - echo "Dumping first 500K bytes of karaf log..." - head --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" - echo "Dumping last 500K bytes of karaf log..." - tail --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" - echo "Listing all open ports on controller system" - netstat -pnatu - exit 1 - else - COUNT=\$(( \${COUNT} + 1 )) - sleep 1 - if [[ \$((\$COUNT % 5)) == 0 ]]; then - echo already waited \${COUNT} seconds... - fi +if [[ "$USEFEATURESBOOT" != "True" ]]; then + + # wait up to 60s for karaf port 8101 to be opened, polling every 5s + loop_count=0; + until [[ \$loop_count -ge 12 ]]; do + netstat -na | grep 8101 && break; + loop_count=\$[\$loop_count+1]; + sleep 5; + done + + echo "going to feature:install --no-auto-refresh ${SPACE_SEPARATED_FEATURES} one at a time" + for feature in ${SPACE_SEPARATED_FEATURES}; do + sshpass -p karaf ssh -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + -o LogLevel=error \ + -p 8101 karaf@localhost \ + feature:install --no-auto-refresh \$feature; + done + + echo "ssh to karaf console to list -i installed features" + sshpass -p karaf ssh -o StrictHostKeyChecking=no \ + -o UserKnownHostsFile=/dev/null \ + -o LogLevel=error \ + -p 8101 karaf@localhost \ + feature:list -i +fi + +echo "Waiting up to 3 minutes for controller to come up, checking every 5 seconds..." +for i in {1..36}; + do sleep 5; + grep 'org.opendaylight.infrautils.ready-impl.*System ready' /tmp/${BUNDLEFOLDER}/data/log/karaf.log + if [ \$? -eq 0 ] + then + echo "Controller is UP" + break fi -done +done; + +# if we ended up not finding ready status in the above loop, we can output some debugs +grep 'org.opendaylight.infrautils.ready-impl.*System ready' /tmp/${BUNDLEFOLDER}/data/log/karaf.log +if [ $? -ne 0 ] +then + echo "Timeout Controller DOWN" + echo "Dumping first 500K bytes of karaf log..." + head --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" + echo "Dumping last 500K bytes of karaf log..." + tail --bytes=500K "/tmp/${BUNDLEFOLDER}/data/log/karaf.log" + echo "Listing all open ports on controller system" + netstat -pnatu + exit 1 +fi echo "Listing all open ports on controller system..." netstat -pnatu @@ -199,6 +199,7 @@ exit_on_log_file_message 'BindException: Address already in use' exit_on_log_file_message 'server is unhealthy' EOF +# cat > ${WORKSPACE}/post-startup-script.sh < ${WORKSPACE}/karaf_${i}_threads_before.log || true + ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_before.log + pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_before.log | grep -v grep | tr -s ' ' | cut -f2 -d' ') + echo "karaf main: org.apache.karaf.main.Main, pid:${pid}" + ssh ${!CONTROLLERIP} "jstack ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_before.log || true done if [ ${NUM_OPENSTACK_SYSTEM} -gt 0 ]; then @@ -295,20 +295,59 @@ fi echo "Changing the testplan path..." cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt cat testplan.txt -SUITES=$( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' ' ) + +# Use the testplan if specific SUITES are not defined. +if [ -z "${SUITES}" ]; then + SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '` +else + newsuites="" + workpath="${WORKSPACE}/test/csit/suites" + for suite in ${SUITES}; do + fullsuite="${workpath}/${suite}" + if [ -z "${newsuites}" ]; then + newsuites+=${fullsuite} + else + newsuites+=" "${fullsuite} + fi + done + SUITES=${newsuites} +fi echo "Starting Robot test suites ${SUITES} ..." -pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude -e skip_if_${DISTROSTREAM} -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \ --v JAVA_HOME:${JAVA_HOME} -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \ --v CONTROLLER:${ODL_SYSTEM_IP} -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_IP} \ --v CONTROLLER_USER:${USER} -v ODL_SYSTEM_USER:${USER} \ --v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} -v TOOLS_SYSTEM_3_IP:${TOOLS_SYSTEM_3_IP} \ --v TOOLS_SYSTEM_4_IP:${TOOLS_SYSTEM_4_IP} -v TOOLS_SYSTEM_5_IP:${TOOLS_SYSTEM_5_IP} -v TOOLS_SYSTEM_6_IP:${TOOLS_SYSTEM_6_IP} \ --v TOOLS_SYSTEM_USER:${USER} -v JDKVERSION:${JDKVERSION} -v ODL_STREAM:${DISTROSTREAM} -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \ --v MININET:${TOOLS_SYSTEM_IP} -v MININET1:${TOOLS_SYSTEM_2_IP} -v MININET2:${TOOLS_SYSTEM_3_IP} \ --v MININET3:${TOOLS_SYSTEM_4_IP} -v MININET4:${TOOLS_SYSTEM_5_IP} -v MININET5:${TOOLS_SYSTEM_6_IP} \ --v MININET_USER:${USER} -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true -# FIXME: Sort (at least -v) options alphabetically. +pybot -N ${TESTPLAN} \ + --removekeywords wuks -c critical -e exclude -e skip_if_${DISTROSTREAM} \ + -v BUNDLEFOLDER:${BUNDLEFOLDER} \ + -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} \ + -v CONTROLLER:${ODL_SYSTEM_IP} \ + -v CONTROLLER_USER:${USER} \ + -v JAVA_HOME:${JAVA_HOME} \ + -v JDKVERSION:${JDKVERSION} \ + -v JENKINS_WORKSPACE:${WORKSPACE} \ + -v MININET1:${TOOLS_SYSTEM_2_IP} \ + -v MININET2:${TOOLS_SYSTEM_3_IP} \ + -v MININET3:${TOOLS_SYSTEM_4_IP} \ + -v MININET4:${TOOLS_SYSTEM_5_IP} \ + -v MININET5:${TOOLS_SYSTEM_6_IP} \ + -v MININET:${TOOLS_SYSTEM_IP} \ + -v MININET_USER:${USER} \ + -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \ + -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \ + -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \ + -v ODL_STREAM:${DISTROSTREAM} \ + -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_IP} \ + -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \ + -v ODL_SYSTEM_USER:${USER} \ + -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_IP} \ + -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \ + -v TOOLS_SYSTEM_3_IP:${TOOLS_SYSTEM_3_IP} \ + -v TOOLS_SYSTEM_4_IP:${TOOLS_SYSTEM_4_IP} \ + -v TOOLS_SYSTEM_5_IP:${TOOLS_SYSTEM_5_IP} \ + -v TOOLS_SYSTEM_6_IP:${TOOLS_SYSTEM_6_IP} \ + -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} \ + -v TOOLS_SYSTEM_USER:${USER} \ + -v USER_HOME:${HOME} \ + -v WORKSPACE:/tmp \ + ${TESTOPTIONS} ${SUITES} || true echo "Examining the files in data/log and checking filesize" ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/" @@ -318,8 +357,10 @@ for i in `seq 1 ${NUM_ODL_SYSTEM}` do CONTROLLERIP=ODL_SYSTEM_${i}_IP echo "Lets's take the karaf thread dump again..." - KARAF_PID=$(ssh ${!CONTROLLERIP} "ps aux | grep ${KARAF_ARTIFACT} | grep -v grep | tr -s ' ' | cut -f2 -d' '") - ssh ${!CONTROLLERIP} "jstack $KARAF_PID"> ${WORKSPACE}/karaf_${i}_threads_after.log || true + ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_after.log + pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_after.log | grep -v grep | tr -s ' ' | cut -f2 -d' ') + echo "karaf main: org.apache.karaf.main.Main, pid:${pid}" + ssh ${!CONTROLLERIP} "jstack ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_after.log || true echo "Killing ODL" set +e # We do not want to create red dot just because something went wrong while fetching logs. ssh "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'