2 # Activate robotframework virtualenv
3 # ${ROBOT_VENV} comes from the integration-install-robotframework.sh
5 # shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091
6 source ${ROBOT_VENV}/bin/activate
7 source /tmp/common-functions.sh ${BUNDLEFOLDER}
9 PYTHON="${ROBOT_VENV}/bin/python"
11 ADMIN_PASSWORD="admin"
12 OPENSTACK_MASTER_CLIENTS_VERSION="queens"
17 # TODO: remove this work to run changes.py if/when it's moved higher up to be visible at the Robot level
18 printf "\nshowing recent changes that made it into the distribution used by this job:\n"
19 $PYTHON -m pip install --upgrade urllib3
20 python ${WORKSPACE}/test/tools/distchanges/changes.py -d /tmp/distribution_folder \
21 -u ${ACTUAL_BUNDLE_URL} -b ${DISTROBRANCH} \
22 -r ssh://jenkins-${SILO}@git.opendaylight.org:29418 || true
24 printf "\nshowing recent changes that made it into integration/test used by this job:\n"
26 printf "Hash Author Date Commit Date Author Subject\n"
27 printf "%s\n" "------- ------------------------------ ------------------------------ -------------------- -----------------------------"
28 git --no-pager log --pretty=format:'%h %<(30)%ad %<(30)%cd %<(20,trunc)%an%d %s' -n20
33 #################################################
34 ## Deploy Openstack 3-node ##
35 #################################################
38 # Catch command errors and collect logs.
39 # This ensures logs are collected when script commands fail rather than simply exiting.
40 function trap_handler() {
44 echo "trap_hanlder: ${prog}: line ${lastline}: exit status of last command: ${lasterr}"
45 echo "trap_handler: command: ${BASH_COMMAND}"
49 trap 'trap_handler ${LINENO} ${$?}' ERR
51 function print_job_parameters() {
55 DISTROBRANCH: ${DISTROBRANCH}
56 DISTROSTREAM: ${DISTROSTREAM}
57 BUNDLE_URL: ${BUNDLE_URL}
58 CONTROLLERFEATURES: ${CONTROLLERFEATURES}
59 CONTROLLERDEBUGMAP: ${CONTROLLERDEBUGMAP}
60 SCRIPTPLAN: ${SCRIPTPLAN}
61 CONFIGPLAN: ${CONFIGPLAN}
62 STREAMTESTPLAN: ${STREAMTESTPLAN}
65 PATCHREFSPEC: ${PATCHREFSPEC}
66 OPENSTACK_BRANCH: ${OPENSTACK_BRANCH}
67 DEVSTACK_HASH: ${DEVSTACK_HASH}
68 ODL_ML2_DRIVER_REPO: ${ODL_ML2_DRIVER_REPO}
69 ODL_ML2_BRANCH: ${ODL_ML2_BRANCH}
70 ODL_ML2_DRIVER_VERSION: ${ODL_ML2_DRIVER_VERSION}
71 ODL_ML2_PORT_BINDING: ${ODL_ML2_PORT_BINDING}
72 DEVSTACK_KUBERNETES_PLUGIN_REPO: ${DEVSTACK_KUBERNETES_PLUGIN_REPO}
73 DEVSTACK_LBAAS_PLUGIN_REPO: ${DEVSTACK_LBAAS_PLUGIN_REPO}
74 DEVSTACK_NETWORKING_SFC_PLUGIN_REPO: ${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO}
75 ODL_ENABLE_L3_FWD: ${ODL_ENABLE_L3_FWD}
76 IPSEC_VXLAN_TUNNELS_ENABLED: ${IPSEC_VXLAN_TUNNELS_ENABLED}
77 PUBLIC_BRIDGE: ${PUBLIC_BRIDGE}
78 ENABLE_HAPROXY_FOR_NEUTRON: ${ENABLE_HAPROXY_FOR_NEUTRON}
79 ENABLE_OS_SERVICES: ${ENABLE_OS_SERVICES}
80 ENABLE_OS_COMPUTE_SERVICES: ${ENABLE_OS_COMPUTE_SERVICES}
81 ENABLE_OS_NETWORK_SERVICES: ${ENABLE_OS_NETWORK_SERVICES}
82 ENABLE_OS_PLUGINS: ${ENABLE_OS_PLUGINS}
83 DISABLE_OS_SERVICES: ${DISABLE_OS_SERVICES}
84 TENANT_NETWORK_TYPE: ${TENANT_NETWORK_TYPE}
85 SECURITY_GROUP_MODE: ${SECURITY_GROUP_MODE}
86 ENABLE_ITM_DIRECT_TUNNELS: ${ENABLE_ITM_DIRECT_TUNNELS}
87 PUBLIC_PHYSICAL_NETWORK: ${PUBLIC_PHYSICAL_NETWORK}
88 ENABLE_NETWORKING_L2GW: ${ENABLE_NETWORKING_L2GW}
89 CREATE_INITIAL_NETWORKS: ${CREATE_INITIAL_NETWORKS}
90 LBAAS_SERVICE_PROVIDER: ${LBAAS_SERVICE_PROVIDER}
91 NUM_OPENSTACK_SITES: ${NUM_OPENSTACK_SITES}
92 ODL_SFC_DRIVER: ${ODL_SFC_DRIVER}
93 ODL_SNAT_MODE: ${ODL_SNAT_MODE}
100 function create_etc_hosts() {
103 : > ${WORKSPACE}/hosts_file
104 for iter in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
106 COMPUTE_IP=OPENSTACK_COMPUTE_NODE_${iter}_IP
107 if [ "${!COMPUTE_IP}" == "${NODE_IP}" ]; then
108 CONTROL_HNAME=$(${SSH} ${CTRL_IP} "hostname")
109 echo "${CTRL_IP} ${CONTROL_HNAME}" >> ${WORKSPACE}/hosts_file
111 COMPUTE_HNAME=$(${SSH} ${!COMPUTE_IP} "hostname")
112 echo "${!COMPUTE_IP} ${COMPUTE_HNAME}" >> ${WORKSPACE}/hosts_file
116 echo "Created the hosts file for ${NODE_IP}:"
117 cat ${WORKSPACE}/hosts_file
118 } # create_etc_hosts()
120 #function to install Openstack Clients for Testing
121 #This will pull the latest versions compatiable with the
123 function install_openstack_clients_in_robot_vm() {
124 packages=("python-novaclient" "python-neutronclient" "python-openstackclient")
126 os_plugins=$(csv2ssv "${ENABLE_OS_PLUGINS}")
127 for plugin_name in $os_plugins; do
128 if [ "$plugin_name" == "networking-sfc" ]; then
129 packages+=("networking-sfc")
132 openstack_version=$(echo ${OPENSTACK_BRANCH} | cut -d/ -f2)
133 #If the job tests "master", we will use the clients from previous released stable version to avoid failures
134 if [ "${openstack_version}" == "master" ]; then
135 openstack_version=${OPENSTACK_MASTER_CLIENTS_VERSION}
137 for package in ${packages[*]}; do
138 echo "Get the current support version of the package ${package}"
139 wget https://raw.githubusercontent.com/openstack/requirements/stable/${openstack_version}/upper-constraints.txt -O /tmp/constraints.txt 2>/dev/null
140 echo "$PYTHON -m pip install --upgrade --no-deps ${package} --no-cache-dir -c /tmp/constraints.txt"
141 $PYTHON -m pip install --upgrade --no-deps ${package} --no-cache-dir -c /tmp/constraints.txt
142 echo "$PYTHON -m pip install ${package} --no-cache-dir -c /tmp/constraints.txt"
143 $PYTHON -m pip install ${package} --no-cache-dir -c /tmp/constraints.txt
146 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
147 #networking-l2gw is not officially available in any release yet. Gettting the latest stable version.
148 $PYTHON -m pip install networking-l2gw==11.0.0
152 function is_openstack_feature_enabled() {
154 for enabled_feature in $(csv2ssv ${ENABLE_OS_SERVICES})
156 if [ "${enabled_feature}" == "${feature}" ]; then
164 function fix_libvirt_version_n_cpu_pike() {
168 git clone https://git.openstack.org/openstack/requirements;
170 git checkout stable/pike;
171 sed -i s/libvirt-python===3.5.0/libvirt-python===4.2.0/ upper-constraints.txt
175 #Function to install rdo release
176 # This will help avoiding installing wrong version of packages which causes
177 # functionality failures
178 function install_rdo_release() {
180 case ${OPENSTACK_BRANCH} in
182 ${SSH} ${ip} "sudo yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-pike/rdo-release-pike-1.noarch.rpm"
186 ${SSH} ${ip} "sudo yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-queens/rdo-release-queens-1.noarch.rpm"
190 ${SSH} ${ip} "sudo yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-queens/rdo-release-queens-1.noarch.rpm"
195 # Involves just setting up the shared directory
196 function setup_live_migration_control() {
198 printf "${control_ip}:Setup directory Share with NFS"
199 cat > ${WORKSPACE}/setup_live_migration_control.sh << EOF
200 sudo mkdir --mode=777 /vm_instances
201 sudo chown -R jenkins:jenkins /vm_instances
202 sudo yum install -y nfs-utils
203 printf "/vm_instances *(rw,no_root_squash)" | sudo tee -a /etc/exports
204 sudo systemctl start rpcbind nfs-server
207 scp ${WORKSPACE}/setup_live_migration_control.sh ${control_ip}:/tmp/setup_live_migration_control.sh
208 ssh ${control_ip} "bash /tmp/setup_live_migration_control.sh"
211 # Involves mounting the share and configuring the libvirtd
212 function setup_live_migration_compute() {
215 printf "${compute_ip}:Mount Shared directory from ${control_ip}"
216 printf "${compute_ip}:Configure libvirt in listen mode"
217 cat > ${WORKSPACE}/setup_live_migration_compute.sh << EOF
218 sudo yum install -y libvirt libvirt-devel nfs-utils
219 sudo crudini --verbose --set --inplace /etc/libvirt/libvirtd.conf '' listen_tls 0
220 sudo crudini --verbose --set --inplace /etc/libvirt/libvirtd.conf '' listen_tcp 1
221 sudo crudini --verbose --set --inplace /etc/libvirt/libvirtd.conf '' auth_tcp '"none"'
222 sudo crudini --verbose --set --inplace /etc/sysconfig/libvirtd '' LIBVIRTD_ARGS '"--listen"'
223 sudo mkdir --mode=777 -p /var/instances
224 sudo chown -R jenkins:jenkins /var/instances
225 sudo chmod o+x /var/instances
226 sudo systemctl start rpcbind
227 sudo mount -t nfs ${control_ip}:/vm_instances /var/instances
230 scp ${WORKSPACE}/setup_live_migration_compute.sh ${compute_ip}:/tmp/setup_live_migration_compute.sh
231 ssh ${compute_ip} "bash /tmp/setup_live_migration_compute.sh"
234 # Add enable_services and disable_services to the local.conf
235 function add_os_services() {
236 local core_services=$1
237 local enable_services=$2
238 local disable_services=$3
239 local local_conf_file_name=$4
240 local enable_network_services=$5
242 cat >> ${local_conf_file_name} << EOF
243 enable_service $(csv2ssv "${core_services}")
245 if [ -n "${enable_services}" ]; then
246 cat >> ${local_conf_file_name} << EOF
247 enable_service $(csv2ssv "${enable_services}")
250 if [ -n "${disable_services}" ]; then
251 cat >> ${local_conf_file_name} << EOF
252 disable_service $(csv2ssv "${disable_services}")
255 if [ -n "${enable_network_services}" ]; then
256 cat >> ${local_conf_file_name} << EOF
257 enable_service $(csv2ssv "${enable_network_services}")
262 function create_control_node_local_conf() {
265 ODL_OVS_MANAGERS="$3"
267 local_conf_file_name=${WORKSPACE}/local.conf_control_${HOSTIP}
268 cat > ${local_conf_file_name} << EOF
274 # Increase the wait used by stack to poll for services
280 add_os_services "${CORE_OS_CONTROL_SERVICES}" "${ENABLE_OS_SERVICES}" "${DISABLE_OS_SERVICES}" "${local_conf_file_name}" "${ENABLE_OS_NETWORK_SERVICES}"
282 cat >> ${local_conf_file_name} << EOF
285 SERVICE_HOST=\$HOST_IP
286 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
287 NEUTRON_CREATE_INITIAL_NETWORKS=${CREATE_INITIAL_NETWORKS}
292 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
293 ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}
295 MYSQL_HOST=\$SERVICE_HOST
296 RABBIT_HOST=\$SERVICE_HOST
297 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
298 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
299 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
301 ADMIN_PASSWORD=${ADMIN_PASSWORD}
302 DATABASE_PASSWORD=${ADMIN_PASSWORD}
303 RABBIT_PASSWORD=${ADMIN_PASSWORD}
304 SERVICE_TOKEN=${ADMIN_PASSWORD}
305 SERVICE_PASSWORD=${ADMIN_PASSWORD}
307 NEUTRON_LBAAS_SERVICE_PROVIDERV2=${LBAAS_SERVICE_PROVIDER} # Only relevant if neutron-lbaas plugin is enabled
308 NEUTRON_SFC_DRIVERS=${ODL_SFC_DRIVER} # Only relevant if networking-sfc plugin is enabled
309 NEUTRON_FLOWCLASSIFIER_DRIVERS=${ODL_SFC_DRIVER} # Only relevant if networking-sfc plugin is enabled
312 if [ "${TENANT_NETWORK_TYPE}" == "local" ]; then
313 cat >> ${local_conf_file_name} << EOF
314 ENABLE_TENANT_TUNNELS=false
318 if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
319 echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
322 for plugin_name in ${ENABLE_OS_PLUGINS}; do
323 if [ "$plugin_name" == "networking-odl" ]; then
324 ENABLE_PLUGIN_ARGS="${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}"
325 elif [ "$plugin_name" == "kuryr-kubernetes" ]; then
326 ENABLE_PLUGIN_ARGS="${DEVSTACK_KUBERNETES_PLUGIN_REPO} master" # note: kuryr-kubernetes only exists in master at the moment
327 elif [ "$plugin_name" == "neutron-lbaas" ]; then
328 ENABLE_PLUGIN_ARGS="${DEVSTACK_LBAAS_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
329 IS_LBAAS_PLUGIN_ENABLED="yes"
330 elif [ "$plugin_name" == "networking-sfc" ]; then
331 ENABLE_PLUGIN_ARGS="${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO} master"
332 IS_SFC_PLUGIN_ENABLED="yes"
334 echo "Error: Invalid plugin $plugin_name, unsupported"
337 cat >> ${local_conf_file_name} << EOF
339 enable_plugin ${plugin_name} ${ENABLE_PLUGIN_ARGS}
344 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
345 cat >> ${local_conf_file_name} << EOF
347 enable_plugin networking-l2gw ${NETWORKING_L2GW_DRIVER} ${ODL_ML2_BRANCH}
348 NETWORKING_L2GW_SERVICE_DRIVER=L2GW:OpenDaylight:networking_odl.l2gateway.driver_v2.OpenDaylightL2gwDriver:default
352 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
353 cat >> ${local_conf_file_name} << EOF
355 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
356 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
357 ML2_VLAN_RANGES=${PUBLIC_PHYSICAL_NETWORK}
358 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
361 if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
362 SERVICE_PLUGINS="odl-router_v2"
364 SERVICE_PLUGINS="odl-router"
366 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
367 SERVICE_PLUGINS+=", networking_l2gw.services.l2gateway.plugin.L2GatewayPlugin"
369 if [ "${IS_LBAAS_PLUGIN_ENABLED}" == "yes" ]; then
370 SERVICE_PLUGINS+=", lbaasv2"
372 if [ "${IS_SFC_PLUGIN_ENABLED}" == "yes" ]; then
373 SERVICE_PLUGINS+=", networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin,networking_sfc.services.sfc.plugin.SfcPlugin"
375 fi #check for ODL_ENABLE_L3_FWD
377 cat >> ${local_conf_file_name} << EOF
379 [[post-config|\$NEUTRON_CONF]]
381 service_plugins = ${SERVICE_PLUGINS}
382 log_dir = /opt/stack/logs
384 [[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
386 minimize_polling=True
389 # Needed for VLAN provider tests - because our provider networks are always encapsulated in VXLAN (br-physnet1)
390 # MTU(1400) + VXLAN(50) + VLAN(4) = 1454 < MTU eth0/br-physnet1(1458)
391 physical_network_mtus = ${PUBLIC_PHYSICAL_NETWORK}:1400
395 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
396 cat >> ${local_conf_file_name} << EOF
399 enable_dhcp_service = True
403 cat >> ${local_conf_file_name} << EOF
406 # Trigger n-odl full sync every 30 secs.
407 maintenance_interval = 30
409 [[post-config|/etc/neutron/dhcp_agent.ini]]
411 force_metadata = True
412 enable_isolated_metadata = True
413 log_dir = /opt/stack/logs
415 [[post-config|/etc/nova/nova.conf]]
417 force_config_drive = False
418 force_raw_images = False
419 log_dir = /opt/stack/logs
422 discover_hosts_in_cells_interval = 30
425 echo "Control local.conf created:"
426 cat ${local_conf_file_name}
427 } # create_control_node_local_conf()
429 function create_compute_node_local_conf() {
433 ODL_OVS_MANAGERS="$4"
435 local_conf_file_name=${WORKSPACE}/local.conf_compute_${HOSTIP}
436 cat > ${local_conf_file_name} << EOF
442 # Increase the wait used by stack to poll for the nova service on the control node
443 NOVA_READY_TIMEOUT=1800
448 add_os_services "${CORE_OS_COMPUTE_SERVICES}" "${ENABLE_OS_COMPUTE_SERVICES}" "${DISABLE_OS_SERVICES}" "${local_conf_file_name}"
450 cat >> ${local_conf_file_name} << EOF
452 SERVICE_HOST=${SERVICEHOST}
453 Q_ML2_TENANT_NETWORK_TYPE=${TENANT_NETWORK_TYPE}
458 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
459 ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}
461 Q_HOST=\$SERVICE_HOST
462 MYSQL_HOST=\$SERVICE_HOST
463 RABBIT_HOST=\$SERVICE_HOST
464 GLANCE_HOSTPORT=\$SERVICE_HOST:9292
465 KEYSTONE_AUTH_HOST=\$SERVICE_HOST
466 KEYSTONE_SERVICE_HOST=\$SERVICE_HOST
468 ADMIN_PASSWORD=${ADMIN_PASSWORD}
469 DATABASE_PASSWORD=${ADMIN_PASSWORD}
470 RABBIT_PASSWORD=${ADMIN_PASSWORD}
471 SERVICE_TOKEN=${ADMIN_PASSWORD}
472 SERVICE_PASSWORD=${ADMIN_PASSWORD}
475 if [[ "${ENABLE_OS_PLUGINS}" =~ networking-odl ]]; then
476 cat >> ${local_conf_file_name} << EOF
478 enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}
482 if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
483 cat >> ${local_conf_file_name} << EOF
485 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
486 PUBLIC_PHYSICAL_NETWORK=${PUBLIC_PHYSICAL_NETWORK}
487 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
493 cat >> ${local_conf_file_name} << EOF
495 [[post-config|/etc/nova/nova.conf]]
497 auth_strategy = keystone
500 force_raw_images = False
501 log_dir = /opt/stack/logs
503 live_migration_uri = qemu+tcp://%s/system
507 echo "Compute local.conf created:"
508 cat ${local_conf_file_name}
509 } # create_compute_node_local_conf()
511 function configure_haproxy_for_neutron_requests() {
513 # shellcheck disable=SC2206
516 cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
517 sudo systemctl stop firewalld
518 sudo yum -y install policycoreutils-python haproxy
521 cat > ${WORKSPACE}/haproxy.cfg << EOF
527 pidfile /tmp/haproxy.pid
535 timeout http-request 10s
546 listen opendaylight_rest
550 listen opendaylight_websocket
557 for odlip in ${ODL_IPS[*]}; do
558 sed -i "/listen opendaylight$/a server controller-${odlindex} ${odlip}:8080 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
559 sed -i "/listen opendaylight_rest$/a server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
560 sed -i "/listen opendaylight_websocket$/a server controller-websocket-${odlindex} ${odlip}:8185 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
561 odlindex=$((odlindex+1))
565 echo "Dump haproxy.cfg"
566 cat ${WORKSPACE}/haproxy.cfg
568 cat > ${WORKSPACE}/deploy_ha_proxy.sh<< EOF
569 sudo chown haproxy:haproxy /tmp/haproxy.cfg
570 sudo sed -i 's/\\/etc\\/haproxy\\/haproxy.cfg/\\/tmp\\/haproxy.cfg/g' /usr/lib/systemd/system/haproxy.service
571 sudo /usr/sbin/semanage permissive -a haproxy_t
572 sudo systemctl restart haproxy
575 sudo systemctl status haproxy
579 scp ${WORKSPACE}/install_ha_proxy.sh ${MGRIP}:/tmp
580 ${SSH} ${MGRIP} "sudo bash /tmp/install_ha_proxy.sh"
581 scp ${WORKSPACE}/haproxy.cfg ${MGRIP}:/tmp
582 scp ${WORKSPACE}/deploy_ha_proxy.sh ${MGRIP}:/tmp
583 ${SSH} ${MGRIP} "sudo bash /tmp/deploy_ha_proxy.sh"
584 } # configure_haproxy_for_neutron_requests()
586 # Following three functions are debugging helpers when debugging devstack changes.
587 # Keeping them for now so we can simply call them when needed.
591 function get_hostnames () {
593 local ctrlip=${OPENSTACK_CONTROL_NODE_1_IP}
594 local comp1ip=${OPENSTACK_COMPUTE_NODE_1_IP}
595 local comp2ip=${OPENSTACK_COMPUTE_NODE_2_IP}
596 ctrlhn=$(${SSH} ${ctrlip} "hostname")
597 comp1hn=$(${SSH} ${comp1ip} "hostname")
598 comp2hn=$(${SSH} ${comp2ip} "hostname")
599 echo "hostnames: ${ctrlhn}, ${comp1hn}, ${comp2hn}"
603 function check_firewall() {
606 local ctrlip=${OPENSTACK_CONTROL_NODE_1_IP}
607 local comp1ip=${OPENSTACK_COMPUTE_NODE_1_IP}
608 local comp2ip=${OPENSTACK_COMPUTE_NODE_2_IP}
610 echo "check_firewall on control"
612 sudo systemctl status firewalld
613 sudo systemctl -l status iptables
614 sudo iptables --line-numbers -nvL
616 echo "check_firewall on compute 1"
618 sudo systemctl status firewalld
619 sudo systemctl -l status iptables
620 sudo iptables --line-numbers -nvL
622 echo "check_firewall on compute 2"
624 sudo systemctl status firewalld
625 sudo systemctl -l status iptables
626 sudo iptables --line-numbers -nvL
630 function get_service () {
634 local ctrlip=${OPENSTACK_CONTROL_NODE_1_IP}
635 local comp1ip=${OPENSTACK_COMPUTE_NODE_1_IP}
637 #if [ ${idx} -eq 1 ]; then
638 if [ ${iter} -eq 1 ] || [ ${iter} -gt 16 ]; then
639 curl http://${ctrlip}:5000
640 curl http://${ctrlip}:35357
641 curl http://${ctrlip}/identity
643 source /opt/stack/devstack/openrc admin admin;
645 openstack configuration show --unmask;
646 openstack service list
647 openstack --os-cloud devstack-admin --os-region RegionOne compute service list
648 openstack hypervisor list;
656 # Check if rabbitmq is ready by looking for a pid in it's status.
657 # The function returns the status of the grep command which callers can check.
658 function is_rabbitmq_ready() {
660 local grepfor="nova_cell1"
662 ${SSH} ${ip} "sudo rabbitmqctl list_vhosts" > rabbit.txt
663 grep ${grepfor} rabbit.txt
666 # retry the given command ($3) until success for a number of iterations ($1)
667 # sleeping ($2) between tries.
669 local -r -i max_tries=${1}
670 local -r -i sleep_time=${2}
675 echo "retry ${cmd}: attempt: ${retries}"
678 if ((${rc} == 0)); then
681 if ((${retries} == ${max_tries})); then
692 ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}"
697 # Always compare the lists below against the devstack upstream ENABLED_SERVICES in
698 # https://github.com/openstack-dev/devstack/blob/master/stackrc#L52
699 # ODL CSIT does not use vnc, cinder, q-agt, q-l3 or horizon so they are not included below.
700 # collect performance stats
701 CORE_OS_CONTROL_SERVICES="dstat"
703 CORE_OS_CONTROL_SERVICES+=",g-api,g-reg"
705 CORE_OS_CONTROL_SERVICES+=",key"
706 # Nova - services to support libvirt
707 CORE_OS_CONTROL_SERVICES+=",n-api,n-api-meta,n-cauth,n-cond,n-crt,n-obj,n-sch"
708 # ODL - services to connect to ODL
709 CORE_OS_CONTROL_SERVICES+=",odl-compute,odl-neutron"
710 # Additional services
711 CORE_OS_CONTROL_SERVICES+=",mysql,rabbit"
713 # collect performance stats
714 CORE_OS_COMPUTE_SERVICES="dstat"
715 # computes only need nova and odl
716 CORE_OS_COMPUTE_SERVICES+=",n-cpu,odl-compute"
718 cat > ${WORKSPACE}/disable_firewall.sh << EOF
719 sudo systemctl stop firewalld
720 # Open these ports to match the tutorial vms
721 # http/https (80/443), samba (445), netbios (137,138,139)
722 sudo iptables -I INPUT -p tcp -m multiport --dports 80,443,139,445 -j ACCEPT
723 sudo iptables -I INPUT -p udp -m multiport --dports 137,138 -j ACCEPT
724 # OpenStack services as well as vxlan tunnel ports 4789 and 9876
725 # identity public/admin (5000/35357), ampq (5672), vnc (6080), nova (8774), glance (9292), neutron (9696)
726 sudo sudo iptables -I INPUT -p tcp -m multiport --dports 5000,5672,6080,8774,9292,9696,35357 -j ACCEPT
727 sudo sudo iptables -I INPUT -p udp -m multiport --dports 4789,9876 -j ACCEPT
728 sudo iptables-save > /etc/sysconfig/iptables
729 sudo systemctl restart iptables
730 sudo iptables --line-numbers -nvL
734 cat > ${WORKSPACE}/get_devstack.sh << EOF
735 sudo systemctl stop firewalld
736 sudo yum install bridge-utils python-pip -y
737 #sudo systemctl stop NetworkManager
738 #Disable NetworkManager and kill dhclient and dnsmasq
739 sudo systemctl stop NetworkManager
740 sudo killall dhclient
742 #Workaround for mysql failure
743 echo "127.0.0.1 localhost \${HOSTNAME}" >> /tmp/hosts
744 echo "::1 localhost \${HOSTNAME}" >> /tmp/hosts
745 sudo mv /tmp/hosts /etc/hosts
746 sudo mkdir /opt/stack
747 echo "Create RAM disk for /opt/stack"
748 sudo mount -t tmpfs -o size=2G tmpfs /opt/stack
749 sudo chmod 777 /opt/stack
751 echo "git clone https://git.openstack.org/openstack-dev/devstack --branch ${OPENSTACK_BRANCH}"
752 git clone https://git.openstack.org/openstack-dev/devstack --branch ${OPENSTACK_BRANCH}
754 if [ -n "${DEVSTACK_HASH}" ]; then
755 echo "git checkout ${DEVSTACK_HASH}"
756 git checkout ${DEVSTACK_HASH}
758 git --no-pager log --pretty=format:'%h %<(13)%ar%<(13)%cr %<(20,trunc)%an%d %s%b' -n20
761 echo "workaround: do not upgrade openvswitch"
762 sudo yum install -y yum-plugin-versionlock
763 sudo yum versionlock add openvswitch
765 #Install qemu-img command in Control Node for Pike
766 echo "Install qemu-img application"
767 sudo yum install -y qemu-img
770 cat > "${WORKSPACE}/setup_host_cell_mapping.sh" << EOF
771 sudo nova-manage cell_v2 map_cell0
772 sudo nova-manage cell_v2 simple_cell_setup
773 sudo nova-manage db sync
774 sudo nova-manage cell_v2 discover_hosts
777 NUM_OPENSTACK_SITES=${NUM_OPENSTACK_SITES:-1}
781 os_interval=$(( ${NUM_OPENSTACK_SYSTEM} / ${NUM_OPENSTACK_SITES} ))
782 ha_proxy_index=${os_interval}
784 for i in `seq 1 ${NUM_OPENSTACK_SITES}`; do
785 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
786 echo "Configure HAProxy"
787 ODL_HAPROXYIP_PARAM=OPENSTACK_HAPROXY_${i}_IP
788 ha_proxy_index=$(( $ha_proxy_index + $os_interval ))
789 odl_index=$(((i - 1) * 3 + 1))
790 ODL_IP_PARAM1=ODL_SYSTEM_$((odl_index++))_IP
791 ODL_IP_PARAM2=ODL_SYSTEM_$((odl_index++))_IP
792 ODL_IP_PARAM3=ODL_SYSTEM_$((odl_index++))_IP
793 ODLMGRIP[$i]=${!ODL_HAPROXYIP_PARAM} # ODL Northbound uses HAProxy VIP
794 ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM1},${!ODL_IP_PARAM2},${!ODL_IP_PARAM3}" # OVSDB connects to all ODL IPs
795 configure_haproxy_for_neutron_requests ${!ODL_HAPROXYIP_PARAM} "${ODL_OVS_MGRS[$i]}"
797 ODL_IP_PARAM=ODL_SYSTEM_${i}_IP
798 ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM}" # ODL Northbound uses ODL IP
799 ODLMGRIP[$i]=${!ODL_IP_PARAM} # OVSDB connects to ODL IP
803 # Begin stacking the nodes, starting with the controller(s) and then the compute(s)
805 for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`; do
806 CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
807 echo "Configure the stack of the control node ${i} of ${NUM_OPENSTACK_CONTROL_NODES}: ${!CONTROLIP}"
808 scp ${WORKSPACE}/disable_firewall.sh ${!CONTROLIP}:/tmp
809 ${SSH} ${!CONTROLIP} "sudo bash /tmp/disable_firewall.sh"
810 create_etc_hosts ${!CONTROLIP}
811 scp ${WORKSPACE}/hosts_file ${!CONTROLIP}:/tmp/hosts
812 scp ${WORKSPACE}/get_devstack.sh ${!CONTROLIP}:/tmp
813 # devstack Master is yet to migrate fully to lib/neutron, there are some ugly hacks that is
814 # affecting the stacking.
815 # Workaround For Queens, Make the physical Network as physnet1 in lib/neutron
816 # In Queens the neutron new libs are used and do not have the following options from Pike and earlier:
817 # Q_ML2_PLUGIN_FLAT_TYPE_OPTIONS could be used for the flat_networks
818 # and Q_ML2_PLUGIN_VLAN_TYPE_OPTIONS could be used for the ml2_type_vlan
819 ${SSH} ${!CONTROLIP} "bash /tmp/get_devstack.sh > /tmp/get_devstack.sh.txt 2>&1"
820 if [ "${ODL_ML2_BRANCH}" == "stable/queens" ]; then
821 ssh ${!CONTROLIP} "sed -i 's/flat_networks public/flat_networks public,physnet1/' /opt/stack/devstack/lib/neutron"
822 ssh ${!CONTROLIP} "sed -i '186i iniset \$NEUTRON_CORE_PLUGIN_CONF ml2_type_vlan network_vlan_ranges public:1:4094,physnet1:1:4094' /opt/stack/devstack/lib/neutron"
824 create_control_node_local_conf ${!CONTROLIP} ${ODLMGRIP[$i]} "${ODL_OVS_MGRS[$i]}"
825 scp ${WORKSPACE}/local.conf_control_${!CONTROLIP} ${!CONTROLIP}:/opt/stack/devstack/local.conf
826 echo "Install rdo release to avoid incompatible Package versions"
827 install_rdo_release ${!CONTROLIP}
828 setup_live_migration_control ${!CONTROLIP}
829 echo "Stack the control node ${i} of ${NUM_OPENSTACK_CONTROL_NODES}: ${CONTROLIP}"
830 ssh ${!CONTROLIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
831 ssh ${!CONTROLIP} "ps -ef | grep stack.sh"
832 ssh ${!CONTROLIP} "ls -lrt /opt/stack/devstack/nohup.out"
833 os_node_list+=("${!CONTROLIP}")
836 # This is a backup to the CELLSV2_SETUP=singleconductor workaround. Keeping it here as an easy lookup
838 # Let the control node get started to avoid a race condition where the computes start and try to access
839 # the nova_cell1 on the control node before it is created. If that happens, the nova-compute service on the
840 # compute exits and does not attempt to restart.
841 # 180s is chosen because in test runs the control node usually finished in 17-20 minutes and the computes finished
842 # in 17 minutes, so take the max difference of 3 minutes and the jobs should still finish around the same time.
843 # one of the following errors is seen in the compute n-cpu.log:
844 # Unhandled error: NotAllowed: Connection.open: (530) NOT_ALLOWED - access to vhost 'nova_cell1' refused for user 'stackrabbit'
845 # AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.
846 # Compare that timestamp to this log in the control stack.log: sudo rabbitmqctl set_permissions -p nova_cell1 stackrabbit
847 # If the n-cpu.log is earlier than the control stack.log timestamp then the failure condition is likely hit.
848 if [ ${NUM_OPENSTACK_COMPUTE_NODES} -gt 0 ]; then
849 WAIT_FOR_RABBITMQ_MINUTES=60
850 echo "Wait a maximum of ${WAIT_FOR_RABBITMQ_MINUTES}m until rabbitmq is ready and nova_cell1 created to allow the controller to create nova_cell1 before the computes need it"
852 retry ${WAIT_FOR_RABBITMQ_MINUTES} 60 "is_rabbitmq_ready ${OPENSTACK_CONTROL_NODE_1_IP}"
855 if ((${rc} == 0)); then
856 echo "rabbitmq is ready, starting ${NUM_OPENSTACK_COMPUTE_NODES} compute(s)"
858 echo "rabbitmq was not ready in ${WAIT_FOR_RABBITMQ_MINUTES}m"
863 for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`; do
864 NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
865 SITE_INDEX=$((((i - 1) / NUM_COMPUTES_PER_SITE) + 1)) # We need the site index to infer the control node IP for this compute
866 COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
867 CONTROLIP=OPENSTACK_CONTROL_NODE_${SITE_INDEX}_IP
868 echo "Configure the stack of the compute node ${i} of ${NUM_OPENSTACK_COMPUTE_NODES}: ${!COMPUTEIP}"
869 scp ${WORKSPACE}/disable_firewall.sh "${!COMPUTEIP}:/tmp"
870 ${SSH} "${!COMPUTEIP}" "sudo bash /tmp/disable_firewall.sh"
871 create_etc_hosts ${!COMPUTEIP} ${!CONTROLIP}
872 scp ${WORKSPACE}/hosts_file ${!COMPUTEIP}:/tmp/hosts
873 scp ${WORKSPACE}/get_devstack.sh ${!COMPUTEIP}:/tmp
874 ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh > /tmp/get_devstack.sh.txt 2>&1"
875 if [ "${ODL_ML2_BRANCH}" == "stable/pike" ]; then
876 echo "Updating requirements for ${ODL_ML2_BRANCH}"
877 echo "Workaround for libvirt-python failing installation"
878 echo "Modify upper-constraints to use libvirt-python 4.2.0"
879 fix_libvirt_version_n_cpu_pike ${!COMPUTEIP}
881 create_compute_node_local_conf ${!COMPUTEIP} ${!CONTROLIP} ${ODLMGRIP[$SITE_INDEX]} "${ODL_OVS_MGRS[$SITE_INDEX]}"
882 scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
883 echo "Install rdo release to avoid incompatible Package versions"
884 install_rdo_release ${!COMPUTEIP}
885 setup_live_migration_compute ${!COMPUTEIP} ${!CONTROLIP}
886 echo "Stack the compute node ${i} of ${NUM_OPENSTACK_COMPUTE_NODES}: ${COMPUTEIP}"
887 ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
888 ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
889 os_node_list+=("${!COMPUTEIP}")
892 echo "nodelist: ${os_node_list[*]}"
894 # This script runs on the openstack nodes. It greps for a string that devstack writes when stacking is complete.
895 # The script then writes a status depending on the grep output that is later scraped by the robot vm to control
896 # the status polling.
897 cat > ${WORKSPACE}/check_stacking.sh << EOF
898 > /tmp/stack_progress
899 ps -ef | grep "stack.sh" | grep -v grep
901 if [ \${ret} -eq 1 ]; then
902 grep "This is your host IP address:" /opt/stack/devstack/nohup.out
903 if [ \$? -eq 0 ]; then
904 echo "Stacking Complete" > /tmp/stack_progress
906 echo "Stacking Failed" > /tmp/stack_progress
908 elif [ \${ret} -eq 0 ]; then
909 echo "Still Stacking" > /tmp/stack_progress
916 # Check if the stacking is finished. Poll all nodes every 60s for one hour.
919 while [ ${in_progress} -eq 1 ]; do
920 iteration=$(($iteration + 1))
921 for index in "${!os_node_list[@]}"; do
922 echo "node $index ${os_node_list[index]}: checking stacking status attempt ${iteration} of 60"
923 scp ${WORKSPACE}/check_stacking.sh ${os_node_list[index]}:/tmp
924 ${SSH} ${os_node_list[index]} "bash /tmp/check_stacking.sh"
925 scp ${os_node_list[index]}:/tmp/stack_progress .
927 stacking_status=`cat stack_progress`
929 # get_service "${iteration}" "${index}"
930 if [ "$stacking_status" == "Still Stacking" ]; then
932 elif [ "$stacking_status" == "Stacking Failed" ]; then
933 echo "node $index ${os_node_list[index]}: stacking has failed"
935 elif [ "$stacking_status" == "Stacking Complete" ]; then
936 echo "node $index ${os_node_list[index]}: stacking complete"
937 unset 'os_node_list[index]'
938 if [ ${#os_node_list[@]} -eq 0 ]; then
943 echo "sleep for a minute before the next check"
945 if [ ${iteration} -eq 60 ]; then
946 echo "stacking has failed - took longer than 60m"
951 # Further configuration now that stacking is complete.
952 NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
953 for i in `seq 1 ${NUM_OPENSTACK_SITES}`; do
954 echo "Configure the Control Node"
955 CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
956 # Gather Compute IPs for the site
957 for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`; do
958 COMPUTE_INDEX=$(((i-1) * NUM_COMPUTES_PER_SITE + j))
959 IP_VAR=OPENSTACK_COMPUTE_NODE_${COMPUTE_INDEX}_IP
960 COMPUTE_IPS[$((j-1))]=${!IP_VAR}
963 echo "sleep for 60s and print hypervisor-list"
965 ${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
966 # in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
967 # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
968 # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
969 # is one less than the total number of openstack systems
970 if [ $((NUM_OPENSTACK_SYSTEM / NUM_OPENSTACK_SITES)) -eq 1 ]; then
971 expected_num_hypervisors=1
973 expected_num_hypervisors=${NUM_COMPUTES_PER_SITE}
975 num_hypervisors=$(${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; openstack hypervisor list -f value | wc -l" | tail -1 | tr -d "\r")
976 if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
977 echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
981 # Gather Compute IPs for the site
982 for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`; do
983 COMPUTE_INDEX=$(((i-1) * NUM_COMPUTES_PER_SITE + j))
984 IP_VAR=OPENSTACK_COMPUTE_NODE_${COMPUTE_INDEX}_IP
985 COMPUTE_IPS[$((j-1))]=${!IP_VAR}
989 echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
990 # FIXME Should there be a unique gateway IP and devstack index for each site?
992 for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}; do
993 # 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
994 ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
995 ${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++))"
999 if [ "${IPSEC_VXLAN_TUNNELS_ENABLED}" == "yes" ]; then
1000 # shellcheck disable=SC2206
1001 ALL_NODES=(${!CONTROLIP} ${COMPUTE_IPS[*]})
1002 for ((inx_ip1=0; inx_ip1<$((${#ALL_NODES[@]} - 1)); inx_ip1++)); do
1003 for ((inx_ip2=$((inx_ip1 + 1)); inx_ip2<${#ALL_NODES[@]}; inx_ip2++)); do
1004 KEY1=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
1005 KEY2=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
1006 ID=0x$(dd if=/dev/urandom count=4 bs=1 2> /dev/null| xxd -p -c 8)
1007 ip1=${ALL_NODES[$inx_ip1]}
1008 ip2=${ALL_NODES[$inx_ip2]}
1009 ${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"
1010 ${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"
1011 ${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"
1012 ${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"
1014 ${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"
1015 ${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"
1016 ${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"
1017 ${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"
1021 for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}; do
1022 echo "ip xfrm configuration for node $ip:"
1023 ${SSH} $ip "sudo ip xfrm policy list"
1024 ${SSH} $ip "sudo ip xfrm state list"
1028 # Control Node - PUBLIC_BRIDGE will act as the external router
1029 # Parameter values below are used in integration/test - changing them requires updates in intergration/test as well
1030 EXTNET_GATEWAY_IP="10.10.10.250"
1031 EXTNET_INTERNET_IP="10.9.9.9"
1032 EXTNET_PNF_IP="10.10.10.253"
1033 ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE} up ${EXTNET_GATEWAY_IP}/24"
1035 # Control Node - external net PNF simulation
1036 ${SSH} ${!CONTROLIP} "
1037 sudo ip netns add pnf_ns;
1038 sudo ip link add pnf_veth0 type veth peer name pnf_veth1;
1039 sudo ip link set pnf_veth1 netns pnf_ns;
1040 sudo ip link set pnf_veth0 up;
1041 sudo ip netns exec pnf_ns ifconfig pnf_veth1 up ${EXTNET_PNF_IP}/24;
1042 sudo ovs-vsctl add-port ${PUBLIC_BRIDGE} pnf_veth0;
1045 # Control Node - external net internet address simulation
1046 ${SSH} ${!CONTROLIP} "
1047 sudo ip tuntap add dev internet_tap mode tap;
1048 sudo ifconfig internet_tap up ${EXTNET_INTERNET_IP}/24;
1053 for compute_ip in ${COMPUTE_IPS[*]}; do
1054 # Tunnel from controller to compute
1055 COMPUTEPORT=compute$(( compute_index++ ))_vxlan
1056 ${SSH} ${!CONTROLIP} "
1057 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
1059 # Tunnel from compute to controller
1060 CONTROLPORT="control_vxlan"
1061 ${SSH} $compute_ip "
1062 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
1067 if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
1068 odlmgrip=OPENSTACK_HAPROXY_1_IP
1069 HA_PROXY_IP=${!odlmgrip}
1070 HA_PROXY_1_IP=${!odlmgrip}
1071 odlmgrip2=OPENSTACK_HAPROXY_2_IP
1072 HA_PROXY_2_IP=${!odlmgrip2}
1073 odlmgrip3=OPENSTACK_HAPROXY_1_IP
1074 HA_PROXY_3_IP=${!odlmgrip3}
1076 HA_PROXY_IP=${ODL_SYSTEM_IP}
1077 HA_PROXY_1_IP=${ODL_SYSTEM_1_IP}
1078 HA_PROXY_2_IP=${ODL_SYSTEM_2_IP}
1079 HA_PROXY_3_IP=${ODL_SYSTEM_3_IP}
1082 echo "Locating test plan to use..."
1083 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
1084 if [ ! -f "${testplan_filepath}" ]; then
1085 testplan_filepath="${WORKSPACE}/test/csit/testplans/${TESTPLAN}"
1088 echo "Changing the testplan path..."
1089 cat "${testplan_filepath}" | sed "s:integration:${WORKSPACE}:" > testplan.txt
1092 # Use the testplan if specific SUITES are not defined.
1093 if [ -z "${SUITES}" ]; then
1094 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
1097 workpath="${WORKSPACE}/test/csit/suites"
1098 for suite in ${SUITES}; do
1099 fullsuite="${workpath}/${suite}"
1100 if [ -z "${newsuites}" ]; then
1101 newsuites+=${fullsuite}
1103 newsuites+=" "${fullsuite}
1109 #install all client versions required for this job testing
1110 install_openstack_clients_in_robot_vm
1112 # TODO: run openrc on control node and then scrape the vars from it
1113 # Environment Variables Needed to execute Openstack Client for NetVirt Jobs
1114 cat > /tmp/os_netvirt_client_rc << EOF
1115 export OS_USERNAME=admin
1116 export OS_PASSWORD=admin
1117 export OS_PROJECT_NAME=admin
1118 export OS_USER_DOMAIN_NAME=default
1119 export OS_PROJECT_DOMAIN_NAME=default
1120 export OS_AUTH_URL="http://${!CONTROLIP}/identity"
1121 export OS_IDENTITY_API_VERSION=3
1122 export OS_IMAGE_API_VERSION=2
1123 export OS_TENANT_NAME=admin
1127 source /tmp/os_netvirt_client_rc
1129 echo "Get all versions before executing pybot"
1130 echo "openstack --version"
1133 echo "nova --version"
1136 echo "neutron --version"
1140 echo "Starting Robot test suites ${SUITES} ..."
1141 # please add pybot -v arguments on a single line and alphabetized
1143 for suite in ${SUITES}; do
1144 # prepend an incremental counter to the suite name so that the full robot log combining all the suites as is done
1145 # in the rebot step below will list all the suites in chronological order as rebot seems to alphabetize them
1146 let "suite_num = suite_num + 1"
1147 suite_index="$(printf %02d ${suite_num})"
1148 suite_name="$(basename ${suite} | cut -d. -f1)"
1149 log_name="${suite_index}_${suite_name}"
1150 pybot -N ${log_name} \
1151 -c critical -e exclude -e skip_if_${DISTROSTREAM} \
1152 --log log_${log_name}.html --report None --output output_${log_name}.xml \
1153 --removekeywords wuks \
1154 --removekeywords name:SetupUtils.Setup_Utils_For_Setup_And_Teardown \
1155 --removekeywords name:SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing \
1156 --removekeywords name:OpenStackOperations.Add_OVS_Logging_On_All_OpenStack_Nodes \
1157 -v BUNDLEFOLDER:${BUNDLEFOLDER} \
1158 -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} \
1159 -v CONTROLLERFEATURES:"${CONTROLLERFEATURES}" \
1160 -v CONTROLLER_USER:${USER} \
1161 -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
1162 -v ENABLE_ITM_DIRECT_TUNNELS:${ENABLE_ITM_DIRECT_TUNNELS} \
1163 -v HA_PROXY_IP:${HA_PROXY_IP} \
1164 -v HA_PROXY_1_IP:${HA_PROXY_1_IP} \
1165 -v HA_PROXY_2_IP:${HA_PROXY_2_IP} \
1166 -v HA_PROXY_3_IP:${HA_PROXY_3_IP} \
1167 -v JDKVERSION:${JDKVERSION} \
1168 -v JENKINS_WORKSPACE:${WORKSPACE} \
1169 -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
1170 -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
1171 -v NUM_OPENSTACK_SITES:${NUM_OPENSTACK_SITES} \
1172 -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
1173 -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
1174 -v ODL_SNAT_MODE:${ODL_SNAT_MODE} \
1175 -v ODL_ENABLE_L3_FWD:${ODL_ENABLE_L3_FWD} \
1176 -v ODL_STREAM:${DISTROSTREAM} \
1177 -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
1178 -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} \
1179 -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
1180 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} \
1181 -v ODL_SYSTEM_4_IP:${ODL_SYSTEM_4_IP} \
1182 -v ODL_SYSTEM_5_IP:${ODL_SYSTEM_5_IP} \
1183 -v ODL_SYSTEM_6_IP:${ODL_SYSTEM_6_IP} \
1184 -v ODL_SYSTEM_7_IP:${ODL_SYSTEM_7_IP} \
1185 -v ODL_SYSTEM_8_IP:${ODL_SYSTEM_8_IP} \
1186 -v ODL_SYSTEM_9_IP:${ODL_SYSTEM_9_IP} \
1187 -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
1188 -v OS_CONTROL_NODE_1_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
1189 -v OS_CONTROL_NODE_2_IP:${OPENSTACK_CONTROL_NODE_2_IP} \
1190 -v OS_CONTROL_NODE_3_IP:${OPENSTACK_CONTROL_NODE_3_IP} \
1191 -v OPENSTACK_BRANCH:${OPENSTACK_BRANCH} \
1192 -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} \
1193 -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
1194 -v OS_COMPUTE_3_IP:${OPENSTACK_COMPUTE_NODE_3_IP} \
1195 -v OS_COMPUTE_4_IP:${OPENSTACK_COMPUTE_NODE_4_IP} \
1196 -v OS_COMPUTE_5_IP:${OPENSTACK_COMPUTE_NODE_5_IP} \
1197 -v OS_COMPUTE_6_IP:${OPENSTACK_COMPUTE_NODE_6_IP} \
1198 -v CMP_INSTANCES_SHARED_PATH:/var/instances \
1199 -v OS_USER:${USER} \
1200 -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
1201 -v SECURITY_GROUP_MODE:${SECURITY_GROUP_MODE} \
1202 -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_1_IP} \
1203 -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_1_IP} \
1204 -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
1205 -v USER_HOME:${HOME} \
1207 ${TESTOPTIONS} ${suite} || true
1209 #rebot exit codes seem to be different
1210 rebot --output ${WORKSPACE}/output.xml --log log_full.html --report None -N openstack output_*.xml || true
1212 echo "Examining the files in data/log and checking file size"
1213 ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
1214 ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
1216 echo "Tests Executed"
1218 true # perhaps Jenkins is testing last exit code
1219 # vim: ts=4 sw=4 sts=4 et ft=sh :