Merge "Add support for configplan"
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-controller-run-test.sh
index fecf5688b5c3e2cc8ae252e051f67a7af2712619..56f8ddf9bbd003561e93cf9e2ea3c05b042ff26b 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"