Merge "Add OpenStack Ocata runs for netvirt"
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-openstack-run-test.sh
index a273ac5b317cd6c2585a84d01f0f88b1efd0735c..a3a38778e844138469ffce1eb164b7aa7282c312 100644 (file)
@@ -8,7 +8,7 @@ source ${ROBOT_VENV}/bin/activate
 echo "showing recent changes that made it in to the distribution used by this job"
 pip install --upgrade urllib3
 python ${WORKSPACE}/test/tools/distchanges/changes.py -d /tmp/distribution_folder \
-                  -u ${ACTUALBUNDLEURL} -b ${DISTROBRANCH} \
+                  -u ${ACTUAL_BUNDLE_URL} -b ${DISTROBRANCH} \
                   -r ssh://jenkins-${SILO}@git.opendaylight.org:29418 || true
 
 echo "#################################################"
@@ -19,13 +19,16 @@ echo "#################################################"
 SSH="ssh -t -t"
 
 function create_control_node_local_conf {
-local_conf_file_name=${WORKSPACE}/local.conf_control
+HOSTIP=$1
+MGRIP=$2
+ODL_OVS_MANAGERS="$3"
 #Needs to be removed
 if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
    RECLONE=no
 else
    RECLONE=yes
 fi
+local_conf_file_name=${WORKSPACE}/local.conf_control_${HOSTIP}
 cat > ${local_conf_file_name} << EOF
 [[local|localrc]]
 LOGFILE=stack.sh.log
@@ -55,6 +58,8 @@ elif [ "$plugin_name" == "kuryr-kubernetes" ]; then
     ENABLE_PLUGIN_ARGS="${DEVSTACK_KUBERNETES_PLUGIN_REPO} master" # note: kuryr-kubernetes only exists in master at the moment
 elif [ "$plugin_name" == "neutron-lbaas" ]; then
     ENABLE_PLUGIN_ARGS="${DEVSTACK_LBAAS_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
+elif [ "$plugin_name" == "networking-sfc" ]; then
+    ENABLE_PLUGIN_ARGS="${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
 else
     echo "Error: Invalid plugin $plugin_name, unsupported"
     continue
@@ -70,7 +75,7 @@ if [ "${OPENSTACK_BRANCH}" == "master" ] || [ "${OPENSTACK_BRANCH}" == "stable/o
     echo "enable_service placement-api" >> ${local_conf_file_name}
 fi
 cat >> ${local_conf_file_name} << EOF
-HOST_IP=$OPENSTACK_CONTROL_NODE_IP
+HOST_IP=${HOSTIP}
 SERVICE_HOST=\$HOST_IP
 
 NEUTRON_CREATE_INITIAL_NETWORKS=${CREATE_INITIAL_NETWORKS}
@@ -97,8 +102,11 @@ ODL_MODE=externalodl
 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
 
 LIBVIRT_TYPE=qemu
+ODL_MGR_IP=${MGRIP}
 
 NEUTRON_LBAAS_SERVICE_PROVIDERV2=${LBAAS_SERVICE_PROVIDER} # Only relevant if neutron-lbaas plugin is enabled
+NEUTRON_SFC_DRIVERS=${ODL_SFC_DRIVER} # Only relevant if networking-sfc plugin is enabled
+NEUTRON_FLOWCLASSIFIER_DRIVERS=${ODL_SFC_DRIVER} # Only relevant if networking-sfc plugin is enabled
 EOF
 
 if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
@@ -115,37 +123,15 @@ if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
     echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
 fi
 
-if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
-odl_list=${ODL_SYSTEM_1_IP}
-for i in `seq 2 ${NUM_ODL_SYSTEM}`
-do
-odlip=ODL_SYSTEM_${i}_IP
-odl_list=${odl_list},${!odlip}
-done
-if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
-HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
-odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
-odl_mgr_ip=${!odlmgrip}
-else
-odl_mgr_ip=${ODL_SYSTEM_1_IP}
-fi
-cat >> ${local_conf_file_name} << EOF
-ODL_OVS_MANAGERS=${odl_list}
-ODL_MGR_IP=${odl_mgr_ip}
-EOF
-else
-cat >> ${local_conf_file_name} << EOF
-ODL_MGR_IP=${ODL_SYSTEM_1_IP}
-EOF
-fi
+echo "ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}" >> ${local_conf_file_name}
 
 # if we are using the old netvirt impl, as determined by the feature name
 # odl-ovsdb-openstack (note: new impl is odl-netvirt-openstack) then we
 # want ODL_L3 to be True.  New impl wants it False
 if [[ ${CONTROLLERFEATURES} == *"odl-ovsdb-openstack"* ]]; then
-  ODL_L3=True
+    ODL_L3=True
 else
-  ODL_L3=False
+    ODL_L3=False
 fi
 
 # if we are using the new netvirt impl, as determined by the feature name
@@ -169,18 +155,20 @@ disable_service q-l3
 PUBLIC_INTERFACE=br100
 EOF
 
-if [ -z ${DISABLE_ODL_L3_PLUGIN} ] || [ "${DISABLE_ODL_L3_PLUGIN}" == "no" ]; then
-if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
+if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
 cat >> ${local_conf_file_name} << EOF
-Q_L3_ENABLED=True
-ODL_L3=${ODL_L3}
 [[post-config|\$NEUTRON_CONF]]
 [DEFAULT]
-service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin
+service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin, networking_l2gw.services.l2gateway.plugin.L2GatewayPlugin
 
 EOF
-fi #check for ODL_ML2_BRANCH
-fi #check for DISABLE_ODL_L3_PLUGIN
+else
+cat >> ${local_conf_file_name} << EOF
+[[post-config|\$NEUTRON_CONF]]
+[DEFAULT]
+service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin
+EOF
+fi #check for ENABLE_NETWORKING_L2GW
 
 fi #ODL_ENABLE_L3_FWD check
 
@@ -190,8 +178,8 @@ cat >> ${local_conf_file_name} << EOF
 minimize_polling=True
 
 [ml2]
-# Needed for VLAN provider tests - because our provider networks are always encapsulated in VXLAN (br-phys1)
-# MTU(1440) + VXLAN(50) + VLAN(4) = 1494 < MTU eth0/br-phys1(1500)
+# Needed for VLAN provider tests - because our provider networks are always encapsulated in VXLAN (br-physnet1)
+# MTU(1440) + VXLAN(50) + VLAN(4) = 1494 < MTU eth0/br-physnet1(1500)
 physical_network_mtus = ${PUBLIC_PHYSICAL_NETWORK}:1440
 path_mtu = 1490
 
@@ -212,6 +200,9 @@ cat ${local_conf_file_name}
 
 function create_compute_node_local_conf {
 HOSTIP=$1
+SERVICEHOST=$2
+MGRIP=$3
+ODL_OVS_MANAGERS="$4"
 #Needs to be removed
 if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
    RECLONE=no
@@ -237,7 +228,7 @@ NOVA_VNC_ENABLED=True
 MULTI_HOST=1
 ENABLED_SERVICES=${ENABLED_SERVICES}
 HOST_IP=${HOSTIP}
-SERVICE_HOST=${OPENSTACK_CONTROL_NODE_IP}
+SERVICE_HOST=${SERVICEHOST}
 
 Q_PLUGIN=ml2
 ENABLE_TENANT_TUNNELS=True
@@ -259,6 +250,7 @@ ADMIN_PASSWORD=admin
 ODL_MODE=compute
 ODL_PORT_BINDING_CONTROLLER=${ODL_ML2_PORT_BINDING}
 LIBVIRT_TYPE=qemu
+ODL_MGR_IP=${MGRIP}
 EOF
 
 if [[ "${ENABLE_OS_PLUGINS}" =~ networking-odl ]]; then
@@ -267,29 +259,7 @@ enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH}
 EOF
 fi
 
-if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
-odl_list=${ODL_SYSTEM_1_IP}
-for i in `seq 2 ${NUM_ODL_SYSTEM}`
-do
-odlip=ODL_SYSTEM_${i}_IP
-odl_list=${odl_list},${!odlip}
-done
-if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
-HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
-odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
-odl_mgr_ip=${!odlmgrip}
-else
-odl_mgr_ip=${ODL_SYSTEM_1_IP}
-fi
-cat >> ${local_conf_file_name} << EOF
-ODL_OVS_MANAGERS=${odl_list}
-ODL_MGR_IP=${odl_mgr_ip}
-EOF
-else
-cat >> ${local_conf_file_name} << EOF
-ODL_MGR_IP=${ODL_SYSTEM_1_IP}
-EOF
-fi
+echo "ODL_OVS_MANAGERS=${ODL_OVS_MANAGERS}" >> ${local_conf_file_name}
 
 # if we are using the new netvirt impl, as determined by the feature name
 # odl-netvirt-openstack (note: old impl is odl-ovsdb-openstack) then we
@@ -317,9 +287,8 @@ cat ${local_conf_file_name}
 }
 
 function configure_haproxy_for_neutron_requests () {
-HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
-odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
-ha_proxy_ip=${!odlmgrip}
+MGRIP=$1
+ODL_IPS=(${2//,/ })
 
 cat > ${WORKSPACE}/install_ha_proxy.sh<< EOF
 sudo systemctl stop firewalld
@@ -348,32 +317,37 @@ defaults
   timeout  check 10s
 
 listen opendaylight
-  bind ${ha_proxy_ip}:8080
+  bind ${MGRIP}:8080
   balance source
 EOF
 
-for i in `seq 1 ${NUM_ODL_SYSTEM}`
+odlindex=1
+for odlip in ${ODL_IPS[*]}
 do
-odlip=ODL_SYSTEM_${i}_IP
 cat >> ${WORKSPACE}/haproxy.cfg << EOF
-  server controller-$i ${!odlip}:8080 check fall 5 inter 2000 rise 2
+  server controller-${odlindex} ${odlip}:8080 check fall 5 inter 2000 rise 2
 EOF
+odlindex=$((odlindex+1))
 done
 
 cat >> ${WORKSPACE}/haproxy.cfg << EOF
 listen opendaylight_rest
-  bind ${ha_proxy_ip}:8181
+  bind ${MGRIP}:8181
   balance source
 EOF
 
-for i in `seq 1 ${NUM_ODL_SYSTEM}`
+odlindex=1
+for odlip in ${ODL_IPS[*]}
 do
-odlip=ODL_SYSTEM_${i}_IP
 cat >> ${WORKSPACE}/haproxy.cfg << EOF
-  server controller-rest-$i ${!odlip}:8181 check fall 5 inter 2000 rise 2
+  server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2
 EOF
+odlindex=$((odlindex+1))
 done
 
+echo "Dump haproxy.cfg"
+cat ${WORKSPACE}/haproxy.cfg
+
 cat > ${WORKSPACE}/deploy_ha_proxy.sh<< EOF
 sudo chown haproxy:haproxy /tmp/haproxy.cfg
 sudo sed -i 's/\\/etc\\/haproxy\\/haproxy.cfg/\\/tmp\\/haproxy.cfg/g' /usr/lib/systemd/system/haproxy.service
@@ -384,18 +358,21 @@ sudo netstat -tunpl
 sudo systemctl status haproxy
 true
 EOF
-scp ${WORKSPACE}/install_ha_proxy.sh ${ha_proxy_ip}:/tmp
-${SSH} ${ha_proxy_ip} "sudo bash /tmp/install_ha_proxy.sh"
-scp ${WORKSPACE}/haproxy.cfg ${ha_proxy_ip}:/tmp
-scp ${WORKSPACE}/deploy_ha_proxy.sh ${ha_proxy_ip}:/tmp
-${SSH} ${ha_proxy_ip} "sudo bash /tmp/deploy_ha_proxy.sh"
+scp ${WORKSPACE}/install_ha_proxy.sh ${MGRIP}:/tmp
+${SSH} ${MGRIP} "sudo bash /tmp/install_ha_proxy.sh"
+scp ${WORKSPACE}/haproxy.cfg ${MGRIP}:/tmp
+scp ${WORKSPACE}/deploy_ha_proxy.sh ${MGRIP}:/tmp
+${SSH} ${MGRIP} "sudo bash /tmp/deploy_ha_proxy.sh"
 }
 
-function collect_logs_and_exit (){
+function collect_logs_and_exit () {
 set +e  # We do not want to create red dot just because something went wrong while fetching logs.
 for i in `seq 1 ${NUM_ODL_SYSTEM}`
 do
     CONTROLLERIP=ODL_SYSTEM_${i}_IP
+    echo "Lets's take the karaf thread dump again..."
+    KARAF_PID=$(ssh ${!CONTROLLERIP} "ps aux | grep ${KARAF_ARTIFACT} | grep -v grep | tr -s ' ' | cut -f2 -d' '")
+    ssh ${!CONTROLLERIP} "jstack $KARAF_PID"> ${WORKSPACE}/karaf_${i}_threads_after.log || true
     echo "killing karaf process..."
     ${SSH} "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh'
 done
@@ -415,6 +392,8 @@ do
     ${SSH} "${!CONTROLLERIP}"  "cp -r /tmp/${BUNDLEFOLDER}/data/log /tmp/odl_log"
     ${SSH} "${!CONTROLLERIP}"  "tar -cf /tmp/odl${i}_karaf.log.tar /tmp/odl_log/*"
     scp "${!CONTROLLERIP}:/tmp/odl${i}_karaf.log.tar" "${WORKSPACE}/odl${i}_karaf.log.tar"
+    ${SSH} "${!CONTROLLERIP}"  "tar -cf /tmp/odl${i}_zrpcd.log.tar /tmp/zrpcd.init.log"
+    scp "${!CONTROLLERIP}:/tmp/odl${i}_zrpcd.log.tar" "${WORKSPACE}/odl${i}_zrpcd.log.tar"
     tar -xvf ${WORKSPACE}/odl${i}_karaf.log.tar -C . --strip-components 2 --transform s/karaf/odl${i}_karaf/g
     grep "ROBOT MESSAGE\| ERROR " odl${i}_karaf.log > odl${i}_err.log
     grep "ROBOT MESSAGE\|Exception" odl${i}_karaf.log > odl${i}_exception.log
@@ -428,20 +407,26 @@ done
 mkdir -p ${WORKSPACE}/archives
 
 # Control Node
-OS_CTRL_FOLDER="control"
-mkdir -p ${OS_CTRL_FOLDER}
-scp ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/nohup.out ${OS_CTRL_FOLDER}/stack.log
-scp ${OPENSTACK_CONTROL_NODE_IP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_CTRL_FOLDER}/ovs-vswitchd.log
-scp ${OPENSTACK_CONTROL_NODE_IP}:/etc/neutron/neutron.conf ${OS_CTRL_FOLDER}/neutron.conf
-rsync -avhe ssh ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/logs/* ${OS_CTRL_FOLDER} # rsync to prevent copying of symbolic links
-scp extra_debug.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
-scp ${OPENSTACK_CONTROL_NODE_IP}:/tmp/extra_debug.log ${OS_CTRL_FOLDER}/extra_debug.log
-mv local.conf_control ${OS_CTRL_FOLDER}/local.conf
-mv ${OS_CTRL_FOLDER} ${WORKSPACE}/archives/
+for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`
+do
+    OS_CTRL_IP=OPENSTACK_CONTROL_NODE_${i}_IP
+    OS_CTRL_FOLDER="control_${i}"
+    mkdir -p ${OS_CTRL_FOLDER}
+    scp ${!OS_CTRL_IP}:/opt/stack/devstack/nohup.out ${OS_CTRL_FOLDER}/stack.log
+    scp ${!OS_CTRL_IP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_CTRL_FOLDER}/ovs-vswitchd.log
+    scp ${!OS_CTRL_IP}:/etc/neutron/neutron.conf ${OS_CTRL_FOLDER}/neutron.conf
+    scp ${!OS_CTRL_IP}:/etc/nova/nova.conf ${OS_CTRL_FOLDER}/nova.conf
+    rsync -avhe ssh ${!OS_CTRL_IP}:/opt/stack/logs/* ${OS_CTRL_FOLDER} # rsync to prevent copying of symbolic links
+    scp extra_debug.sh ${!OS_CTRL_IP}:/tmp
+    ${SSH} ${!OS_CTRL_IP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
+    scp ${!OS_CTRL_IP}:/tmp/extra_debug.log ${OS_CTRL_FOLDER}/extra_debug.log
+    scp ${!OS_CTRL_IP}:/tmp/*.xz ${OS_CTRL_FOLDER}/
+    mv local.conf_control_${!OS_CTRL_IP} ${OS_CTRL_FOLDER}/local.conf
+    mv ${OS_CTRL_FOLDER} ${WORKSPACE}/archives/
+done
 
 # Compute Nodes
-for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
+for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
 do
     OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
     OS_COMPUTE_FOLDER="compute_${i}"
@@ -453,6 +438,7 @@ do
     scp extra_debug.sh ${!OSIP}:/tmp
     ${SSH} ${!OSIP} "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
     scp ${!OSIP}:/tmp/extra_debug.log ${OS_COMPUTE_FOLDER}/extra_debug.log
+    scp ${!OSIP}:/tmp/*.xz ${OS_COMPUTE_FOLDER}/
     mv local.conf_compute_${!OSIP} ${OS_COMPUTE_FOLDER}/local.conf
     mv ${OS_COMPUTE_FOLDER} ${WORKSPACE}/archives/
 done
@@ -461,13 +447,13 @@ ls local.conf* | xargs -I % mv % %.log
 
 # Tempest
 DEVSTACK_TEMPEST_DIR="/opt/stack/tempest"
-if $(ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 ]'"); then # if Tempest results exist
-    ssh ${OPENSTACK_CONTROL_NODE_IP} "for I in \$(sudo ls ${DEVSTACK_TEMPEST_DIR}/.testrepository/ | grep -E '^[0-9]+$'); do sudo sh -c \"${DEVSTACK_TEMPEST_DIR}/.tox/tempest/bin/subunit-1to2 < ${DEVSTACK_TEMPEST_DIR}/.testrepository/\${I} >> ${DEVSTACK_TEMPEST_DIR}/subunit_log.txt\"; done"
-    ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo sh -c '${DEVSTACK_TEMPEST_DIR}/.tox/tempest/bin/python ${DEVSTACK_TEMPEST_DIR}/.tox/tempest/lib/python2.7/site-packages/os_testr/subunit2html.py ${DEVSTACK_TEMPEST_DIR}/subunit_log.txt ${DEVSTACK_TEMPEST_DIR}/tempest_results.html'"
+if $(ssh ${OPENSTACK_CONTROL_NODE_1_IP} "sudo sh -c '[ -f ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 ]'"); then # if Tempest results exist
+    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"
+    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'"
     TEMPEST_LOGS_DIR=${WORKSPACE}/archives/tempest
     mkdir -p ${TEMPEST_LOGS_DIR}
-    scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${TEMPEST_LOGS_DIR}
-    scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest.log ${TEMPEST_LOGS_DIR}
+    scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${TEMPEST_LOGS_DIR}
+    scp ${OPENSTACK_CONTROL_NODE_1_IP}:${DEVSTACK_TEMPEST_DIR}/tempest.log ${TEMPEST_LOGS_DIR}
     mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
 fi
 }
@@ -500,18 +486,19 @@ cd devstack
 git checkout $OPENSTACK_BRANCH
 EOF
 
-echo "Create HAProxy if needed"
-if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
- echo "Need to configure HAProxy"
- configure_haproxy_for_neutron_requests
-fi
+cat > "${WORKSPACE}/setup_host_cell_mapping.sh" << EOF
+sudo nova-manage cell_v2 map_cell0
+sudo nova-manage cell_v2 simple_cell_setup
+sudo nova-manage db sync
+sudo nova-manage cell_v2 discover_hosts
+EOF
 
+[ "$NUM_OPENSTACK_SITES" ] || NUM_OPENSTACK_SITES=1
+compute_index=1
+odl_index=1
 os_node_list=()
-echo "Stack the Control Node"
-scp ${WORKSPACE}/get_devstack.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "bash /tmp/get_devstack.sh"
-create_control_node_local_conf
-scp ${WORKSPACE}/local.conf_control ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/local.conf
+os_interval=$(( ${NUM_OPENSTACK_SYSTEM} / ${NUM_OPENSTACK_SITES} ))
+ha_proxy_index=${os_interval}
 
 cat > "${WORKSPACE}/manual_install_package.sh" << EOF
 cd /opt/stack
@@ -519,52 +506,66 @@ git clone "\$1"
 cd "\$2"
 git checkout "\$3"
 sudo python setup.py install
-
 EOF
 
+for i in `seq 1 ${NUM_OPENSTACK_SITES}`
+do
+    if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
+        echo "Configure HAProxy"
+        ODL_HAPROXYIP_PARAM=OPENSTACK_HAPROXY_${i}_IP
+        ha_proxy_index=$(( $ha_proxy_index + $os_interval ))
+        odl_index=$(((i - 1) * 3 + 1))
+        ODL_IP_PARAM1=ODL_SYSTEM_$((odl_index++))_IP
+        ODL_IP_PARAM2=ODL_SYSTEM_$((odl_index++))_IP
+        ODL_IP_PARAM3=ODL_SYSTEM_$((odl_index++))_IP
+        ODLMGRIP[$i]=${!ODL_HAPROXYIP_PARAM} # ODL Northbound uses HAProxy VIP
+        ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM1},${!ODL_IP_PARAM2},${!ODL_IP_PARAM3}" # OVSDB connects to all ODL IPs
+
+        configure_haproxy_for_neutron_requests ${!ODL_HAPROXYIP_PARAM} "${ODL_OVS_MGRS[$i]}"
+    else
+        ODL_IP_PARAM=ODL_SYSTEM_${i}_IP
+        ODL_OVS_MGRS[$i]="${!ODL_IP_PARAM}" # ODL Northbound uses ODL IP
+        ODLMGRIP[$i]=${!ODL_IP_PARAM} # OVSDB connects to ODL IP
+    fi
+done
 
-# Workworund for successful stacking with  Mitaka
-if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
-
-  # Workaround for problems with latest versions/specified versions in requirements of openstack
-  # Openstacksdk,libvirt-python -> the current version does not work with  Mitaka diue to some requirements
-  # conflict and breaks when trying to stack
-  # paramiko -> Problems with tempest tests due to paramiko incompatibility with pycrypto.
-  # the problem has been solved with  version 1.17. If the latest version of paramiko is used, it causes
-  # other timeout problems
-  ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://git.openstack.org/openstack/requirements; cd requirements; git checkout stable/mitaka; sed -i /openstacksdk/d upper-constraints.txt; sed -i /libvirt-python/d upper-constraints.txt; sed -i /paramiko/d upper-constraints.txt"
-  scp "${WORKSPACE}/manual_install_package.sh"  "${OPENSTACK_CONTROL_NODE_IP}:/tmp"
-  ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install deprecation"
-  # Fix for recent requirements update  in the  master branch of the sdk.The section must be replaced with a better fix.
-  ssh "${OPENSTACK_CONTROL_NODE_IP}" "sh /tmp/manual_install_package.sh https://github.com/openstack/python-openstacksdk python-openstacksdk 0.9.14"
-  ssh "${OPENSTACK_CONTROL_NODE_IP}" "sh /tmp/manual_install_package.sh https://github.com/paramiko/paramiko paramiko 1.17"
-fi
-
-ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
-ssh ${OPENSTACK_CONTROL_NODE_IP} "ps -ef | grep stack.sh"
-ssh ${OPENSTACK_CONTROL_NODE_IP} "ls -lrt /opt/stack/devstack/nohup.out"
-os_node_list+=(${OPENSTACK_CONTROL_NODE_IP})
-
-#Workaround for stable/newton jobs
-if [ "${ODL_ML2_BRANCH}" == "stable/newton" ]; then
-  ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://git.openstack.org/openstack/requirements; cd requirements; git checkout stable/newton; sed -i /appdirs/d upper-constraints.txt"
-fi
+for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`
+do
+    echo "Stack the Control Node"
+    CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
+    scp ${WORKSPACE}/get_devstack.sh ${!CONTROLIP}:/tmp
+    ${SSH} ${!CONTROLIP} "bash /tmp/get_devstack.sh"
+    create_control_node_local_conf ${!CONTROLIP} ${ODLMGRIP[$i]} "${ODL_OVS_MGRS[$i]}"
+    scp ${WORKSPACE}/local.conf_control_${!CONTROLIP} ${!CONTROLIP}:/opt/stack/devstack/local.conf
+    ssh ${!CONTROLIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
+    ssh ${!CONTROLIP} "ps -ef | grep stack.sh"
+    ssh ${!CONTROLIP} "ls -lrt /opt/stack/devstack/nohup.out"
+    os_node_list+=(${!CONTROLIP})
+
+    #Workaround for stable/newton jobs
+    if [ "${ODL_ML2_BRANCH}" == "stable/newton" ]; then
+        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"
+    fi
+done
 
-for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
+for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`
 do
+    echo "Stack the Compute Node"
+    NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
+    SITE_INDEX=$((((i - 1) / NUM_COMPUTES_PER_SITE) + 1)) # We need the site index to infer the control node IP for this compute
     COMPUTEIP=OPENSTACK_COMPUTE_NODE_${i}_IP
+    CONTROLIP=OPENSTACK_CONTROL_NODE_${SITE_INDEX}_IP
     scp ${WORKSPACE}/get_devstack.sh  ${!COMPUTEIP}:/tmp
     ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh"
-    create_compute_node_local_conf ${!COMPUTEIP}
+    create_compute_node_local_conf ${!COMPUTEIP} ${!CONTROLIP} ${ODLMGRIP[$SITE_INDEX]} "${ODL_OVS_MGRS[$SITE_INDEX]}"
     scp ${WORKSPACE}/local.conf_compute_${!COMPUTEIP} ${!COMPUTEIP}:/opt/stack/devstack/local.conf
-    if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then
-       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"
-    fi
     ssh ${!COMPUTEIP} "cd /opt/stack/devstack; nohup ./stack.sh > /opt/stack/devstack/nohup.out 2>&1 &"
     ssh ${!COMPUTEIP} "ps -ef | grep stack.sh"
     os_node_list+=(${!COMPUTEIP})
 done
 
+echo ${os_node_list[*]}
+
 cat > ${WORKSPACE}/check_stacking.sh << EOF
 > /tmp/stack_progress
 ps -ef | grep "stack.sh" | grep -v grep
@@ -615,84 +616,161 @@ done
  fi
 done
 
-#Need to disable firewalld and iptables in control node
-echo "Stop Firewall in Control Node for compute nodes to be able to reach the ports and add to hypervisor-list"
-scp ${WORKSPACE}/disable_firewall.sh ${OPENSTACK_CONTROL_NODE_IP}:/tmp
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo bash /tmp/disable_firewall.sh"
-echo "sleep for a minute and print hypervisor-list"
-sleep 60
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
-# in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
-# will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
-# assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
-# is one less than the total number of openstack systems
-if [ "${NUM_OPENSTACK_SYSTEM}" -eq 1 ]; then
-  expected_num_hypervisors=1
-else
-  expected_num_hypervisors=$((NUM_OPENSTACK_SYSTEM - 1))
-fi
-num_hypervisors=$(${SSH} ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; source openrc admin admin; openstack hypervisor list -f value | wc -l" | tail -1 | tr -d "\r")
-if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
-  echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
-  collect_logs_and_exit
-  exit 1
-fi
-
-#Need to disable firewalld and iptables in compute nodes as well
-for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
-do
-    OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
-    scp ${WORKSPACE}/disable_firewall.sh "${!OSIP}:/tmp"
-    ${SSH} "${!OSIP}" "sudo bash /tmp/disable_firewall.sh"
-done
-
-# upgrading pip, urllib3 and httplib2 so that tempest tests can be run on ${OPENSTACK_CONTROL_NODE_IP}
-# this needs to happen after devstack runs because it seems devstack is pulling in specific versions
-# of these libs that are not working for tempest.
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install --upgrade pip"
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install urllib3 --upgrade"
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install httplib2 --upgrade"
-
-for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
+NUM_COMPUTES_PER_SITE=$((NUM_OPENSTACK_COMPUTE_NODES / NUM_OPENSTACK_SITES))
+for i in `seq 1 ${NUM_OPENSTACK_SITES}`
 do
-    IP_VAR=OPENSTACK_COMPUTE_NODE_${i}_IP
-    COMPUTE_IPS[$((i-1))]=${!IP_VAR}
-done
+    echo "Configure the Control Node"
+    CONTROLIP=OPENSTACK_CONTROL_NODE_${i}_IP
+
+    #Need to disable firewalld and iptables in control node
+    echo "Stop Firewall in Control Node for compute nodes to be able to reach the ports and add to hypervisor-list"
+    scp ${WORKSPACE}/disable_firewall.sh ${!CONTROLIP}:/tmp
+    ${SSH} ${!CONTROLIP} "sudo bash /tmp/disable_firewall.sh"
+
+    echo "sleep for 60s and print hypervisor-list"
+    sleep 60
+    ${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list"
+    # in the case that we are doing openstack (control + compute) all in one node, then the number of hypervisors
+    # will be the same as the number of openstack systems. However, if we are doing multinode openstack then the
+    # assumption is we have a single control node and the rest are compute nodes, so the number of expected hypervisors
+    # is one less than the total number of openstack systems
+    if [ $((NUM_OPENSTACK_SYSTEM / NUM_OPENSTACK_SITES)) -eq 1 ]; then
+        expected_num_hypervisors=1
+    else
+        expected_num_hypervisors=${NUM_COMPUTES_PER_SITE}
+    fi
+    num_hypervisors=$(${SSH} ${!CONTROLIP} "cd /opt/stack/devstack; source openrc admin admin; openstack hypervisor list -f value | wc -l" | tail -1 | tr -d "\r")
+    if ! [ "${num_hypervisors}" ] || ! [ ${num_hypervisors} -eq ${expected_num_hypervisors} ]; then
+        echo "Error: Only $num_hypervisors hypervisors detected, expected $expected_num_hypervisors"
+        collect_logs_and_exit
+        exit 1
+    fi
 
-# External Network
-echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
-devstack_index=1
-for ip in ${OPENSTACK_CONTROL_NODE_IP} ${COMPUTE_IPS[*]}
-do
-    # 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
-    ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
-    ${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++))"
-done
+    # For Ocata, if we do not enable the n-cpu in control node
+    # We need to discover hosts manually and ensure that they are mapped to cells.
+    # reference: https://ask.openstack.org/en/question/102256/how-to-configure-placement-service-for-compute-node-on-ocata/
+    if [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then
+        scp ${WORKSPACE}/setup_host_cell_mapping.sh  ${!CONTROLIP}:/tmp
+        ${SSH} ${!CONTROLIP} "sudo bash /tmp/setup_host_cell_mapping.sh"
+    fi
 
-# Control Node - PUBLIC_BRIDGE will act as the external router
-GATEWAY_IP="10.10.10.250" # FIXME this should be a parameter, also shared with integration-test
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ip link add link ${PUBLIC_BRIDGE} name  ${PUBLIC_BRIDGE}.167 type vlan id 167"
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ifconfig  ${PUBLIC_BRIDGE} up"
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ifconfig   ${PUBLIC_BRIDGE}.167 up ${GATEWAY_IP}/24"
-compute_index=1
-for compute_ip in ${COMPUTE_IPS[*]}
-do
-    # Tunnel from controller to compute
-    PORT_NAME=compute$((compute_index++))_vxlan
-    ${SSH} ${OPENSTACK_CONTROL_NODE_IP} "sudo ovs-vsctl add-port $PUBLIC_BRIDGE $PORT_NAME -- set interface $PORT_NAME type=vxlan options:local_ip="${OPENSTACK_CONTROL_NODE_IP}" options:remote_ip="$compute_ip" options:dst_port=9876 options:key=flow"
+    # upgrading pip, urllib3 and httplib2 so that tempest tests can be run on openstack control node
+    # this needs to happen after devstack runs because it seems devstack is pulling in specific versions
+    # of these libs that are not working for tempest.
+    ${SSH} ${!CONTROLIP} "sudo pip install --upgrade pip"
+    ${SSH} ${!CONTROLIP} "sudo pip install urllib3 --upgrade"
+    ${SSH} ${!CONTROLIP} "sudo pip install httplib2 --upgrade"
+
+    # Gather Compute IPs for the site
+    for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`
+    do
+        COMPUTE_INDEX=$(((i-1) * NUM_COMPUTES_PER_SITE + j))
+        IP_VAR=OPENSTACK_COMPUTE_NODE_${COMPUTE_INDEX}_IP
+        COMPUTE_IPS[$((j-1))]=${!IP_VAR}
+    done
+
+    # Need to disable firewalld and iptables in compute nodes as well
+    for ip in ${COMPUTE_IPS[*]}
+    do
+        scp ${WORKSPACE}/disable_firewall.sh "${ip}:/tmp"
+        ${SSH} "${ip}" "sudo bash /tmp/disable_firewall.sh"
+    done
+
+    # External Network
+    echo "prepare external networks by adding vxlan tunnels between all nodes on a separate bridge..."
+    # FIXME Should there be a unique gateway IP and devstack index for each site?
+    devstack_index=1
+    for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}
+    do
+        # 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
+        ${SSH} $ip "sudo ovs-vsctl --if-exists del-port br-int $PUBLIC_BRIDGE"
+        ${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++))"
+    done
+
+    # ipsec support
+    if [ "${IPSEC_VXLAN_TUNNELS_ENABLED}" == "yes" ]; then
+        ALL_NODES=(${!CONTROLIP} ${COMPUTE_IPS[*]})
+        for ((inx_ip1=0; inx_ip1<$((${#ALL_NODES[@]} - 1)); inx_ip1++))
+        do
+            for ((inx_ip2=$((inx_ip1 + 1)); inx_ip2<${#ALL_NODES[@]}; inx_ip2++))
+            do
+                KEY1=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
+                KEY2=0x$(dd if=/dev/urandom count=32 bs=1 2> /dev/null| xxd -p -c 64)
+                ID=0x$(dd if=/dev/urandom count=4 bs=1 2> /dev/null| xxd -p -c 8)
+                ip1=${ALL_NODES[$inx_ip1]}
+                ip2=${ALL_NODES[$inx_ip2]}
+                ${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"
+                ${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"
+                ${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"
+                ${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"
+
+                ${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"
+                ${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"
+                ${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"
+                ${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"
+            done
+        done
+
+        for ip in ${!CONTROLIP} ${COMPUTE_IPS[*]}
+        do
+            echo "ip xfrm configuration for node $ip:"
+            ${SSH} $ip "sudo ip xfrm policy list"
+            ${SSH} $ip "sudo ip xfrm state list"
+        done
+    fi
 
-    # Tunnel from compute to controller
-    PORT_NAME=control_vxlan
-    ${SSH} ${compute_ip} "sudo ovs-vsctl add-port $PUBLIC_BRIDGE $PORT_NAME -- set interface $PORT_NAME type=vxlan options:local_ip="$compute_ip" options:remote_ip="${OPENSTACK_CONTROL_NODE_IP}" options:dst_port=9876 options:key=flow"
+    # Control Node - PUBLIC_BRIDGE will act as the external router
+    # Parameter values below are used in integration/test - changing them requires updates in intergration/test as well
+    EXTNET_GATEWAY_IP="10.10.10.250"
+    EXTNET_VLAN_ID=167
+    EXTNET_INTERNET_IP="10.9.9.9"
+    EXTNET_PNF_IP="10.10.10.253"
+    ${SSH} ${!CONTROLIP} "sudo ifconfig ${PUBLIC_BRIDGE} up ${EXTNET_GATEWAY_IP}/24"
+
+    # Control Node - external net PNF simulation
+    ${SSH} ${!CONTROLIP} "
+        sudo ip netns add pnf_ns;
+        sudo ip link add pnf_veth0 type veth peer name pnf_veth1;
+        sudo ip link set pnf_veth1 netns pnf_ns;
+        sudo ip link set pnf_veth0 up;
+        sudo ip netns exec pnf_ns ifconfig pnf_veth1 up ${EXTNET_PNF_IP}/24;
+        sudo ovs-vsctl add-port ${PUBLIC_BRIDGE} pnf_veth0;
+    "
+
+    # Control Node - external net internet address simulation
+    ${SSH} ${!CONTROLIP} "
+        sudo ip tuntap add dev internet_tap mode tap;
+        sudo ifconfig internet_tap up ${EXTNET_INTERNET_IP}/24;
+    "
+
+    # Computes
+    compute_index=1
+    for compute_ip in ${COMPUTE_IPS[*]}
+    do
+        # Tunnel from controller to compute
+        COMPUTEPORT=compute$(( compute_index++ ))_vxlan
+        ${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"
+        # Tunnel from compute to controller
+        CONTROLPORT="control_vxlan"
+        ${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"
+    done
 done
 
-if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then
-  HA_PROXY_INDEX=${NUM_OPENSTACK_SYSTEM}
-  odlmgrip=OPENSTACK_COMPUTE_NODE_${HA_PROXY_INDEX}_IP
-  HA_PROXY_IP=${!odlmgrip}
+if [ "${ENABLE_HAPROXY_FOR_NEUTRON}" == "yes" ]; then
+    odlmgrip=OPENSTACK_HAPROXY_1_IP
+    HA_PROXY_IP=${!odlmgrip}
+    HA_PROXY_1_IP=${!odlmgrip}
+    odlmgrip2=OPENSTACK_HAPROXY_2_IP
+    HA_PROXY_2_IP=${!odlmgrip2}
+    odlmgrip3=OPENSTACK_HAPROXY_1_IP
+    HA_PROXY_3_IP=${!odlmgrip3}
 else
-  HA_PROXY_IP=${ODL_SYSTEM_IP}
+    HA_PROXY_IP=${ODL_SYSTEM_IP}
+    HA_PROXY_1_IP=${ODL_SYSTEM_1_IP}
+    HA_PROXY_2_IP=${ODL_SYSTEM_2_IP}
+    HA_PROXY_3_IP=${ODL_SYSTEM_3_IP}
 fi
+
 echo "Locating test plan to use..."
 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
 if [ ! -f "${testplan_filepath}" ]; then
@@ -705,28 +783,47 @@ cat testplan.txt
 
 SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
 
+#FIXME currently support only 1 site
 echo "Starting Robot test suites ${SUITES} ..."
 # please add pybot -v arguments on a single line and alphabetized
 pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude \
     -v BUNDLEFOLDER:${BUNDLEFOLDER} \
-    -v BUNDLE_URL:${ACTUALBUNDLEURL} \
+    -v BUNDLE_URL:${ACTUAL_BUNDLE_URL} \
     -v CONTROLLER_USER:${USER} \
     -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
     -v HA_PROXY_IP:${HA_PROXY_IP} \
+    -v HA_PROXY_1_IP:${HA_PROXY_1_IP} \
+    -v HA_PROXY_2_IP:${HA_PROXY_2_IP} \
+    -v HA_PROXY_3_IP:${HA_PROXY_3_IP} \
     -v JDKVERSION:${JDKVERSION} \
     -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
     -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
+    -v NUM_OPENSTACK_SITES:${NUM_OPENSTACK_SITES} \
     -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
     -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
+    -v ODL_SNAT_MODE:${ODL_SNAT_MODE} \
     -v ODL_STREAM:${DISTROSTREAM} \
     -v ODL_SYSTEM_IP:${ODL_SYSTEM_IP} \
     -v ODL_SYSTEM_1_IP:${ODL_SYSTEM_1_IP} \
     -v ODL_SYSTEM_2_IP:${ODL_SYSTEM_2_IP} \
     -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} \
-    -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_IP} \
+    -v ODL_SYSTEM_4_IP:${ODL_SYSTEM_4_IP} \
+    -v ODL_SYSTEM_5_IP:${ODL_SYSTEM_5_IP} \
+    -v ODL_SYSTEM_6_IP:${ODL_SYSTEM_6_IP} \
+    -v ODL_SYSTEM_7_IP:${ODL_SYSTEM_7_IP} \
+    -v ODL_SYSTEM_8_IP:${ODL_SYSTEM_8_IP} \
+    -v ODL_SYSTEM_9_IP:${ODL_SYSTEM_9_IP} \
+    -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
+    -v OS_CONTROL_NODE_1_IP:${OPENSTACK_CONTROL_NODE_1_IP} \
+    -v OS_CONTROL_NODE_2_IP:${OPENSTACK_CONTROL_NODE_2_IP} \
+    -v OS_CONTROL_NODE_3_IP:${OPENSTACK_CONTROL_NODE_3_IP} \
     -v OPENSTACK_BRANCH:${OPENSTACK_BRANCH} \
     -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} \
     -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
+    -v OS_COMPUTE_3_IP:${OPENSTACK_COMPUTE_NODE_3_IP} \
+    -v OS_COMPUTE_4_IP:${OPENSTACK_COMPUTE_NODE_4_IP} \
+    -v OS_COMPUTE_5_IP:${OPENSTACK_COMPUTE_NODE_5_IP} \
+    -v OS_COMPUTE_6_IP:${OPENSTACK_COMPUTE_NODE_6_IP} \
     -v OS_USER:${USER} \
     -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
     -v SECURITY_GROUP_MODE:${SECURITY_GROUP_MODE} \