Merge "Add support for configplan"
authorVratko Polák <vrpolak@cisco.com>
Fri, 5 Aug 2016 14:23:54 +0000 (14:23 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 5 Aug 2016 14:23:54 +0000 (14:23 +0000)
1  2 
jjb/integration/include-raw-integration-deploy-controller-run-test.sh

index fecf5688b5c3e2cc8ae252e051f67a7af2712619,397cda5e4e38c9e8921a3cfe7d1586c97b47acdb..56f8ddf9bbd003561e93cf9e2ea3c05b042ff26b
@@@ -29,7 -29,7 +29,7 @@@ if [ -f ${WORKSPACE}/test/csit/scriptpl
      done
  fi
  
- cat > ${WORKSPACE}/controller-script.sh <<EOF
+ cat > ${WORKSPACE}/configuration-script.sh <<EOF
  
  echo "Changing to /tmp"
  cd /tmp
@@@ -80,6 -80,11 +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,18 -135,31 +135,35 @@@ exit_on_log_file_message 'server is unh
  
  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"
     exit
  fi
  
 +echo "Lets's take the karaf thread dump"
 +KARAF_PID=$(ssh ${ODL_SYSTEM_IP} "ps aux | grep 'distribution-karaf' | grep -v grep | tr -s ' ' | cut -f2 -d' '")
 +ssh ${ODL_SYSTEM_IP} "jstack $KARAF_PID"> ${WORKSPACE}/karaf_threads_before.log
 +
  echo "Locating test plan to use..."
  testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
  if [ ! -f "${testplan_filepath}" ]; then
@@@ -166,10 -184,6 +188,10 @@@ pybot -N ${TESTPLAN} -c critical -e exc
  -v MININET_USER:${USER} -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
  # FIXME: Sort (at least -v) options alphabetically.
  
 +echo "Lets's take the karaf thread dump again"
 +KARAF_PID=$(ssh ${ODL_SYSTEM_IP} "ps aux | grep 'distribution-karaf' | grep -v grep | tr -s ' ' | cut -f2 -d' '")
 +ssh ${ODL_SYSTEM_IP} "jstack $KARAF_PID"> ${WORKSPACE}/karaf_threads_after.log
 +
  echo "Killing ODL and fetching Karaf log..."
  set +e  # We do not want to create red dot just because something went wrong while fetching logs.
  ssh "${ODL_SYSTEM_IP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'