1 #@IgnoreInspection BashAddShebang
2 # Activate robotframework virtualenv
3 # ${ROBOT_VENV} comes from the integration-install-robotframework.sh
5 # shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091
6 source ${ROBOT_VENV}/bin/activate
8 echo "#################################################"
9 echo "## Configure Cluster and Start ##"
10 echo "#################################################"
12 if [ ${CONTROLLERSCOPE} == 'all' ]; then
13 ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}"
14 export CONTROLLERMEM="3072m"
16 ACTUALFEATURES="odl-infrautils-ready,${CONTROLLERFEATURES}"
18 # Some versions of jenkins job builder result in feature list containing spaces
19 # and ending in newline. Remove all that.
20 ACTUALFEATURES=`echo "${ACTUALFEATURES}" | tr -d '\n \r'`
22 # Utility function for joining strings.
28 final=${final}${delim}${str}
34 # Create the string for nodes
35 for i in `seq 1 ${NUM_ODL_SYSTEM}` ; do
36 CONTROLLERIP=ODL_SYSTEM_${i}_IP
37 nodes[$i]=${!CONTROLLERIP}
40 nodes_list=$(join "${nodes[@]}")
44 # Run script plan in case it exists
45 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
46 echo "scriptplan exists!!!"
47 echo "Reading the scriptplan:"
48 cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
50 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
51 echo "Executing ${line}..."
56 # Create the configuration script to be run on controllers.
57 cat > ${WORKSPACE}/configuration-script.sh <<EOF
59 echo "Changing to /tmp"
62 echo "Downloading the distribution from ${ACTUAL_BUNDLE_URL}"
63 wget --progress=dot:mega '${ACTUAL_BUNDLE_URL}'
65 echo "Extracting the new controller..."
68 echo "Adding external repositories..."
69 sed -ie "s%org.ops4j.pax.url.mvn.repositories=%org.ops4j.pax.url.mvn.repositories=http://repo1.maven.org/maven2@id=central, http://repository.springsource.com/maven/bundles/release@id=spring.ebr.release, http://repository.springsource.com/maven/bundles/external@id=spring.ebr.external, http://zodiac.springsource.com/maven/bundles/release@id=gemini, http://repository.apache.org/content/groups/snapshots-group@id=apache@snapshots@noreleases, https://oss.sonatype.org/content/repositories/snapshots@id=sonatype.snapshots.deploy@snapshots@noreleases, https://oss.sonatype.org/content/repositories/ops4j-snapshots@id=ops4j.sonatype.snapshots.deploy@snapshots@noreleases%g" ${MAVENCONF}
72 echo "Configuring the startup features..."
73 sed -ie "s/\(featuresBoot=\|featuresBoot =\)/featuresBoot = ${ACTUALFEATURES},/g" ${FEATURESCONF}
75 FEATURE_TEST_STRING="features-integration-test"
76 if [[ "$KARAF_VERSION" == "karaf4" ]]; then
77 FEATURE_TEST_STRING="features-test"
80 sed -ie "s%\(featuresRepositories=\|featuresRepositories =\)%featuresRepositories = mvn:org.opendaylight.integration/\${FEATURE_TEST_STRING}/${BUNDLEVERSION}/xml/features,mvn:org.apache.karaf.decanter/apache-karaf-decanter/1.0.0/xml/features,%g" ${FEATURESCONF}
83 echo "Configuring the log..."
84 sed -ie 's/log4j.appender.out.maxBackupIndex=10/log4j.appender.out.maxBackupIndex=1/g' ${LOGCONF}
85 # FIXME: Make log size limit configurable from build parameter.
86 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=30GB/g' ${LOGCONF}
87 # Add custom logging levels
88 # CONTROLLERDEBUGMAP is expected to be a key:value map of space separated values like "module:level module2:level2"
89 # where module is abbreviated and does not include org.opendaylight
91 if [ -n "${CONTROLLERDEBUGMAP}" ]; then
92 for kv in ${CONTROLLERDEBUGMAP}; do
95 if [ -n \${module} ] && [ -n \${level} ]; then
96 echo "log4j.logger.org.opendaylight.\${module} = \${level}" >> \${LOGCONF}
102 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
103 echo "Enable the l3.fwd in custom.properties.."
104 echo "ovsdb.l3.fwd.enabled=yes" >> ${CUSTOMPROP}
110 # Copy shard file if exists
111 if [ -f /tmp/custom_shard_config.txt ]; then
112 echo "Custom shard config exists!!!"
113 echo "Copying the shard config..."
114 cp /tmp/custom_shard_config.txt /tmp/${BUNDLEFOLDER}/bin/
117 echo "Configuring cluster"
118 /tmp/${BUNDLEFOLDER}/bin/configure_cluster.sh \$1 ${nodes_list}
120 echo "Dump akka.conf"
123 echo "Dump modules.conf"
126 echo "Dump module-shards.conf"
127 cat ${MODULESHARDSCONF}
131 # Create the startup script to be run on controllers.
132 cat > ${WORKSPACE}/startup-script.sh <<EOF
134 echo "Redirecting karaf console output to karaf_console.log"
135 export KARAF_REDIRECT="/tmp/${BUNDLEFOLDER}/data/log/karaf_console.log"
136 mkdir -p /tmp/${BUNDLEFOLDER}/data/log
138 echo "Starting controller..."
139 /tmp/${BUNDLEFOLDER}/bin/start
143 # Copy over the configuration script and configuration files to each controller
144 # Execute the configuration script on each controller.
145 for i in `seq 1 ${NUM_ODL_SYSTEM}`
147 CONTROLLERIP=ODL_SYSTEM_${i}_IP
148 echo "Configuring member-${i} with IP address ${!CONTROLLERIP}"
149 scp ${WORKSPACE}/configuration-script.sh ${!CONTROLLERIP}:/tmp/
150 ssh ${!CONTROLLERIP} "bash /tmp/configuration-script.sh ${i}"
153 # Run config plan in case it exists
154 configplan_filepath="${WORKSPACE}/test/csit/configplans/${STREAMTESTPLAN}"
155 if [ ! -f "${configplan_filepath}" ]; then
156 configplan_filepath="${WORKSPACE}/test/csit/configplans/${TESTPLAN}"
159 if [ -f ${configplan_filepath} ]; then
160 echo "configplan exists!!!"
161 echo "Reading the configplan:"
162 cat ${configplan_filepath} | sed "s:integration:${WORKSPACE}:" > configplan.txt
164 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
165 echo "Executing ${line}..."
170 # Copy over the startup script to each controller and execute it.
171 for i in `seq 1 ${NUM_ODL_SYSTEM}`
173 CONTROLLERIP=ODL_SYSTEM_${i}_IP
174 echo "Starting member-${i} with IP address ${!CONTROLLERIP}"
175 scp ${WORKSPACE}/startup-script.sh ${!CONTROLLERIP}:/tmp/
176 ssh ${!CONTROLLERIP} "bash /tmp/startup-script.sh"
179 # vim: ts=4 sw=4 sts=4 et ft=sh :