Merge "Switch global-jjb jobs to use mvn35"
[releng/builder.git] / jjb / integration / integration-deploy-openstack-run-test.sh
index 427238becde30d1841135336c646dd924e28b712..06ebf1094f220867e025d8cb4c8878ded6f83e58 100644 (file)
@@ -4,6 +4,8 @@
 # script.
 # shellcheck source=${ROBOT_VENV}/bin/activate disable=SC1091
 source ${ROBOT_VENV}/bin/activate
+source /tmp/common-functions.sh ${BUNDLEFOLDER}
+
 PYTHON="${ROBOT_VENV}/bin/python"
 SSH="ssh -t -t"
 ADMIN_PASSWORD="admin"
@@ -18,7 +20,9 @@ python ${WORKSPACE}/test/tools/distchanges/changes.py -d /tmp/distribution_folde
 
 printf "\nshowing recent changes that made it into integration/test used by this job:\n"
 cd ${WORKSPACE}/test
-git --no-pager log --pretty=format:'%h %<(13)%ar%<(13)%cr %<(20,trunc)%an%d %s' -n10
+printf "Hash    Author Date                    Commit Date                    Author               Subject"
+printf "------- ------------------------------ ------------------------------ -------------------- -----------------------------"
+git --no-pager log --pretty=format:'%h %<(30)%ad%<(30)%cd %<(20,trunc)%an%d %s' -n20
 cd -
 
 cat << EOF
@@ -111,7 +115,9 @@ function create_etc_hosts() {
 # openstack release
 function install_openstack_clients_in_robot_vm() {
     packages=("python-novaclient" "python-neutronclient" "python-openstackclient")
-    for plugin_name in ${ENABLE_OS_PLUGINS}; do
+    local os_plugins
+    os_plugins=$(csv2ssv "${ENABLE_OS_PLUGINS}")
+    for plugin_name in $os_plugins; do
         if [ "$plugin_name" == "networking-sfc" ]; then
             packages+=("networking-sfc")
         fi
@@ -136,16 +142,6 @@ function install_openstack_clients_in_robot_vm() {
     fi
 }
 
-# convert commas in csv strings to spaces (ssv)
-function csv2ssv() {
-    local csv=$1
-    if [ -n "${csv}" ]; then
-        ssv=$(echo ${csv} | sed 's/,/ /g' | sed 's/\ \ */\ /g')
-    fi
-
-    echo "${ssv}"
-} # csv2ssv
-
 function is_openstack_feature_enabled() {
     local feature=$1
     for enabled_feature in $(csv2ssv ${ENABLE_OS_SERVICES})
@@ -158,14 +154,14 @@ function is_openstack_feature_enabled() {
     echo 0
 }
 
-function fix_libvirt_version_n_cpu_ocata() {
+function fix_libvirt_version_n_cpu_pike() {
     local ip=$1
     ${SSH} ${ip} "
         cd /opt/stack;
         git clone https://git.openstack.org/openstack/requirements;
         cd requirements;
-        git checkout stable/ocata;
-        sed -i s/libvirt-python===2.5.0/libvirt-python===3.2.0/ upper-constraints.txt
+        git checkout stable/pike;
+        sed -i s/libvirt-python===3.5.0/libvirt-python===4.2.0/ upper-constraints.txt
    "
 }
 
@@ -183,10 +179,6 @@ function install_rdo_release() {
           ${SSH} ${ip} "sudo yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-queens/rdo-release-queens-1.noarch.rpm"
           ;;
 
-       *ocata*)
-          ${SSH} ${ip} "sudo yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-ocata/rdo-release-ocata-3.noarch.rpm"
-          ;;
-
        master)
           ${SSH} ${ip} "sudo yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-queens/rdo-release-queens-1.noarch.rpm"
           ;;
@@ -282,7 +274,6 @@ EOF
     if [ "${ODL_ML2_DRIVER_VERSION}" == "v2" ]; then
         echo "ODL_V2DRIVER=True" >> ${local_conf_file_name}
     fi
-
     IFS=,
     for plugin_name in ${ENABLE_OS_PLUGINS}; do
         if [ "$plugin_name" == "networking-odl" ]; then
@@ -293,7 +284,8 @@ EOF
             ENABLE_PLUGIN_ARGS="${DEVSTACK_LBAAS_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
             IS_LBAAS_PLUGIN_ENABLED="yes"
         elif [ "$plugin_name" == "networking-sfc" ]; then
-            ENABLE_PLUGIN_ARGS="${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO} ${OPENSTACK_BRANCH}"
+            ENABLE_PLUGIN_ARGS="${DEVSTACK_NETWORKING_SFC_PLUGIN_REPO} master"
+            IS_SFC_PLUGIN_ENABLED="yes"
         else
             echo "Error: Invalid plugin $plugin_name, unsupported"
             continue
@@ -333,6 +325,9 @@ EOF
         if [ "${IS_LBAAS_PLUGIN_ENABLED}" == "yes" ]; then
             SERVICE_PLUGINS+=", lbaasv2"
         fi
+        if [ "${IS_SFC_PLUGIN_ENABLED}" == "yes" ]; then
+            SERVICE_PLUGINS+=", networking_sfc.services.flowclassifier.plugin.FlowClassifierPlugin,networking_sfc.services.sfc.plugin.SfcPlugin"
+        fi
     fi #check for ODL_ENABLE_L3_FWD
 
     cat >> ${local_conf_file_name} << EOF
@@ -482,44 +477,26 @@ defaults
 listen opendaylight
   bind ${MGRIP}:8080
   balance source
-EOF
 
-    odlindex=1
-    for odlip in ${ODL_IPS[*]}; do
-        cat >> ${WORKSPACE}/haproxy.cfg << EOF
-  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 ${MGRIP}:8181
   balance source
-EOF
 
-    odlindex=1
-    for odlip in ${ODL_IPS[*]}; do
-        cat >> ${WORKSPACE}/haproxy.cfg << EOF
-  server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2
-EOF
-        odlindex=$((odlindex+1))
-    done
-
-    cat >> ${WORKSPACE}/haproxy.cfg << EOF
-listen opendaylight_rest
+listen opendaylight_websocket
   bind ${MGRIP}:8185
   balance source
+
 EOF
 
     odlindex=1
     for odlip in ${ODL_IPS[*]}; do
-        cat >> ${WORKSPACE}/haproxy.cfg << EOF
-  server controller-websocket-${odlindex} ${odlip}:8185 check fall 5 inter 2000 rise 2
-EOF
+        sed -i "/listen opendaylight$/a server controller-${odlindex} ${odlip}:8080 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
+        sed -i "/listen opendaylight_rest$/a server controller-rest-${odlindex} ${odlip}:8181 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
+        sed -i "/listen opendaylight_websocket$/a server controller-websocket-${odlindex} ${odlip}:8185 check fall 5 inter 2000 rise 2" ${WORKSPACE}/haproxy.cfg
         odlindex=$((odlindex+1))
     done
 
+
     echo "Dump haproxy.cfg"
     cat ${WORKSPACE}/haproxy.cfg
 
@@ -707,6 +684,7 @@ EOF
             ${NODE_FOLDER}/odl${i}_karaf.log > ${NODE_FOLDER}/odl${i}_err_warn_exception.log
         # Print ROBOT lines and print Exception lines. For exception lines also print the previous line for context
         sed -n -e '/ROBOT MESSAGE/P' -e '$!N;/Exception/P;D' ${NODE_FOLDER}/odl${i}_karaf.log > ${NODE_FOLDER}/odl${i}_exception.log
+        mv /tmp/odl${i}_exceptions.txt ${NODE_FOLDER}
         rm ${NODE_FOLDER}/odl${i}_karaf.log.tar
         mv *_threads* ${NODE_FOLDER}
         mv ps_* ${NODE_FOLDER}
@@ -816,9 +794,6 @@ EOF
         mkdir -p ${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}
-        if [ "$(echo ${OPENSTACK_BRANCH} | cut -d/ -f2)" != "queens" ]; then
-           mv ${WORKSPACE}/tempest_output* ${TEMPEST_LOGS_DIR}
-        fi
     else
         echo "tempest results not found in ${DEVSTACK_TEMPEST_DIR}/${TESTREPO}/0"
     fi
@@ -900,12 +875,7 @@ function is_rabbitmq_ready() {
     local -r ip=${1}
     local grepfor="nova_cell1"
     rm -f rabbit.txt
-    if [ "${OPENSTACK_BRANCH}" == "stable/ocata" ]; then
-        ${SSH} ${ip} "sudo rabbitmqctl status" > rabbit.txt
-        grepfor="pid"
-    else
-        ${SSH} ${ip} "sudo rabbitmqctl list_vhosts" > rabbit.txt
-    fi
+    ${SSH} ${ip} "sudo rabbitmqctl list_vhosts" > rabbit.txt
     grep ${grepfor} rabbit.txt
 }
 
@@ -1031,6 +1001,10 @@ sed -i 's/wait_for_compute 60/wait_for_compute 1800/g' /opt/stack/devstack/lib/n
 # TODO: modify sleep 1 to sleep 60, search wait_for_compute, then first sleep 1
 # that would just reduce the number of logs in the compute stack.log
 
+echo "workaround: do not upgrade openvswitch"
+sudo yum install -y yum-plugin-versionlock
+sudo yum versionlock add openvswitch
+
 #Install qemu-img command in Control Node for Pike
 echo "Install qemu-img application"
 sudo yum install -y qemu-img
@@ -1088,12 +1062,6 @@ for i in `seq 1 ${NUM_OPENSTACK_CONTROL_NODES}`; do
        ssh ${!CONTROLIP} "sed -i 's/flat_networks public/flat_networks public,physnet1/' /opt/stack/devstack/lib/neutron"
        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"
     fi
-    if [[ "${ODL_ML2_BRANCH}" == "stable/ocata" && "$(is_openstack_feature_enabled n-cpu)" == "1" ]]; then
-        echo "Updating requirements for ${ODL_ML2_BRANCH}"
-        echo "Workaround for https://review.openstack.org/#/c/491032/"
-        echo "Modify upper-constraints to use libvirt-python 3.2.0"
-        fix_libvirt_version_n_cpu_ocata ${!CONTROLIP}
-    fi
     create_control_node_local_conf ${!CONTROLIP} ${ODLMGRIP[$i]} "${ODL_OVS_MGRS[$i]}"
     scp ${WORKSPACE}/local.conf_control_${!CONTROLIP} ${!CONTROLIP}:/opt/stack/devstack/local.conf
     echo "Install rdo release to avoid incompatible Package versions"
@@ -1145,11 +1113,11 @@ for i in `seq 1 ${NUM_OPENSTACK_COMPUTE_NODES}`; do
     scp ${WORKSPACE}/hosts_file ${!COMPUTEIP}:/tmp/hosts
     scp ${WORKSPACE}/get_devstack.sh  ${!COMPUTEIP}:/tmp
     ${SSH} ${!COMPUTEIP} "bash /tmp/get_devstack.sh > /tmp/get_devstack.sh.txt 2>&1"
-    if [ "${ODL_ML2_BRANCH}" == "stable/ocata" ]; then
+    if [ "${ODL_ML2_BRANCH}" == "stable/pike" ]; then
         echo "Updating requirements for ${ODL_ML2_BRANCH}"
-        echo "Workaround for https://review.openstack.org/#/c/491032/"
-        echo "Modify upper-constraints to use libvirt-python 3.2.0"
-        fix_libvirt_version_n_cpu_ocata ${!COMPUTEIP}
+        echo "Workaround for libvirt-python failing installation"
+        echo "Modify upper-constraints to use libvirt-python 4.2.0"
+        fix_libvirt_version_n_cpu_pike ${!COMPUTEIP}
     fi
     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
@@ -1236,13 +1204,6 @@ for i in `seq 1 ${NUM_OPENSTACK_SITES}`; do
 
     echo "sleep for 60s and print hypervisor-list"
     sleep 60
-    # In Ocata if we do not enable the n-cpu in control node then
-    # 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
     ${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
@@ -1260,12 +1221,14 @@ for i in `seq 1 ${NUM_OPENSTACK_SITES}`; do
         exit 1
     fi
 
-    # 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"
+    if [ "${OPENSTACK_BRANCH}" == "stable/pike" ]; then
+        # 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"
+    fi
 
     # Gather Compute IPs for the site
     for j in `seq 1 ${NUM_COMPUTES_PER_SITE}`; do
@@ -1453,6 +1416,7 @@ for suite in ${SUITES}; do
     -v HA_PROXY_2_IP:${HA_PROXY_2_IP} \
     -v HA_PROXY_3_IP:${HA_PROXY_3_IP} \
     -v JDKVERSION:${JDKVERSION} \
+    -v JENKINS_WORKSPACE:${WORKSPACE} \
     -v NEXUSURL_PREFIX:${NEXUSURL_PREFIX} \
     -v NUM_ODL_SYSTEM:${NUM_ODL_SYSTEM} \
     -v NUM_OPENSTACK_SITES:${NUM_OPENSTACK_SITES} \