Create Oxygen jobs and bump Nitrogen branch
[releng/builder.git] / jjb / integration / include-raw-integration-configure-clustering.sh
index bdb4eb2f752ed61ba41eb5f3747b1e5ecbc0f276..9568c3688129b1b5c73049370c3c88581e7a210f 100644 (file)
@@ -1,3 +1,10 @@
+#@IgnoreInspection BashAddShebang
+# Activate robotframework virtualenv
+# ${ROBOT_VENV} comes from the include-raw-integration-install-robotframework.sh
+# script.
+# shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091
+source ${ROBOT_VENV}/bin/activate
+
 echo "#################################################"
 echo "##         Configure Cluster and Start         ##"
 echo "#################################################"
@@ -5,7 +12,6 @@ echo "#################################################"
 AKKACONF=/tmp/${BUNDLEFOLDER}/configuration/initial/akka.conf
 MODULESCONF=/tmp/${BUNDLEFOLDER}/configuration/initial/modules.conf
 MODULESHARDSCONF=/tmp/${BUNDLEFOLDER}/configuration/initial/module-shards.conf
-BGPCONF=/tmp/${BUNDLEFOLDER}/system/org/opendaylight/bgpcep/bgp-controller-config/*/bgp-controller-config-*-config-example.xml
 CONTROLLERMEM="2048m"
 
 if [ ${CONTROLLERSCOPE} == 'all' ]; then
@@ -23,7 +29,7 @@ function join {
     delim=' '
     final=$1; shift
 
-    for str in $* ; do
+    for str in "$@" ; do
         final=${final}${delim}${str}
     done
 
@@ -36,7 +42,7 @@ for i in `seq 1 ${NUM_ODL_SYSTEM}` ; do
     nodes[$i]=${!CONTROLLERIP}
 done
 
-nodes_list=$(join ${nodes[@]})
+nodes_list=$(join "${nodes[@]}")
 
 echo ${nodes_list}
 
@@ -58,8 +64,8 @@ cat > ${WORKSPACE}/configuration-script.sh <<EOF
 echo "Changing to /tmp"
 cd /tmp
 
-echo "Downloading the distribution from ${ACTUALBUNDLEURL}"
-wget --progress=dot:mega  '${ACTUALBUNDLEURL}'
+echo "Downloading the distribution from ${ACTUAL_BUNDLE_URL}"
+wget --progress=dot:mega  '${ACTUAL_BUNDLE_URL}'
 
 echo "Extracting the new controller..."
 unzip -q ${BUNDLE}
@@ -67,7 +73,7 @@ unzip -q ${BUNDLE}
 echo "Configuring the startup features..."
 FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
 CUSTOMPROP=/tmp/${BUNDLEFOLDER}/etc/custom.properties
-sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
+sed -ie "s/\(featuresBoot=\|featuresBoot =\)/featuresBoot = ${ACTUALFEATURES},/g" \${FEATURESCONF}
 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,mvn:org.apache.karaf.decanter/apache-karaf-decanter/1.0.0/xml/features%g" \${FEATURESCONF}
 cat \${FEATURESCONF}
 
@@ -112,14 +118,6 @@ fi
 echo "Configuring cluster"
 /tmp/${BUNDLEFOLDER}/bin/configure_cluster.sh \$1 ${nodes_list}
 
-echo "Update bgp configuration in 41-bgp-example.xml"
-sed -i -e "s/<topology-id>example-ipv4-topology/<topology-id>example-ipv4-topology-\$1/g" ${BGPCONF}
-sed -i -e "s/<topology-id>example-ipv6-topology/<topology-id>example-ipv6-topology-\$1/g" ${BGPCONF}
-sed -i -e "s/<topology-id>example-linkstate-topology/<topology-id>example-linkstate-topology-\$1/g" ${BGPCONF}
-
-echo "Dump ${BGPCONF}"
-cat ${BGPCONF}
-
 echo "Dump akka.conf"
 cat ${AKKACONF}
 
@@ -134,6 +132,9 @@ EOF
 # Create the startup script to be run on controllers.
 cat > ${WORKSPACE}/startup-script.sh <<EOF
 
+echo "Redirecting karaf console output to karaf_console.log"
+export KARAF_REDIRECT="/tmp/${BUNDLEFOLDER}/data/log/karaf_console.log"
+
 echo "Starting controller..."
 /tmp/${BUNDLEFOLDER}/bin/start
 
@@ -150,10 +151,15 @@ do
 done
 
 # Run config plan in case it exists
-if [ -f ${WORKSPACE}/test/csit/configplans/${TESTPLAN} ]; then
+configplan_filepath="${WORKSPACE}/test/csit/configplans/${STREAMTESTPLAN}"
+if [ ! -f "${configplan_filepath}" ]; then
+    configplan_filepath="${WORKSPACE}/test/csit/configplans/${TESTPLAN}"
+fi
+
+if [ -f ${configplan_filepath} ]; then
     echo "configplan exists!!!"
     echo "Reading the configplan:"
-    cat ${WORKSPACE}/test/csit/configplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > configplan.txt
+    cat ${configplan_filepath} | sed "s:integration:${WORKSPACE}:" > configplan.txt
     cat configplan.txt
     for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
         echo "Executing ${line}..."