X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fintegration%2Finclude-raw-integration-deploy-openstack-run-test.sh;h=38c520b1559895568dac083955fedae097300150;hb=7885c1966559e25710ecbd0ab477e96514c9b208;hp=ea00cfc4e8a8aceea48c5f82523d12c8ee2a646f;hpb=0b92ff6fac73f8132e037e2ff83525690ebed02a;p=releng%2Fbuilder.git diff --git a/jjb/integration/include-raw-integration-deploy-openstack-run-test.sh b/jjb/integration/include-raw-integration-deploy-openstack-run-test.sh index ea00cfc4e..38c520b15 100644 --- a/jjb/integration/include-raw-integration-deploy-openstack-run-test.sh +++ b/jjb/integration/include-raw-integration-deploy-openstack-run-test.sh @@ -10,14 +10,21 @@ 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/mitaka" ]; 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=, @@ -58,7 +65,7 @@ SERVICE_TOKEN=service SERVICE_PASSWORD=admin ADMIN_PASSWORD=admin -enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_VERSION} +enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH} ODL_PORT=8080 ODL_MODE=externalodl @@ -66,6 +73,11 @@ LIBVIRT_TYPE=qemu EOF + +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}` @@ -99,22 +111,39 @@ else ODL_L3=False fi +# 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 +# want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support +# external networks in legacy netvirt +if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then + ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}" +else + ODL_PROVIDER_MAPPINGS= +fi + if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then cat >> ${local_conf_file_name} << EOF - PUBLIC_BRIDGE=${PUBLIC_BRIDGE} -ODL_PROVIDER_MAPPINGS=${PUBLIC_BRIDGE}:br100 +PUBLIC_PHYSICAL_NETWORK=physnet1 # FIXME this should be a parameter +ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS} disable_service q-l3 Q_L3_ENABLED=True ODL_L3=${ODL_L3} PUBLIC_INTERFACE=br100 +EOF + +if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then +cat >> ${local_conf_file_name} << EOF [[post-config|\$NEUTRON_CONF]] [DEFAULT] service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin EOF -fi +fi #check for ODL_ML2_BRANCH + +fi #ODL_ENABLE_L3_FWD check + cat >> ${local_conf_file_name} << EOF [[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]] [agent] @@ -137,13 +166,19 @@ cat ${local_conf_file_name} function create_compute_node_local_conf { HOSTIP=$1 +#Needs to be removed +if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; 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 @@ -169,10 +204,9 @@ SERVICE_TOKEN=service SERVICE_PASSWORD=admin ADMIN_PASSWORD=admin -enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_VERSION} +enable_plugin networking-odl ${ODL_ML2_DRIVER_REPO} ${ODL_ML2_BRANCH} ODL_MODE=compute LIBVIRT_TYPE=qemu - EOF if [ "${NUM_ODL_SYSTEM}" -gt 1 ]; then @@ -199,12 +233,25 @@ ODL_MGR_IP=${ODL_SYSTEM_1_IP} EOF fi +# 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 +# want PROVIDER_MAPPINGS to be used -- this should be fixed if we want to support +# external networks in legacy netvirt +if [[ ${CONTROLLERFEATURES} == *"odl-netvirt-openstack"* ]]; then + ODL_PROVIDER_MAPPINGS="\${PUBLIC_PHYSICAL_NETWORK}:${PUBLIC_BRIDGE}" +else + ODL_PROVIDER_MAPPINGS= +fi + if [ "${ODL_ENABLE_L3_FWD}" == "yes" ]; then cat >> ${local_conf_file_name} << EOF # Uncomment lines below if odl-compute is to be used for l3 forwarding Q_L3_ENABLED=True ODL_L3=${ODL_L3} -PUBLIC_INTERFACE=br100 +PUBLIC_INTERFACE=br100 # FIXME do we use br100 at all? +PUBLIC_BRIDGE=${PUBLIC_BRIDGE} +PUBLIC_PHYSICAL_NETWORK=physnet1 # FIXME this should be a parameter +ODL_PROVIDER_MAPPINGS=${ODL_PROVIDER_MAPPINGS} EOF fi echo "local.conf Created...." @@ -255,6 +302,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 @@ -281,6 +342,13 @@ do ${SSH} "${!CONTROLLERIP}" bash -c 'ps axf | grep karaf | grep -v grep | awk '"'"'{print "kill -9 " $1}'"'"' | sh' done +cat > extra_debug.sh << EOF +echo -e "/usr/sbin/lsmod | /usr/bin/grep openvswitch\n" +/usr/sbin/lsmod | /usr/bin/grep openvswitch +echo -e "\ngrep ct_ /var/log/openvswitch/ovs-vswitchd.log\n" +grep ct_ /var/log/openvswitch/ovs-vswitchd.log +EOF + sleep 5 # FIXME: Do not create .tar and gzip before copying. for i in `seq 1 ${NUM_ODL_SYSTEM}` @@ -293,16 +361,40 @@ do 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 +# 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 ${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" + 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 } cat > ${WORKSPACE}/disable_firewall.sh << EOF @@ -324,7 +416,7 @@ echo "127.0.0.1 localhost \${HOSTNAME}" > /tmp/hosts 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 @@ -345,6 +437,12 @@ 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 + +if [ "${ODL_ML2_BRANCH}" == "stable/mitaka" ]; then +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" +ssh ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack; git clone https://github.com/openstack/python-openstacksdk; cd python-openstacksdk; 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" @@ -358,6 +456,9 @@ 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}) @@ -419,7 +520,14 @@ 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;nova-manage service list" +${SSH} ${OPENSTACK_CONTROL_NODE_IP} "cd /opt/stack/devstack; source openrc admin admin; nova hypervisor-list" +expected_num_hypervisors=$((NUM_OPENSTACK_SYSTEM - 1)) +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))` @@ -436,6 +544,44 @@ ${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))` +do + IP_VAR=OPENSTACK_COMPUTE_NODE_${i}_IP + COMPUTE_IPS[$((i-1))]=${!IP_VAR} +done + +# 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 + +# 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 ifconfig $PUBLIC_BRIDGE 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" + + # 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" +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 @@ -449,18 +595,19 @@ cat testplan.txt SUITES=`egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' testplan.txt | tr '\012' ' '` echo "Starting Robot test suites ${SUITES} ..." -pybot -N ${TESTPLAN} -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} \ +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 HA_PROXY_IP:${HA_PROXY_IP} \ -v DEVSTACK_DEPLOY_PATH:/opt/stack/devstack -v USER_HOME:${HOME} ${TESTOPTIONS} ${SUITES} || true 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} "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'" scp ${OPENSTACK_CONTROL_NODE_IP}:${DEVSTACK_TEMPEST_DIR}/tempest_results.html ${WORKSPACE}/ fi