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
8 BGPCONF=/tmp/${BUNDLEFOLDER}/system/org/opendaylight/bgpcep/bgp-controller-config/*/bgp-controller-config-*-config-example.xml
11 if [ ${CONTROLLERSCOPE} == 'all' ]; then
12 ACTUALFEATURES="odl-integration-compatible-with-all,${CONTROLLERFEATURES}"
15 ACTUALFEATURES="${CONTROLLERFEATURES}"
17 # Some versions of jenkins job builder result in feature list containing spaces
18 # and ending in newline. Remove all that.
19 ACTUALFEATURES=`echo "${ACTUALFEATURES}" | tr -d '\n \r'`
21 # Utility function for joining strings.
27 final=${final}${delim}${str}
33 # Create the string for nodes
34 for i in `seq 1 ${NUM_ODL_SYSTEM}` ; do
35 CONTROLLERIP=ODL_SYSTEM_${i}_IP
36 nodes[$i]=${!CONTROLLERIP}
39 nodes_list=$(join ${nodes[@]})
43 # Run script plan in case it exists
44 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
45 echo "scriptplan exists!!!"
46 echo "Reading the scriptplan:"
47 cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
49 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
50 echo "Executing ${line}..."
55 # Create the configuration script to be run on controllers.
56 cat > ${WORKSPACE}/configuration-script.sh <<EOF
58 echo "Changing to /tmp"
61 echo "Downloading the distribution from ${ACTUALBUNDLEURL}"
62 wget --progress=dot:mega '${ACTUALBUNDLEURL}'
64 echo "Extracting the new controller..."
67 echo "Configuring the startup features..."
68 FEATURESCONF=/tmp/${BUNDLEFOLDER}/etc/org.apache.karaf.features.cfg
69 CUSTOMPROP=/tmp/${BUNDLEFOLDER}/etc/custom.properties
70 sed -ie "s/featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${ACTUALFEATURES}/g" \${FEATURESCONF}
71 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}
74 echo "Configuring the log..."
75 LOGCONF=/tmp/${BUNDLEFOLDER}/etc/org.ops4j.pax.logging.cfg
76 sed -ie 's/log4j.appender.out.maxBackupIndex=10/log4j.appender.out.maxBackupIndex=1/g' \${LOGCONF}
77 # FIXME: Make log size limit configurable from build parameter.
78 sed -ie 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=100GB/g' \${LOGCONF}
81 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
82 echo "Enable the l3.fwd in custom.properties.."
83 echo "ovsdb.l3.fwd.enabled=yes" >> \${CUSTOMPROP}
87 echo "Configure java home and max memory..."
88 MEMCONF=/tmp/${BUNDLEFOLDER}/bin/setenv
89 sed -ie 's%^# export JAVA_HOME%export JAVA_HOME="\${JAVA_HOME:-${JAVA_HOME}}"%g' \${MEMCONF}
90 sed -ie 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/g' \${MEMCONF}
93 echo "Set Java version"
94 sudo /usr/sbin/alternatives --install /usr/bin/java java ${JAVA_HOME}/bin/java 1
95 sudo /usr/sbin/alternatives --set java ${JAVA_HOME}/bin/java
96 echo "JDK default version ..."
100 export JAVA_HOME="${JAVA_HOME}"
101 # Did you know that in HERE documents, single quote is an ordinary character, but backticks are still executing?
102 JAVA_RESOLVED=\`readlink -e "\${JAVA_HOME}/bin/java"\`
103 echo "Java binary pointed at by JAVA_HOME: \${JAVA_RESOLVED}"
105 # Copy shard file if exists
106 if [ -f /tmp/custom_shard_config.txt ]; then
107 echo "Custom shard config exists!!!"
108 echo "Copying the shard config..."
109 cp /tmp/custom_shard_config.txt /tmp/${BUNDLEFOLDER}/bin/
112 echo "Configuring cluster"
113 /tmp/${BUNDLEFOLDER}/bin/configure_cluster.sh \$1 ${nodes_list}
115 echo "Update bgp configuration in 41-bgp-example.xml"
116 sed -i -e "s/<topology-id>example-ipv4-topology/<topology-id>example-ipv4-topology-\$1/g" ${BGPCONF}
117 sed -i -e "s/<topology-id>example-ipv6-topology/<topology-id>example-ipv6-topology-\$1/g" ${BGPCONF}
118 sed -i -e "s/<topology-id>example-linkstate-topology/<topology-id>example-linkstate-topology-\$1/g" ${BGPCONF}
120 echo "Dump ${BGPCONF}"
123 echo "Dump akka.conf"
126 echo "Dump modules.conf"
129 echo "Dump module-shards.conf"
130 cat ${MODULESHARDSCONF}
134 # Create the startup script to be run on controllers.
135 cat > ${WORKSPACE}/startup-script.sh <<EOF
137 echo "Starting controller..."
138 /tmp/${BUNDLEFOLDER}/bin/start
142 # Copy over the configuration script and configuration files to each controller
143 # Execute the configuration script on each controller.
144 for i in `seq 1 ${NUM_ODL_SYSTEM}`
146 CONTROLLERIP=ODL_SYSTEM_${i}_IP
147 echo "Configuring member-${i} with IP address ${!CONTROLLERIP}"
148 scp ${WORKSPACE}/configuration-script.sh ${!CONTROLLERIP}:/tmp/
149 ssh ${!CONTROLLERIP} "bash /tmp/configuration-script.sh ${i}"
152 # Run config plan in case it exists
153 if [ -f ${WORKSPACE}/test/csit/configplans/${TESTPLAN} ]; then
154 echo "configplan exists!!!"
155 echo "Reading the configplan:"
156 cat ${WORKSPACE}/test/csit/configplans/${TESTPLAN} | 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 :