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