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 JAVA_HOME:${JAVA_HOME} \
83 -v JDKVERSION:${JDKVERSION} \
84 -v JENKINS_WORKSPACE:${WORKSPACE} \
85 -v MININET1:${TOOLS_SYSTEM_2_IP} \
86 -v MININET2:${TOOLS_SYSTEM_3_IP} \
87 -v MININET3:${TOOLS_SYSTEM_4_IP} \
88 -v MININET4:${TOOLS_SYSTEM_5_IP} \
89 -v MININET5:${TOOLS_SYSTEM_6_IP} \
90 -v MININET:${TOOLS_SYSTEM_IP} \
91 -v MININET_USER:${USER} \
92 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
93 -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
94 -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
95 -v ODL_STREAM:${DISTROSTREAM} \
96 -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_IP} \
97 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
98 -v ODL_SYSTEM_USER:${USER} \
99 -v SUITES:"${SUITES}" \
100 -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_IP} \
101 -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
102 -v TOOLS_SYSTEM_3_IP:${TOOLS_SYSTEM_3_IP} \
103 -v TOOLS_SYSTEM_4_IP:${TOOLS_SYSTEM_4_IP} \
104 -v TOOLS_SYSTEM_5_IP:${TOOLS_SYSTEM_5_IP} \
105 -v TOOLS_SYSTEM_6_IP:${TOOLS_SYSTEM_6_IP} \
106 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_IP} \
107 -v TOOLS_SYSTEM_USER:${USER} \
108 -v USER_HOME:${HOME} \
110 ${TESTOPTIONS} ${SUITES} || true
112 echo "Examining the files in data/log and checking filesize"
113 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
114 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
116 for i in `seq 1 ${NUM_ODL_SYSTEM}`
118 CONTROLLERIP=ODL_SYSTEM_${i}_IP
119 echo "Lets's take the karaf thread dump again..."
120 ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_after.log
121 pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_after.log | grep -v grep | tr -s ' ' | cut -f2 -d' ')
122 echo "karaf main: org.apache.karaf.main.Main, pid:${pid}"
123 ssh ${!CONTROLLERIP} "${JAVA_HOME}/bin/jstack -l ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_after.log || true
125 set +e # We do not want to create red dot just because something went wrong while fetching logs.
126 ssh "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
130 # FIXME: Unify the copy process between various scripts.
132 for i in `seq 1 ${NUM_ODL_SYSTEM}`
134 CONTROLLERIP=ODL_SYSTEM_${i}_IP
135 echo "Compressing karaf.log ${i}"
136 ssh ${!CONTROLLERIP} gzip --best /tmp/${BUNDLEFOLDER}/data/log/karaf.log
137 echo "Fetching compressed karaf.log ${i}"
138 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"
139 # TODO: Should we compress the output log file as well?
140 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"
142 # FIXME: Put member index in filename, instead of directory name.
143 mkdir -p "gclogs-${i}"
144 scp "${!CONTROLLERIP}:/tmp/${BUNDLEFOLDER}/data/log/*.log" "gclogs-${i}/" && ssh ${!CONTROLLERIP} rm -f "/tmp/${BUNDLEFOLDER}/data/log/*.log"
147 echo "Examine copied files"
150 true # perhaps Jenkins is testing last exit code
152 # vim: ts=4 sw=4 sts=4 et ft=sh :