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 {
26 if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
31 local_conf_file_name=${WORKSPACE}/local.conf_control_${HOSTIP}
32 cat > ${local_conf_file_name} << EOF
35 SCREEN_LOGDIR=/opt/stack/data/log
41 for service_name in ${DISABLE_OS_SERVICES}
43 cat >> ${local_conf_file_name} << EOF
44 disable_service ${service_name}
47 for service_name in ${ENABLE_OS_SERVICES}
49 cat >> ${local_conf_file_name} << EOF
50 enable_service ${service_name}
53 for plugin_name in ${ENABLE_OS_PLUGINS}
55 if [ "$plugin_name" == "networking-odl" ]; then
56 ENABLE_PLUGIN_ARGS="${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}"
57 elif [ "$plugin_name" == "kuryr-kubernetes" ]; then
58 ENABLE_PLUGIN_ARGS="${DEVSTACK_KUBERNETES_PLUGIN_REPO} master" # note: kuryr-kubernetes only exists in master at the moment
59 elif [ "$plugin_name" == "neutron-lbaas" ]; then
60 ENABLE_PLUGIN_ARGS="${DEVSTACK_LBAAS_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
62 echo "Error: Invalid plugin $plugin_name, unsupported"
65 cat >> ${local_conf_file_name} << EOF
66 enable_plugin ${plugin_name} ${ENABLE_PLUGIN_ARGS}
70 if [ "${OPENSTACK_BRANCH}" == "master" ] || [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then # Ocata+
71 # placement is mandatory for nova since Ocata, note that this requires computes to enable placement-client
72 # this should be moved into enabled_services for each job (but only for Ocata)
73 echo "enable_service placement-api" >> ${local_conf_file_name}
75 cat >> ${local_conf_file_name} << EOF
77 SERVICE_HOST=\$HOST_IP
79 NEUTRON_CREATE_INITIAL_NETWORKS=${CREATE_INITIAL_NETWORKS}
81 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
84 ENABLE_TENANT_TUNNELS=True
86 MYSQL_HOST=\$SERVICE_HOST
87 RABBIT_HOST=\$SERVICE_HOST
88 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
89 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
90 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
93 RABBIT_PASSWORD=rabbit
95 SERVICE_PASSWORD=admin
100 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
105 NEUTRON_LBAAS_SERVICE_PROVIDERV2=${LBAAS_SERVICE_PROVIDER} # Only relevant if neutron-lbaas plugin is enabled
108 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
109 cat >> ${local_conf_file_name} << EOF
111 enable_plugin networking-l2gw ${NETWORKING_L2GW_DRIVER} ${ODL_ML2_BRANCH}
112 NETWORKING_L2GW_SERVICE_DRIVER=L2GW:OpenDaylight:networking_odl.l2gateway.driver.OpenDaylightL2gwDriver:default
113 ENABLED_SERVICES+=,neutron,q-svc,nova,q-meta
118 if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
119 echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
122 echo "ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}" >> ${local_conf_file_name}
124 # if we are using the old netvirt impl, as determined by the feature name
125 # odl-ovsdb-openstack (note: new impl is odl-netvirt-openstack) then we
126 # want ODL_L3 to be True. New impl wants it False
127 if [[ ${CONTROLLERFEATURES} == *"odl-ovsdb-openstack"* ]]; then
133 # if we are using the new netvirt impl, as determined by the feature name
134 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
135 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
136 # external networks in legacy netvirt
137 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
138 ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
140 ODL_PROVIDER_MAPPINGS=
143 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
144 cat >> ${local_conf_file_name} << EOF
145 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
146 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
147 ML2_VLAN_RANGES=${PUBLIC_PHYSICAL_NETWORK}
148 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
151 PUBLIC_INTERFACE=br100
154 if [ -z ${DISABLE_ODL_L3_PLUGIN} ] || [ "${DISABLE_ODL_L3_PLUGIN}" == "no" ]; then
155 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
156 cat >> ${local_conf_file_name} << EOF
159 [[post-config|\$NEUTRON_CONF]]
161 service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin
164 fi #check for ODL_ML2_BRANCH
165 fi #check for DISABLE_ODL_L3_PLUGIN
167 fi #ODL_ENABLE_L3_FWD check
169 cat >> ${local_conf_file_name} << EOF
170 [[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
172 minimize_polling=True
175 # Needed for VLAN provider tests - because our provider networks are always encapsulated in VXLAN (br-phys1)
176 # MTU(1440) + VXLAN(50) + VLAN(4) = 1494 < MTU eth0/br-phys1(1500)
177 physical_network_mtus = ${PUBLIC_PHYSICAL_NETWORK}:1440
180 [[post-config|/etc/neutron/dhcp_agent.ini]]
182 force_metadata = True
183 enable_isolated_metadata = True
185 [[post-config|/etc/nova/nova.conf]]
187 force_config_drive = False
191 echo "local.conf Created...."
192 cat ${local_conf_file_name}
195 function create_compute_node_local_conf {
199 ODL_OVS_MANAGERS="$4"
201 if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
206 if [ "${OPENSTACK_BRANCH}" == "master" ] || [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then # Ocata+
207 # placement is mandatory for nova since Ocata, note that this requires controller to enable placement-api
208 ENABLED_SERVICES="n-cpu,placement-client"
210 ENABLED_SERVICES="n-cpu"
213 local_conf_file_name=${WORKSPACE}/local.conf_compute_${HOSTIP}
214 cat > ${local_conf_file_name} << EOF
218 SCREEN_LOGDIR=/opt/stack/data/log
221 NOVA_VNC_ENABLED=True
223 ENABLED_SERVICES=${ENABLED_SERVICES}
225 SERVICE_HOST=${SERVICEHOST}
228 ENABLE_TENANT_TUNNELS=True
229 Q_ML2_TENANT_NETWORK_TYPE=vxlan
231 Q_HOST=\$SERVICE_HOST
232 MYSQL_HOST=\$SERVICE_HOST
233 RABBIT_HOST=\$SERVICE_HOST
234 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
235 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
236 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
239 RABBIT_PASSWORD=rabbit
240 SERVICE_TOKEN=service
241 SERVICE_PASSWORD=admin
245 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
250 if [[ "${ENABLE_OS_PLUGINS}" =~ networking-odl ]]; then
251 cat >> ${local_conf_file_name} << EOF
252 enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}
256 echo "ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}" >> ${local_conf_file_name}
258 # if we are using the new netvirt impl, as determined by the feature name
259 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
260 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
261 # external networks in legacy netvirt
262 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
263 ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
265 ODL_PROVIDER_MAPPINGS=
268 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
269 cat >> ${local_conf_file_name} << EOF
270 # Uncomment lines below if odl-compute is to be used for l3 forwarding
273 PUBLIC_INTERFACE=br100 # FIXME do we use br100 at all?
274 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
275 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
276 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
279 echo "local.conf Created...."
280 cat ${local_conf_file_name}
283 function configure_haproxy_for_neutron_requests () {
287 cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
288 sudo systemctl stop firewalld
289 sudo yum -y install policycoreutils-python haproxy
292 cat > ${WORKSPACE}/haproxy.cfg << EOF
298 pidfile /tmp/haproxy.pid
306 timeout http-request 10s
319 for odlip in ${ODL_IPS[*]}
321 cat >> ${WORKSPACE}/haproxy.cfg << EOF
322 server controller-${odlindex} ${odlip}:8080 check fall 5 inter 2000 rise 2
324 odlindex=$((odlindex+1))
327 cat >> ${WORKSPACE}/haproxy.cfg << EOF
328 listen opendaylight_rest
334 for odlip in ${ODL_IPS[*]}
336 cat >> ${WORKSPACE}/haproxy.cfg << EOF
337 server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2
339 odlindex=$((odlindex+1))
342 echo "Dump haproxy.cfg"
343 cat ${WORKSPACE}/haproxy.cfg
345 cat > ${WORKSPACE}/deploy_ha_proxy.sh<< EOF
346 sudo chown haproxy:haproxy /tmp/haproxy.cfg
347 sudo sed -i 's/\\/etc\\/haproxy\\/haproxy.cfg/\\/tmp\\/haproxy.cfg/g' /usr/lib/systemd/system/haproxy.service
348 sudo /usr/sbin/semanage permissive -a haproxy_t
349 sudo systemctl restart haproxy
352 sudo systemctl status haproxy
355 scp ${WORKSPACE}/install_ha_proxy.sh ${MGRIP}:/tmp
356 ${SSH} ${MGRIP} "sudo bash /tmp/install_ha_proxy.sh"
357 scp ${WORKSPACE}/haproxy.cfg ${MGRIP}:/tmp
358 scp ${WORKSPACE}/deploy_ha_proxy.sh ${MGRIP}:/tmp
359 ${SSH} ${MGRIP} "sudo bash /tmp/deploy_ha_proxy.sh"
362 function collect_logs_and_exit () {
363 set +e # We do not want to create red dot just because something went wrong while fetching logs.
364 for i in `seq 1 ${NUM_ODL_SYSTEM}`
366 CONTROLLERIP=ODL_SYSTEM_${i}_IP
367 echo "killing karaf process..."
368 ${SSH} "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
371 cat > extra_debug.sh << EOF
372 echo -e "/usr/sbin/lsmod | /usr/bin/grep openvswitch\n"
373 /usr/sbin/lsmod | /usr/bin/grep openvswitch
374 echo -e "\ngrep ct_ /var/log/openvswitch/ovs-vswitchd.log\n"
375 grep ct_ /var/log/openvswitch/ovs-vswitchd.log
379 # FIXME: Do not create .tar and gzip before copying.
380 for i in `seq 1 ${NUM_ODL_SYSTEM}`
382 CONTROLLERIP=ODL_SYSTEM_${i}_IP
383 ${SSH} "${!CONTROLLERIP}" "cp -r /tmp/${BUNDLEFOLDER}/data/log /tmp/odl_log"
384 ${SSH} "${!CONTROLLERIP}" "tar -cf /tmp/odl${i}_karaf.log.tar /tmp/odl_log/*"
385 scp "${!CONTROLLERIP}:/tmp/odl${i}_karaf.log.tar" "${WORKSPACE}/odl${i}_karaf.log.tar"
386 tar -xvf ${WORKSPACE}/odl${i}_karaf.log.tar -C . --strip-components 2 --transform s/karaf/odl${i}_karaf/g
387 grep "ROBOT MESSAGE\| ERROR " odl${i}_karaf.log > odl${i}_err.log
388 grep "ROBOT MESSAGE\|Exception" odl${i}_karaf.log > odl${i}_exception.log
389 grep "ROBOT MESSAGE\| ERROR \| WARN \|Exception" odl${i}_karaf.log > odl${i}_err_warn_exception.log
390 rm ${WORKSPACE}/odl${i}_karaf.log.tar
393 # Since this log collection work is happening before the archive build macro which also
394 # creates the ${WORKSPACE}/archives dir, we have to do it here first. The mkdir in the
395 # archives build step will essentially be a noop.
396 mkdir -p ${WORKSPACE}/archives
399 for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`
401 OS_CTRL_IP=OPENSTACK_CONTROL_NODE_${i}_IP
402 OS_CTRL_FOLDER="control_${i}"
403 mkdir -p ${OS_CTRL_FOLDER}
404 scp ${!OS_CTRL_IP}:/opt/stack/devstack/nohup.out ${OS_CTRL_FOLDER}/stack.log
405 scp ${!OS_CTRL_IP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_CTRL_FOLDER}/ovs-vswitchd.log
406 scp ${!OS_CTRL_IP}:/etc/neutron/neutron.conf ${OS_CTRL_FOLDER}/neutron.conf
407 scp ${!OS_CTRL_IP}:/etc/nova/nova.conf ${OS_CTRL_FOLDER}/nova.conf
408 rsync -avhe ssh ${!OS_CTRL_IP}:/opt/stack/logs/* ${OS_CTRL_FOLDER} # rsync to prevent copying of symbolic links
409 scp extra_debug.sh ${!OS_CTRL_IP}:/tmp
410 ${SSH} ${!OS_CTRL_IP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
411 scp ${!OS_CTRL_IP}:/tmp/extra_debug.log ${OS_CTRL_FOLDER}/extra_debug.log
412 mv local.conf_control ${OS_CTRL_FOLDER}/local.conf
413 mv ${OS_CTRL_FOLDER} ${WORKSPACE}/archives/
417 for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
419 OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
420 OS_COMPUTE_FOLDER="compute_${i}"
421 mkdir -p ${OS_COMPUTE_FOLDER}
422 scp ${!OSIP}:/opt/stack/devstack/nohup.out ${OS_COMPUTE_FOLDER}/stack.log
423 scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_COMPUTE_FOLDER}/ovs-vswitchd.log
424 scp ${!OSIP}:/etc/nova/nova.conf ${OS_COMPUTE_FOLDER}/nova.conf
425 rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${OS_COMPUTE_FOLDER} # rsync to prevent copying of symbolic links
426 scp extra_debug.sh ${!OSIP}:/tmp
427 ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
428 scp ${!OSIP}:/tmp/extra_debug.log ${OS_COMPUTE_FOLDER}/extra_debug.log
429 mv local.conf_compute_${!OSIP} ${OS_COMPUTE_FOLDER}/local.conf
430 mv ${OS_COMPUTE_FOLDER} ${WORKSPACE}/archives/
433 ls local.conf* | xargs -I % mv % %.log
436 DEVSTACK_TEMPEST_DIR="/opt/stack/tempest"
437 if $(ssh ${OPENSTACK_CONTROL_NODE_1_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 ]'"); then # if Tempest results exist
438 ssh ${OPENSTACK_CONTROL_NODE_1_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"
439 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'"
440 TEMPEST_LOGS_DIR=${WORKSPACE}/archives/tempest
441 mkdir -p ${TEMPEST_LOGS_DIR}
442 scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${TEMPEST_LOGS_DIR}
443 scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest.log ${TEMPEST_LOGS_DIR}
444 mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
448 cat > ${WORKSPACE}/disable_firewall.sh << EOF
449 sudo systemctl stop firewalld
450 sudo systemctl stop iptables
454 cat > ${WORKSPACE}/get_devstack.sh << EOF
455 sudo systemctl stop firewalld
456 sudo yum install bridge-utils -y
457 sudo systemctl stop NetworkManager
458 #Disable NetworkManager and kill dhclient and dnsmasq
459 sudo systemctl stop NetworkManager
460 sudo killall dhclient
462 #Workaround for mysql failure
463 echo "127.0.0.1 localhost \${HOSTNAME}" > /tmp/hosts
464 echo "::1 localhost \${HOSTNAME}" >> /tmp/hosts
465 sudo mv /tmp/hosts /etc/hosts
466 sudo /usr/sbin/brctl addbr br100
467 #sudo ifconfig eth0 mtu 2000
468 sudo mkdir /opt/stack
469 sudo chmod 777 /opt/stack
471 git clone https://git.openstack.org/openstack-dev/devstack
473 git checkout $OPENSTACK_BRANCH
476 [ "$NUM_OPENSTACK_SITES" ] || NUM_OPENSTACK_SITES=1
480 os_interval=$(( ${NUM_OPENSTACK_SYSTEM} / ${NUM_OPENSTACK_SITES} ))
481 ha_proxy_index=${os_interval}
483 cat > "${WORKSPACE}/manual_install_package.sh" << EOF
488 sudo python setup.py install
491 for i in `seq 1 ${NUM_OPENSTACK_SITES}`
493 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
494 echo "Configure HAProxy"
495 ODL_HAPROXYIP_PARAM=OPENSTACK_HAPROXY_${i}_IP
496 ha_proxy_index=$(( $ha_proxy_index + $os_interval ))
497 odl_index=$(((i - 1) * 3 + 1))
498 ODL_IP_PARAM1=ODL_SYSTEM_$((odl_index++))_IP
499 ODL_IP_PARAM2=ODL_SYSTEM_$((odl_index++))_IP
500 ODL_IP_PARAM3=ODL_SYSTEM_$((odl_index++))_IP
501 ODLMGRIP[$i]=${!ODL_HAPROXYIP_PARAM} # ODL Northbound uses HAProxy VIP
502 ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM1},${!ODL_IP_PARAM2},${!ODL_IP_PARAM3}" # OVSDB connects to all ODL IPs
504 configure_haproxy_for_neutron_requests ${!ODL_HAPROXYIP_PARAM} "${ODL_OVS_MGRS[$i]}"
506 ODL_IP_PARAM=ODL_SYSTEM_${i}_IP
507 ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM}" # ODL Northbound uses ODL IP
508 ODLMGRIP[$i]=${!ODL_IP_PARAM} # OVSDB connects to ODL IP
512 for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`
514 echo "Stack the Control Node"
515 CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
516 scp ${WORKSPACE}/get_devstack.sh ${!CONTROLIP}:/tmp
517 ${SSH} ${!CONTROLIP} "bash /tmp/get_devstack.sh"
518 create_control_node_local_conf ${!CONTROLIP} ${ODLMGRIP[$i]} "${ODL_OVS_MGRS[$i]}"
519 scp ${WORKSPACE}/local.conf_control_${!CONTROLIP} ${!CONTROLIP}:/opt/stack/devstack/local.conf
520 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
521 # Workaround for problems with latest versions/specified versions in requirements of openstack
522 # Openstacksdk,libvirt-python -> the current version does not work with Mitaka diue to some requirements
523 # conflict and breaks when trying to stack
524 # paramiko -> Problems with tempest tests due to paramiko incompatibility with pycrypto.
525 # the problem has been solved with version 1.17. If the latest version of paramiko is used, it causes
526 # other timeout problems
527 ssh ${!CONTROLIP} "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"
528 scp "${WORKSPACE}/manual_install_package.sh" "${!CONTROLIP}:/tmp"
529 ssh ${!CONTROLIP} "sudo pip install deprecation"
530 # Fix for recent requirements update in the master branch of the sdk.The section must be replaced with a better fix.
531 ssh "${!CONTROLIP}" "sh /tmp/manual_install_package.sh https://github.com/openstack/python-openstacksdk python-openstacksdk 0.9.14"
532 ssh "${!CONTROLIP}" "sh /tmp/manual_install_package.sh https://github.com/paramiko/paramiko paramiko 1.17"
534 ssh ${!CONTROLIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
535 ssh ${!CONTROLIP} "ps -ef | grep stack.sh"
536 ssh ${!CONTROLIP} "ls -lrt /opt/stack/devstack/nohup.out"
537 os_node_list+=(${!CONTROLIP})
539 #Workaround for stable/newton jobs
540 if [ "${ODL_ML2_BRANCH}" == "stable/newton" ]; then
541 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"
545 for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
547 echo "Stack the Compute Node"
548 NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
549 SITE_INDEX=$((((i - 1) / NUM_COMPUTES_PER_SITE) + 1)) # We need the site index to infer the control node IP for this compute
550 COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
551 CONTROLIP=OPENSTACK_CONTROL_NODE_${SITE_INDEX}_IP
552 scp ${WORKSPACE}/get_devstack.sh ${!COMPUTEIP}:/tmp
553 ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh"
554 create_compute_node_local_conf ${!COMPUTEIP} ${!CONTROLIP} ${ODLMGRIP[$SITE_INDEX]} "${ODL_OVS_MGRS[$SITE_INDEX]}"
555 scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
556 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
557 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"
559 ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
560 ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
561 os_node_list+=(${!COMPUTEIP})
564 echo ${os_node_list[*]}
566 cat > ${WORKSPACE}/check_stacking.sh << EOF
567 > /tmp/stack_progress
568 ps -ef | grep "stack.sh" | grep -v grep
570 if [ \${ret} -eq 1 ]; then
571 grep "This is your host IP address:" /opt/stack/devstack/nohup.out
572 if [ \$? -eq 0 ]; then
573 echo "Stacking Complete" > /tmp/stack_progress
575 echo "Stacking Failed" > /tmp/stack_progress
577 elif [ \${ret} -eq 0 ]; then
578 echo "Still Stacking" > /tmp/stack_progress
582 #the checking is repeated for an hour
585 while [ ${in_progress} -eq 1 ]; do
586 iteration=$(($iteration + 1))
587 for index in ${!os_node_list[@]}
589 echo "Check the status of stacking in ${os_node_list[index]}"
590 scp ${WORKSPACE}/check_stacking.sh ${os_node_list[index]}:/tmp
591 ${SSH} ${os_node_list[index]} "bash /tmp/check_stacking.sh"
592 scp ${os_node_list[index]}:/tmp/stack_progress .
595 stacking_status=`cat stack_progress`
596 if [ "$stacking_status" == "Still Stacking" ]; then
598 elif [ "$stacking_status" == "Stacking Failed" ]; then
599 collect_logs_and_exit
601 elif [ "$stacking_status" == "Stacking Complete" ]; then
602 unset os_node_list[index]
603 if [ ${#os_node_list[@]} -eq 0 ]; then
608 echo "sleep for a minute before the next check"
610 if [ ${iteration} -eq 60 ]; then
611 collect_logs_and_exit
616 NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
617 for i in `seq 1 ${NUM_OPENSTACK_SITES}`
619 echo "Configure the Control Node"
620 CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
622 #Need to disable firewalld and iptables in control node
623 echo "Stop Firewall in Control Node for compute nodes to be able to reach the ports and add to hypervisor-list"
624 scp ${WORKSPACE}/disable_firewall.sh ${!CONTROLIP}:/tmp
625 ${SSH} ${!CONTROLIP} "sudo bash /tmp/disable_firewall.sh"
627 echo "sleep for 60s and print hypervisor-list"
629 ${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
630 # in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
631 # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
632 # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
633 # is one less than the total number of openstack systems
634 if [ $((NUM_OPENSTACK_SYSTEM / NUM_OPENSTACK_SITES - 1)) -eq 1 ]; then
635 expected_num_hypervisors=1
637 expected_num_hypervisors=${NUM_COMPUTES_PER_SITE}
639 num_hypervisors=$(${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; openstack hypervisor list -f value | wc -l" | tail -1 | tr -d "\r")
640 if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
641 echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
642 collect_logs_and_exit
646 # upgrading pip, urllib3 and httplib2 so that tempest tests can be run on openstack control node
647 # this needs to happen after devstack runs because it seems devstack is pulling in specific versions
648 # of these libs that are not working for tempest.
649 ${SSH} ${!CONTROLIP} "sudo pip install --upgrade pip"
650 ${SSH} ${!CONTROLIP} "sudo pip install urllib3 --upgrade"
651 ${SSH} ${!CONTROLIP} "sudo pip install httplib2 --upgrade"
653 # Gather Compute IPs for the site
654 for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`
656 COMPUTE_INDEX=$(((i-1) * NUM_COMPUTES_PER_SITE + j))
657 IP_VAR=OPENSTACK_COMPUTE_NODE_${COMPUTE_INDEX}_IP
658 COMPUTE_IPS[$((j-1))]=${!IP_VAR}
661 # Need to disable firewalld and iptables in compute nodes as well
662 for ip in ${COMPUTE_IPS[*]}
664 scp ${WORKSPACE}/disable_firewall.sh "${ip}:/tmp"
665 ${SSH} "${ip}" "sudo bash /tmp/disable_firewall.sh"
669 echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
670 # FIXME Should there be a unique gateway IP and devstack index for each site?
672 for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}
674 # 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
675 ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
676 ${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++))"
680 if [ "${IPSEC_VXLAN_TUNNELS_ENABLED}" == "yes" ]; then
681 ALL_NODES=(${!CONTROLIP} ${COMPUTE_IPS[*]})
682 for ((inx_ip1=0; inx_ip1<$((${#ALL_NODES[@]} - 1)); inx_ip1++))
684 for ((inx_ip2=$((inx_ip1 + 1)); inx_ip2<${#ALL_NODES[@]}; inx_ip2++))
686 KEY1=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
687 KEY2=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
688 ID=0x$(dd if=/dev/urandom count=4 bs=1 2> /dev/null| xxd -p -c 8)
689 ip1=${ALL_NODES[$inx_ip1]}
690 ip2=${ALL_NODES[$inx_ip2]}
691 ${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"
692 ${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"
693 ${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"
694 ${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"
696 ${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"
697 ${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"
698 ${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"
699 ${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"
703 for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}
705 echo "ip xfrm configuration for node $ip:"
706 ${SSH} $ip "sudo ip xfrm policy list"
707 ${SSH} $ip "sudo ip xfrm state list"
711 # Control Node - PUBLIC_BRIDGE will act as the external router
712 GATEWAY_IP="10.10.10.250" # FIXME this should be a parameter, also shared with integration-test
714 ${SSH} ${!CONTROLIP} "sudo ip link add link ${PUBLIC_BRIDGE} name ${PUBLIC_BRIDGE}.${GATEWAY_VLAN_ID} type vlan id ${GATEWAY_VLAN_ID}"
715 ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE} up"
716 ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE}.${GATEWAY_VLAN_ID} up ${GATEWAY_IP}/24"
720 for compute_ip in ${COMPUTE_IPS[*]}
722 # Tunnel from controller to compute
723 COMPUTEPORT=compute$(( compute_index++ ))_vxlan
724 ${SSH} ${!CONTROLIP} "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"
725 # Tunnel from compute to controller
726 CONTROLPORT="control_vxlan"
727 ${SSH} $compute_ip "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"
731 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
732 odlmgrip=OPENSTACK_HAPROXY_1_IP
733 HA_PROXY_IP=${!odlmgrip}
734 HA_PROXY_1_IP=${!odlmgrip}
735 odlmgrip2=OPENSTACK_HAPROXY_2_IP
736 HA_PROXY_2_IP=${!odlmgrip2}
737 odlmgrip3=OPENSTACK_HAPROXY_1_IP
738 HA_PROXY_3_IP=${!odlmgrip3}
740 HA_PROXY_IP=${ODL_SYSTEM_IP}
741 HA_PROXY_1_IP=${ODL_SYSTEM_1_IP}
742 HA_PROXY_2_IP=${ODL_SYSTEM_2_IP}
743 HA_PROXY_3_IP=${ODL_SYSTEM_3_IP}
746 echo "Locating test plan to use..."
747 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
748 if [ ! -f "${testplan_filepath}" ]; then
749 testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
752 echo "Changing the testplan path..."
753 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
756 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
758 #FIXME currently support only 1 site
759 echo "Starting Robot test suites ${SUITES} ..."
760 # please add pybot -v arguments on a single line and alphabetized
761 pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude \
762 -v BUNDLEFOLDER:${BUNDLEFOLDER} \
763 -v BUNDLE_URL:${ACTUALBUNDLEURL} \
764 -v CONTROLLER_USER:${USER} \
765 -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
766 -v HA_PROXY_IP:${HA_PROXY_IP} \
767 -v HA_PROXY_1_IP:${HA_PROXY_1_IP} \
768 -v HA_PROXY_2_IP:${HA_PROXY_2_IP} \
769 -v HA_PROXY_3_IP:${HA_PROXY_3_IP} \
770 -v JDKVERSION:${JDKVERSION} \
771 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
772 -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
773 -v NUM_OPENSTACK_SITES:${NUM_OPENSTACK_SITES} \
774 -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
775 -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
776 -v ODL_STREAM:${DISTROSTREAM} \
777 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
778 -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} \
779 -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
780 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} \
781 -v ODL_SYSTEM_4_IP:${ODL_SYSTEM_4_IP} \
782 -v ODL_SYSTEM_5_IP:${ODL_SYSTEM_5_IP} \
783 -v ODL_SYSTEM_6_IP:${ODL_SYSTEM_6_IP} \
784 -v ODL_SYSTEM_7_IP:${ODL_SYSTEM_7_IP} \
785 -v ODL_SYSTEM_8_IP:${ODL_SYSTEM_8_IP} \
786 -v ODL_SYSTEM_9_IP:${ODL_SYSTEM_9_IP} \
787 -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
788 -v OS_CONTROL_NODE_1_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
789 -v OS_CONTROL_NODE_2_IP:${OPENSTACK_CONTROL_NODE_2_IP} \
790 -v OS_CONTROL_NODE_3_IP:${OPENSTACK_CONTROL_NODE_3_IP} \
791 -v OPENSTACK_BRANCH:${OPENSTACK_BRANCH} \
792 -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} \
793 -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
794 -v OS_COMPUTE_3_IP:${OPENSTACK_COMPUTE_NODE_3_IP} \
795 -v OS_COMPUTE_4_IP:${OPENSTACK_COMPUTE_NODE_4_IP} \
796 -v OS_COMPUTE_5_IP:${OPENSTACK_COMPUTE_NODE_5_IP} \
797 -v OS_COMPUTE_6_IP:${OPENSTACK_COMPUTE_NODE_6_IP} \
799 -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
800 -v SECURITY_GROUP_MODE:${SECURITY_GROUP_MODE} \
801 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_1_IP} \
802 -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_1_IP} \
803 -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
804 -v USER_HOME:${HOME} \
806 ${TESTOPTIONS} ${SUITES} || true
808 echo "Examining the files in data/log and checking filesize"
809 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
810 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
812 echo "Tests Executed"
813 collect_logs_and_exit
815 true # perhaps Jenkins is testing last exit code
816 # vim: ts=4 sw=4 sts=4 et ft=sh :