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 scp ${OPENSTACK_CONTROL_NODE_IP}:/etc/nova/nova.conf ${OS_CTRL_FOLDER}/nova.conf
437 rsync -avhe ssh ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/logs/* ${OS_CTRL_FOLDER} # rsync to prevent copying of symbolic links
438 scp extra_debug.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
439 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
440 scp ${OPENSTACK_CONTROL_NODE_IP}:/tmp/extra_debug.log ${OS_CTRL_FOLDER}/extra_debug.log
441 mv local.conf_control ${OS_CTRL_FOLDER}/local.conf
442 mv ${OS_CTRL_FOLDER} ${WORKSPACE}/archives/
445 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
447 OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
448 OS_COMPUTE_FOLDER="compute_${i}"
449 mkdir -p ${OS_COMPUTE_FOLDER}
450 scp ${!OSIP}:/opt/stack/devstack/nohup.out ${OS_COMPUTE_FOLDER}/stack.log
451 scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_COMPUTE_FOLDER}/ovs-vswitchd.log
452 scp ${!OSIP}:/etc/nova/nova.conf ${OS_COMPUTE_FOLDER}/nova.conf
453 rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${OS_COMPUTE_FOLDER} # rsync to prevent copying of symbolic links
454 scp extra_debug.sh ${!OSIP}:/tmp
455 ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
456 scp ${!OSIP}:/tmp/extra_debug.log ${OS_COMPUTE_FOLDER}/extra_debug.log
457 mv local.conf_compute_${!OSIP} ${OS_COMPUTE_FOLDER}/local.conf
458 mv ${OS_COMPUTE_FOLDER} ${WORKSPACE}/archives/
461 ls local.conf* | xargs -I % mv % %.log
464 DEVSTACK_TEMPEST_DIR="/opt/stack/tempest"
465 if $(ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 ]'"); then # if Tempest results exist
466 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"
467 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'"
468 TEMPEST_LOGS_DIR=${WORKSPACE}/archives/tempest
469 mkdir -p ${TEMPEST_LOGS_DIR}
470 scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${TEMPEST_LOGS_DIR}
471 scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest.log ${TEMPEST_LOGS_DIR}
472 mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
476 cat > ${WORKSPACE}/disable_firewall.sh << EOF
477 sudo systemctl stop firewalld
478 sudo systemctl stop iptables
482 cat > ${WORKSPACE}/get_devstack.sh << EOF
483 sudo systemctl stop firewalld
484 sudo yum install bridge-utils -y
485 sudo systemctl stop NetworkManager
486 #Disable NetworkManager and kill dhclient and dnsmasq
487 sudo systemctl stop NetworkManager
488 sudo killall dhclient
490 #Workaround for mysql failure
491 echo "127.0.0.1 localhost \${HOSTNAME}" > /tmp/hosts
492 echo "::1 localhost \${HOSTNAME}" >> /tmp/hosts
493 sudo mv /tmp/hosts /etc/hosts
494 sudo /usr/sbin/brctl addbr br100
495 #sudo ifconfig eth0 mtu 2000
496 sudo mkdir /opt/stack
497 sudo chmod 777 /opt/stack
499 git clone https://git.openstack.org/openstack-dev/devstack
501 git checkout $OPENSTACK_BRANCH
504 echo "Create HAProxy if needed"
505 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
506 echo "Need to configure HAProxy"
507 configure_haproxy_for_neutron_requests
511 echo "Stack the Control Node"
512 scp ${WORKSPACE}/get_devstack.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
513 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/get_devstack.sh"
514 create_control_node_local_conf
515 scp ${WORKSPACE}/local.conf_control ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/local.conf
517 cat > "${WORKSPACE}/manual_install_package.sh" << EOF
522 sudo python setup.py install
527 # Workworund for successful stacking with Mitaka
528 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
530 # Workaround for problems with latest versions/specified versions in requirements of openstack
531 # Openstacksdk,libvirt-python -> the current version does not work with Mitaka diue to some requirements
532 # conflict and breaks when trying to stack
533 # paramiko -> Problems with tempest tests due to paramiko incompatibility with pycrypto.
534 # the problem has been solved with version 1.17. If the latest version of paramiko is used, it causes
535 # other timeout problems
536 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"
537 scp "${WORKSPACE}/manual_install_package.sh" "${OPENSTACK_CONTROL_NODE_IP}:/tmp"
538 ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install deprecation"
539 # Fix for recent requirements update in the master branch of the sdk.The section must be replaced with a better fix.
540 ssh "${OPENSTACK_CONTROL_NODE_IP}" "sh /tmp/manual_install_package.sh https://github.com/openstack/python-openstacksdk python-openstacksdk 0.9.14"
541 ssh "${OPENSTACK_CONTROL_NODE_IP}" "sh /tmp/manual_install_package.sh https://github.com/paramiko/paramiko paramiko 1.17"
544 ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
545 ssh ${OPENSTACK_CONTROL_NODE_IP} "ps -ef | grep stack.sh"
546 ssh ${OPENSTACK_CONTROL_NODE_IP} "ls -lrt /opt/stack/devstack/nohup.out"
547 os_node_list+=(${OPENSTACK_CONTROL_NODE_IP})
549 #Workaround for stable/newton jobs
550 if [ "${ODL_ML2_BRANCH}" == "stable/newton" ]; then
551 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"
554 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
556 COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
557 scp ${WORKSPACE}/get_devstack.sh ${!COMPUTEIP}:/tmp
558 ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh"
559 create_compute_node_local_conf ${!COMPUTEIP}
560 scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
561 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
562 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"
564 ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
565 ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
566 os_node_list+=(${!COMPUTEIP})
569 cat > ${WORKSPACE}/check_stacking.sh << EOF
570 > /tmp/stack_progress
571 ps -ef | grep "stack.sh" | grep -v grep
573 if [ \${ret} -eq 1 ]; then
574 grep "This is your host IP address:" /opt/stack/devstack/nohup.out
575 if [ \$? -eq 0 ]; then
576 echo "Stacking Complete" > /tmp/stack_progress
578 echo "Stacking Failed" > /tmp/stack_progress
580 elif [ \${ret} -eq 0 ]; then
581 echo "Still Stacking" > /tmp/stack_progress
585 #the checking is repeated for an hour
588 while [ ${in_progress} -eq 1 ]; do
589 iteration=$(($iteration + 1))
590 for index in ${!os_node_list[@]}
592 echo "Check the status of stacking in ${os_node_list[index]}"
593 scp ${WORKSPACE}/check_stacking.sh ${os_node_list[index]}:/tmp
594 ${SSH} ${os_node_list[index]} "bash /tmp/check_stacking.sh"
595 scp ${os_node_list[index]}:/tmp/stack_progress .
598 stacking_status=`cat stack_progress`
599 if [ "$stacking_status" == "Still Stacking" ]; then
601 elif [ "$stacking_status" == "Stacking Failed" ]; then
602 collect_logs_and_exit
604 elif [ "$stacking_status" == "Stacking Complete" ]; then
605 unset os_node_list[index]
606 if [ ${#os_node_list[@]} -eq 0 ]; then
611 echo "sleep for a minute before the next check"
613 if [ ${iteration} -eq 60 ]; then
614 collect_logs_and_exit
619 #Need to disable firewalld and iptables in control node
620 echo "Stop Firewall in Control Node for compute nodes to be able to reach the ports and add to hypervisor-list"
621 scp ${WORKSPACE}/disable_firewall.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
622 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo bash /tmp/disable_firewall.sh"
623 echo "sleep for a minute and print hypervisor-list"
625 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
626 # in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
627 # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
628 # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
629 # is one less than the total number of openstack systems
630 if [ "${NUM_OPENSTACK_SYSTEM}" -eq 1 ]; then
631 expected_num_hypervisors=1
633 expected_num_hypervisors=$((NUM_OPENSTACK_SYSTEM - 1))
635 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")
636 if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
637 echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
638 collect_logs_and_exit
642 #Need to disable firewalld and iptables in compute nodes as well
643 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
645 OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
646 scp ${WORKSPACE}/disable_firewall.sh "${!OSIP}:/tmp"
647 ${SSH} "${!OSIP}" "sudo bash /tmp/disable_firewall.sh"
650 # upgrading pip, urllib3 and httplib2 so that tempest tests can be run on ${OPENSTACK_CONTROL_NODE_IP}
651 # this needs to happen after devstack runs because it seems devstack is pulling in specific versions
652 # of these libs that are not working for tempest.
653 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install --upgrade pip"
654 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install urllib3 --upgrade"
655 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install httplib2 --upgrade"
657 for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
659 IP_VAR=OPENSTACK_COMPUTE_NODE_${i}_IP
660 COMPUTE_IPS[$((i-1))]=${!IP_VAR}
664 echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
666 for ip in ${OPENSTACK_CONTROL_NODE_IP} ${COMPUTE_IPS[*]}
668 # 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
669 ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
670 ${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++))"
674 if [ "${IPSEC_VXLAN_TUNNELS_ENABLED}" == "yes" ]; then
675 ALL_NODES=(${OPENSTACK_CONTROL_NODE_IP} ${COMPUTE_IPS[*]})
676 for ((inx_ip1=0; inx_ip1<$((${#ALL_NODES[@]} - 1)); inx_ip1++))
678 for ((inx_ip2=$((inx_ip1 + 1)); inx_ip2<${#ALL_NODES[@]}; inx_ip2++))
680 KEY1=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
681 KEY2=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
682 ID=0x$(dd if=/dev/urandom count=4 bs=1 2> /dev/null| xxd -p -c 8)
683 ip1=${ALL_NODES[$inx_ip1]}
684 ip2=${ALL_NODES[$inx_ip2]}
685 ${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"
686 ${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"
687 ${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"
688 ${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"
690 ${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"
691 ${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"
692 ${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"
693 ${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"
697 for ip in ${OPENSTACK_CONTROL_NODE_IP} ${COMPUTE_IPS[*]}
699 echo "ip xfrm configuration for node $ip:"
700 ${SSH} $ip "sudo ip xfrm policy list"
701 ${SSH} $ip "sudo ip xfrm state list"
705 # Control Node - PUBLIC_BRIDGE will act as the external router
706 GATEWAY_IP="10.10.10.250" # FIXME this should be a parameter, also shared with integration-test
707 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ip link add link ${PUBLIC_BRIDGE} name ${PUBLIC_BRIDGE}.167 type vlan id 167"
708 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ifconfig ${PUBLIC_BRIDGE} up"
709 ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ifconfig ${PUBLIC_BRIDGE}.167 up ${GATEWAY_IP}/24"
711 for compute_ip in ${COMPUTE_IPS[*]}
713 # Tunnel from controller to compute
714 PORT_NAME=compute$((compute_index++))_vxlan
715 ${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"
717 # Tunnel from compute to controller
718 PORT_NAME=control_vxlan
719 ${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"
722 if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
723 HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
724 odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
725 HA_PROXY_IP=${!odlmgrip}
727 HA_PROXY_IP=${ODL_SYSTEM_IP}
729 echo "Locating test plan to use..."
730 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
731 if [ ! -f "${testplan_filepath}" ]; then
732 testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
735 echo "Changing the testplan path..."
736 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
739 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
741 echo "Starting Robot test suites ${SUITES} ..."
742 # please add pybot -v arguments on a single line and alphabetized
743 pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude \
744 -v BUNDLEFOLDER:${BUNDLEFOLDER} \
745 -v BUNDLE_URL:${ACTUALBUNDLEURL} \
746 -v CONTROLLER_USER:${USER} \
747 -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
748 -v HA_PROXY_IP:${HA_PROXY_IP} \
749 -v JDKVERSION:${JDKVERSION} \
750 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
751 -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
752 -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
753 -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
754 -v ODL_STREAM:${DISTROSTREAM} \
755 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
756 -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} \
757 -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
758 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} \
759 -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_IP} \
760 -v OPENSTACK_BRANCH:${OPENSTACK_BRANCH} \
761 -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} \
762 -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
764 -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
765 -v SECURITY_GROUP_MODE:${SECURITY_GROUP_MODE} \
766 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_1_IP} \
767 -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_1_IP} \
768 -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
769 -v USER_HOME:${HOME} \
771 ${TESTOPTIONS} ${SUITES} || true
773 echo "Examining the files in data/log and checking filesize"
774 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
775 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
777 echo "Tests Executed"
778 collect_logs_and_exit
780 true # perhaps Jenkins is testing last exit code
781 # vim: ts=4 sw=4 sts=4 et ft=sh :