1 echo "#################################################"
2 echo "## include-raw-integration-deploy-controller ##"
3 echo "#################################################"
8 cat > ${WORKSPACE}/deploy-controller-script.sh <<EOF
9 echo "Downloading the distribution from ${ACTUALBUNDLEURL}"
11 wget --no-verbose ${ACTUALBUNDLEURL}
13 echo "Extracting the new controller..."
16 echo "Configuring the startup features..."
17 cd ${BUNDLEFOLDER}/etc
18 CFG=org.apache.karaf.features.cfg
19 cp \${CFG} \${CFG}.bak
20 cat \${CFG}.bak | sed "s/^featuresBoot=.*/featuresBoot=config,standard,region,package,kar,ssh,management,${CONTROLLERFEAT}/" > \${CFG}.1
21 cat \${CFG}.1 | sed "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%" > \${CFG}
24 echo "Configuring the log..."
25 LOG=org.ops4j.pax.logging.cfg
26 cp \${LOG} \${LOG}.bak
27 cat \${LOG}.bak | sed 's/log4j.appender.out.maxFileSize=1MB/log4j.appender.out.maxFileSize=20MB/' > \${LOG}
30 echo "Configure max memory..."
33 cp \${MEM} \${MEM}.bak
34 cat \${MEM}.bak | sed 's/JAVA_MAX_MEM="2048m"/JAVA_MAX_MEM="${CONTROLLERMEM}"/' > \${MEM}
37 echo "Starting deploy controller..."
42 cat > ${WORKSPACE}/deploy-sanitytest-controller-script.sh <<EOF
45 echo "Waiting for controller to come up..."
47 cd ${BUNDLEFOLDER}/bin
53 RESP="\$( curl --user admin:admin -sL -w "%{http_code} %{url_effective}\\n" http://localhost:8181/restconf/modules -o /dev/null )"
55 if [[ \$RESP == *"200"* ]]; then
58 elif (( "\$COUNT" > "600" )); then
59 echo Timeout Controller DOWN
61 cd /tmp/${BUNDLEFOLDER}/data/
65 COUNT=\$(( \${COUNT} + 5 ))
67 echo waiting \$COUNT secs...
72 cd /tmp/${BUNDLEFOLDER}/bin/
74 echo "Checking OSGi bundles..."
75 sshpass -p karaf ./client -u karaf 'bundle:list'
89 ###############################################################
90 ## Define a function to run controller-script on controller #
91 ###############################################################
93 function runcontrollerscript
96 echo "running controller $CONTROLLERIP"
97 scp ${WORKSPACE}/deploy-controller-script.sh $CONTROLLERIP:/tmp
98 ssh $CONTROLLERIP 'bash /tmp/deploy-controller-script.sh'
101 function sanitytestcontroller
103 local CONTROLLERIP=$1
104 echo "sanity testing controller $CONTROLLERIP"
105 scp ${WORKSPACE}/deploy-sanitytest-controller-script.sh $CONTROLLERIP:/tmp
106 ssh $CONTROLLERIP 'bash /tmp/deploy-sanitytest-controller-script.sh'
109 echo "##################################"
110 echo "## Loop through controller IPs #"
111 echo "##################################"
113 declare CONTROLLERIPS=($(cat slave_addresses.txt | grep CONTROLLER | awk -F = '{print $2}'))
115 for i in "${CONTROLLERIPS[@]}"
117 echo "IP address is: $i"
118 runcontrollerscript $i
121 for i in "${CONTROLLERIPS[@]}"
123 echo "IP address is: $i"
124 sanitytestcontroller $i
127 echo "###################################################"
128 echo "## END include-raw-integration-deploy-controller ##"
129 echo "###################################################"
131 # vim: ts=4 sw=4 sts=4 et ft=sh :