Merge "Add robot options to openstack jobs"
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-openstack-run-test.sh
1 #@IgnoreInspection BashAddShebang
2 # Activate robotframework virtualenv
3 # ${ROBOT_VENV} comes from the include-raw-integration-install-robotframework.sh
4 # script.
5 source ${ROBOT_VENV}/bin/activate
6
7 echo "#################################################"
8 echo "##         Deploy Openstack 3-node             ##"
9 echo "#################################################"
10
11
12 SSH="ssh -t -t"
13
14 function create_control_node_local_conf {
15 local_conf_file_name=${WORKSPACE}/local.conf_control
16 #Needs to be removed
17 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
18    RECLONE=no
19 else
20    RECLONE=yes
21 fi
22 cat > ${local_conf_file_name} << EOF
23 [[local|localrc]]
24 LOGFILE=stack.sh.log
25 SCREEN_LOGDIR=/opt/stack/data/log
26 LOG_COLOR=False
27 RECLONE=${RECLONE}
28 EOF
29
30 IFS=,
31 for service_name in ${DISABLE_OS_SERVICES}
32 do
33 cat >> ${local_conf_file_name} << EOF
34 disable_service ${service_name}
35 EOF
36 done
37 for service_name in ${ENABLE_OS_SERVICES}
38 do
39 cat >> ${local_conf_file_name} << EOF
40 enable_service ${service_name}
41 EOF
42 done
43 unset IFS
44
45 cat >> ${local_conf_file_name} << EOF
46 HOST_IP=$OPENSTACK_CONTROL_NODE_IP
47 SERVICE_HOST=\$HOST_IP
48
49 NEUTRON_CREATE_INITIAL_NETWORKS=False
50 Q_PLUGIN=ml2
51 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
52 Q_OVS_USE_VETH=True
53
54 ENABLE_TENANT_TUNNELS=True
55
56 MYSQL_HOST=\$SERVICE_HOST
57 RABBIT_HOST=\$SERVICE_HOST
58 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
59 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
60 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
61
62 MYSQL_PASSWORD=mysql
63 RABBIT_PASSWORD=rabbit
64 SERVICE_TOKEN=service
65 SERVICE_PASSWORD=admin
66 ADMIN_PASSWORD=admin
67
68 enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}
69
70 ODL_PORT=8080
71 ODL_MODE=externalodl
72 LIBVIRT_TYPE=qemu
73
74 EOF
75
76
77 if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
78     echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
79 fi
80
81 if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
82 odl_list=${ODL_SYSTEM_1_IP}
83 for i in `seq 2 ${NUM_ODL_SYSTEM}`
84 do
85 odlip=ODL_SYSTEM_${i}_IP
86 odl_list=${odl_list},${!odlip}
87 done
88 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
89 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
90 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
91 odl_mgr_ip=${!odlmgrip}
92 else
93 odl_mgr_ip=${ODL_SYSTEM_1_IP}
94 fi
95 cat >> ${local_conf_file_name} << EOF
96 ODL_OVS_MANAGERS=${odl_list}
97 ODL_MGR_IP=${odl_mgr_ip}
98 EOF
99 else
100 cat >> ${local_conf_file_name} << EOF
101 ODL_MGR_IP=${ODL_SYSTEM_1_IP}
102 EOF
103 fi
104
105 # if we are using the old netvirt impl, as determined by the feature name
106 # odl-ovsdb-openstack (note: new impl is odl-netvirt-openstack) then we
107 # want ODL_L3 to be True.  New impl wants it False
108 if [[ ${CONTROLLERFEATURES} == *"odl-ovsdb-openstack"* ]]; then
109   ODL_L3=True
110 else
111   ODL_L3=False
112 fi
113
114 # if we are using the new netvirt impl, as determined by the feature name
115 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
116 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
117 # external networks in legacy netvirt
118 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
119   ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
120 else
121   ODL_PROVIDER_MAPPINGS=
122 fi
123
124 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
125 cat >> ${local_conf_file_name} << EOF
126 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
127 PUBLIC_PHYSICAL_NETWORK=physnet1 # FIXME this should be a parameter
128 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
129
130 disable_service q-l3
131 Q_L3_ENABLED=True
132 ODL_L3=${ODL_L3}
133 PUBLIC_INTERFACE=br100
134 EOF
135
136 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
137 cat >> ${local_conf_file_name} << EOF
138 [[post-config|\$NEUTRON_CONF]]
139 [DEFAULT]
140 service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin
141
142 EOF
143 fi #check for ODL_ML2_BRANCH
144
145 fi #ODL_ENABLE_L3_FWD check
146
147 cat >> ${local_conf_file_name} << EOF
148 [[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
149 [agent]
150 minimize_polling=True
151
152 [[post-config|/etc/neutron/dhcp_agent.ini]]
153 [DEFAULT]
154 force_metadata = True
155 enable_isolated_metadata = True
156
157 [[post-config|/etc/nova/nova.conf]]
158 [DEFAULT]
159 force_config_drive = False
160
161 EOF
162
163 echo "local.conf Created...."
164 cat ${local_conf_file_name}
165 }
166
167 function create_compute_node_local_conf {
168 HOSTIP=$1
169 #Needs to be removed
170 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
171    RECLONE=no
172 else
173    RECLONE=yes
174 fi
175 local_conf_file_name=${WORKSPACE}/local.conf_compute_${HOSTIP}
176 cat > ${local_conf_file_name} << EOF
177 [[local|localrc]]
178 LOGFILE=stack.sh.log
179 LOG_COLOR=False
180 SCREEN_LOGDIR=/opt/stack/data/log
181 RECLONE=${RECLONE}
182
183 NOVA_VNC_ENABLED=True
184 MULTI_HOST=1
185 ENABLED_SERVICES=n-cpu
186
187 HOST_IP=${HOSTIP}
188 SERVICE_HOST=${OPENSTACK_CONTROL_NODE_IP}
189
190 Q_PLUGIN=ml2
191 ENABLE_TENANT_TUNNELS=True
192 Q_ML2_TENANT_NETWORK_TYPE=vxlan
193
194 Q_HOST=\$SERVICE_HOST
195 MYSQL_HOST=\$SERVICE_HOST
196 RABBIT_HOST=\$SERVICE_HOST
197 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
198 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
199 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
200
201 MYSQL_PASSWORD=mysql
202 RABBIT_PASSWORD=rabbit
203 SERVICE_TOKEN=service
204 SERVICE_PASSWORD=admin
205 ADMIN_PASSWORD=admin
206
207 enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}
208 ODL_MODE=compute
209 LIBVIRT_TYPE=qemu
210 EOF
211
212 if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
213 odl_list=${ODL_SYSTEM_1_IP}
214 for i in `seq 2 ${NUM_ODL_SYSTEM}`
215 do
216 odlip=ODL_SYSTEM_${i}_IP
217 odl_list=${odl_list},${!odlip}
218 done
219 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
220 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
221 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
222 odl_mgr_ip=${!odlmgrip}
223 else
224 odl_mgr_ip=${ODL_SYSTEM_1_IP}
225 fi
226 cat >> ${local_conf_file_name} << EOF
227 ODL_OVS_MANAGERS=${odl_list}
228 ODL_MGR_IP=${odl_mgr_ip}
229 EOF
230 else
231 cat >> ${local_conf_file_name} << EOF
232 ODL_MGR_IP=${ODL_SYSTEM_1_IP}
233 EOF
234 fi
235
236 # if we are using the new netvirt impl, as determined by the feature name
237 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
238 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
239 # external networks in legacy netvirt
240 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
241   ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
242 else
243   ODL_PROVIDER_MAPPINGS=
244 fi
245
246 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
247 cat >> ${local_conf_file_name} << EOF
248 # Uncomment lines below if odl-compute is to be used for l3 forwarding
249 Q_L3_ENABLED=True
250 ODL_L3=${ODL_L3}
251 PUBLIC_INTERFACE=br100 # FIXME do we use br100 at all?
252 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
253 PUBLIC_PHYSICAL_NETWORK=physnet1 # FIXME this should be a parameter
254 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
255 EOF
256 fi
257 echo "local.conf Created...."
258 cat ${local_conf_file_name}
259 }
260
261 function configure_haproxy_for_neutron_requests () {
262 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
263 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
264 ha_proxy_ip=${!odlmgrip}
265
266 cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
267 sudo systemctl stop firewalld
268 sudo yum -y install policycoreutils-python haproxy
269 EOF
270
271 cat > ${WORKSPACE}/haproxy.cfg << EOF
272 global
273   daemon
274   group  haproxy
275   log  /dev/log local0
276   maxconn  20480
277   pidfile  /tmp/haproxy.pid
278   user  haproxy
279
280 defaults
281   log  global
282   maxconn  4096
283   mode  tcp
284   retries  3
285   timeout  http-request 10s
286   timeout  queue 1m
287   timeout  connect 10s
288   timeout  client 1m
289   timeout  server 1m
290   timeout  check 10s
291
292 listen opendaylight
293   bind ${ha_proxy_ip}:8080
294   balance source
295 EOF
296
297 for i in `seq 1 ${NUM_ODL_SYSTEM}`
298 do
299 odlip=ODL_SYSTEM_${i}_IP
300 cat >> ${WORKSPACE}/haproxy.cfg << EOF
301   server controller-$i ${!odlip}:8080 check fall 5 inter 2000 rise 2
302 EOF
303 done
304
305 cat > ${WORKSPACE}/deploy_ha_proxy.sh<< EOF
306 sudo chown haproxy:haproxy /tmp/haproxy.cfg
307 sudo sed -i 's/\\/etc\\/haproxy\\/haproxy.cfg/\\/tmp\\/haproxy.cfg/g' /usr/lib/systemd/system/haproxy.service
308 sudo /usr/sbin/semanage permissive -a haproxy_t
309 sudo systemctl restart haproxy
310 sleep 3
311 sudo netstat -tunpl
312 sudo systemctl status haproxy
313 true
314 EOF
315 scp ${WORKSPACE}/install_ha_proxy.sh ${ha_proxy_ip}:/tmp
316 ${SSH} ${ha_proxy_ip} "sudo bash /tmp/install_ha_proxy.sh"
317 scp ${WORKSPACE}/haproxy.cfg ${ha_proxy_ip}:/tmp
318 scp ${WORKSPACE}/deploy_ha_proxy.sh ${ha_proxy_ip}:/tmp
319 ${SSH} ${ha_proxy_ip} "sudo bash /tmp/deploy_ha_proxy.sh"
320 }
321
322 function collect_logs_and_exit (){
323 set +e  # We do not want to create red dot just because something went wrong while fetching logs.
324 for i in `seq 1 ${NUM_ODL_SYSTEM}`
325 do
326     CONTROLLERIP=ODL_SYSTEM_${i}_IP
327     echo "killing karaf process..."
328     ${SSH} "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
329 done
330
331 cat > extra_debug.sh << EOF
332 echo -e "/usr/sbin/lsmod | /usr/bin/grep openvswitch\n"
333 /usr/sbin/lsmod | /usr/bin/grep openvswitch
334 echo -e "\ngrep ct_ /var/log/openvswitch/ovs-vswitchd.log\n"
335 grep ct_ /var/log/openvswitch/ovs-vswitchd.log
336 EOF
337
338 sleep 5
339 # FIXME: Do not create .tar and gzip before copying.
340 for i in `seq 1 ${NUM_ODL_SYSTEM}`
341 do
342     CONTROLLERIP=ODL_SYSTEM_${i}_IP
343     ${SSH} "${!CONTROLLERIP}"  "cp -r /tmp/${BUNDLEFOLDER}/data/log /tmp/odl_log"
344     ${SSH} "${!CONTROLLERIP}"  "tar -cf /tmp/odl${i}_karaf.log.tar /tmp/odl_log/*"
345     scp "${!CONTROLLERIP}:/tmp/odl${i}_karaf.log.tar" "${WORKSPACE}/odl${i}_karaf.log.tar"
346     tar -xvf ${WORKSPACE}/odl${i}_karaf.log.tar -C . --strip-components 2 --transform s/karaf/odl${i}_karaf/g
347     rm ${WORKSPACE}/odl${i}_karaf.log.tar
348 done
349
350 # Since this log collection work is happening before the archive build macro which also
351 # creates the ${WORKSPACE}/archives dir, we have to do it here first.  The mkdir in the
352 # archives build step will essentially be a noop.
353 mkdir -p ${WORKSPACE}/archives
354
355 # Control Node
356 OS_CTRL_FOLDER="control"
357 mkdir -p ${OS_CTRL_FOLDER}
358 scp ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/nohup.out ${OS_CTRL_FOLDER}/stack.log
359 scp ${OPENSTACK_CONTROL_NODE_IP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_CTRL_FOLDER}/ovs-vswitchd.log
360 rsync -avhe ssh ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/logs/* ${OS_CTRL_FOLDER} # rsync to prevent copying of symbolic links
361 scp extra_debug.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
362 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
363 scp ${OPENSTACK_CONTROL_NODE_IP}:/tmp/extra_debug.log ${OS_CTRL_FOLDER}/extra_debug.log
364 mv local.conf_control ${OS_CTRL_FOLDER}/local.conf
365 mv ${OS_CTRL_FOLDER} ${WORKSPACE}/archives/
366
367 # Compute Nodes
368 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
369 do
370     OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
371     OS_COMPUTE_FOLDER="compute_${i}"
372     mkdir -p ${OS_COMPUTE_FOLDER}
373     scp ${!OSIP}:/opt/stack/devstack/nohup.out ${OS_COMPUTE_FOLDER}/stack.log
374     scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_COMPUTE_FOLDER}/ovs-vswitchd.log
375     rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${OS_COMPUTE_FOLDER} # rsync to prevent copying of symbolic links
376     scp extra_debug.sh ${!OSIP}:/tmp
377     ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
378     scp ${!OSIP}:/tmp/extra_debug.log ${OS_COMPUTE_FOLDER}/extra_debug.log
379     mv local.conf_compute_${!OSIP} ${OS_COMPUTE_FOLDER}/local.conf
380     mv ${OS_COMPUTE_FOLDER} ${WORKSPACE}/archives/
381 done
382
383 ls local.conf* | xargs -I % mv % %.log
384 }
385
386 cat > ${WORKSPACE}/disable_firewall.sh << EOF
387 sudo systemctl stop firewalld
388 sudo systemctl stop iptables
389 true
390 EOF
391
392 cat > ${WORKSPACE}/get_devstack.sh << EOF
393 sudo systemctl stop firewalld
394 sudo yum install bridge-utils -y
395 sudo systemctl stop  NetworkManager
396 #Disable NetworkManager and kill dhclient and dnsmasq
397 sudo systemctl stop NetworkManager
398 sudo killall dhclient
399 sudo killall dnsmasq
400 #Workaround for mysql failure
401 echo "127.0.0.1    localhost \${HOSTNAME}" > /tmp/hosts
402 echo "::1   localhost  \${HOSTNAME}" >> /tmp/hosts
403 sudo mv /tmp/hosts /etc/hosts
404 sudo /usr/sbin/brctl addbr br100
405 #sudo ifconfig eth0 mtu 2000
406 sudo mkdir /opt/stack
407 sudo chmod 777 /opt/stack
408 cd /opt/stack
409 git clone https://git.openstack.org/openstack-dev/devstack
410 cd devstack
411 git checkout $OPENSTACK_BRANCH
412 EOF
413
414 echo "Create HAProxy if needed"
415 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
416  echo "Need to configure HAProxy"
417  configure_haproxy_for_neutron_requests
418 fi
419
420 os_node_list=()
421 echo "Stack the Control Node"
422 scp ${WORKSPACE}/get_devstack.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
423 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/get_devstack.sh"
424 create_control_node_local_conf
425 scp ${WORKSPACE}/local.conf_control ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/local.conf
426
427 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
428 ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://git.openstack.org/openstack/requirements; cd requirements; git checkout stable/mitaka; sed -i /openstacksdk/d upper-constraints.txt; sed -i /libvirt-python/d upper-constraints.txt"
429 ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://github.com/openstack/python-openstacksdk; cd python-openstacksdk; sudo python setup.py install"
430 fi
431
432 ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
433 ssh ${OPENSTACK_CONTROL_NODE_IP} "ps -ef | grep stack.sh"
434 ssh ${OPENSTACK_CONTROL_NODE_IP} "ls -lrt /opt/stack/devstack/nohup.out"
435 os_node_list+=(${OPENSTACK_CONTROL_NODE_IP})
436
437
438 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
439 do
440     COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
441     scp ${WORKSPACE}/get_devstack.sh  ${!COMPUTEIP}:/tmp
442     ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh"
443     create_compute_node_local_conf ${!COMPUTEIP}
444     scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
445     if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
446        ssh ${!COMPUTEIP} "cd /opt/stack; git clone https://git.openstack.org/openstack/requirements; cd requirements; git checkout stable/mitaka; sed -i /libvirt-python/d upper-constraints.txt"
447     fi
448     ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
449     ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
450     os_node_list+=(${!COMPUTEIP})
451 done
452
453 cat > ${WORKSPACE}/check_stacking.sh << EOF
454 > /tmp/stack_progress
455 ps -ef | grep "stack.sh" | grep -v grep
456 ret=\$?
457 if [ \${ret} -eq 1 ]; then
458   grep "This is your host IP address:" /opt/stack/devstack/nohup.out
459   if [ \$? -eq 0 ]; then
460      echo "Stacking Complete" > /tmp/stack_progress
461   else
462      echo "Stacking Failed" > /tmp/stack_progress
463   fi
464 elif [ \${ret} -eq 0 ]; then
465   echo "Still Stacking" > /tmp/stack_progress
466 fi
467 EOF
468
469 #the checking is repeated for an hour
470 iteration=0
471 in_progress=1
472 while [ ${in_progress} -eq 1 ]; do
473 iteration=$(($iteration + 1))
474 for index in ${!os_node_list[@]}
475 do
476 echo "Check the status of stacking in ${os_node_list[index]}"
477 scp ${WORKSPACE}/check_stacking.sh  ${os_node_list[index]}:/tmp
478 ${SSH} ${os_node_list[index]} "bash /tmp/check_stacking.sh"
479 scp ${os_node_list[index]}:/tmp/stack_progress .
480 #debug
481 cat stack_progress
482 stacking_status=`cat stack_progress`
483 if [ "$stacking_status" == "Still Stacking" ]; then
484   continue
485 elif [ "$stacking_status" == "Stacking Failed" ]; then
486   collect_logs_and_exit
487   exit 1
488 elif [ "$stacking_status" == "Stacking Complete" ]; then
489   unset os_node_list[index]
490   if  [ ${#os_node_list[@]} -eq 0 ]; then
491      in_progress=0
492   fi
493 fi
494 done
495  echo "sleep for a minute before the next check"
496  sleep 60
497  if [ ${iteration} -eq 60 ]; then
498   collect_logs_and_exit
499   exit 1
500  fi
501 done
502
503 #Need to disable firewalld and iptables in control node
504 echo "Stop Firewall in Control Node for compute nodes to be able to reach the ports and add to hypervisor-list"
505 scp ${WORKSPACE}/disable_firewall.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
506 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo bash /tmp/disable_firewall.sh"
507 echo "sleep for a minute and print hypervisor-list"
508 sleep 60
509 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
510
511 #Need to disable firewalld and iptables in compute nodes as well
512 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
513 do
514     OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
515     scp ${WORKSPACE}/disable_firewall.sh "${!OSIP}:/tmp"
516     ${SSH} "${!OSIP}" "sudo bash /tmp/disable_firewall.sh"
517 done
518
519 # upgrading pip, urllib3 and httplib2 so that tempest tests can be run on ${OPENSTACK_CONTROL_NODE_IP}
520 # this needs to happen after devstack runs because it seems devstack is pulling in specific versions
521 # of these libs that are not working for tempest.
522 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install --upgrade pip"
523 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install urllib3 --upgrade"
524 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install httplib2 --upgrade"
525
526 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
527 do
528     IP_VAR=OPENSTACK_COMPUTE_NODE_${i}_IP
529     COMPUTE_IPS[$((i-1))]=${!IP_VAR}
530 done
531
532 # External Network
533 echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
534 devstack_index=1
535 for ip in ${OPENSTACK_CONTROL_NODE_IP} ${COMPUTE_IPS[*]}
536 do
537     # 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
538     ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
539     ${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++))"
540 done
541
542 # Control Node - PUBLIC_BRIDGE will act as the external router
543 GATEWAY_IP="10.10.10.250" # FIXME this should be a parameter, also shared with integration-test
544 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ifconfig $PUBLIC_BRIDGE up ${GATEWAY_IP}/24"
545 compute_index=1
546 for compute_ip in ${COMPUTE_IPS[*]}
547 do
548     # Tunnel from controller to compute
549     PORT_NAME=compute$((compute_index++))_vxlan
550     ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ovs-vsctl add-port $PUBLIC_BRIDGE $PORT_NAME -- set interface $PORT_NAME type=vxlan options:local_ip="${OPENSTACK_CONTROL_NODE_IP}" options:remote_ip="$compute_ip" options:dst_port=9876 options:key=flow"
551
552     # Tunnel from compute to controller
553     PORT_NAME=control_vxlan
554     ${SSH} ${compute_ip} "sudo ovs-vsctl add-port $PUBLIC_BRIDGE $PORT_NAME -- set interface $PORT_NAME type=vxlan options:local_ip="$compute_ip" options:remote_ip="${OPENSTACK_CONTROL_NODE_IP}" options:dst_port=9876 options:key=flow"
555 done
556
557 echo "Locating test plan to use..."
558 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
559 if [ ! -f "${testplan_filepath}" ]; then
560     testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
561 fi
562
563 echo "Changing the testplan path..."
564 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
565 cat testplan.txt
566
567 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
568
569 echo "Starting Robot test suites ${SUITES} ..."
570 pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \
571 -v BUNDLE_URL:${ACTUALBUNDLEURL} -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} -v JDKVERSION:${JDKVERSION} -v ODL_STREAM:${DISTROSTREAM} \
572 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
573 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} -v CONTROLLER_USER:${USER} -v OS_USER:${USER} \
574 -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_IP} \
575 -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
576 -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
577
578 echo "Tests Executed"
579 DEVSTACK_TEMPEST_DIR="/opt/stack/tempest"
580 if $(ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 ]'"); then # if Tempest results exist
581     ssh ${OPENSTACK_CONTROL_NODE_IP} "for I in \$(sudo ls ${DEVSTACK_TEMPEST_DIR}/.testrepository/ | grep -E '^[0-9]+$'); do sudo sh -c \"${DEVSTACK_TEMPEST_DIR}/.tox/tempest/bin/subunit-1to2 < ${DEVSTACK_TEMPEST_DIR}/.testrepository/\${I} >> ${DEVSTACK_TEMPEST_DIR}/subunit_log.txt\"; done"
582     ssh ${OPENSTACK_CONTROL_NODE_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'"
583     scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${WORKSPACE}/
584 fi
585 collect_logs_and_exit
586
587 true  # perhaps Jenkins is testing last exit code
588 # vim: ts=4 sw=4 sts=4 et ft=sh :