# 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} -b ${BRANCH} \
+ -r ssh://jenkins-${SILO}@git.opendaylight.org:29418 || true
+
echo "#################################################"
echo "## Deploy Openstack 3-node ##"
echo "#################################################"
SSH="ssh -t -t"
+
function create_control_node_local_conf {
local_conf_file_name=${WORKSPACE}/local.conf_control
+#Needs to be removed
+if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
+ RECLONE=no
+else
+ RECLONE=yes
+fi
cat > ${local_conf_file_name} << EOF
[[local|localrc]]
LOGFILE=stack.sh.log
SCREEN_LOGDIR=/opt/stack/data/log
LOG_COLOR=False
-RECLONE=yes
+RECLONE=${RECLONE}
EOF
IFS=,
EOF
+if [ "${ENABLE_NETWORKING_L2GW}" == "yes" ]; then
+cat >> ${local_conf_file_name} << EOF
+
+enable_plugin networking-l2gw ${NETWORKING_L2GW_DRIVER} ${ODL_ML2_BRANCH}
+NETWORKING_L2GW_SERVICE_DRIVER=L2GW:OpenDaylight:networking_odl.l2gateway.driver.OpenDaylightL2gwDriver:default
+ENABLED_SERVICES+=,neutron,q-svc,nova,q-meta
+
+EOF
+fi
+
if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
fi
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
-Q_L3_ENABLED=True
-ODL_L3=${ODL_L3}
PUBLIC_INTERFACE=br100
EOF
+if [ -z ${DISABLE_ODL_L3_PLUGIN} ] || [ "${DISABLE_ODL_L3_PLUGIN}" == "no" ]; then
if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; 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
EOF
fi #check for ODL_ML2_BRANCH
+fi #check for DISABLE_ODL_L3_PLUGIN
fi #ODL_ENABLE_L3_FWD check
[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
function create_compute_node_local_conf {
HOSTIP=$1
+#Needs to be removed
+if [ "${ODL_ML2_BRANCH}" != "stable/ocata" ]; then
+ RECLONE=no
+else
+ RECLONE=yes
+fi
local_conf_file_name=${WORKSPACE}/local.conf_compute_${HOSTIP}
cat > ${local_conf_file_name} << EOF
[[local|localrc]]
LOGFILE=stack.sh.log
LOG_COLOR=False
SCREEN_LOGDIR=/opt/stack/data/log
-RECLONE=yes
+RECLONE=${RECLONE}
NOVA_VNC_ENABLED=True
MULTI_HOST=1
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
${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"
tar -xvf ${WORKSPACE}/odl${i}_karaf.log.tar -C . --strip-components 2 --transform s/karaf/odl${i}_karaf/g
+ grep "ROBOT MESSAGE\| ERROR " odl1_karaf.log > odl${i}_err.log
+ grep "ROBOT MESSAGE\| ERROR \| WARN " odl1_karaf.log > odl${i}_err_warn.log
rm ${WORKSPACE}/odl${i}_karaf.log.tar
done
-scp ${OPENSTACK_CONTROL_NODE_IP}:/opt/stack/devstack/nohup.out "openstack_control_stack.log"
-${SSH} ${OPENSTACK_CONTROL_NODE_IP} "tar -cf /tmp/control_node_openstack_logs.tgz /opt/stack/logs/*"
-scp "${OPENSTACK_CONTROL_NODE_IP}:/tmp/control_node_openstack_logs.tgz" control_node_openstack_logs.tgz
-scp ${OPENSTACK_CONTROL_NODE_IP}:/var/log/openvswitch/ovs-vswitchd.log "ovs-vswitchd_control.log"
-rm control_ovs-vswitchd.log
+# Since this log collection work is happening before the archive build macro which also
+# creates the ${WORKSPACE}/archives dir, we have to do it here first. The mkdir in the
+# archives build step will essentially be a noop.
+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
+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" extra_debug_control.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/
+
+# Compute Nodes
for i in `seq 1 $((NUM_OPENSTACK_SYSTEM - 1))`
do
OSIP=OPENSTACK_COMPUTE_NODE_${i}_IP
- scp "${!OSIP}:/opt/stack/devstack/nohup.out" "openstack_compute_stack_${i}.log"
- ${SSH} "${!OSIP}" "tar -cf /tmp/compute_node_${i}_openstack_logs.tgz /opt/stack/logs/*"
- scp "${!OSIP}:/tmp/compute_node_${i}_openstack_logs.tgz" "compute_node_${i}_openstack_logs.tgz"
- scp "${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log" "ovs-vswitchd_compute_${i}.log"
- rm compute_${1}_ovs-vswitchd.log
- scp "extra_debug.sh" "${!OSIP}:/tmp"
- ${SSH} "${!OSIP}" "bash /tmp/extra_debug.sh > /tmp/extra_debug.log"
- scp "${!OSIP}:/tmp/extra_debug.log" "extra_debug_compute_${i}.log"
+ OS_COMPUTE_FOLDER="compute_${i}"
+ mkdir -p ${OS_COMPUTE_FOLDER}
+ scp ${!OSIP}:/opt/stack/devstack/nohup.out ${OS_COMPUTE_FOLDER}/stack.log
+ scp ${!OSIP}:/var/log/openvswitch/ovs-vswitchd.log ${OS_COMPUTE_FOLDER}/ovs-vswitchd.log
+ rsync -avhe ssh ${!OSIP}:/opt/stack/logs/* ${OS_COMPUTE_FOLDER} # rsync to prevent copying of symbolic links
+ 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
+ mv local.conf_compute_${!OSIP} ${OS_COMPUTE_FOLDER}/local.conf
+ mv ${OS_COMPUTE_FOLDER} ${WORKSPACE}/archives/
done
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'"
+ 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}
+ mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
+fi
}
cat > ${WORKSPACE}/disable_firewall.sh << EOF
echo "::1 localhost \${HOSTNAME}" >> /tmp/hosts
sudo mv /tmp/hosts /etc/hosts
sudo /usr/sbin/brctl addbr br100
-#sudo ifconfig eth0 mtu 2000
+#sudo ifconfig eth0 mtu 2000
sudo mkdir /opt/stack
sudo chmod 777 /opt/stack
cd /opt/stack
${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
+
+
+# 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"
+ ssh ${OPENSTACK_CONTROL_NODE_IP} "sudo pip install deprecation"
+ ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://github.com/openstack/python-openstacksdk; cd python-openstacksdk; sudo python setup.py install"
+ ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://github.com/paramiko/paramiko; cd paramiko; git checkout 1.17; sudo python setup.py install"
+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_SYSTEM - 1))`
do
${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh"
create_compute_node_local_conf ${!COMPUTEIP}
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})
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))`
${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
SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '`
echo "Starting Robot test suites ${SUITES} ..."
-pybot -N ${TESTPLAN} --removekeywords wuks -c critical -e exclude -v BUNDLEFOLDER:${BUNDLEFOLDER} -v WORKSPACE:/tmp \
--v BUNDLE_URL:${ACTUALBUNDLEURL} -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} -v JDKVERSION:${JDKVERSION} -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 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 DEVSTACK_DEPLOY_PATH:/opt/stack/devstack -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true
+# 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 CONTROLLER_USER:${USER} \
+ -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack \
+ -v HA_PROXY_IP:${HA_PROXY_IP} \
+ -v JDKVERSION:${JDKVERSION} \
+ -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
+ -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
+ -v NUM_OS_SYSTEM:${NUM_OPENSTACK_SYSTEM} \
+ -v NUM_TOOLS_SYSTEM:${NUM_TOOLS_SYSTEM} \
+ -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 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_USER:${USER} \
+ -v PUBLIC_PHYSICAL_NETWORK:${PUBLIC_PHYSICAL_NETWORK} \
+ -v TOOLS_SYSTEM_IP:${TOOLS_SYSTEM_1_IP} \
+ -v TOOLS_SYSTEM_1_IP:${TOOLS_SYSTEM_1_IP} \
+ -v TOOLS_SYSTEM_2_IP:${TOOLS_SYSTEM_2_IP} \
+ -v USER_HOME:${HOME} \
+ -v WORKSPACE:/tmp \
+ ${TESTOPTIONS} ${SUITES} || true
+
+echo "Examining the files in data/log and checking filesize"
+ssh ${ODL_SYSTEM_IP} "ls -altr /tmp/${BUNDLEFOLDER}/data/log/"
+ssh ${ODL_SYSTEM_IP} "du -hs /tmp/${BUNDLEFOLDER}/data/log/*"
echo "Tests Executed"
-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} "sudo sh -c '${DEVSTACK_TEMPEST_DIR}/.tox/tempest/bin/subunit-1to2 < ${DEVSTACK_TEMPEST_DIR}/.testrepository/0 > ${DEVSTACK_TEMPEST_DIR}/subunit_log.txt'"
- 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'"
- scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${WORKSPACE}/
-fi
collect_logs_and_exit
true # perhaps Jenkins is testing last exit code