Merge "Make builder jobs use a machine with less RAM"
[releng/builder.git] / jjb / integration / include-raw-integration-deploy-openstack-run-test.sh
index 9d742f13e0382d3c4d6c9ad0003d7c8e994debed..5c057535ce893fc27dc24a993f97cb5286a046f4 100644 (file)
@@ -4,6 +4,13 @@
 # script.
 source ${ROBOT_VENV}/bin/activate
 
+# TODO: remove this work to run changes.py if/when it's moved higher up to be visible at the Robot level
+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} \
+                  -r ssh://jenkins-${SILO}@git.opendaylight.org:29418
+
 echo "#################################################"
 echo "##         Deploy Openstack 3-node             ##"
 echo "#################################################"
@@ -125,6 +132,7 @@ if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then
 cat >> ${local_conf_file_name} << EOF
 PUBLIC_BRIDGE=${PUBLIC_BRIDGE}
 PUBLIC_PHYSICAL_NETWORK=physnet1 # FIXME this should be a parameter
+ML2_VLAN_RANGES=physnet1
 ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS}
 
 disable_service q-l3
@@ -149,6 +157,11 @@ cat >> ${local_conf_file_name} << EOF
 [agent]
 minimize_polling=True
 
+[ml2]
+# 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-phynset1(1500)
+physical_network_mtus = physnet1:1440
+
 [[post-config|/etc/neutron/dhcp_agent.ini]]
 [DEFAULT]
 force_metadata = True
@@ -302,6 +315,20 @@ cat >> ${WORKSPACE}/haproxy.cfg << EOF
 EOF
 done
 
+cat >> ${WORKSPACE}/haproxy.cfg << EOF
+listen opendaylight_rest
+  bind ${ha_proxy_ip}:8181
+  balance source
+EOF
+
+for i in `seq 1 ${NUM_ODL_SYSTEM}`
+do
+odlip=ODL_SYSTEM_${i}_IP
+cat >> ${WORKSPACE}/haproxy.cfg << EOF
+  server controller-rest-$i ${!odlip}:8181 check fall 5 inter 2000 rise 2
+EOF
+done
+
 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
@@ -507,6 +534,21 @@ ${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))`
@@ -554,6 +596,13 @@ do
     ${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"
 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}
+else
+  HA_PROXY_IP=${ODL_SYSTEM_IP}
+fi
 echo "Locating test plan to use..."
 testplan_filepath="${WORKSPACE}/test/csit/testplans/${STREAMTESTPLAN}"
 if [ ! -f "${testplan_filepath}" ]; then
@@ -573,6 +622,7 @@ pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude -v BUNDLEFOLDE
 -v ODL_SYSTEM_3_IP:${ODL_SYSTEM_3_IP} -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} -v CONTROLLER_USER:${USER} -v OS_USER:${USER} \
 -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} -v OS_CONTROL_NODE_IP:${OPENSTACK_CONTROL_NODE_IP} \
 -v OS_COMPUTE_1_IP:${OPENSTACK_COMPUTE_NODE_1_IP} -v OS_COMPUTE_2_IP:${OPENSTACK_COMPUTE_NODE_2_IP} \
+-v HA_PROXY_IP:${HA_PROXY_IP} \
 -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
 
 echo "Tests Executed"