1 #@IgnoreInspection BashAddShebang
2 # Activate robotframework virtualenv
3 # ${ROBOT_VENV} comes from the include-raw-integration-install-robotframework.sh
5 source ${ROBOT_VENV}/bin/activate
7 # TODO: remove this work to run changes.py if/when it's moved higher up to be visible at the Robot level
8 echo "showing recent changes that made it in to the distribution used by this job"
9 pip install --upgrade urllib3
10 python ${WORKSPACE}/test/tools/distchanges/changes.py -d /tmp/distribution_folder \
11 -u ${ACTUALBUNDLEURL} -b ${DISTROBRANCH} \
12 -r ssh://jenkins-${SILO}@git.opendaylight.org:29418 || true
14 echo "#################################################"
15 echo "## Deploy Openstack 3-node ##"
16 echo "#################################################"
21 function create_control_node_local_conf {
22 local_conf_file_name=${WORKSPACE}/local.conf_control
24 if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
29 cat > ${local_conf_file_name} << EOF
32 SCREEN_LOGDIR=/opt/stack/data/log
38 for service_name in ${DISABLE_OS_SERVICES}
40 cat >> ${local_conf_file_name} << EOF
41 disable_service ${service_name}
44 for service_name in ${ENABLE_OS_SERVICES}
46 cat >> ${local_conf_file_name} << EOF
47 enable_service ${service_name}
50 for plugin_name in ${ENABLE_OS_PLUGINS}
52 if [ "$plugin_name" == "networking-odl" ]; then
53 ENABLE_PLUGIN_ARGS="${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}"
54 elif [ "$plugin_name" == "kuryr-kubernetes" ]; then
55 ENABLE_PLUGIN_ARGS="${DEVSTACK_KUBERNETES_PLUGIN_REPO} master" # note: kuryr-kubernetes only exists in master at the moment
56 elif [ "$plugin_name" == "neutron-lbaas" ]; then
57 ENABLE_PLUGIN_ARGS="${DEVSTACK_LBAAS_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
59 echo "Error: Invalid plugin $plugin_name, unsupported"
62 cat >> ${local_conf_file_name} << EOF
63 enable_plugin ${plugin_name} ${ENABLE_PLUGIN_ARGS}
67 if [ "${OPENSTACK_BRANCH}" == "master" ] || [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then # Ocata+
68 # placement is mandatory for nova since Ocata, note that this requires computes to enable placement-client
69 # this should be moved into enabled_services for each job (but only for Ocata)
70 echo "enable_service placement-api" >> ${local_conf_file_name}
72 cat >> ${local_conf_file_name} << EOF
73 HOST_IP=$OPENSTACK_CONTROL_NODE_IP
74 SERVICE_HOST=\$HOST_IP
76 NEUTRON_CREATE_INITIAL_NETWORKS=${CREATE_INITIAL_NETWORKS}
78 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
81 ENABLE_TENANT_TUNNELS=True
83 MYSQL_HOST=\$SERVICE_HOST
84 RABBIT_HOST=\$SERVICE_HOST
85 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
86 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
87 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
90 RABBIT_PASSWORD=rabbit
92 SERVICE_PASSWORD=admin
97 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
101 NEUTRON_LBAAS_SERVICE_PROVIDERV2=${LBAAS_SERVICE_PROVIDER} # Only relevant if neutron-lbaas plugin is enabled
104 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
105 cat >> ${local_conf_file_name} << EOF
107 enable_plugin networking-l2gw ${NETWORKING_L2GW_DRIVER} ${ODL_ML2_BRANCH}
108 NETWORKING_L2GW_SERVICE_DRIVER=L2GW:OpenDaylight:networking_odl.l2gateway.driver.OpenDaylightL2gwDriver:default
109 ENABLED_SERVICES+=,neutron,q-svc,nova,q-meta
114 if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
115 echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
118 if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
119 odl_list=${ODL_SYSTEM_1_IP}
120 for i in `seq 2 ${NUM_ODL_SYSTEM}`
122 odlip=ODL_SYSTEM_${i}_IP
123 odl_list=${odl_list},${!odlip}
125 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
126 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
127 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
128 odl_mgr_ip=${!odlmgrip}
130 odl_mgr_ip=${ODL_SYSTEM_1_IP}
132 cat >> ${local_conf_file_name} << EOF
133 ODL_OVS_MANAGERS=${odl_list}
134 ODL_MGR_IP=${odl_mgr_ip}
137 cat >> ${local_conf_file_name} << EOF
138 ODL_MGR_IP=${ODL_SYSTEM_1_IP}
142 # if we are using the old netvirt impl, as determined by the feature name
143 # odl-ovsdb-openstack (note: new impl is odl-netvirt-openstack) then we
144 # want ODL_L3 to be True. New impl wants it False
145 if [[ ${CONTROLLERFEATURES} == *"odl-ovsdb-openstack"* ]]; then
151 # if we are using the new netvirt impl, as determined by the feature name
152 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
153 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
154 # external networks in legacy netvirt
155 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
156 ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
158 ODL_PROVIDER_MAPPINGS=
161 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
162 cat >> ${local_conf_file_name} << EOF
163 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
164 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
165 ML2_VLAN_RANGES=${PUBLIC_PHYSICAL_NETWORK}
166 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
169 PUBLIC_INTERFACE=br100
172 if [ -z ${DISABLE_ODL_L3_PLUGIN} ] || [ "${DISABLE_ODL_L3_PLUGIN}" == "no" ]; then
173 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
174 cat >> ${local_conf_file_name} << EOF
177 [[post-config|\$NEUTRON_CONF]]
179 service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin
182 fi #check for ODL_ML2_BRANCH
183 fi #check for DISABLE_ODL_L3_PLUGIN
185 fi #ODL_ENABLE_L3_FWD check
187 cat >> ${local_conf_file_name} << EOF
188 [[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
190 minimize_polling=True
193 # Needed for VLAN provider tests - because our provider networks are always encapsulated in VXLAN (br-phys1)
194 # MTU(1440) + VXLAN(50) + VLAN(4) = 1494 < MTU eth0/br-phys1(1500)
195 physical_network_mtus = ${PUBLIC_PHYSICAL_NETWORK}:1440
198 [[post-config|/etc/neutron/dhcp_agent.ini]]
200 force_metadata = True
201 enable_isolated_metadata = True
203 [[post-config|/etc/nova/nova.conf]]
205 force_config_drive = False
209 echo "local.conf Created...."
210 cat ${local_conf_file_name}
213 function create_compute_node_local_conf {
216 if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
221 if [ "${OPENSTACK_BRANCH}" == "master" ] || [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then # Ocata+
222 # placement is mandatory for nova since Ocata, note that this requires controller to enable placement-api
223 ENABLED_SERVICES="n-cpu,placement-client"
225 ENABLED_SERVICES="n-cpu"
228 local_conf_file_name=${WORKSPACE}/local.conf_compute_${HOSTIP}
229 cat > ${local_conf_file_name} << EOF
233 SCREEN_LOGDIR=/opt/stack/data/log
236 NOVA_VNC_ENABLED=True
238 ENABLED_SERVICES=${ENABLED_SERVICES}
240 SERVICE_HOST=${OPENSTACK_CONTROL_NODE_IP}
243 ENABLE_TENANT_TUNNELS=True
244 Q_ML2_TENANT_NETWORK_TYPE=vxlan
246 Q_HOST=\$SERVICE_HOST
247 MYSQL_HOST=\$SERVICE_HOST
248 RABBIT_HOST=\$SERVICE_HOST
249 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
250 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
251 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
254 RABBIT_PASSWORD=rabbit
255 SERVICE_TOKEN=service
256 SERVICE_PASSWORD=admin
260 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
264 if [[ "${ENABLE_OS_PLUGINS}" =~ networking-odl ]]; then
265 cat >> ${local_conf_file_name} << EOF
266 enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}
270 if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
271 odl_list=${ODL_SYSTEM_1_IP}
272 for i in `seq 2 ${NUM_ODL_SYSTEM}`
274 odlip=ODL_SYSTEM_${i}_IP
275 odl_list=${odl_list},${!odlip}
277 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
278 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
279 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
280 odl_mgr_ip=${!odlmgrip}
282 odl_mgr_ip=${ODL_SYSTEM_1_IP}
284 cat >> ${local_conf_file_name} << EOF
285 ODL_OVS_MANAGERS=${odl_list}
286 ODL_MGR_IP=${odl_mgr_ip}
289 cat >> ${local_conf_file_name} << EOF
290 ODL_MGR_IP=${ODL_SYSTEM_1_IP}
294 # if we are using the new netvirt impl, as determined by the feature name
295 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
296 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
297 # external networks in legacy netvirt
298 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
299 ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
301 ODL_PROVIDER_MAPPINGS=
304 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
305 cat >> ${local_conf_file_name} << EOF
306 # Uncomment lines below if odl-compute is to be used for l3 forwarding
309 PUBLIC_INTERFACE=br100 # FIXME do we use br100 at all?
310 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
311 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
312 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
315 echo "local.conf Created...."
316 cat ${local_conf_file_name}
319 function configure_haproxy_for_neutron_requests () {
320 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
321 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
322 ha_proxy_ip=${!odlmgrip}
324 cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
325 sudo systemctl stop firewalld
326 sudo yum -y install policycoreutils-python haproxy
329 cat > ${WORKSPACE}/haproxy.cfg << EOF
335 pidfile /tmp/haproxy.pid
343 timeout http-request 10s
351 bind ${ha_proxy_ip}:8080
355 for i in `seq 1 ${NUM_ODL_SYSTEM}`
357 odlip=ODL_SYSTEM_${i}_IP
358 cat >> ${WORKSPACE}/haproxy.cfg << EOF
359 server controller-$i ${!odlip}:8080 check fall 5 inter 2000 rise 2
363 cat >> ${WORKSPACE}/haproxy.cfg << EOF
364 listen opendaylight_rest
365 bind ${ha_proxy_ip}:8181
369 for i in `seq 1 ${NUM_ODL_SYSTEM}`
371 odlip=ODL_SYSTEM_${i}_IP
372 cat >> ${WORKSPACE}/haproxy.cfg << EOF
373 server controller-rest-$i ${!odlip}:8181 check fall 5 inter 2000 rise 2
377 cat > ${WORKSPACE}/deploy_ha_proxy.sh<< EOF
378 sudo chown haproxy:haproxy /tmp/haproxy.cfg
379 sudo sed -i 's/\\/etc\\/haproxy\\/haproxy.cfg/\\/tmp\\/haproxy.cfg/g' /usr/lib/systemd/system/haproxy.service
380 sudo /usr/sbin/semanage permissive -a haproxy_t
381 sudo systemctl restart haproxy
384 sudo systemctl status haproxy
387 scp ${WORKSPACE}/install_ha_proxy.sh ${ha_proxy_ip}:/tmp
388 ${SSH} ${ha_proxy_ip} "sudo bash /tmp/install_ha_proxy.sh"
389 scp ${WORKSPACE}/haproxy.cfg ${ha_proxy_ip}:/tmp
390 scp ${WORKSPACE}/deploy_ha_proxy.sh ${ha_proxy_ip}:/tmp
391 ${SSH} ${ha_proxy_ip} "sudo bash /tmp/deploy_ha_proxy.sh"
394 function collect_logs_and_exit (){
395 set +e # We do not want to create red dot just because something went wrong while fetching logs.
396 for i in `seq 1 ${NUM_ODL_SYSTEM}`
398 CONTROLLERIP=ODL_SYSTEM_${i}_IP
399 echo "killing karaf process..."
400 ${SSH} "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
403 cat > extra_debug.sh << EOF
404 echo -e "/usr/sbin/lsmod | /usr/bin/grep openvswitch\n"
405 /usr/sbin/lsmod | /usr/bin/grep openvswitch
406 echo -e "\ngrep ct_ /var/log/openvswitch/ovs-vswitchd.log\n"
407 grep ct_ /var/log/openvswitch/ovs-vswitchd.log
411 # FIXME: Do not create .tar and gzip before copying.
412 for i in `seq 1 ${NUM_ODL_SYSTEM}`
414 CONTROLLERIP=ODL_SYSTEM_${i}_IP
415 ${SSH} "${!CONTROLLERIP}" "cp -r /tmp/${BUNDLEFOLDER}/data/log /tmp/odl_log"
416 ${SSH} "${!CONTROLLERIP}" "tar -cf /tmp/odl${i}_karaf.log.tar /tmp/odl_log/*"
417 scp "${!CONTROLLERIP}:/tmp/odl${i}_karaf.log.tar" "${WORKSPACE}/odl${i}_karaf.log.tar"
418 tar -xvf ${WORKSPACE}/odl${i}_karaf.log.tar -C . --strip-components 2 --transform s/karaf/odl${i}_karaf/g
419 grep "ROBOT MESSAGE\| ERROR " odl${i}_karaf.log > odl${i}_err.log
420 grep "ROBOT MESSAGE\|Exception" odl${i}_karaf.log > odl${i}_exception.log
421 grep "ROBOT MESSAGE\| ERROR \| WARN \|Exception" odl${i}_karaf.log > odl${i}_err_warn_exception.log
422 rm ${WORKSPACE}/odl${i}_karaf.log.tar
425 # Since this log collection work is happening before the archive build macro which also
426 # creates the ${WORKSPACE}/archives dir, we have to do it here first. The mkdir in the
427 # archives build step will essentially be a noop.
428 mkdir -p ${WORKSPACE}/archives
431 OS_CTRL_FOLDER="control"
432 mkdir -p ${OS_CTRL_FOLDER}
433 scp ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/nohup.out ${OS_CTRL_FOLDER}/stack.log
434 scp ${OPENSTACK_CONTROL_NODE_IP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_CTRL_FOLDER}/ovs-vswitchd.log
435 scp ${OPENSTACK_CONTROL_NODE_IP}:/etc/neutron/neutron.conf ${OS_CTRL_FOLDER}/neutron.conf
436 rsync -avhe ssh ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/logs/* ${OS_CTRL_FOLDER} # rsync to prevent copying of symbolic links
437 scp extra_debug.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
438 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
439 scp ${OPENSTACK_CONTROL_NODE_IP}:/tmp/extra_debug.log ${OS_CTRL_FOLDER}/extra_debug.log
440 mv local.conf_control ${OS_CTRL_FOLDER}/local.conf
441 mv ${OS_CTRL_FOLDER} ${WORKSPACE}/archives/
444 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
446 OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
447 OS_COMPUTE_FOLDER="compute_${i}"
448 mkdir -p ${OS_COMPUTE_FOLDER}
449 scp ${!OSIP}:/opt/stack/devstack/nohup.out ${OS_COMPUTE_FOLDER}/stack.log
450 scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_COMPUTE_FOLDER}/ovs-vswitchd.log
451 scp ${!OSIP}:/etc/nova/nova.conf ${OS_COMPUTE_FOLDER}/nova.conf
452 rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${OS_COMPUTE_FOLDER} # rsync to prevent copying of symbolic links
453 scp extra_debug.sh ${!OSIP}:/tmp
454 ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
455 scp ${!OSIP}:/tmp/extra_debug.log ${OS_COMPUTE_FOLDER}/extra_debug.log
456 mv local.conf_compute_${!OSIP} ${OS_COMPUTE_FOLDER}/local.conf
457 mv ${OS_COMPUTE_FOLDER} ${WORKSPACE}/archives/
460 ls local.conf* | xargs -I % mv % %.log
463 DEVSTACK_TEMPEST_DIR="/opt/stack/tempest"
464 if $(ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 ]'"); then # if Tempest results exist
465 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"
466 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'"
467 TEMPEST_LOGS_DIR=${WORKSPACE}/archives/tempest
468 mkdir -p ${TEMPEST_LOGS_DIR}
469 scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${TEMPEST_LOGS_DIR}
470 scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest.log ${TEMPEST_LOGS_DIR}
471 mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
475 cat > ${WORKSPACE}/disable_firewall.sh << EOF
476 sudo systemctl stop firewalld
477 sudo systemctl stop iptables
481 cat > ${WORKSPACE}/get_devstack.sh << EOF
482 sudo systemctl stop firewalld
483 sudo yum install bridge-utils -y
484 sudo systemctl stop NetworkManager
485 #Disable NetworkManager and kill dhclient and dnsmasq
486 sudo systemctl stop NetworkManager
487 sudo killall dhclient
489 #Workaround for mysql failure
490 echo "127.0.0.1 localhost \${HOSTNAME}" > /tmp/hosts
491 echo "::1 localhost \${HOSTNAME}" >> /tmp/hosts
492 sudo mv /tmp/hosts /etc/hosts
493 sudo /usr/sbin/brctl addbr br100
494 #sudo ifconfig eth0 mtu 2000
495 sudo mkdir /opt/stack
496 sudo chmod 777 /opt/stack
498 git clone https://git.openstack.org/openstack-dev/devstack
500 git checkout $OPENSTACK_BRANCH
503 echo "Create HAProxy if needed"
504 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
505 echo "Need to configure HAProxy"
506 configure_haproxy_for_neutron_requests
510 echo "Stack the Control Node"
511 scp ${WORKSPACE}/get_devstack.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
512 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/get_devstack.sh"
513 create_control_node_local_conf
514 scp ${WORKSPACE}/local.conf_control ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/local.conf
516 cat > "${WORKSPACE}/manual_install_package.sh" << EOF
521 sudo python setup.py install
526 # Workworund for successful stacking with Mitaka
527 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
529 # Workaround for problems with latest versions/specified versions in requirements of openstack
530 # Openstacksdk,libvirt-python -> the current version does not work with Mitaka diue to some requirements
531 # conflict and breaks when trying to stack
532 # paramiko -> Problems with tempest tests due to paramiko incompatibility with pycrypto.
533 # the problem has been solved with version 1.17. If the latest version of paramiko is used, it causes
534 # other timeout problems
535 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; sed -i /paramiko/d upper-constraints.txt"
536 scp "${WORKSPACE}/manual_install_package.sh" "${OPENSTACK_CONTROL_NODE_IP}:/tmp"
537 ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install deprecation"
538 # Fix for recent requirements update in the master branch of the sdk.The section must be replaced with a better fix.
539 ssh "${OPENSTACK_CONTROL_NODE_IP}" "sh /tmp/manual_install_package.sh https://github.com/openstack/python-openstacksdk python-openstacksdk 0.9.14"
540 ssh "${OPENSTACK_CONTROL_NODE_IP}" "sh /tmp/manual_install_package.sh https://github.com/paramiko/paramiko paramiko 1.17"
543 ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
544 ssh ${OPENSTACK_CONTROL_NODE_IP} "ps -ef | grep stack.sh"
545 ssh ${OPENSTACK_CONTROL_NODE_IP} "ls -lrt /opt/stack/devstack/nohup.out"
546 os_node_list+=(${OPENSTACK_CONTROL_NODE_IP})
548 #Workaround for stable/newton jobs
549 if [ "${ODL_ML2_BRANCH}" == "stable/newton" ]; then
550 ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://git.openstack.org/openstack/requirements; cd requirements; git checkout stable/newton; sed -i /appdirs/d upper-constraints.txt"
553 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
555 COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
556 scp ${WORKSPACE}/get_devstack.sh ${!COMPUTEIP}:/tmp
557 ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh"
558 create_compute_node_local_conf ${!COMPUTEIP}
559 scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
560 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
561 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"
563 ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
564 ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
565 os_node_list+=(${!COMPUTEIP})
568 cat > ${WORKSPACE}/check_stacking.sh << EOF
569 > /tmp/stack_progress
570 ps -ef | grep "stack.sh" | grep -v grep
572 if [ \${ret} -eq 1 ]; then
573 grep "This is your host IP address:" /opt/stack/devstack/nohup.out
574 if [ \$? -eq 0 ]; then
575 echo "Stacking Complete" > /tmp/stack_progress
577 echo "Stacking Failed" > /tmp/stack_progress
579 elif [ \${ret} -eq 0 ]; then
580 echo "Still Stacking" > /tmp/stack_progress
584 #the checking is repeated for an hour
587 while [ ${in_progress} -eq 1 ]; do
588 iteration=$(($iteration + 1))
589 for index in ${!os_node_list[@]}
591 echo "Check the status of stacking in ${os_node_list[index]}"
592 scp ${WORKSPACE}/check_stacking.sh ${os_node_list[index]}:/tmp
593 ${SSH} ${os_node_list[index]} "bash /tmp/check_stacking.sh"
594 scp ${os_node_list[index]}:/tmp/stack_progress .
597 stacking_status=`cat stack_progress`
598 if [ "$stacking_status" == "Still Stacking" ]; then
600 elif [ "$stacking_status" == "Stacking Failed" ]; then
601 collect_logs_and_exit
603 elif [ "$stacking_status" == "Stacking Complete" ]; then
604 unset os_node_list[index]
605 if [ ${#os_node_list[@]} -eq 0 ]; then
610 echo "sleep for a minute before the next check"
612 if [ ${iteration} -eq 60 ]; then
613 collect_logs_and_exit
618 #Need to disable firewalld and iptables in control node
619 echo "Stop Firewall in Control Node for compute nodes to be able to reach the ports and add to hypervisor-list"
620 scp ${WORKSPACE}/disable_firewall.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
621 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo bash /tmp/disable_firewall.sh"
622 echo "sleep for a minute and print hypervisor-list"
624 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
625 # in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
626 # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
627 # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
628 # is one less than the total number of openstack systems
629 if [ "${NUM_OPENSTACK_SYSTEM}" -eq 1 ]; then
630 expected_num_hypervisors=1
632 expected_num_hypervisors=$((NUM_OPENSTACK_SYSTEM - 1))
634 num_hypervisors=$(${SSH} ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; source openrc admin admin; openstack hypervisor list -f value | wc -l" | tail -1 | tr -d "\r")
635 if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
636 echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
637 collect_logs_and_exit
641 #Need to disable firewalld and iptables in compute nodes as well
642 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
644 OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
645 scp ${WORKSPACE}/disable_firewall.sh "${!OSIP}:/tmp"
646 ${SSH} "${!OSIP}" "sudo bash /tmp/disable_firewall.sh"
649 # upgrading pip, urllib3 and httplib2 so that tempest tests can be run on ${OPENSTACK_CONTROL_NODE_IP}
650 # this needs to happen after devstack runs because it seems devstack is pulling in specific versions
651 # of these libs that are not working for tempest.
652 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install --upgrade pip"
653 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install urllib3 --upgrade"
654 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install httplib2 --upgrade"
656 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
658 IP_VAR=OPENSTACK_COMPUTE_NODE_${i}_IP
659 COMPUTE_IPS[$((i-1))]=${!IP_VAR}
663 echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
665 for ip in ${OPENSTACK_CONTROL_NODE_IP} ${COMPUTE_IPS[*]}
667 # 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
668 ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
669 ${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++))"
672 # Control Node - PUBLIC_BRIDGE will act as the external router
673 GATEWAY_IP="10.10.10.250" # FIXME this should be a parameter, also shared with integration-test
674 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ip link add link ${PUBLIC_BRIDGE} name ${PUBLIC_BRIDGE}.167 type vlan id 167"
675 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ifconfig ${PUBLIC_BRIDGE} up"
676 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ifconfig ${PUBLIC_BRIDGE}.167 up ${GATEWAY_IP}/24"
678 for compute_ip in ${COMPUTE_IPS[*]}
680 # Tunnel from controller to compute
681 PORT_NAME=compute$((compute_index++))_vxlan
682 ${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"
684 # Tunnel from compute to controller
685 PORT_NAME=control_vxlan
686 ${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"
689 if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
690 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
691 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
692 HA_PROXY_IP=${!odlmgrip}
694 HA_PROXY_IP=${ODL_SYSTEM_IP}
696 echo "Locating test plan to use..."
697 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
698 if [ ! -f "${testplan_filepath}" ]; then
699 testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
702 echo "Changing the testplan path..."
703 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
706 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
708 echo "Starting Robot test suites ${SUITES} ..."
709 # please add pybot -v arguments on a single line and alphabetized
710 pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude \
711 -v BUNDLEFOLDER:${BUNDLEFOLDER} \
712 -v BUNDLE_URL:${ACTUALBUNDLEURL} \
713 -v CONTROLLER_USER:${USER} \
714 -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
715 -v HA_PROXY_IP:${HA_PROXY_IP} \
716 -v JDKVERSION:${JDKVERSION} \
717 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
718 -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
719 -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
720 -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
721 -v ODL_STREAM:${DISTROSTREAM} \
722 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
723 -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} \
724 -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
725 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} \
726 -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_IP} \
727 -v OPENSTACK_BRANCH:${OPENSTACK_BRANCH} \
728 -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} \
729 -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
731 -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
732 -v SECURITY_GROUP_MODE:${SECURITY_GROUP_MODE} \
733 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_1_IP} \
734 -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_1_IP} \
735 -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
736 -v USER_HOME:${HOME} \
738 ${TESTOPTIONS} ${SUITES} || true
740 echo "Examining the files in data/log and checking filesize"
741 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
742 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
744 echo "Tests Executed"
745 collect_logs_and_exit
747 true # perhaps Jenkins is testing last exit code
748 # vim: ts=4 sw=4 sts=4 et ft=sh :