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}
74 sed -ie "s%\(featuresRepositories=\|featuresRepositories =\)%featuresRepositories = 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}
77 echo "Configuring the log..."
78 sed -ie 's/log4j.appender.out.maxBackupIndex=10/log4j.appender.out.maxBackupIndex=1/g' ${LOGCONF}
79 # FIXME: Make log size limit configurable from build parameter.
80 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=30GB/g' ${LOGCONF}
81 # Add custom logging levels
82 # CONTROLLERDEBUGMAP is expected to be a key:value map of space separated values like "module:level module2:level2"
83 # where module is abbreviated and does not include org.opendaylight
85 if [ -n "${CONTROLLERDEBUGMAP}" ]; then
86 for kv in ${CONTROLLERDEBUGMAP}; do
89 if [ -n \${module} ] && [ -n \${level} ]; then
90 echo "log4j.logger.org.opendaylight.\${module} = \${level}" >> \${LOGCONF}
96 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
97 echo "Enable the l3.fwd in custom.properties.."
98 echo "ovsdb.l3.fwd.enabled=yes" >> ${CUSTOMPROP}
104 # Copy shard file if exists
105 if [ -f /tmp/custom_shard_config.txt ]; then
106 echo "Custom shard config exists!!!"
107 echo "Copying the shard config..."
108 cp /tmp/custom_shard_config.txt /tmp/${BUNDLEFOLDER}/bin/
111 echo "Configuring cluster"
112 /tmp/${BUNDLEFOLDER}/bin/configure_cluster.sh \$1 ${nodes_list}
114 echo "Dump akka.conf"
117 echo "Dump modules.conf"
120 echo "Dump module-shards.conf"
121 cat ${MODULESHARDSCONF}
125 # Create the startup script to be run on controllers.
126 cat > ${WORKSPACE}/startup-script.sh <<EOF
128 echo "Redirecting karaf console output to karaf_console.log"
129 export KARAF_REDIRECT="/tmp/${BUNDLEFOLDER}/data/log/karaf_console.log"
130 mkdir -p /tmp/${BUNDLEFOLDER}/data/log
132 echo "Starting controller..."
133 /tmp/${BUNDLEFOLDER}/bin/start
137 # Copy over the configuration script and configuration files to each controller
138 # Execute the configuration script on each controller.
139 for i in `seq 1 ${NUM_ODL_SYSTEM}`
141 CONTROLLERIP=ODL_SYSTEM_${i}_IP
142 echo "Configuring member-${i} with IP address ${!CONTROLLERIP}"
143 scp ${WORKSPACE}/configuration-script.sh ${!CONTROLLERIP}:/tmp/
144 ssh ${!CONTROLLERIP} "bash /tmp/configuration-script.sh ${i}"
147 # Run config plan in case it exists
148 configplan_filepath="${WORKSPACE}/test/csit/configplans/${STREAMTESTPLAN}"
149 if [ ! -f "${configplan_filepath}" ]; then
150 configplan_filepath="${WORKSPACE}/test/csit/configplans/${TESTPLAN}"
153 if [ -f ${configplan_filepath} ]; then
154 echo "configplan exists!!!"
155 echo "Reading the configplan:"
156 cat ${configplan_filepath} | sed "s:integration:${WORKSPACE}:" > configplan.txt
158 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
159 echo "Executing ${line}..."
164 # Copy over the startup script to each controller and execute it.
165 for i in `seq 1 ${NUM_ODL_SYSTEM}`
167 CONTROLLERIP=ODL_SYSTEM_${i}_IP
168 echo "Starting member-${i} with IP address ${!CONTROLLERIP}"
169 scp ${WORKSPACE}/startup-script.sh ${!CONTROLLERIP}:/tmp/
170 ssh ${!CONTROLLERIP} "bash /tmp/startup-script.sh"
173 # vim: ts=4 sw=4 sts=4 et ft=sh :