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/<rib-id>example-bgp-rib/<rib-id>example-bgp-rib-\$1/g" ${BGPCONF}
117 sed -i -e "s/<topology-id>example-ipv4-topology/<topology-id>example-ipv4-topology-\$1/g" ${BGPCONF}
118 sed -i -e "s/<topology-id>example-ipv6-topology/<topology-id>example-ipv6-topology-\$1/g" ${BGPCONF}
119 sed -i -e "s/<topology-id>example-linkstate-topology/<topology-id>example-linkstate-topology-\$1/g" ${BGPCONF}
121 echo "Dump ${BGPCONF}"
124 echo "Dump akka.conf"
127 echo "Dump modules.conf"
130 echo "Dump module-shards.conf"
131 cat ${MODULESHARDSCONF}
135 # Create the startup script to be run on controllers.
136 cat > ${WORKSPACE}/startup-script.sh <<EOF
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 if [ -f ${WORKSPACE}/test/csit/configplans/${TESTPLAN} ]; then
155 echo "configplan exists!!!"
156 echo "Reading the configplan:"
157 cat ${WORKSPACE}/test/csit/configplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > configplan.txt
159 for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
160 echo "Executing ${line}..."
165 # Copy over the startup script to each controller and execute it.
166 for i in `seq 1 ${NUM_ODL_SYSTEM}`
168 CONTROLLERIP=ODL_SYSTEM_${i}_IP
169 echo "Starting member-${i} with IP address ${!CONTROLLERIP}"
170 scp ${WORKSPACE}/startup-script.sh ${!CONTROLLERIP}:/tmp/
171 ssh ${!CONTROLLERIP} "bash /tmp/startup-script.sh"
174 # vim: ts=4 sw=4 sts=4 et ft=sh :