Add support for configplan 78/43078/3
authorLuis Gomez <ecelgp@gmail.com>
Wed, 3 Aug 2016 18:39:43 +0000 (11:39 -0700)
committerLuis Gomez <ecelgp@gmail.com>
Fri, 5 Aug 2016 05:40:10 +0000 (22:40 -0700)
This change will allow to run a shell script after controller is
deployed and just before it is started.

A configplan file is required in test/csit/configplans.

Change-Id: I3c366797c0b5df91a33ef15274fe1be79204967c
Signed-off-by: Luis Gomez <ecelgp@gmail.com>
jjb/integration/include-raw-integration-configure-clustering.sh
jjb/integration/include-raw-integration-deploy-controller-run-test.sh

index afd6bed748e0b949fa32173086e5532bc5eb0d67..a1bca7ea23d29a08226dc67ed893825e242b6c55 100644 (file)
@@ -43,7 +43,7 @@ echo ${nodes_list}
 # Run script plan in case it exists
 if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
     echo "scriptplan exists!!!"
-    echo "Changing the scriptplan path..."
+    echo "Reading the scriptplan:"
     cat ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > scriptplan.txt
     cat scriptplan.txt
     for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' scriptplan.txt ); do
@@ -150,6 +150,18 @@ do
     ssh ${!CONTROLLERIP} "bash /tmp/configuration-script.sh ${i}"
 done
 
+# Run config plan in case it exists
+if [ -f ${WORKSPACE}/test/csit/configplans/${TESTPLAN} ]; then
+    echo "configplan exists!!!"
+    echo "Reading the configplan:"
+    cat ${WORKSPACE}/test/csit/configplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > configplan.txt
+    cat configplan.txt
+    for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
+        echo "Executing ${line}..."
+        source ${line}
+    done
+fi
+
 # Copy over the startup script to each controller and execute it.
 for i in `seq 1 ${NUM_ODL_SYSTEM}`
 do
index d72e7d2fcf237c14f5b7c0ba9a04149139b34851..397cda5e4e38c9e8921a3cfe7d1586c97b47acdb 100644 (file)
@@ -29,7 +29,7 @@ if [ -f ${WORKSPACE}/test/csit/scriptplans/${TESTPLAN} ]; then
     done
 fi
 
-cat > ${WORKSPACE}/controller-script.sh <<EOF
+cat > ${WORKSPACE}/configuration-script.sh <<EOF
 
 echo "Changing to /tmp"
 cd /tmp
@@ -80,6 +80,11 @@ export JAVA_HOME="$JAVA_HOME"
 JAVA_RESOLVED=\`readlink -e "\${JAVA_HOME}/bin/java"\`
 echo "Java binary pointed at by JAVA_HOME: \${JAVA_RESOLVED}"
 
+EOF
+
+# Create the startup script to be run on controller.
+cat > ${WORKSPACE}/startup-script.sh <<EOF
+
 echo "Starting controller..."
 /tmp/${BUNDLEFOLDER}/bin/start
 
@@ -130,8 +135,25 @@ exit_on_log_file_message 'server is unhealthy'
 
 EOF
 
-scp ${WORKSPACE}/controller-script.sh ${ODL_SYSTEM_IP}:/tmp
-ssh ${ODL_SYSTEM_IP} 'bash /tmp/controller-script.sh'
+# Execute the configuration script on controller.
+scp ${WORKSPACE}/configuration-script.sh ${ODL_SYSTEM_IP}:/tmp
+ssh ${ODL_SYSTEM_IP} 'bash /tmp/configuration-script.sh'
+
+# Run config plan in case it exists
+if [ -f ${WORKSPACE}/test/csit/configplans/${TESTPLAN} ]; then
+    echo "configplan exists!!!"
+    echo "Reading the configplan:"
+    cat ${WORKSPACE}/test/csit/configplans/${TESTPLAN} | sed "s:integration:${WORKSPACE}:" > configplan.txt
+    cat configplan.txt
+    for line in $( egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' configplan.txt ); do
+        echo "Executing ${line}..."
+        source ${line}
+    done
+fi
+
+# Copy over the startup script to controller and execute it.
+scp ${WORKSPACE}/startup-script.sh ${ODL_SYSTEM_IP}:/tmp
+ssh ${ODL_SYSTEM_IP} 'bash /tmp/startup-script.sh'
 
 if [ ${NUM_OPENSTACK_SYSTEM} -gt 0 ]; then
    echo "Exiting without running tests to deploy openstack for testing"