Merge "Switch the csit-openstack to use job prefix"
[releng/builder.git] / jjb / integration / integration-deploy-openstack-run-test.sh
1 #!/bin/bash
2 # Activate robotframework virtualenv
3 # ${ROBOT_VENV} comes from the integration-install-robotframework.sh
4 # script.
5 # shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091
6 source ${ROBOT_VENV}/bin/activate
7 PYTHON="${ROBOT_VENV}/bin/python"
8 SSH="ssh -t -t"
9 ADMIN_PASSWORD="admin"
10 OPENSTACK_MASTER_CLIENTS_VERSION="pike"
11
12 # TODO: remove this work to run changes.py if/when it's moved higher up to be visible at the Robot level
13 echo "showing recent changes that made it in to the distribution used by this job"
14 $PYTHON -m pip install --upgrade urllib3
15 python ${WORKSPACE}/test/tools/distchanges/changes.py -d /tmp/distribution_folder \
16                   -u ${ACTUAL_BUNDLE_URL} -b ${DISTROBRANCH} \
17                   -r ssh://jenkins-${SILO}@git.opendaylight.org:29418 || true
18 cat << EOF
19 #################################################
20 ##         Deploy Openstack 3-node             ##
21 #################################################
22 EOF
23
24 # Catch command errors and collect logs.
25 # This ensures logs are collected when script commands fail rather than simply exiting.
26 function trap_handler() {
27     local prog="$0"
28     local lastline="$1"
29     local lasterr="$2"
30     echo "${prog}: line ${lastline}: exit status of last command: ${lasterr}"
31     echo "command: ${BASH_COMMAND}"
32     collect_logs
33     exit 1
34 } # trap_handler()
35
36 trap 'trap_handler ${LINENO} ${$?}' ERR
37
38 function print_job_parameters() {
39     cat << EOF
40
41 Job parameters:
42 DISTROBRANCH: ${DISTROBRANCH}
43 DISTROSTREAM: ${DISTROSTREAM}
44 BUNDLE_URL: ${BUNDLE_URL}
45 CONTROLLERFEATURES: ${CONTROLLERFEATURES}
46 CONTROLLERDEBUGMAP: ${CONTROLLERDEBUGMAP}
47 TESTPLAN: ${TESTPLAN}
48 SUITES: ${SUITES}
49 PATCHREFSPEC: ${PATCHREFSPEC}
50 OPENSTACK_BRANCH: ${OPENSTACK_BRANCH}
51 DEVSTACK_HASH: ${DEVSTACK_HASH}
52 ODL_ML2_DRIVER_REPO: ${ODL_ML2_DRIVER_REPO}
53 ODL_ML2_BRANCH: ${ODL_ML2_BRANCH}
54 ODL_ML2_DRIVER_VERSION: ${ODL_ML2_DRIVER_VERSION}
55 ODL_ML2_PORT_BINDING: ${ODL_ML2_PORT_BINDING}
56 DEVSTACK_KUBERNETES_PLUGIN_REPO: ${DEVSTACK_KUBERNETES_PLUGIN_REPO}
57 DEVSTACK_LBAAS_PLUGIN_REPO: ${DEVSTACK_LBAAS_PLUGIN_REPO}
58 DEVSTACK_NETWORKING_SFC_PLUGIN_REPO: ${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO}
59 ODL_ENABLE_L3_FWD: ${ODL_ENABLE_L3_FWD}
60 IPSEC_VXLAN_TUNNELS_ENABLED: ${IPSEC_VXLAN_TUNNELS_ENABLED}
61 PUBLIC_BRIDGE: ${PUBLIC_BRIDGE}
62 ENABLE_HAPROXY_FOR_NEUTRON: ${ENABLE_HAPROXY_FOR_NEUTRON}
63 ENABLE_OS_SERVICES: ${ENABLE_OS_SERVICES}
64 ENABLE_OS_COMPUTE_SERVICES: ${ENABLE_OS_COMPUTE_SERVICES}
65 ENABLE_OS_PLUGINS: ${ENABLE_OS_PLUGINS}
66 DISABLE_OS_SERVICES: ${DISABLE_OS_SERVICES}
67 TENANT_NETWORK_TYPE: ${TENANT_NETWORK_TYPE}
68 SECURITY_GROUP_MODE: ${SECURITY_GROUP_MODE}
69 PUBLIC_PHYSICAL_NETWORK: ${PUBLIC_PHYSICAL_NETWORK}
70 ENABLE_NETWORKING_L2GW: ${ENABLE_NETWORKING_L2GW}
71 CREATE_INITIAL_NETWORKS: ${CREATE_INITIAL_NETWORKS}
72 LBAAS_SERVICE_PROVIDER: ${LBAAS_SERVICE_PROVIDER}
73 NUM_OPENSTACK_SITES: ${NUM_OPENSTACK_SITES}
74 ODL_SFC_DRIVER: ${ODL_SFC_DRIVER}
75 ODL_SNAT_MODE: ${ODL_SNAT_MODE}
76
77 EOF
78 }
79
80 print_job_parameters
81
82 function create_etc_hosts() {
83     NODE_IP=$1
84     CTRL_IP=$2
85     : > ${WORKSPACE}/hosts_file
86     for iter in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
87     do
88         COMPUTE_IP=OPENSTACK_COMPUTE_NODE_${iter}_IP
89         if [ "${!COMPUTE_IP}" == "${NODE_IP}" ]; then
90            CONTROL_HNAME=$(${SSH}  ${CTRL_IP}  "hostname")
91            echo "${CTRL_IP}   ${CONTROL_HNAME}" >> ${WORKSPACE}/hosts_file
92         else
93            COMPUTE_HNAME=$(${SSH}  ${!COMPUTE_IP}  "hostname")
94            echo "${!COMPUTE_IP}   ${COMPUTE_HNAME}" >> ${WORKSPACE}/hosts_file
95         fi
96     done
97
98     echo "Created the hosts file for ${NODE_IP}:"
99     cat ${WORKSPACE}/hosts_file
100 } # create_etc_hosts()
101
102 #function to install Openstack Clients for Testing
103 #This will pull the latest versions compatiable with the
104 # openstack release
105 function install_openstack_clients_in_robot_vm() {
106     packages=("python-novaclient" "python-neutronclient" "python-openstackclient")
107     for plugin_name in ${ENABLE_OS_PLUGINS}; do
108         if [ "$plugin_name" == "networking-sfc" ]; then
109             packages+=("networking-sfc")
110         fi
111     done
112     openstack_version=$(echo ${OPENSTACK_BRANCH} | cut -d/ -f2)
113     #If the job tests "master", we will use the clients from previous released stable version to avoid failures
114     if [ "${openstack_version}" == "master" ]; then
115        openstack_version=${OPENSTACK_MASTER_CLIENTS_VERSION}
116     fi
117     for package in ${packages[*]}; do
118        echo "Get the current support version of the package ${package}"
119        wget https://raw.githubusercontent.com/openstack/requirements/stable/${openstack_version}/upper-constraints.txt -O /tmp/constraints.txt 2>/dev/null
120        echo "$PYTHON -m pip install --upgrade --no-deps ${package} --no-cache-dir -c /tmp/constraints.txt"
121        $PYTHON -m pip install --upgrade --no-deps ${package} --no-cache-dir -c /tmp/constraints.txt
122        echo "$PYTHON -m pip install ${package} --no-cache-dir -c /tmp/constraints.txt"
123        $PYTHON -m pip install ${package} --no-cache-dir -c /tmp/constraints.txt
124     done
125
126     if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
127         #networking-l2gw is not officially available in any release yet. Gettting the latest stable version.
128         $PYTHON -m pip install networking-l2gw
129     fi
130 }
131
132
133
134 # convert commas in csv strings to spaces (ssv)
135 function csv2ssv() {
136     local csv=$1
137     if [ -n "${csv}" ]; then
138         ssv=$(echo ${csv} | sed 's/,/ /g' | sed 's/\ \ */\ /g')
139     fi
140
141     echo "${ssv}"
142 } # csv2ssv
143
144 # Add enable_services and disable_services to the local.conf
145 function add_os_services() {
146     local core_services=$1
147     local enable_services=$2
148     local disable_services=$3
149     local local_conf_file_name=$4
150
151     cat >> ${local_conf_file_name} << EOF
152 enable_service $(csv2ssv "${core_services}")
153 EOF
154     if [ -n "${enable_services}" ]; then
155         cat >> ${local_conf_file_name} << EOF
156 enable_service $(csv2ssv "${enable_services}")
157 EOF
158     fi
159     if [ -n "${disable_services}" ]; then
160         cat >> ${local_conf_file_name} << EOF
161 disable_service $(csv2ssv "${disable_services}")
162 EOF
163     fi
164 }
165
166 function create_control_node_local_conf() {
167     HOSTIP=$1
168     MGRIP=$2
169     ODL_OVS_MANAGERS="$3"
170
171     local_conf_file_name=${WORKSPACE}/local.conf_control_${HOSTIP}
172     cat > ${local_conf_file_name} << EOF
173 [[local|localrc]]
174 LOGFILE=stack.sh.log
175 USE_SCREEN=True
176 SCREEN_LOGDIR=/opt/stack/data/log
177 LOG_COLOR=False
178 RECLONE=${RECLONE}
179
180 disable_all_services
181 EOF
182
183     add_os_services "${CORE_OS_CONTROL_SERVICES}" "${ENABLE_OS_SERVICES}" "${DISABLE_OS_SERVICES}" "${local_conf_file_name}"
184
185     cat >> ${local_conf_file_name} << EOF
186
187 HOST_IP=${HOSTIP}
188 SERVICE_HOST=\$HOST_IP
189 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
190 NEUTRON_CREATE_INITIAL_NETWORKS=${CREATE_INITIAL_NETWORKS}
191
192 ODL_MODE=manual
193 ODL_MGR_IP=${MGRIP}
194 ODL_PORT=${ODL_PORT}
195 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
196 ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}
197
198 MYSQL_HOST=\$SERVICE_HOST
199 RABBIT_HOST=\$SERVICE_HOST
200 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
201 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
202 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
203
204 ADMIN_PASSWORD=${ADMIN_PASSWORD}
205 DATABASE_PASSWORD=${ADMIN_PASSWORD}
206 RABBIT_PASSWORD=${ADMIN_PASSWORD}
207 SERVICE_TOKEN=${ADMIN_PASSWORD}
208 SERVICE_PASSWORD=${ADMIN_PASSWORD}
209
210 NEUTRON_LBAAS_SERVICE_PROVIDERV2=${LBAAS_SERVICE_PROVIDER} # Only relevant if neutron-lbaas plugin is enabled
211 NEUTRON_SFC_DRIVERS=${ODL_SFC_DRIVER} # Only relevant if networking-sfc plugin is enabled
212 NEUTRON_FLOWCLASSIFIER_DRIVERS=${ODL_SFC_DRIVER} # Only relevant if networking-sfc plugin is enabled
213 ETCD_PORT=2379
214 EOF
215
216     if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
217         echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
218     fi
219
220     IFS=,
221     for plugin_name in ${ENABLE_OS_PLUGINS}; do
222         if [ "$plugin_name" == "networking-odl" ]; then
223             ENABLE_PLUGIN_ARGS="${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}"
224         elif [ "$plugin_name" == "kuryr-kubernetes" ]; then
225             ENABLE_PLUGIN_ARGS="${DEVSTACK_KUBERNETES_PLUGIN_REPO} master" # note: kuryr-kubernetes only exists in master at the moment
226         elif [ "$plugin_name" == "neutron-lbaas" ]; then
227             ENABLE_PLUGIN_ARGS="${DEVSTACK_LBAAS_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
228             IS_LBAAS_PLUGIN_ENABLED="yes"
229         elif [ "$plugin_name" == "networking-sfc" ]; then
230             ENABLE_PLUGIN_ARGS="${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
231         else
232             echo "Error: Invalid plugin $plugin_name, unsupported"
233             continue
234         fi
235         cat >> ${local_conf_file_name} << EOF
236
237 enable_plugin ${plugin_name} ${ENABLE_PLUGIN_ARGS}
238 EOF
239     done
240     unset IFS
241
242     if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
243         cat >> ${local_conf_file_name} << EOF
244
245 enable_plugin networking-l2gw ${NETWORKING_L2GW_DRIVER} ${ODL_ML2_BRANCH}
246 NETWORKING_L2GW_SERVICE_DRIVER=L2GW:OpenDaylight:networking_odl.l2gateway.driver.OpenDaylightL2gwDriver:default
247 EOF
248     fi
249
250     if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
251         cat >> ${local_conf_file_name} << EOF
252
253 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
254 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
255 ML2_VLAN_RANGES=${PUBLIC_PHYSICAL_NETWORK}
256 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
257 EOF
258
259         if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
260            SERVICE_PLUGINS="odl-router_v2"
261         else
262            SERVICE_PLUGINS="odl-router"
263         fi
264         if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
265             SERVICE_PLUGINS+=", networking_l2gw.services.l2gateway.plugin.L2GatewayPlugin"
266         fi
267         if [ "${IS_LBAAS_PLUGIN_ENABLED}" == "yes" ]; then
268             SERVICE_PLUGINS+=", lbaasv2"
269         fi
270     fi #check for ODL_ENABLE_L3_FWD
271
272     cat >> ${local_conf_file_name} << EOF
273
274 [[post-config|\$NEUTRON_CONF]]
275 [DEFAULT]
276 service_plugins = ${SERVICE_PLUGINS}
277
278 [[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
279 [agent]
280 minimize_polling=True
281
282 [ml2]
283 # Needed for VLAN provider tests - because our provider networks are always encapsulated in VXLAN (br-physnet1)
284 # MTU(1400) + VXLAN(50) + VLAN(4) = 1454 < MTU eth0/br-physnet1(1458)
285 physical_network_mtus = ${PUBLIC_PHYSICAL_NETWORK}:1400
286 path_mtu = 1458
287
288 [[post-config|/etc/neutron/dhcp_agent.ini]]
289 [DEFAULT]
290 force_metadata = True
291 enable_isolated_metadata = True
292
293 [[post-config|/etc/nova/nova.conf]]
294 [DEFAULT]
295 force_config_drive = False
296 force_raw_images = False
297
298 [scheduler]
299 discover_hosts_in_cells_interval = 30
300 EOF
301
302     echo "Control local.conf created:"
303     cat ${local_conf_file_name}
304 } # create_control_node_local_conf()
305
306 function create_compute_node_local_conf() {
307     HOSTIP=$1
308     SERVICEHOST=$2
309     MGRIP=$3
310     ODL_OVS_MANAGERS="$4"
311
312     local_conf_file_name=${WORKSPACE}/local.conf_compute_${HOSTIP}
313     cat > ${local_conf_file_name} << EOF
314 [[local|localrc]]
315 LOGFILE=stack.sh.log
316 LOG_COLOR=False
317 USE_SCREEN=True
318 SCREEN_LOGDIR=/opt/stack/data/log
319 RECLONE=${RECLONE}
320
321 disable_all_services
322 EOF
323
324     add_os_services "${CORE_OS_COMPUTE_SERVICES}" "${ENABLE_OS_COMPUTE_SERVICES}" "${DISABLE_OS_SERVICES}" "${local_conf_file_name}"
325
326     cat >> ${local_conf_file_name} << EOF
327
328 HOST_IP=${HOSTIP}
329 SERVICE_HOST=${SERVICEHOST}
330 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
331
332 ODL_MODE=manual
333 ODL_MGR_IP=${MGRIP}
334 ODL_PORT=${ODL_PORT}
335 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
336 ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}
337
338 Q_HOST=\$SERVICE_HOST
339 MYSQL_HOST=\$SERVICE_HOST
340 RABBIT_HOST=\$SERVICE_HOST
341 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
342 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
343 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
344
345 ADMIN_PASSWORD=${ADMIN_PASSWORD}
346 DATABASE_PASSWORD=${ADMIN_PASSWORD}
347 RABBIT_PASSWORD=${ADMIN_PASSWORD}
348 SERVICE_TOKEN=${ADMIN_PASSWORD}
349 SERVICE_PASSWORD=${ADMIN_PASSWORD}
350 EOF
351
352     if [[ "${ENABLE_OS_PLUGINS}" =~ networking-odl ]]; then
353         cat >> ${local_conf_file_name} << EOF
354
355 enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}
356 EOF
357     fi
358
359     if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
360         cat >> ${local_conf_file_name} << EOF
361
362 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
363 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
364 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
365 Q_L3_ENABLED=True
366 ODL_L3=${ODL_L3}
367 EOF
368     fi
369
370     cat >> ${local_conf_file_name} << EOF
371
372 [[post-config|/etc/nova/nova.conf]]
373 [api]
374 auth_strategy = keystone
375 [DEFAULT]
376 use_neutron = True
377 force_raw_images = False
378 EOF
379
380     echo "Compute local.conf created:"
381     cat ${local_conf_file_name}
382 } # create_compute_node_local_conf()
383
384 function configure_haproxy_for_neutron_requests() {
385     MGRIP=$1
386     # shellcheck disable=SC2206
387     ODL_IPS=(${2//,/ })
388
389     cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
390 sudo systemctl stop firewalld
391 sudo yum -y install policycoreutils-python haproxy
392 EOF
393
394 cat > ${WORKSPACE}/haproxy.cfg << EOF
395 global
396   daemon
397   group  haproxy
398   log  /dev/log local0
399   maxconn  20480
400   pidfile  /tmp/haproxy.pid
401   user  haproxy
402
403 defaults
404   log  global
405   maxconn  4096
406   mode  tcp
407   retries  3
408   timeout  http-request 10s
409   timeout  queue 1m
410   timeout  connect 10s
411   timeout  client 1m
412   timeout  server 1m
413   timeout  check 10s
414
415 listen opendaylight
416   bind ${MGRIP}:8080
417   balance source
418 EOF
419
420     odlindex=1
421     for odlip in ${ODL_IPS[*]}; do
422         cat >> ${WORKSPACE}/haproxy.cfg << EOF
423   server controller-${odlindex} ${odlip}:8080 check fall 5 inter 2000 rise 2
424 EOF
425         odlindex=$((odlindex+1))
426     done
427
428     cat >> ${WORKSPACE}/haproxy.cfg << EOF
429 listen opendaylight_rest
430   bind ${MGRIP}:8181
431   balance source
432 EOF
433
434     odlindex=1
435     for odlip in ${ODL_IPS[*]}; do
436         cat >> ${WORKSPACE}/haproxy.cfg << EOF
437   server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2
438 EOF
439         odlindex=$((odlindex+1))
440     done
441
442     echo "Dump haproxy.cfg"
443     cat ${WORKSPACE}/haproxy.cfg
444
445     cat > ${WORKSPACE}/deploy_ha_proxy.sh<< EOF
446 sudo chown haproxy:haproxy /tmp/haproxy.cfg
447 sudo sed -i 's/\\/etc\\/haproxy\\/haproxy.cfg/\\/tmp\\/haproxy.cfg/g' /usr/lib/systemd/system/haproxy.service
448 sudo /usr/sbin/semanage permissive -a haproxy_t
449 sudo systemctl restart haproxy
450 sleep 3
451 sudo netstat -tunpl
452 sudo systemctl status haproxy
453 true
454 EOF
455
456     scp ${WORKSPACE}/install_ha_proxy.sh ${MGRIP}:/tmp
457     ${SSH} ${MGRIP} "sudo bash /tmp/install_ha_proxy.sh"
458     scp ${WORKSPACE}/haproxy.cfg ${MGRIP}:/tmp
459     scp ${WORKSPACE}/deploy_ha_proxy.sh ${MGRIP}:/tmp
460     ${SSH} ${MGRIP} "sudo bash /tmp/deploy_ha_proxy.sh"
461 } # configure_haproxy_for_neutron_requests()
462
463 # Collect the list of files on the hosts
464 function list_files () {
465     local ip=$1
466     local folder=$2
467     ${SSH} ${ip} "sudo find /etc > /tmp/find.etc.txt"
468     ${SSH} ${ip} "sudo find /opt/stack > /tmp/find.opt.stack.txt"
469     ${SSH} ${ip} "sudo find /var > /tmp/find2.txt"
470     ${SSH} ${ip} "sudo find /var > /tmp/find.var.txt"
471     rsync --rsync-path="sudo rsync" --list-only -arvhe ssh ${ip}:/etc/ > ${folder}/rsync.etc.txt
472     rsync --rsync-path="sudo rsync" --list-only -arvhe ssh ${ip}:/opt/stack/ > ${folder}/rsync.opt.stack.txt
473     rsync --rsync-path="sudo rsync" --list-only -arvhe ssh ${ip}:/var/ > ${folder}/rsync.var.txt
474     scp ${ip}:/tmp/find.etc.txt ${folder}
475     scp ${ip}:/tmp/find.opt.stack.txt ${folder}
476     scp ${ip}:/tmp/find2.txt ${folder}
477     scp ${ip}:/tmp/find.var.txt ${folder}
478 }
479
480 function collect_logs () {
481     set +e  # We do not want to create red dot just because something went wrong while fetching logs.
482
483     cat > extra_debug.sh << EOF
484 echo -e "/usr/sbin/lsmod | /usr/bin/grep openvswitch\n"
485 /usr/sbin/lsmod | /usr/bin/grep openvswitch
486 echo -e "\ngrep ct_ /var/log/openvswitch/ovs-vswitchd.log\n"
487 grep "Datapath supports" /var/log/openvswitch/ovs-vswitchd.log
488 echo -e "\nsudo netstat -punta\n"
489 sudo netstat -punta
490 echo -e "\nsudo getenforce\n"
491 sudo getenforce
492 echo -e "\nsudo systemctl status httpd\n"
493 sudo systemctl status httpd
494 echo -e "\nenv\n"
495 env
496 source /opt/stack/devstack/openrc admin admin
497 echo -e "\nenv after openrc\n"
498 env
499 echo -e "\nsudo du -hs /opt/stack"
500 sudo du -hs /opt/stack
501 echo -e "\nsudo mount"
502 sudo mount
503 echo -e "\ndmesg -T > /tmp/dmesg.log"
504 dmesg -T > /tmp/dmesg.log
505 echo -e "\njournalctl > /tmp/journalctl.log\n"
506 sudo journalctl > /tmp/journalctl.log
507 echo -e "\novsdb-tool -mm show-log > /tmp/ovsdb-tool.log"
508 ovsdb-tool -mm show-log > /tmp/ovsdb-tool.log
509 EOF
510
511     # Since this log collection work is happening before the archive build macro which also
512     # creates the ${WORKSPACE}/archives dir, we have to do it here first.  The mkdir in the
513     # archives build step will essentially be a noop.
514     mkdir -p ${WORKSPACE}/archives
515
516     mv /tmp/changes.txt ${WORKSPACE}/archives
517
518     sleep 5
519     # FIXME: Do not create .tar and gzip before copying.
520     for i in `seq 1 ${NUM_ODL_SYSTEM}`; do
521         CONTROLLERIP=ODL_SYSTEM_${i}_IP
522         echo "collect_logs: for opendaylight controller ip: ${!CONTROLLERIP}"
523         NODE_FOLDER="odl_${i}"
524         mkdir -p ${NODE_FOLDER}
525         echo "Lets's take the karaf thread dump again..."
526         ssh ${!CONTROLLERIP} "sudo ps aux" > ${WORKSPACE}/ps_after.log
527         pid=$(grep org.apache.karaf.main.Main ${WORKSPACE}/ps_after.log | grep -v grep | tr -s ' ' | cut -f2 -d' ')
528         echo "karaf main: org.apache.karaf.main.Main, pid:${pid}"
529         ssh ${!CONTROLLERIP} "jstack ${pid}" > ${WORKSPACE}/karaf_${i}_${pid}_threads_after.log || true
530         echo "killing karaf process..."
531         ${SSH} "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
532         ${SSH} ${!CONTROLLERIP} "sudo journalctl > /tmp/journalctl.log"
533         scp ${!CONTROLLERIP}:/tmp/journalctl.log ${NODE_FOLDER}
534         ${SSH} ${!CONTROLLERIP} "dmesg -T > /tmp/dmesg.log"
535         scp ${!CONTROLLERIP}:/tmp/dmesg.log ${NODE_FOLDER}
536         ${SSH} ${!CONTROLLERIP} "cp -r /tmp/${BUNDLEFOLDER}/data/log /tmp/odl_log"
537         ${SSH} ${!CONTROLLERIP} "tar -cf /tmp/odl${i}_karaf.log.tar /tmp/odl_log/*"
538         scp ${!CONTROLLERIP}:/tmp/odl${i}_karaf.log.tar ${NODE_FOLDER}
539         ${SSH} ${!CONTROLLERIP} "tar -cf /tmp/odl${i}_zrpcd.log.tar /tmp/zrpcd.init.log"
540         scp ${!CONTROLLERIP}:/tmp/odl${i}_zrpcd.log.tar ${NODE_FOLDER}
541         tar -xvf ${NODE_FOLDER}/odl${i}_karaf.log.tar -C ${NODE_FOLDER} --strip-components 2 --transform s/karaf/odl${i}_karaf/g
542         grep "ROBOT MESSAGE\| ERROR " ${NODE_FOLDER}/odl${i}_karaf.log > ${NODE_FOLDER}/odl${i}_err.log
543         grep "ROBOT MESSAGE\| ERROR \| WARN \|Exception" \
544             ${NODE_FOLDER}/odl${i}_karaf.log > ${NODE_FOLDER}/odl${i}_err_warn_exception.log
545         # Print ROBOT lines and print Exception lines. For exception lines also print the previous line for context
546         sed -n -e '/ROBOT MESSAGE/P' -e '$!N;/Exception/P;D' ${NODE_FOLDER}/odl${i}_karaf.log > ${NODE_FOLDER}/odl${i}_exception.log
547         rm ${NODE_FOLDER}/odl${i}_karaf.log.tar
548         mv *_threads* ${NODE_FOLDER}
549         mv ps_* ${NODE_FOLDER}
550         mv ${NODE_FOLDER} ${WORKSPACE}/archives/
551     done
552
553     print_job_parameters > ${WORKSPACE}/archives/params.txt
554
555     # Control Node
556     for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`; do
557         OSIP=OPENSTACK_CONTROL_NODE_${i}_IP
558         echo "collect_logs: for openstack control node ip: ${!OSIP}"
559         NODE_FOLDER="control_${i}"
560         mkdir -p ${NODE_FOLDER}
561         scp extra_debug.sh ${!OSIP}:/tmp
562         ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
563         scp ${!OSIP}:/etc/dnsmasq.conf ${NODE_FOLDER}
564         scp ${!OSIP}:/etc/keystone/keystone.conf ${NODE_FOLDER}
565         scp ${!OSIP}:/etc/keystone/keystone-uwsgi-admin.ini ${NODE_FOLDER}
566         scp ${!OSIP}:/etc/keystone/keystone-uwsgi-public.ini ${NODE_FOLDER}
567         scp ${!OSIP}:/etc/kuryr/kuryr.conf ${NODE_FOLDER}
568         scp ${!OSIP}:/etc/neutron/dhcp_agent.ini ${NODE_FOLDER}
569         scp ${!OSIP}:/etc/neutron/metadata_agent.ini ${NODE_FOLDER}
570         scp ${!OSIP}:/etc/neutron/neutron.conf ${NODE_FOLDER}
571         scp ${!OSIP}:/etc/neutron/neutron_lbaas.conf ${NODE_FOLDER}
572         scp ${!OSIP}:/etc/neutron/plugins/ml2/ml2_conf.ini ${NODE_FOLDER}
573         scp ${!OSIP}:/etc/neutron/services/loadbalancer/haproxy/lbaas_agent.ini ${NODE_FOLDER}
574         scp ${!OSIP}:/etc/nova/nova.conf ${NODE_FOLDER}
575         scp ${!OSIP}:/etc/nova/nova-api-uwsgi.ini ${NODE_FOLDER}
576         scp ${!OSIP}:/etc/nova/nova_cell1.conf ${NODE_FOLDER}
577         scp ${!OSIP}:/etc/nova/nova-cpu.conf ${NODE_FOLDER}
578         scp ${!OSIP}:/etc/nova/placement-uwsgi.ini ${NODE_FOLDER}
579         scp ${!OSIP}:/etc/openstack/clouds.yaml ${NODE_FOLDER}
580         scp ${!OSIP}:/opt/stack/devstack/.stackenv ${NODE_FOLDER}
581         scp ${!OSIP}:/opt/stack/devstack/nohup.out ${NODE_FOLDER}/stack.log
582         scp ${!OSIP}:/opt/stack/devstack/openrc ${NODE_FOLDER}
583         scp ${!OSIP}:/opt/stack/requirements/upper-constraints.txt ${NODE_FOLDER}
584         scp ${!OSIP}:/opt/stack/tempest/etc/tempest.conf ${NODE_FOLDER}
585         scp ${!OSIP}:/tmp/*.xz ${NODE_FOLDER}
586         scp ${!OSIP}:/tmp/dmesg.log ${NODE_FOLDER}
587         scp ${!OSIP}:/tmp/extra_debug.log ${NODE_FOLDER}
588         scp ${!OSIP}:/tmp/get_devstack.sh.txt ${NODE_FOLDER}
589         scp ${!OSIP}:/tmp/journalctl.log ${NODE_FOLDER}
590         scp ${!OSIP}:/tmp/ovsdb-tool.log ${NODE_FOLDER}
591         scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${NODE_FOLDER}
592         scp ${!OSIP}:/var/log/openvswitch/ovsdb-server.log ${NODE_FOLDER}
593         list_files "${!OSIP}" "${NODE_FOLDER}"
594         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/etc/hosts ${NODE_FOLDER}
595         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/usr/lib/systemd/system/haproxy.service ${NODE_FOLDER}
596         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/audit/audit.log ${NODE_FOLDER}
597         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/httpd/keystone_access.log ${NODE_FOLDER}
598         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/httpd/keystone.log ${NODE_FOLDER}
599         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/messages ${NODE_FOLDER}
600         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/rabbitmq ${NODE_FOLDER}
601         rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${NODE_FOLDER} # rsync to prevent copying of symbolic links
602         mv local.conf_control_${!OSIP} ${NODE_FOLDER}/local.conf
603         # qdhcp files are created by robot tests
604         mv /tmp/qdhcp ${NODE_FOLDER}
605         mv ${NODE_FOLDER} ${WORKSPACE}/archives/
606     done
607
608     # Compute Nodes
609     for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`; do
610         OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
611         echo "collect_logs: for openstack compute node ip: ${!OSIP}"
612         NODE_FOLDER="compute_${i}"
613         mkdir -p ${NODE_FOLDER}
614         scp extra_debug.sh ${!OSIP}:/tmp
615         ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
616         scp ${!OSIP}:/etc/nova/nova.conf ${NODE_FOLDER}
617         scp ${!OSIP}:/etc/nova/nova-cpu.conf ${NODE_FOLDER}
618         scp ${!OSIP}:/etc/openstack/clouds.yaml ${NODE_FOLDER}
619         scp ${!OSIP}:/opt/stack/devstack/.stackenv ${NODE_FOLDER}
620         scp ${!OSIP}:/opt/stack/devstack/nohup.out ${NODE_FOLDER}/stack.log
621         scp ${!OSIP}:/opt/stack/devstack/openrc ${NODE_FOLDER}
622         scp ${!OSIP}:/opt/stack/requirements/upper-constraints.txt ${NODE_FOLDER}
623         scp ${!OSIP}:/tmp/*.xz ${NODE_FOLDER}/
624         scp ${!OSIP}:/tmp/dmesg.log ${NODE_FOLDER}
625         scp ${!OSIP}:/tmp/extra_debug.log ${NODE_FOLDER}
626         scp ${!OSIP}:/tmp/get_devstack.sh.txt ${NODE_FOLDER}
627         scp ${!OSIP}:/tmp/journalctl.log ${NODE_FOLDER}
628         scp ${!OSIP}:/tmp/ovsdb-tool.log ${NODE_FOLDER}
629         scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${NODE_FOLDER}
630         scp ${!OSIP}:/var/log/openvswitch/ovsdb-server.log ${NODE_FOLDER}
631         list_files "${!OSIP}" "${NODE_FOLDER}"
632         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/etc/hosts ${NODE_FOLDER}
633         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/audit/audit.log ${NODE_FOLDER}
634         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/libvirt ${NODE_FOLDER}
635         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/messages ${NODE_FOLDER}
636         rsync --rsync-path="sudo rsync" -avhe ssh ${!OSIP}:/var/log/nova-agent.log ${NODE_FOLDER}
637         rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${NODE_FOLDER} # rsync to prevent copying of symbolic links
638         mv local.conf_compute_${!OSIP} ${NODE_FOLDER}/local.conf
639         mv ${NODE_FOLDER} ${WORKSPACE}/archives/
640     done
641
642     # Tempest
643     DEVSTACK_TEMPEST_DIR="/opt/stack/tempest"
644     TESTREPO=".stestr"
645     TEMPEST_LOGS_DIR=${WORKSPACE}/archives/tempest
646     # Look for tempest test results in the $TESTREPO dir and copy if found
647     if ${SSH} ${OPENSTACK_CONTROL_NODE_1_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/${TESTREPO}/0 ]'"; then
648         ${SSH} ${OPENSTACK_CONTROL_NODE_1_IP} "for I in \$(sudo ls ${DEVSTACK_TEMPEST_DIR}/${TESTREPO}/ | grep -E '^[0-9]+$'); do sudo sh -c \"${DEVSTACK_TEMPEST_DIR}/.tox/tempest/bin/subunit-1to2 < ${DEVSTACK_TEMPEST_DIR}/${TESTREPO}/\${I} >> ${DEVSTACK_TEMPEST_DIR}/subunit_log.txt\"; done"
649         ${SSH} ${OPENSTACK_CONTROL_NODE_1_IP} "sudo sh -c '${DEVSTACK_TEMPEST_DIR}/.tox/tempest/bin/python ${DEVSTACK_TEMPEST_DIR}/.tox/tempest/lib/python2.7/site-packages/os_testr/subunit2html.py ${DEVSTACK_TEMPEST_DIR}/subunit_log.txt ${DEVSTACK_TEMPEST_DIR}/tempest_results.html'"
650         mkdir -p ${TEMPEST_LOGS_DIR}
651         scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${TEMPEST_LOGS_DIR}
652         scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest.log ${TEMPEST_LOGS_DIR}
653         mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
654     else
655         echo "tempest results not found in ${DEVSTACK_TEMPEST_DIR}/${TESTREPO}/0"
656     fi
657 } # collect_logs()
658
659 # Following three functions are debugging helpers when debugging devstack changes.
660 # Keeping them for now so we can simply call them when needed.
661 ctrlhn=""
662 comp1hn=""
663 comp2hn=""
664 function get_hostnames () {
665     set +e
666     local ctrlip=${OPENSTACK_CONTROL_NODE_1_IP}
667     local comp1ip=${OPENSTACK_COMPUTE_NODE_1_IP}
668     local comp2ip=${OPENSTACK_COMPUTE_NODE_2_IP}
669     ctrlhn=$(${SSH} ${ctrlip} "hostname")
670     comp1hn=$(${SSH} ${comp1ip} "hostname")
671     comp2hn=$(${SSH} ${comp2ip} "hostname")
672     echo "hostnames: ${ctrlhn}, ${comp1hn}, ${comp2hn}"
673     set -e
674 }
675
676 function check_firewall() {
677     set +e
678     echo $-
679     local ctrlip=${OPENSTACK_CONTROL_NODE_1_IP}
680     local comp1ip=${OPENSTACK_COMPUTE_NODE_1_IP}
681     local comp2ip=${OPENSTACK_COMPUTE_NODE_2_IP}
682
683     echo "check_firewall on control"
684     ${SSH} ${ctrlip} "
685         sudo systemctl status firewalld
686         sudo systemctl -l status iptables
687         sudo iptables --line-numbers -nvL
688     " || true
689     echo "check_firewall on compute 1"
690     ${SSH} ${comp1ip} "
691         sudo systemctl status firewalld
692         sudo systemctl -l status iptables
693         sudo iptables --line-numbers -nvL
694     " || true
695     echo "check_firewall on compute 2"
696     ${SSH} ${comp2ip} "
697         sudo systemctl status firewalld
698         sudo systemctl -l status iptables
699         sudo iptables --line-numbers -nvL
700     " || true
701 }
702
703 function get_service () {
704     set +e
705     local iter=$1
706     #local idx=$2
707     local ctrlip=${OPENSTACK_CONTROL_NODE_1_IP}
708     local comp1ip=${OPENSTACK_COMPUTE_NODE_1_IP}
709
710     #if [ ${idx} -eq 1 ]; then
711         if [ ${iter} -eq 1 ] || [ ${iter} -gt 16 ]; then
712             curl http://${ctrlip}:5000
713             curl http://${ctrlip}:35357
714             curl http://${ctrlip}/identity
715             ${SSH} ${ctrlip} "
716                 source /opt/stack/devstack/openrc admin admin;
717                 env
718                 openstack configuration show --unmask;
719                 openstack service list
720                 openstack --os-cloud devstack-admin --os-region RegionOne compute service list
721                 openstack hypervisor list;
722             " || true
723             check_firewall
724         fi
725     #fi
726     set -e
727 }
728
729 # Check if rabbitmq is ready by looking for a pid in it's status.
730 # The function returns the status of the grep command which callers can check.
731 function is_rabbitmq_ready() {
732     local -r ip=$1
733     rm -f rabbit.txt
734     ${SSH} ${ip} "sudo rabbitmqctl status" > rabbit.txt
735     grep pid rabbit.txt
736 }
737
738 # retry the given command ($3) until success for a number of iterations ($1)
739 # sleeping ($2) between tries.
740 function retry() {
741     set +e
742     local -r -i max_tries=${1}
743     local -r -i sleep_time=${2}
744     local -r cmd=${3}
745     local -i retries=1
746     local -i rc=1
747     while true; do
748         echo "retry ${cmd}: attempt: ${retries}"
749         ${cmd}
750         rc=$?
751         if ((${rc} == 0)); then
752             break;
753         else
754             if ((${retries} == ${max_tries})); then
755                 break
756             else
757                 ((retries++))
758                 sleep ${sleep_time}
759             fi
760         fi
761     done
762     set -e
763     return ${rc}
764 }
765
766 # if we are using the new netvirt impl, as determined by the feature name
767 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
768 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
769 # external networks in legacy netvirt
770 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
771   ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
772 else
773   ODL_PROVIDER_MAPPINGS=
774 fi
775
776 # if we are using the old netvirt impl, as determined by the feature name
777 # odl-ovsdb-openstack (note: new impl is odl-netvirt-openstack) then we
778 # want ODL_L3 to be True.  New impl wants it False
779 if [[ ${CONTROLLERFEATURES} == *"odl-ovsdb-openstack"* ]]; then
780     ODL_L3=True
781 else
782     ODL_L3=False
783 fi
784
785 RECLONE=False
786 ODL_PORT=8181
787
788 # Always compare the lists below against the devstack upstream ENABLED_SERVICES in
789 # https://github.com/openstack-dev/devstack/blob/master/stackrc#L52
790 # ODL CSIT does not use vnc, cinder, q-agt, q-l3 or horizon so they are not included below.
791 # collect performance stats
792 CORE_OS_CONTROL_SERVICES="dstat"
793 # Glance
794 CORE_OS_CONTROL_SERVICES+=",g-api,g-reg"
795 # Keystone
796 CORE_OS_CONTROL_SERVICES+=",key"
797 # Nova - services to support libvirt
798 CORE_OS_CONTROL_SERVICES+=",n-api,n-api-meta,n-cauth,n-cond,n-crt,n-obj,n-sch"
799 # ODL - services to connect to ODL
800 CORE_OS_CONTROL_SERVICES+=",odl-compute,odl-neutron"
801 # Neutron
802 CORE_OS_CONTROL_SERVICES+=",q-dhcp,q-meta,q-svc"
803 # Additional services
804 CORE_OS_CONTROL_SERVICES+=",mysql,rabbit"
805
806 # computes only need nova and odl
807 CORE_OS_COMPUTE_SERVICES="n-cpu,odl-compute"
808
809 cat > ${WORKSPACE}/disable_firewall.sh << EOF
810 sudo systemctl stop firewalld
811 # Open these ports to match the tutorial vms
812 # http/https (80/443), samba (445), netbios (137,138,139)
813 sudo iptables -I INPUT -p tcp -m multiport --dports 80,443,139,445 -j ACCEPT
814 sudo iptables -I INPUT -p udp -m multiport --dports 137,138 -j ACCEPT
815 # OpenStack services as well as vxlan tunnel ports 4789 and 9876
816 # identity public/admin (5000/35357), ampq (5672), vnc (6080), nova (8774), glance (9292), neutron (9696)
817 sudo sudo iptables -I INPUT -p tcp -m multiport --dports 5000,5672,6080,8774,9292,9696,35357 -j ACCEPT
818 sudo sudo iptables -I INPUT -p udp -m multiport --dports 4789,9876 -j ACCEPT
819 sudo iptables-save > /etc/sysconfig/iptables
820 sudo systemctl restart iptables
821 sudo iptables --line-numbers -nvL
822 true
823 EOF
824
825 cat > ${WORKSPACE}/get_devstack.sh << EOF
826 sudo systemctl stop firewalld
827 sudo yum install bridge-utils python-pip -y
828 #sudo systemctl stop  NetworkManager
829 #Disable NetworkManager and kill dhclient and dnsmasq
830 sudo systemctl stop NetworkManager
831 sudo killall dhclient
832 sudo killall dnsmasq
833 #Workaround for mysql failure
834 echo "127.0.0.1   localhost \${HOSTNAME}" >> /tmp/hosts
835 echo "::1         localhost \${HOSTNAME}" >> /tmp/hosts
836 sudo mv /tmp/hosts /etc/hosts
837 sudo mkdir /opt/stack
838 echo "Create RAM disk for /opt/stack"
839 sudo mount -t tmpfs -o size=2G tmpfs /opt/stack
840 sudo chmod 777 /opt/stack
841 cd /opt/stack
842 echo "git clone https://git.openstack.org/openstack-dev/devstack --branch ${OPENSTACK_BRANCH}"
843 git clone https://git.openstack.org/openstack-dev/devstack --branch ${OPENSTACK_BRANCH}
844 cd devstack
845 if [ -n "${DEVSTACK_HASH}" ]; then
846     echo "git checkout ${DEVSTACK_HASH}"
847     git checkout ${DEVSTACK_HASH}
848 fi
849 git --no-pager log --pretty=format:'%h %<(13)%ar%<(13)%cr %<(20,trunc)%an%d %s\n%b' -n20
850 echo "workaround: adjust wait from 60s to 1800s (30m)"
851 sed -i 's/wait_for_compute 60/wait_for_compute 1800/g' /opt/stack/devstack/lib/nova
852 # TODO: modify sleep 1 to sleep 60, search wait_for_compute, then first sleep 1
853 # that would just reduce the number of logs in the compute stack.log
854
855 #Install qemu-img command in Control Node for Pike
856 echo "Install qemu-img application"
857 sudo yum install -y qemu-img
858 EOF
859
860 cat > "${WORKSPACE}/setup_host_cell_mapping.sh" << EOF
861 sudo nova-manage cell_v2 map_cell0
862 sudo nova-manage cell_v2 simple_cell_setup
863 sudo nova-manage db sync
864 sudo nova-manage cell_v2 discover_hosts
865 EOF
866
867 NUM_OPENSTACK_SITES=${NUM_OPENSTACK_SITES:-1}
868 compute_index=1
869 odl_index=1
870 os_node_list=()
871 os_interval=$(( ${NUM_OPENSTACK_SYSTEM} / ${NUM_OPENSTACK_SITES} ))
872 ha_proxy_index=${os_interval}
873
874 for i in `seq 1 ${NUM_OPENSTACK_SITES}`; do
875     if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
876         echo "Configure HAProxy"
877         ODL_HAPROXYIP_PARAM=OPENSTACK_HAPROXY_${i}_IP
878         ha_proxy_index=$(( $ha_proxy_index + $os_interval ))
879         odl_index=$(((i - 1) * 3 + 1))
880         ODL_IP_PARAM1=ODL_SYSTEM_$((odl_index++))_IP
881         ODL_IP_PARAM2=ODL_SYSTEM_$((odl_index++))_IP
882         ODL_IP_PARAM3=ODL_SYSTEM_$((odl_index++))_IP
883         ODLMGRIP[$i]=${!ODL_HAPROXYIP_PARAM} # ODL Northbound uses HAProxy VIP
884         ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM1},${!ODL_IP_PARAM2},${!ODL_IP_PARAM3}" # OVSDB connects to all ODL IPs
885         configure_haproxy_for_neutron_requests ${!ODL_HAPROXYIP_PARAM} "${ODL_OVS_MGRS[$i]}"
886     else
887         ODL_IP_PARAM=ODL_SYSTEM_${i}_IP
888         ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM}" # ODL Northbound uses ODL IP
889         ODLMGRIP[$i]=${!ODL_IP_PARAM} # OVSDB connects to ODL IP
890     fi
891 done
892
893 # Begin stacking the nodes, starting with the controller(s) and then the compute(s)
894
895 for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`; do
896     CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
897     echo "Configure the stack of the control node ${i} of ${NUM_OPENSTACK_CONTROL_NODES}: ${!CONTROLIP}"
898     scp ${WORKSPACE}/disable_firewall.sh ${!CONTROLIP}:/tmp
899     ${SSH} ${!CONTROLIP} "sudo bash /tmp/disable_firewall.sh"
900     create_etc_hosts ${!CONTROLIP}
901     scp ${WORKSPACE}/hosts_file ${!CONTROLIP}:/tmp/hosts
902     scp ${WORKSPACE}/get_devstack.sh ${!CONTROLIP}:/tmp
903     ${SSH} ${!CONTROLIP} "bash /tmp/get_devstack.sh > /tmp/get_devstack.sh.txt 2>&1"
904     create_control_node_local_conf ${!CONTROLIP} ${ODLMGRIP[$i]} "${ODL_OVS_MGRS[$i]}"
905     scp ${WORKSPACE}/local.conf_control_${!CONTROLIP} ${!CONTROLIP}:/opt/stack/devstack/local.conf
906     echo "Stack the control node ${i} of ${NUM_OPENSTACK_CONTROL_NODES}: ${CONTROLIP}"
907     ssh ${!CONTROLIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
908     ssh ${!CONTROLIP} "ps -ef | grep stack.sh"
909     ssh ${!CONTROLIP} "ls -lrt /opt/stack/devstack/nohup.out"
910     os_node_list+=("${!CONTROLIP}")
911     # Workaround for stable/newton jobs
912     # TODO: can this be removed now?
913     if [ "${ODL_ML2_BRANCH}" == "stable/newton" ]; then
914         ssh ${!CONTROLIP} "cd /opt/stack; git clone https://git.openstack.org/openstack/requirements; cd requirements; git checkout stable/newton; sed -i /appdirs/d upper-constraints.txt"
915     fi
916 done
917
918 # This is a backup to the CELLSV2_SETUP=singleconductor workaround. Keeping it here as an easy lookup
919 # if needed.
920 # Let the control node get started to avoid a race condition where the computes start and try to access
921 # the nova_cell1 on the control node before it is created. If that happens, the nova-compute service on the
922 # compute exits and does not attempt to restart.
923 # 180s is chosen because in test runs the control node usually finished in 17-20 minutes and the computes finished
924 # in 17 minutes, so take the max difference of 3 minutes and the jobs should still finish around the same time.
925 # one of the following errors is seen in the compute n-cpu.log:
926 # Unhandled error: NotAllowed: Connection.open: (530) NOT_ALLOWED - access to vhost 'nova_cell1' refused for user 'stackrabbit'
927 # AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.
928 # Compare that timestamp to this log in the control stack.log: sudo rabbitmqctl set_permissions -p nova_cell1 stackrabbit
929 # If the n-cpu.log is earlier than the control stack.log timestamp then the failure condition is likely hit.
930 WAIT_FOR_RABBITMQ_MINUTES=60
931 echo "Wait a maximum of ${WAIT_FOR_RABBITMQ_MINUTES}m until rabbitmq is ready to allow the controller to create nova_cell1 before the computes need it"
932 retry ${WAIT_FOR_RABBITMQ_MINUTES} 60 "is_rabbitmq_ready ${OPENSTACK_CONTROL_NODE_1_IP}"
933 rc=$?
934 if ((${rc} == 0)); then
935     echo "rabbitmq is ready, starting ${NUM_OPENSTACK_COMPUTE_NODES} compute(s)"
936 else
937     echo "rabbitmq was not ready in ${WAIT_FOR_RABBITMQ_MINUTES}m"
938     collect_logs
939     exit 1
940 fi
941
942 for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`; do
943     NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
944     SITE_INDEX=$((((i - 1) / NUM_COMPUTES_PER_SITE) + 1)) # We need the site index to infer the control node IP for this compute
945     COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
946     CONTROLIP=OPENSTACK_CONTROL_NODE_${SITE_INDEX}_IP
947     echo "Configure the stack of the compute node ${i} of ${NUM_OPENSTACK_COMPUTE_NODES}: ${!COMPUTEIP}"
948     scp ${WORKSPACE}/disable_firewall.sh "${!COMPUTEIP}:/tmp"
949     ${SSH} "${!COMPUTEIP}" "sudo bash /tmp/disable_firewall.sh"
950     create_etc_hosts ${!COMPUTEIP} ${!CONTROLIP}
951     scp ${WORKSPACE}/hosts_file ${!COMPUTEIP}:/tmp/hosts
952     scp ${WORKSPACE}/get_devstack.sh  ${!COMPUTEIP}:/tmp
953     ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh > /tmp/get_devstack.sh.txt 2>&1"
954     if [ "${ODL_ML2_BRANCH}" == "stable/ocata" ]; then
955         echo "Updating requirements for ${ODL_ML2_BRANCH}"
956         echo "Workaround for https://review.openstack.org/#/c/491032/"
957         echo "Modify upper-constraints to use libvirt-python 3.2.0"
958         ${SSH} ${!COMPUTEIP} "
959             cd /opt/stack;
960             git clone https://git.openstack.org/openstack/requirements;
961             cd requirements;
962             git checkout stable/ocata;
963             sed -i s/libvirt-python===2.5.0/libvirt-python===3.2.0/ upper-constraints.txt
964         "
965     fi
966     create_compute_node_local_conf ${!COMPUTEIP} ${!CONTROLIP} ${ODLMGRIP[$SITE_INDEX]} "${ODL_OVS_MGRS[$SITE_INDEX]}"
967     scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
968     echo "Stack the compute node ${i} of ${NUM_OPENSTACK_COMPUTE_NODES}: ${COMPUTEIP}"
969     ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
970     ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
971     os_node_list+=("${!COMPUTEIP}")
972 done
973
974 echo "nodelist: ${os_node_list[*]}"
975
976 # This script runs on the openstack nodes. It greps for a string that devstack writes when stacking is complete.
977 # The script then writes a status depending on the grep output that is later scraped by the robot vm to control
978 # the status polling.
979 cat > ${WORKSPACE}/check_stacking.sh << EOF
980 > /tmp/stack_progress
981 ps -ef | grep "stack.sh" | grep -v grep
982 ret=\$?
983 if [ \${ret} -eq 1 ]; then
984     grep "This is your host IP address:" /opt/stack/devstack/nohup.out
985     if [ \$? -eq 0 ]; then
986         echo "Stacking Complete" > /tmp/stack_progress
987     else
988         echo "Stacking Failed" > /tmp/stack_progress
989     fi
990 elif [ \${ret} -eq 0 ]; then
991     echo "Still Stacking" > /tmp/stack_progress
992 fi
993 EOF
994
995 # devstack debugging
996 # get_hostnames
997
998 # Check if the stacking is finished. Poll all nodes every 60s for one hour.
999 iteration=0
1000 in_progress=1
1001 while [ ${in_progress} -eq 1 ]; do
1002     iteration=$(($iteration + 1))
1003     for index in "${!os_node_list[@]}"; do
1004         echo "node $index ${os_node_list[index]}: checking stacking status attempt ${iteration} of 60"
1005         scp ${WORKSPACE}/check_stacking.sh  ${os_node_list[index]}:/tmp
1006         ${SSH} ${os_node_list[index]} "bash /tmp/check_stacking.sh"
1007         scp ${os_node_list[index]}:/tmp/stack_progress .
1008         cat stack_progress
1009         stacking_status=`cat stack_progress`
1010         # devstack debugging
1011         # get_service "${iteration}" "${index}"
1012         if [ "$stacking_status" == "Still Stacking" ]; then
1013             continue
1014         elif [ "$stacking_status" == "Stacking Failed" ]; then
1015             echo "node $index ${os_node_list[index]}: stacking has failed"
1016             collect_logs
1017             exit 1
1018         elif [ "$stacking_status" == "Stacking Complete" ]; then
1019             echo "node $index ${os_node_list[index]}: stacking complete"
1020             unset 'os_node_list[index]'
1021             if  [ ${#os_node_list[@]} -eq 0 ]; then
1022                 in_progress=0
1023             fi
1024         fi
1025     done
1026     echo "sleep for a minute before the next check"
1027     sleep 60
1028     if [ ${iteration} -eq 60 ]; then
1029         echo "stacking has failed - took longer than 60m"
1030         collect_logs
1031         exit 1
1032     fi
1033 done
1034
1035 # Further configuration now that stacking is complete.
1036 NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
1037 for i in `seq 1 ${NUM_OPENSTACK_SITES}`; do
1038     echo "Configure the Control Node"
1039     CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
1040     # Gather Compute IPs for the site
1041     for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`; do
1042         COMPUTE_INDEX=$(((i-1) * NUM_COMPUTES_PER_SITE + j))
1043         IP_VAR=OPENSTACK_COMPUTE_NODE_${COMPUTE_INDEX}_IP
1044         COMPUTE_IPS[$((j-1))]=${!IP_VAR}
1045     done
1046
1047     echo "sleep for 60s and print hypervisor-list"
1048     sleep 60
1049     # In Ocata if we do not enable the n-cpu in control node then
1050     # we need to discover hosts manually and ensure that they are mapped to cells.
1051     # reference: https://ask.openstack.org/en/question/102256/how-to-configure-placement-service-for-compute-node-on-ocata/
1052     if [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then
1053         scp ${WORKSPACE}/setup_host_cell_mapping.sh  ${!CONTROLIP}:/tmp
1054         ${SSH} ${!CONTROLIP} "sudo bash /tmp/setup_host_cell_mapping.sh"
1055     fi
1056     ${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
1057     # in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
1058     # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
1059     # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
1060     # is one less than the total number of openstack systems
1061     if [ $((NUM_OPENSTACK_SYSTEM / NUM_OPENSTACK_SITES)) -eq 1 ]; then
1062         expected_num_hypervisors=1
1063     else
1064         expected_num_hypervisors=${NUM_COMPUTES_PER_SITE}
1065     fi
1066     num_hypervisors=$(${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; openstack hypervisor list -f value | wc -l" | tail -1 | tr -d "\r")
1067     if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
1068         echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
1069         collect_logs
1070         exit 1
1071     fi
1072
1073     # upgrading pip, urllib3 and httplib2 so that tempest tests can be run on openstack control node
1074     # this needs to happen after devstack runs because it seems devstack is pulling in specific versions
1075     # of these libs that are not working for tempest.
1076     ${SSH} ${!CONTROLIP} "sudo pip install --upgrade pip"
1077     ${SSH} ${!CONTROLIP} "sudo pip install urllib3 --upgrade"
1078     ${SSH} ${!CONTROLIP} "sudo pip install httplib2 --upgrade"
1079
1080     # Gather Compute IPs for the site
1081     for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`; do
1082         COMPUTE_INDEX=$(((i-1) * NUM_COMPUTES_PER_SITE + j))
1083         IP_VAR=OPENSTACK_COMPUTE_NODE_${COMPUTE_INDEX}_IP
1084         COMPUTE_IPS[$((j-1))]=${!IP_VAR}
1085     done
1086
1087     # External Network
1088     echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
1089     # FIXME Should there be a unique gateway IP and devstack index for each site?
1090     devstack_index=1
1091     for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}; do
1092         # FIXME - Workaround, ODL (new netvirt) currently adds PUBLIC_BRIDGE as a port in br-int since it doesn't see such a bridge existing when we stack
1093         ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
1094         ${SSH} $ip "sudo ovs-vsctl --may-exist add-br $PUBLIC_BRIDGE -- set bridge $PUBLIC_BRIDGE other-config:disable-in-band=true other_config:hwaddr=f6:00:00:ff:01:0$((devstack_index++))"
1095     done
1096
1097     # ipsec support
1098     if [ "${IPSEC_VXLAN_TUNNELS_ENABLED}" == "yes" ]; then
1099         # shellcheck disable=SC2206
1100         ALL_NODES=(${!CONTROLIP} ${COMPUTE_IPS[*]})
1101         for ((inx_ip1=0; inx_ip1<$((${#ALL_NODES[@]} - 1)); inx_ip1++)); do
1102             for ((inx_ip2=$((inx_ip1 + 1)); inx_ip2<${#ALL_NODES[@]}; inx_ip2++)); do
1103                 KEY1=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
1104                 KEY2=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
1105                 ID=0x$(dd if=/dev/urandom count=4 bs=1 2> /dev/null| xxd -p -c 8)
1106                 ip1=${ALL_NODES[$inx_ip1]}
1107                 ip2=${ALL_NODES[$inx_ip2]}
1108                 ${SSH} $ip1 "sudo ip xfrm state add src $ip1 dst $ip2 proto esp spi $ID reqid $ID mode transport auth sha256 $KEY1 enc aes $KEY2"
1109                 ${SSH} $ip1 "sudo ip xfrm state add src $ip2 dst $ip1 proto esp spi $ID reqid $ID mode transport auth sha256 $KEY1 enc aes $KEY2"
1110                 ${SSH} $ip1 "sudo ip xfrm policy add src $ip1 dst $ip2 proto udp dir out tmpl src $ip1 dst $ip2 proto esp reqid $ID mode transport"
1111                 ${SSH} $ip1 "sudo ip xfrm policy add src $ip2 dst $ip1 proto udp dir in tmpl src $ip2 dst $ip1 proto esp reqid $ID mode transport"
1112
1113                 ${SSH} $ip2 "sudo ip xfrm state add src $ip2 dst $ip1 proto esp spi $ID reqid $ID mode transport auth sha256 $KEY1 enc aes $KEY2"
1114                 ${SSH} $ip2 "sudo ip xfrm state add src $ip1 dst $ip2 proto esp spi $ID reqid $ID mode transport auth sha256 $KEY1 enc aes $KEY2"
1115                 ${SSH} $ip2 "sudo ip xfrm policy add src $ip2 dst $ip1 proto udp dir out tmpl src $ip2 dst $ip1 proto esp reqid $ID mode transport"
1116                 ${SSH} $ip2 "sudo ip xfrm policy add src $ip1 dst $ip2 proto udp dir in tmpl src $ip1 dst $ip2 proto esp reqid $ID mode transport"
1117             done
1118         done
1119
1120         for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}; do
1121             echo "ip xfrm configuration for node $ip:"
1122             ${SSH} $ip "sudo ip xfrm policy list"
1123             ${SSH} $ip "sudo ip xfrm state list"
1124         done
1125     fi
1126
1127     # Control Node - PUBLIC_BRIDGE will act as the external router
1128     # Parameter values below are used in integration/test - changing them requires updates in intergration/test as well
1129     EXTNET_GATEWAY_IP="10.10.10.250"
1130     EXTNET_INTERNET_IP="10.9.9.9"
1131     EXTNET_PNF_IP="10.10.10.253"
1132     ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE} up ${EXTNET_GATEWAY_IP}/24"
1133
1134     # Control Node - external net PNF simulation
1135     ${SSH} ${!CONTROLIP} "
1136         sudo ip netns add pnf_ns;
1137         sudo ip link add pnf_veth0 type veth peer name pnf_veth1;
1138         sudo ip link set pnf_veth1 netns pnf_ns;
1139         sudo ip link set pnf_veth0 up;
1140         sudo ip netns exec pnf_ns ifconfig pnf_veth1 up ${EXTNET_PNF_IP}/24;
1141         sudo ovs-vsctl add-port ${PUBLIC_BRIDGE} pnf_veth0;
1142     "
1143     # Control Node - set VXLAN TEP IP for Genius Auto TZ
1144     ${SSH} ${!CONTROLIP} "
1145         sudo ovs-vsctl set O . external_ids:tep-ip=${!CONTROLIP};
1146     "
1147
1148     # Control Node - external net internet address simulation
1149     ${SSH} ${!CONTROLIP} "
1150         sudo ip tuntap add dev internet_tap mode tap;
1151         sudo ifconfig internet_tap up ${EXTNET_INTERNET_IP}/24;
1152     "
1153
1154     # Computes
1155     compute_index=1
1156     for compute_ip in ${COMPUTE_IPS[*]}; do
1157         # Tunnel from controller to compute
1158         COMPUTEPORT=compute$(( compute_index++ ))_vxlan
1159         ${SSH} ${!CONTROLIP} "
1160             sudo ovs-vsctl add-port $PUBLIC_BRIDGE $COMPUTEPORT -- set interface $COMPUTEPORT type=vxlan options:local_ip=${!CONTROLIP} options:remote_ip=$compute_ip options:dst_port=9876 options:key=flow
1161         "
1162         # Tunnel from compute to controller
1163         CONTROLPORT="control_vxlan"
1164         ${SSH} $compute_ip "
1165             sudo ovs-vsctl add-port $PUBLIC_BRIDGE $CONTROLPORT -- set interface $CONTROLPORT type=vxlan options:local_ip=$compute_ip options:remote_ip=${!CONTROLIP} options:dst_port=9876 options:key=flow
1166         "
1167          #Compute Node - set VXLAN TEP IP for Genius Auto TZ
1168         ${SSH} $compute_ip "
1169             sudo ovs-vsctl set O . external_ids:tep-ip=${compute_ip};
1170         "
1171     done
1172 done
1173
1174 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
1175     odlmgrip=OPENSTACK_HAPROXY_1_IP
1176     HA_PROXY_IP=${!odlmgrip}
1177     HA_PROXY_1_IP=${!odlmgrip}
1178     odlmgrip2=OPENSTACK_HAPROXY_2_IP
1179     HA_PROXY_2_IP=${!odlmgrip2}
1180     odlmgrip3=OPENSTACK_HAPROXY_1_IP
1181     HA_PROXY_3_IP=${!odlmgrip3}
1182 else
1183     HA_PROXY_IP=${ODL_SYSTEM_IP}
1184     HA_PROXY_1_IP=${ODL_SYSTEM_1_IP}
1185     HA_PROXY_2_IP=${ODL_SYSTEM_2_IP}
1186     HA_PROXY_3_IP=${ODL_SYSTEM_3_IP}
1187 fi
1188
1189 echo "Locating test plan to use..."
1190 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
1191 if [ ! -f "${testplan_filepath}" ]; then
1192     testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
1193 fi
1194
1195 echo "Changing the testplan path..."
1196 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
1197 cat testplan.txt
1198
1199 # Use the testplan if specific SUITES are not defined.
1200 if [ -z "${SUITES}" ]; then
1201     SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
1202 else
1203     newsuites=""
1204     workpath="${WORKSPACE}/test/csit/suites"
1205     for suite in ${SUITES}; do
1206         fullsuite="${workpath}/${suite}"
1207         if [ -z "${newsuites}" ]; then
1208             newsuites+=${fullsuite}
1209         else
1210             newsuites+=" "${fullsuite}
1211         fi
1212     done
1213     SUITES=${newsuites}
1214 fi
1215
1216 #install all client versions required for this job testing
1217 install_openstack_clients_in_robot_vm
1218
1219 # TODO: run openrc on control node and then scrape the vars from it
1220 # Environment Variables Needed to execute Openstack Client for NetVirt Jobs
1221 cat > /tmp/os_netvirt_client_rc << EOF
1222 export OS_USERNAME=admin
1223 export OS_PASSWORD=admin
1224 export OS_PROJECT_NAME=admin
1225 export OS_USER_DOMAIN_NAME=default
1226 export OS_PROJECT_DOMAIN_NAME=default
1227 export OS_AUTH_URL="http://${!CONTROLIP}/identity"
1228 export OS_IDENTITY_API_VERSION=3
1229 export OS_IMAGE_API_VERSION=2
1230 export OS_TENANT_NAME=admin
1231 unset OS_CLOUD
1232 EOF
1233
1234 source /tmp/os_netvirt_client_rc
1235
1236 echo "Get all versions before executing pybot"
1237 echo "openstack --version"
1238 which openstack
1239 openstack --version
1240 echo "nova --version"
1241 which nova
1242 nova --version
1243 echo "neutron --version"
1244 which neutron
1245 neutron --version
1246
1247 echo "Starting Robot test suites ${SUITES} ..."
1248 # please add pybot -v arguments on a single line and alphabetized
1249 suite_num=0
1250 for suite in ${SUITES}; do
1251     # prepend a incrmental counter to the suite name so that the full robot log combining all the suites as is done
1252     # in the rebot step below will list all the suites in chronological order as rebot seems to alphabatize them
1253     let "suite_num = suite_num + 1"
1254     suite_index="$(printf %02d ${suite_num})"
1255     suite_name="$(basename ${suite} | cut -d. -f1)"
1256     log_name="${suite_index}_${suite_name}"
1257     pybot -N ${log_name} --removekeywords wuks -c critical -e exclude -e skip_if_${DISTROSTREAM} \
1258     --log log_${log_name}.html --report None --output output_${log_name}.xml \
1259     -v BUNDLEFOLDER:${BUNDLEFOLDER} \
1260     -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} \
1261     -v CONTROLLERFEATURES:"${CONTROLLERFEATURES}" \
1262     -v CONTROLLER_USER:${USER} \
1263     -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
1264     -v HA_PROXY_IP:${HA_PROXY_IP} \
1265     -v HA_PROXY_1_IP:${HA_PROXY_1_IP} \
1266     -v HA_PROXY_2_IP:${HA_PROXY_2_IP} \
1267     -v HA_PROXY_3_IP:${HA_PROXY_3_IP} \
1268     -v JDKVERSION:${JDKVERSION} \
1269     -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
1270     -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
1271     -v NUM_OPENSTACK_SITES:${NUM_OPENSTACK_SITES} \
1272     -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
1273     -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
1274     -v ODL_SNAT_MODE:${ODL_SNAT_MODE} \
1275     -v ODL_STREAM:${DISTROSTREAM} \
1276     -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
1277     -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} \
1278     -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
1279     -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} \
1280     -v ODL_SYSTEM_4_IP:${ODL_SYSTEM_4_IP} \
1281     -v ODL_SYSTEM_5_IP:${ODL_SYSTEM_5_IP} \
1282     -v ODL_SYSTEM_6_IP:${ODL_SYSTEM_6_IP} \
1283     -v ODL_SYSTEM_7_IP:${ODL_SYSTEM_7_IP} \
1284     -v ODL_SYSTEM_8_IP:${ODL_SYSTEM_8_IP} \
1285     -v ODL_SYSTEM_9_IP:${ODL_SYSTEM_9_IP} \
1286     -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
1287     -v OS_CONTROL_NODE_1_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
1288     -v OS_CONTROL_NODE_2_IP:${OPENSTACK_CONTROL_NODE_2_IP} \
1289     -v OS_CONTROL_NODE_3_IP:${OPENSTACK_CONTROL_NODE_3_IP} \
1290     -v OPENSTACK_BRANCH:${OPENSTACK_BRANCH} \
1291     -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} \
1292     -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
1293     -v OS_COMPUTE_3_IP:${OPENSTACK_COMPUTE_NODE_3_IP} \
1294     -v OS_COMPUTE_4_IP:${OPENSTACK_COMPUTE_NODE_4_IP} \
1295     -v OS_COMPUTE_5_IP:${OPENSTACK_COMPUTE_NODE_5_IP} \
1296     -v OS_COMPUTE_6_IP:${OPENSTACK_COMPUTE_NODE_6_IP} \
1297     -v OS_USER:${USER} \
1298     -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
1299     -v SECURITY_GROUP_MODE:${SECURITY_GROUP_MODE} \
1300     -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_1_IP} \
1301     -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_1_IP} \
1302     -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
1303     -v USER_HOME:${HOME} \
1304     -v WORKSPACE:/tmp \
1305     ${TESTOPTIONS} ${suite} || true
1306 done
1307 #rebot exit codes seem to be different
1308 rebot --output ${WORKSPACE}/output.xml --log log_full.html --report None -N openstack output_*.xml || true
1309
1310 echo "Examining the files in data/log and checking file size"
1311 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
1312 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
1313
1314 echo "Tests Executed"
1315 collect_logs
1316
1317 true  # perhaps Jenkins is testing last exit code
1318 # vim: ts=4 sw=4 sts=4 et ft=sh :