1 #@IgnoreInspection BashAddShebang
2 # Activate robotframework virtualenv
3 # ${ROBOT_VENV} comes from the integration-install-robotframework.sh
5 # shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091
6 source ${ROBOT_VENV}/bin/activate
7 source /tmp/common-functions.sh ${BUNDLEFOLDER}
9 echo "#################################################"
10 echo "## Configure Cluster and Start ##"
11 echo "#################################################"
15 # shellcheck disable=SC2034
16 nodes_list=$(get_nodes_list)
20 create_configuration_script
24 create_post_startup_script
26 copy_and_run_configuration_script
30 copy_and_run_startup_script
32 copy_and_run_post_startup_script
34 create_controller_variables
36 if [ ${NUM_OPENSTACK_SYSTEM} -gt 0 ]; then
37 echo "Exiting without running tests to deploy openstack for testing"
41 echo "Generating mininet variables..."
42 for i in `seq 1 ${NUM_TOOLS_SYSTEM}`
44 MININETIP=TOOLS_SYSTEM_${i}_IP
45 tools_variables=${tools_variables}" -v ${MININETIP}:${!MININETIP}"
48 echo "Locating test plan to use..."
49 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
50 if [ ! -f "${testplan_filepath}" ]; then
51 testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
54 echo "Changing the testplan path..."
55 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
58 # Use the testplan if specific SUITES are not defined.
59 if [ -z "${SUITES}" ]; then
60 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
63 workpath="${WORKSPACE}/test/csit/suites"
64 for suite in ${SUITES}; do
65 fullsuite="${workpath}/${suite}"
66 if [ -z "${newsuites}" ]; then
67 newsuites+=${fullsuite}
69 newsuites+=" "${fullsuite}
75 echo "Starting Robot test suites ${SUITES} ..."
76 pybot -N ${TESTPLAN} \
77 --removekeywords wuks -c critical -e exclude -e skip_if_${DISTROSTREAM} \
78 -v BUNDLEFOLDER:${BUNDLEFOLDER} \
79 -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} \
80 -v CONTROLLER:${ODL_SYSTEM_IP} \
81 -v CONTROLLER_USER:${USER} \
82 -v GERRIT_BRANCH:${GERRIT_BRANCH} \
83 -v GERRIT_REFSPEC:${GERRIT_REFSPEC} \
84 -v JAVA_HOME:${JAVA_HOME} \
85 -v JDKVERSION:${JDKVERSION} \
86 -v JENKINS_WORKSPACE:${WORKSPACE} \
87 -v MININET1:${TOOLS_SYSTEM_2_IP} \
88 -v MININET2:${TOOLS_SYSTEM_3_IP} \
89 -v MININET3:${TOOLS_SYSTEM_4_IP} \
90 -v MININET4:${TOOLS_SYSTEM_5_IP} \
91 -v MININET5:${TOOLS_SYSTEM_6_IP} \
92 -v MININET:${TOOLS_SYSTEM_IP} \
93 -v MININET_USER:${USER} \
94 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
95 -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
96 -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
97 -v ODL_STREAM:${DISTROSTREAM} \
98 -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_IP} \
99 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
100 -v ODL_SYSTEM_USER:${USER} \
101 -v SUITES:"${SUITES}" \
102 -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_IP} \
103 -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
104 -v TOOLS_SYSTEM_3_IP:${TOOLS_SYSTEM_3_IP} \
105 -v TOOLS_SYSTEM_4_IP:${TOOLS_SYSTEM_4_IP} \
106 -v TOOLS_SYSTEM_5_IP:${TOOLS_SYSTEM_5_IP} \
107 -v TOOLS_SYSTEM_6_IP:${TOOLS_SYSTEM_6_IP} \
108 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} \
109 -v TOOLS_SYSTEM_USER:${USER} \
110 -v USER_HOME:${HOME} \
112 ${TESTOPTIONS} ${SUITES} || true
114 echo "Examining the files in data/log and checking filesize"
115 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
116 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
118 for i in `seq 1 ${NUM_ODL_SYSTEM}`
120 CONTROLLERIP=ODL_SYSTEM_${i}_IP
121 echo "Lets's take the karaf thread dump again..."
122 ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_after.log
123 pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_after.log | grep -v grep | tr -s ' ' | cut -f2 -d' ')
124 echo "karaf main: org.apache.karaf.main.Main, pid:${pid}"
125 ssh ${!CONTROLLERIP} "${JAVA_HOME}/bin/jstack -l ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_after.log || true
127 set +e # We do not want to create red dot just because something went wrong while fetching logs.
128 ssh "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
132 # FIXME: Unify the copy process between various scripts.
134 for i in `seq 1 ${NUM_ODL_SYSTEM}`
136 CONTROLLERIP=ODL_SYSTEM_${i}_IP
137 echo "Compressing karaf.log ${i}"
138 ssh ${!CONTROLLERIP} gzip --best /tmp/${BUNDLEFOLDER}/data/log/karaf.log
139 echo "Fetching compressed karaf.log ${i}"
140 scp "${!CONTROLLERIP}:/tmp/${BUNDLEFOLDER}/data/log/karaf.log.gz" "odl${i}_karaf.log.gz" && ssh ${!CONTROLLERIP} rm -f "/tmp/${BUNDLEFOLDER}/data/log/karaf.log.gz"
141 # TODO: Should we compress the output log file as well?
142 scp "${!CONTROLLERIP}:/tmp/${BUNDLEFOLDER}/data/log/karaf_console.log" "odl${i}_karaf_console.log" && ssh ${!CONTROLLERIP} rm -f "/tmp/${BUNDLEFOLDER}/data/log/karaf_console.log"
144 # FIXME: Put member index in filename, instead of directory name.
145 mkdir -p "gclogs-${i}"
146 scp "${!CONTROLLERIP}:/tmp/${BUNDLEFOLDER}/data/log/*.log" "gclogs-${i}/" && ssh ${!CONTROLLERIP} rm -f "/tmp/${BUNDLEFOLDER}/data/log/*.log"
149 echo "Examine copied files"
152 true # perhaps Jenkins is testing last exit code
154 # vim: ts=4 sw=4 sts=4 et ft=sh :