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}"
61 elif [ "$plugin_name" == "networking-sfc" ]; then
62 ENABLE_PLUGIN_ARGS="${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
64 echo "Error: Invalid plugin $plugin_name, unsupported"
67 cat >> ${local_conf_file_name} << EOF
68 enable_plugin ${plugin_name} ${ENABLE_PLUGIN_ARGS}
72 if [ "${OPENSTACK_BRANCH}" == "master" ] || [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then # Ocata+
73 # placement is mandatory for nova since Ocata, note that this requires computes to enable placement-client
74 # this should be moved into enabled_services for each job (but only for Ocata)
75 echo "enable_service placement-api" >> ${local_conf_file_name}
77 cat >> ${local_conf_file_name} << EOF
79 SERVICE_HOST=\$HOST_IP
81 NEUTRON_CREATE_INITIAL_NETWORKS=${CREATE_INITIAL_NETWORKS}
83 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
86 ENABLE_TENANT_TUNNELS=True
88 MYSQL_HOST=\$SERVICE_HOST
89 RABBIT_HOST=\$SERVICE_HOST
90 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
91 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
92 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
95 RABBIT_PASSWORD=rabbit
97 SERVICE_PASSWORD=admin
102 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
107 NEUTRON_LBAAS_SERVICE_PROVIDERV2=${LBAAS_SERVICE_PROVIDER} # Only relevant if neutron-lbaas plugin is enabled
108 NEUTRON_SFC_DRIVERS=odl_v2 # Only relevant if networking-sfc plugin is enabled
109 NEUTRON_FLOWCLASSIFIER_DRIVERS=odl_v2 # Only relevant if networking-sfc plugin is enabled
112 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
113 cat >> ${local_conf_file_name} << EOF
115 enable_plugin networking-l2gw ${NETWORKING_L2GW_DRIVER} ${ODL_ML2_BRANCH}
116 NETWORKING_L2GW_SERVICE_DRIVER=L2GW:OpenDaylight:networking_odl.l2gateway.driver.OpenDaylightL2gwDriver:default
117 ENABLED_SERVICES+=,neutron,q-svc,nova,q-meta
122 if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
123 echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
126 echo "ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}" >> ${local_conf_file_name}
128 # if we are using the old netvirt impl, as determined by the feature name
129 # odl-ovsdb-openstack (note: new impl is odl-netvirt-openstack) then we
130 # want ODL_L3 to be True. New impl wants it False
131 if [[ ${CONTROLLERFEATURES} == *"odl-ovsdb-openstack"* ]]; then
137 # if we are using the new netvirt impl, as determined by the feature name
138 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
139 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
140 # external networks in legacy netvirt
141 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
142 ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
144 ODL_PROVIDER_MAPPINGS=
147 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
148 cat >> ${local_conf_file_name} << EOF
149 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
150 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
151 ML2_VLAN_RANGES=${PUBLIC_PHYSICAL_NETWORK}
152 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
155 PUBLIC_INTERFACE=br100
158 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
159 cat >> ${local_conf_file_name} << EOF
164 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
165 cat >> ${local_conf_file_name} << EOF
166 [[post-config|\$NEUTRON_CONF]]
168 service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin, networking_l2gw.services.l2gateway.plugin.L2GatewayPlugin
172 cat >> ${local_conf_file_name} << EOF
173 [[post-config|\$NEUTRON_CONF]]
175 service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin
177 fi #check for ENABLE_NETWORKING_L2GW
179 fi #check for ODL_ML2_BRANCH
181 fi #ODL_ENABLE_L3_FWD check
183 cat >> ${local_conf_file_name} << EOF
184 [[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
186 minimize_polling=True
189 # Needed for VLAN provider tests - because our provider networks are always encapsulated in VXLAN (br-phys1)
190 # MTU(1440) + VXLAN(50) + VLAN(4) = 1494 < MTU eth0/br-phys1(1500)
191 physical_network_mtus = ${PUBLIC_PHYSICAL_NETWORK}:1440
194 [[post-config|/etc/neutron/dhcp_agent.ini]]
196 force_metadata = True
197 enable_isolated_metadata = True
199 [[post-config|/etc/nova/nova.conf]]
201 force_config_drive = False
205 echo "local.conf Created...."
206 cat ${local_conf_file_name}
209 function create_compute_node_local_conf {
213 ODL_OVS_MANAGERS="$4"
215 if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
220 if [ "${OPENSTACK_BRANCH}" == "master" ] || [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then # Ocata+
221 # placement is mandatory for nova since Ocata, note that this requires controller to enable placement-api
222 ENABLED_SERVICES="n-cpu,placement-client"
224 ENABLED_SERVICES="n-cpu"
227 local_conf_file_name=${WORKSPACE}/local.conf_compute_${HOSTIP}
228 cat > ${local_conf_file_name} << EOF
232 SCREEN_LOGDIR=/opt/stack/data/log
235 NOVA_VNC_ENABLED=True
237 ENABLED_SERVICES=${ENABLED_SERVICES}
239 SERVICE_HOST=${SERVICEHOST}
242 ENABLE_TENANT_TUNNELS=True
243 Q_ML2_TENANT_NETWORK_TYPE=vxlan
245 Q_HOST=\$SERVICE_HOST
246 MYSQL_HOST=\$SERVICE_HOST
247 RABBIT_HOST=\$SERVICE_HOST
248 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
249 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
250 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
253 RABBIT_PASSWORD=rabbit
254 SERVICE_TOKEN=service
255 SERVICE_PASSWORD=admin
259 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 echo "ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}" >> ${local_conf_file_name}
272 # if we are using the new netvirt impl, as determined by the feature name
273 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
274 # want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support
275 # external networks in legacy netvirt
276 if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then
277 ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
279 ODL_PROVIDER_MAPPINGS=
282 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
283 cat >> ${local_conf_file_name} << EOF
284 # Uncomment lines below if odl-compute is to be used for l3 forwarding
287 PUBLIC_INTERFACE=br100 # FIXME do we use br100 at all?
288 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
289 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
290 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
293 echo "local.conf Created...."
294 cat ${local_conf_file_name}
297 function configure_haproxy_for_neutron_requests () {
301 cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
302 sudo systemctl stop firewalld
303 sudo yum -y install policycoreutils-python haproxy
306 cat > ${WORKSPACE}/haproxy.cfg << EOF
312 pidfile /tmp/haproxy.pid
320 timeout http-request 10s
333 for odlip in ${ODL_IPS[*]}
335 cat >> ${WORKSPACE}/haproxy.cfg << EOF
336 server controller-${odlindex} ${odlip}:8080 check fall 5 inter 2000 rise 2
338 odlindex=$((odlindex+1))
341 cat >> ${WORKSPACE}/haproxy.cfg << EOF
342 listen opendaylight_rest
348 for odlip in ${ODL_IPS[*]}
350 cat >> ${WORKSPACE}/haproxy.cfg << EOF
351 server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2
353 odlindex=$((odlindex+1))
356 echo "Dump haproxy.cfg"
357 cat ${WORKSPACE}/haproxy.cfg
359 cat > ${WORKSPACE}/deploy_ha_proxy.sh<< EOF
360 sudo chown haproxy:haproxy /tmp/haproxy.cfg
361 sudo sed -i 's/\\/etc\\/haproxy\\/haproxy.cfg/\\/tmp\\/haproxy.cfg/g' /usr/lib/systemd/system/haproxy.service
362 sudo /usr/sbin/semanage permissive -a haproxy_t
363 sudo systemctl restart haproxy
366 sudo systemctl status haproxy
369 scp ${WORKSPACE}/install_ha_proxy.sh ${MGRIP}:/tmp
370 ${SSH} ${MGRIP} "sudo bash /tmp/install_ha_proxy.sh"
371 scp ${WORKSPACE}/haproxy.cfg ${MGRIP}:/tmp
372 scp ${WORKSPACE}/deploy_ha_proxy.sh ${MGRIP}:/tmp
373 ${SSH} ${MGRIP} "sudo bash /tmp/deploy_ha_proxy.sh"
376 function collect_logs_and_exit () {
377 set +e # We do not want to create red dot just because something went wrong while fetching logs.
378 for i in `seq 1 ${NUM_ODL_SYSTEM}`
380 CONTROLLERIP=ODL_SYSTEM_${i}_IP
381 echo "killing karaf process..."
382 ${SSH} "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
385 cat > extra_debug.sh << EOF
386 echo -e "/usr/sbin/lsmod | /usr/bin/grep openvswitch\n"
387 /usr/sbin/lsmod | /usr/bin/grep openvswitch
388 echo -e "\ngrep ct_ /var/log/openvswitch/ovs-vswitchd.log\n"
389 grep ct_ /var/log/openvswitch/ovs-vswitchd.log
393 # FIXME: Do not create .tar and gzip before copying.
394 for i in `seq 1 ${NUM_ODL_SYSTEM}`
396 CONTROLLERIP=ODL_SYSTEM_${i}_IP
397 ${SSH} "${!CONTROLLERIP}" "cp -r /tmp/${BUNDLEFOLDER}/data/log /tmp/odl_log"
398 ${SSH} "${!CONTROLLERIP}" "tar -cf /tmp/odl${i}_karaf.log.tar /tmp/odl_log/*"
399 scp "${!CONTROLLERIP}:/tmp/odl${i}_karaf.log.tar" "${WORKSPACE}/odl${i}_karaf.log.tar"
400 tar -xvf ${WORKSPACE}/odl${i}_karaf.log.tar -C . --strip-components 2 --transform s/karaf/odl${i}_karaf/g
401 grep "ROBOT MESSAGE\| ERROR " odl${i}_karaf.log > odl${i}_err.log
402 grep "ROBOT MESSAGE\|Exception" odl${i}_karaf.log > odl${i}_exception.log
403 grep "ROBOT MESSAGE\| ERROR \| WARN \|Exception" odl${i}_karaf.log > odl${i}_err_warn_exception.log
404 rm ${WORKSPACE}/odl${i}_karaf.log.tar
407 # Since this log collection work is happening before the archive build macro which also
408 # creates the ${WORKSPACE}/archives dir, we have to do it here first. The mkdir in the
409 # archives build step will essentially be a noop.
410 mkdir -p ${WORKSPACE}/archives
413 for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`
415 OS_CTRL_IP=OPENSTACK_CONTROL_NODE_${i}_IP
416 OS_CTRL_FOLDER="control_${i}"
417 mkdir -p ${OS_CTRL_FOLDER}
418 scp ${!OS_CTRL_IP}:/opt/stack/devstack/nohup.out ${OS_CTRL_FOLDER}/stack.log
419 scp ${!OS_CTRL_IP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_CTRL_FOLDER}/ovs-vswitchd.log
420 scp ${!OS_CTRL_IP}:/etc/neutron/neutron.conf ${OS_CTRL_FOLDER}/neutron.conf
421 scp ${!OS_CTRL_IP}:/etc/nova/nova.conf ${OS_CTRL_FOLDER}/nova.conf
422 rsync -avhe ssh ${!OS_CTRL_IP}:/opt/stack/logs/* ${OS_CTRL_FOLDER} # rsync to prevent copying of symbolic links
423 scp extra_debug.sh ${!OS_CTRL_IP}:/tmp
424 ${SSH} ${!OS_CTRL_IP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
425 scp ${!OS_CTRL_IP}:/tmp/extra_debug.log ${OS_CTRL_FOLDER}/extra_debug.log
426 scp ${!OS_CTRL_IP}:/tmp/*.xz ${OS_CTRL_FOLDER}/
427 mv local.conf_control_${!OS_CTRL_IP} ${OS_CTRL_FOLDER}/local.conf
428 mv ${OS_CTRL_FOLDER} ${WORKSPACE}/archives/
432 for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
434 OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
435 OS_COMPUTE_FOLDER="compute_${i}"
436 mkdir -p ${OS_COMPUTE_FOLDER}
437 scp ${!OSIP}:/opt/stack/devstack/nohup.out ${OS_COMPUTE_FOLDER}/stack.log
438 scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_COMPUTE_FOLDER}/ovs-vswitchd.log
439 scp ${!OSIP}:/etc/nova/nova.conf ${OS_COMPUTE_FOLDER}/nova.conf
440 rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${OS_COMPUTE_FOLDER} # rsync to prevent copying of symbolic links
441 scp extra_debug.sh ${!OSIP}:/tmp
442 ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
443 scp ${!OSIP}:/tmp/extra_debug.log ${OS_COMPUTE_FOLDER}/extra_debug.log
444 scp ${!OSIP}:/tmp/*.xz ${OS_COMPUTE_FOLDER}/
445 mv local.conf_compute_${!OSIP} ${OS_COMPUTE_FOLDER}/local.conf
446 mv ${OS_COMPUTE_FOLDER} ${WORKSPACE}/archives/
449 ls local.conf* | xargs -I % mv % %.log
452 DEVSTACK_TEMPEST_DIR="/opt/stack/tempest"
453 if $(ssh ${OPENSTACK_CONTROL_NODE_1_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 ]'"); then # if Tempest results exist
454 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"
455 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'"
456 TEMPEST_LOGS_DIR=${WORKSPACE}/archives/tempest
457 mkdir -p ${TEMPEST_LOGS_DIR}
458 scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${TEMPEST_LOGS_DIR}
459 scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest.log ${TEMPEST_LOGS_DIR}
460 mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
464 cat > ${WORKSPACE}/disable_firewall.sh << EOF
465 sudo systemctl stop firewalld
466 sudo systemctl stop iptables
470 cat > ${WORKSPACE}/get_devstack.sh << EOF
471 sudo systemctl stop firewalld
472 sudo yum install bridge-utils -y
473 sudo systemctl stop NetworkManager
474 #Disable NetworkManager and kill dhclient and dnsmasq
475 sudo systemctl stop NetworkManager
476 sudo killall dhclient
478 #Workaround for mysql failure
479 echo "127.0.0.1 localhost \${HOSTNAME}" > /tmp/hosts
480 echo "::1 localhost \${HOSTNAME}" >> /tmp/hosts
481 sudo mv /tmp/hosts /etc/hosts
482 sudo /usr/sbin/brctl addbr br100
483 #sudo ifconfig eth0 mtu 2000
484 sudo mkdir /opt/stack
485 sudo chmod 777 /opt/stack
487 git clone https://git.openstack.org/openstack-dev/devstack
489 git checkout $OPENSTACK_BRANCH
492 [ "$NUM_OPENSTACK_SITES" ] || NUM_OPENSTACK_SITES=1
496 os_interval=$(( ${NUM_OPENSTACK_SYSTEM} / ${NUM_OPENSTACK_SITES} ))
497 ha_proxy_index=${os_interval}
499 cat > "${WORKSPACE}/manual_install_package.sh" << EOF
504 sudo python setup.py install
507 for i in `seq 1 ${NUM_OPENSTACK_SITES}`
509 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
510 echo "Configure HAProxy"
511 ODL_HAPROXYIP_PARAM=OPENSTACK_HAPROXY_${i}_IP
512 ha_proxy_index=$(( $ha_proxy_index + $os_interval ))
513 odl_index=$(((i - 1) * 3 + 1))
514 ODL_IP_PARAM1=ODL_SYSTEM_$((odl_index++))_IP
515 ODL_IP_PARAM2=ODL_SYSTEM_$((odl_index++))_IP
516 ODL_IP_PARAM3=ODL_SYSTEM_$((odl_index++))_IP
517 ODLMGRIP[$i]=${!ODL_HAPROXYIP_PARAM} # ODL Northbound uses HAProxy VIP
518 ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM1},${!ODL_IP_PARAM2},${!ODL_IP_PARAM3}" # OVSDB connects to all ODL IPs
520 configure_haproxy_for_neutron_requests ${!ODL_HAPROXYIP_PARAM} "${ODL_OVS_MGRS[$i]}"
522 ODL_IP_PARAM=ODL_SYSTEM_${i}_IP
523 ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM}" # ODL Northbound uses ODL IP
524 ODLMGRIP[$i]=${!ODL_IP_PARAM} # OVSDB connects to ODL IP
528 for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`
530 echo "Stack the Control Node"
531 CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
532 scp ${WORKSPACE}/get_devstack.sh ${!CONTROLIP}:/tmp
533 ${SSH} ${!CONTROLIP} "bash /tmp/get_devstack.sh"
534 create_control_node_local_conf ${!CONTROLIP} ${ODLMGRIP[$i]} "${ODL_OVS_MGRS[$i]}"
535 scp ${WORKSPACE}/local.conf_control_${!CONTROLIP} ${!CONTROLIP}:/opt/stack/devstack/local.conf
536 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
537 # Workaround for problems with latest versions/specified versions in requirements of openstack
538 # Openstacksdk,libvirt-python -> the current version does not work with Mitaka diue to some requirements
539 # conflict and breaks when trying to stack
540 # paramiko -> Problems with tempest tests due to paramiko incompatibility with pycrypto.
541 # the problem has been solved with version 1.17. If the latest version of paramiko is used, it causes
542 # other timeout problems
543 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"
544 scp "${WORKSPACE}/manual_install_package.sh" "${!CONTROLIP}:/tmp"
545 ssh ${!CONTROLIP} "sudo pip install deprecation"
546 # Fix for recent requirements update in the master branch of the sdk.The section must be replaced with a better fix.
547 ssh "${!CONTROLIP}" "sh /tmp/manual_install_package.sh https://github.com/openstack/python-openstacksdk python-openstacksdk 0.9.14"
548 ssh "${!CONTROLIP}" "sh /tmp/manual_install_package.sh https://github.com/paramiko/paramiko paramiko 1.17"
550 ssh ${!CONTROLIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
551 ssh ${!CONTROLIP} "ps -ef | grep stack.sh"
552 ssh ${!CONTROLIP} "ls -lrt /opt/stack/devstack/nohup.out"
553 os_node_list+=(${!CONTROLIP})
555 #Workaround for stable/newton jobs
556 if [ "${ODL_ML2_BRANCH}" == "stable/newton" ]; then
557 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"
561 for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
563 echo "Stack the Compute Node"
564 NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
565 SITE_INDEX=$((((i - 1) / NUM_COMPUTES_PER_SITE) + 1)) # We need the site index to infer the control node IP for this compute
566 COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
567 CONTROLIP=OPENSTACK_CONTROL_NODE_${SITE_INDEX}_IP
568 scp ${WORKSPACE}/get_devstack.sh ${!COMPUTEIP}:/tmp
569 ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh"
570 create_compute_node_local_conf ${!COMPUTEIP} ${!CONTROLIP} ${ODLMGRIP[$SITE_INDEX]} "${ODL_OVS_MGRS[$SITE_INDEX]}"
571 scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
572 if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
573 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"
575 ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
576 ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
577 os_node_list+=(${!COMPUTEIP})
580 echo ${os_node_list[*]}
582 cat > ${WORKSPACE}/check_stacking.sh << EOF
583 > /tmp/stack_progress
584 ps -ef | grep "stack.sh" | grep -v grep
586 if [ \${ret} -eq 1 ]; then
587 grep "This is your host IP address:" /opt/stack/devstack/nohup.out
588 if [ \$? -eq 0 ]; then
589 echo "Stacking Complete" > /tmp/stack_progress
591 echo "Stacking Failed" > /tmp/stack_progress
593 elif [ \${ret} -eq 0 ]; then
594 echo "Still Stacking" > /tmp/stack_progress
598 #the checking is repeated for an hour
601 while [ ${in_progress} -eq 1 ]; do
602 iteration=$(($iteration + 1))
603 for index in ${!os_node_list[@]}
605 echo "Check the status of stacking in ${os_node_list[index]}"
606 scp ${WORKSPACE}/check_stacking.sh ${os_node_list[index]}:/tmp
607 ${SSH} ${os_node_list[index]} "bash /tmp/check_stacking.sh"
608 scp ${os_node_list[index]}:/tmp/stack_progress .
611 stacking_status=`cat stack_progress`
612 if [ "$stacking_status" == "Still Stacking" ]; then
614 elif [ "$stacking_status" == "Stacking Failed" ]; then
615 collect_logs_and_exit
617 elif [ "$stacking_status" == "Stacking Complete" ]; then
618 unset os_node_list[index]
619 if [ ${#os_node_list[@]} -eq 0 ]; then
624 echo "sleep for a minute before the next check"
626 if [ ${iteration} -eq 60 ]; then
627 collect_logs_and_exit
632 NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
633 for i in `seq 1 ${NUM_OPENSTACK_SITES}`
635 echo "Configure the Control Node"
636 CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
638 #Need to disable firewalld and iptables in control node
639 echo "Stop Firewall in Control Node for compute nodes to be able to reach the ports and add to hypervisor-list"
640 scp ${WORKSPACE}/disable_firewall.sh ${!CONTROLIP}:/tmp
641 ${SSH} ${!CONTROLIP} "sudo bash /tmp/disable_firewall.sh"
643 echo "sleep for 60s and print hypervisor-list"
645 ${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
646 # in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
647 # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
648 # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
649 # is one less than the total number of openstack systems
650 if [ $((NUM_OPENSTACK_SYSTEM / NUM_OPENSTACK_SITES)) -eq 1 ]; then
651 expected_num_hypervisors=1
653 expected_num_hypervisors=${NUM_COMPUTES_PER_SITE}
655 num_hypervisors=$(${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; openstack hypervisor list -f value | wc -l" | tail -1 | tr -d "\r")
656 if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
657 echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
658 collect_logs_and_exit
662 # upgrading pip, urllib3 and httplib2 so that tempest tests can be run on openstack control node
663 # this needs to happen after devstack runs because it seems devstack is pulling in specific versions
664 # of these libs that are not working for tempest.
665 ${SSH} ${!CONTROLIP} "sudo pip install --upgrade pip"
666 ${SSH} ${!CONTROLIP} "sudo pip install urllib3 --upgrade"
667 ${SSH} ${!CONTROLIP} "sudo pip install httplib2 --upgrade"
669 # Gather Compute IPs for the site
670 for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`
672 COMPUTE_INDEX=$(((i-1) * NUM_COMPUTES_PER_SITE + j))
673 IP_VAR=OPENSTACK_COMPUTE_NODE_${COMPUTE_INDEX}_IP
674 COMPUTE_IPS[$((j-1))]=${!IP_VAR}
677 # Need to disable firewalld and iptables in compute nodes as well
678 for ip in ${COMPUTE_IPS[*]}
680 scp ${WORKSPACE}/disable_firewall.sh "${ip}:/tmp"
681 ${SSH} "${ip}" "sudo bash /tmp/disable_firewall.sh"
685 echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
686 # FIXME Should there be a unique gateway IP and devstack index for each site?
688 for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}
690 # 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
691 ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
692 ${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++))"
696 if [ "${IPSEC_VXLAN_TUNNELS_ENABLED}" == "yes" ]; then
697 ALL_NODES=(${!CONTROLIP} ${COMPUTE_IPS[*]})
698 for ((inx_ip1=0; inx_ip1<$((${#ALL_NODES[@]} - 1)); inx_ip1++))
700 for ((inx_ip2=$((inx_ip1 + 1)); inx_ip2<${#ALL_NODES[@]}; inx_ip2++))
702 KEY1=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
703 KEY2=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
704 ID=0x$(dd if=/dev/urandom count=4 bs=1 2> /dev/null| xxd -p -c 8)
705 ip1=${ALL_NODES[$inx_ip1]}
706 ip2=${ALL_NODES[$inx_ip2]}
707 ${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"
708 ${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"
709 ${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"
710 ${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"
712 ${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"
713 ${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"
714 ${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"
715 ${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"
719 for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}
721 echo "ip xfrm configuration for node $ip:"
722 ${SSH} $ip "sudo ip xfrm policy list"
723 ${SSH} $ip "sudo ip xfrm state list"
727 # Control Node - PUBLIC_BRIDGE will act as the external router
728 # Parameter values below are used in integration/test - changing them requires updates in intergration/test as well
729 EXTNET_GATEWAY_IP="10.10.10.250"
731 EXTNET_INTERNET_IP="10.9.9.9"
732 EXTNET_PNF_IP="10.10.10.253"
733 if [[ ${CONTROLLERFEATURES} == *"odl-ovsdb-openstack"* ]]; then
734 ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE} up ${EXTNET_GATEWAY_IP}/24"
736 ${SSH} ${!CONTROLIP} "sudo ip link add link ${PUBLIC_BRIDGE} name ${PUBLIC_BRIDGE}.${EXTNET_VLAN_ID} type vlan id ${EXTNET_VLAN_ID}"
737 ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE} up"
738 ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE}.${EXTNET_VLAN_ID} up ${EXTNET_GATEWAY_IP}/24"
740 # Control Node - external net PNF simulation
741 ${SSH} ${!CONTROLIP} "
742 sudo ip netns add pnf_ns;
743 sudo ip link add pnf_veth0 type veth peer name pnf_veth1;
744 sudo ip link set pnf_veth1 netns pnf_ns;
745 sudo ip link set pnf_veth0 up;
746 sudo ip netns exec pnf_ns ifconfig pnf_veth1 up;
747 sudo ip netns exec pnf_ns ip link add link pnf_veth1 name pnf_veth1.${EXTNET_VLAN_ID} type vlan id ${EXTNET_VLAN_ID};
748 sudo ip netns exec pnf_ns ifconfig pnf_veth1.${EXTNET_VLAN_ID} up ${EXTNET_PNF_IP}/24;
749 sudo ovs-vsctl add-port ${PUBLIC_BRIDGE} pnf_veth0;
752 # Control Node - external net internet address simulation
753 ${SSH} ${!CONTROLIP} "
754 sudo ip tuntap add dev internet_tap mode tap;
755 sudo ifconfig internet_tap up ${EXTNET_INTERNET_IP}/24;
761 for compute_ip in ${COMPUTE_IPS[*]}
763 # Tunnel from controller to compute
764 COMPUTEPORT=compute$(( compute_index++ ))_vxlan
765 ${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"
766 # Tunnel from compute to controller
767 CONTROLPORT="control_vxlan"
768 ${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"
772 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
773 odlmgrip=OPENSTACK_HAPROXY_1_IP
774 HA_PROXY_IP=${!odlmgrip}
775 HA_PROXY_1_IP=${!odlmgrip}
776 odlmgrip2=OPENSTACK_HAPROXY_2_IP
777 HA_PROXY_2_IP=${!odlmgrip2}
778 odlmgrip3=OPENSTACK_HAPROXY_1_IP
779 HA_PROXY_3_IP=${!odlmgrip3}
781 HA_PROXY_IP=${ODL_SYSTEM_IP}
782 HA_PROXY_1_IP=${ODL_SYSTEM_1_IP}
783 HA_PROXY_2_IP=${ODL_SYSTEM_2_IP}
784 HA_PROXY_3_IP=${ODL_SYSTEM_3_IP}
787 echo "Locating test plan to use..."
788 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
789 if [ ! -f "${testplan_filepath}" ]; then
790 testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
793 echo "Changing the testplan path..."
794 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
797 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
799 #FIXME currently support only 1 site
800 echo "Starting Robot test suites ${SUITES} ..."
801 # please add pybot -v arguments on a single line and alphabetized
802 pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude \
803 -v BUNDLEFOLDER:${BUNDLEFOLDER} \
804 -v BUNDLE_URL:${ACTUALBUNDLEURL} \
805 -v CONTROLLER_USER:${USER} \
806 -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
807 -v HA_PROXY_IP:${HA_PROXY_IP} \
808 -v HA_PROXY_1_IP:${HA_PROXY_1_IP} \
809 -v HA_PROXY_2_IP:${HA_PROXY_2_IP} \
810 -v HA_PROXY_3_IP:${HA_PROXY_3_IP} \
811 -v JDKVERSION:${JDKVERSION} \
812 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
813 -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
814 -v NUM_OPENSTACK_SITES:${NUM_OPENSTACK_SITES} \
815 -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
816 -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
817 -v ODL_STREAM:${DISTROSTREAM} \
818 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
819 -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} \
820 -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
821 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} \
822 -v ODL_SYSTEM_4_IP:${ODL_SYSTEM_4_IP} \
823 -v ODL_SYSTEM_5_IP:${ODL_SYSTEM_5_IP} \
824 -v ODL_SYSTEM_6_IP:${ODL_SYSTEM_6_IP} \
825 -v ODL_SYSTEM_7_IP:${ODL_SYSTEM_7_IP} \
826 -v ODL_SYSTEM_8_IP:${ODL_SYSTEM_8_IP} \
827 -v ODL_SYSTEM_9_IP:${ODL_SYSTEM_9_IP} \
828 -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
829 -v OS_CONTROL_NODE_1_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
830 -v OS_CONTROL_NODE_2_IP:${OPENSTACK_CONTROL_NODE_2_IP} \
831 -v OS_CONTROL_NODE_3_IP:${OPENSTACK_CONTROL_NODE_3_IP} \
832 -v OPENSTACK_BRANCH:${OPENSTACK_BRANCH} \
833 -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} \
834 -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
835 -v OS_COMPUTE_3_IP:${OPENSTACK_COMPUTE_NODE_3_IP} \
836 -v OS_COMPUTE_4_IP:${OPENSTACK_COMPUTE_NODE_4_IP} \
837 -v OS_COMPUTE_5_IP:${OPENSTACK_COMPUTE_NODE_5_IP} \
838 -v OS_COMPUTE_6_IP:${OPENSTACK_COMPUTE_NODE_6_IP} \
840 -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
841 -v SECURITY_GROUP_MODE:${SECURITY_GROUP_MODE} \
842 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_1_IP} \
843 -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_1_IP} \
844 -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
845 -v USER_HOME:${HOME} \
847 ${TESTOPTIONS} ${SUITES} || true
849 echo "Examining the files in data/log and checking filesize"
850 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
851 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
853 echo "Tests Executed"
854 collect_logs_and_exit
856 true # perhaps Jenkins is testing last exit code
857 # vim: ts=4 sw=4 sts=4 et ft=sh :