1 echo "#################################################"
2 echo "## Configure Cluster and Start ##"
3 echo "#################################################"
5 AKKACONF=/tmp/${BUNDLEFOLDER}/configuration/initial/akka.conf
6 MODULESCONF=/tmp/${BUNDLEFOLDER}/configuration/initial/modules.conf
7 MODULESHARDSCONF=/tmp/${BUNDLEFOLDER}/configuration/initial/module-shards.conf
10 if [ ${CONTROLLERSCOPE} == 'all' ]; then
11 ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}"
14 ACTUALFEATURES="${CONTROLLERFEATURES}"
16 # Some versions of jenkins job builder result in feature list containing spaces
17 # and ending in newline. Remove all that.
18 ACTUALFEATURES=`echo "${ACTUALFEATURES}" | tr -d '\n \r'`
20 # Utility function for joining strings.
26 final=${final}${delim}${str}
32 # Create the string for nodes
33 for i in `seq 1 ${NUM_ODL_SYSTEM}` ; do
34 CONTROLLERIP=ODL_SYSTEM_${i}_IP
35 nodes[$i]=${!CONTROLLERIP}
38 nodes_list=$(join ${nodes[@]})
42 # Run script plan in case it exists
43 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
44 echo "scriptplan exists!!!"
45 echo "Changing the scriptplan path..."
46 cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
48 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
49 echo "Executing ${line}..."
54 # Create the configuration script to be run on controllers.
55 cat > ${WORKSPACE}/configuration-script.sh <<EOF
57 echo "Changing to /tmp"
60 echo "Downloading the distribution from ${ACTUALBUNDLEURL}"
61 wget --progress=dot:mega '${ACTUALBUNDLEURL}'
63 echo "Extracting the new controller..."
66 echo "Configuring the startup features..."
67 FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
68 CUSTOMPROP=/tmp/${BUNDLEFOLDER}/etc/custom.properties
69 sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
70 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%g" \${FEATURESCONF}
73 echo "Configuring the log..."
74 LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
75 sed -ie 's/log4j.appender.out.maxBackupIndex=10/log4j.appender.out.maxBackupIndex=1/g' \${LOGCONF}
76 # FIXME: Make log size limit configurable from build parameter.
77 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=100GB/g' \${LOGCONF}
80 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
81 echo "Enable the l3.fwd in custom.properties.."
82 echo "ovsdb.l3.fwd.enabled=yes" >> \${CUSTOMPROP}
86 echo "Configure java home and max memory..."
87 MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv
88 sed -ie 's%^# export JAVA_HOME%export JAVA_HOME="\${JAVA_HOME:-${JAVA_HOME}}"%g' \${MEMCONF}
89 sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' \${MEMCONF}
92 echo "Set Java version"
93 sudo /usr/sbin/alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 1
94 sudo /usr/sbin/alternatives --set java ${JAVA_HOME}/bin/java
95 echo "JDK default version ..."
99 export JAVA_HOME="${JAVA_HOME}"
100 # Did you know that in HERE documents, single quote is an ordinary character, but backticks are still executing?
101 JAVA_RESOLVED=\`readlink -e "\${JAVA_HOME}/bin/java"\`
102 echo "Java binary pointed at by JAVA_HOME: \${JAVA_RESOLVED}"
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 "Starting controller..."
129 /tmp/${BUNDLEFOLDER}/bin/start
133 # Copy over the configuration script and configuration files to each controller
134 # Execute the configuration script on each controller.
135 for i in `seq 1 ${NUM_ODL_SYSTEM}`
137 CONTROLLERIP=ODL_SYSTEM_${i}_IP
138 echo "Configuring member-${i} with IP address ${!CONTROLLERIP}"
139 scp ${WORKSPACE}/configuration-script.sh ${!CONTROLLERIP}:/tmp/
140 ssh ${!CONTROLLERIP} "bash /tmp/configuration-script.sh ${i}"
143 # Copy over the startup script to each controller and execute it.
144 for i in `seq 1 ${NUM_ODL_SYSTEM}`
146 CONTROLLERIP=ODL_SYSTEM_${i}_IP
147 echo "Starting member-${i} with IP address ${!CONTROLLERIP}"
148 scp ${WORKSPACE}/startup-script.sh ${!CONTROLLERIP}:/tmp/
149 ssh ${!CONTROLLERIP} "bash /tmp/startup-script.sh"
152 # vim: ts=4 sw=4 sts=4 et ft=sh :