Functest: Restores ability to run with pre-defined creds 67/59067/2
authorTim Rozet <trozet@redhat.com>
Tue, 26 Jun 2018 20:58:28 +0000 (16:58 -0400)
committerTim Rozet <trozet@redhat.com>
Wed, 27 Jun 2018 13:14:09 +0000 (09:14 -0400)
This patch is needed for the case where there are provided OS
credentials to functest, and there is no need to find the installer VM
and copy the credentials to the host. In the Apex snapshot case, there
is no installer VM on the slave, so we must provide the credentials
file.

Also includes a fix to use tempest_smoke_serial for the snapshot netvirt
verification until CSIT suite is working correctly.

Change-Id: Ic84955f527e3f84bb0d8579a377b4a1883fe3eb2
Signed-off-by: Tim Rozet <trozet@redhat.com>
.gitignore
jjb/3rd_party_ci/odl-netvirt.yaml
jjb/functest/functest-env-presetup.sh
utils/fetch_os_creds.sh

index 7790d46..9ee8c53 100644 (file)
@@ -1,5 +1,6 @@
 *~
 .*.sw?
+*.swp
 /docs_build/
 /docs_output/
 /releng/
index c077fce..3a46e79 100644 (file)
               predefined-parameters: |
                 DEPLOY_SCENARIO=os-odl-nofeature-ha
                 FUNCTEST_MODE=testcase
-                FUNCTEST_SUITE_NAME=odl_netvirt
+                FUNCTEST_SUITE_NAME=tempest_smoke_serial
                 RC_FILE_PATH=$HOME/cloner-info/overcloudrc
               node-parameters: true
               kill-phase-on: FAILURE
index 323b325..81718a5 100755 (executable)
@@ -5,27 +5,31 @@ set -o pipefail
 
 # Fetch INSTALLER_IP for APEX deployments
 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
-    echo "Gathering IP information for Apex installer VM"
-    ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
-    if sudo virsh list | grep undercloud; then
-        echo "Installer VM detected"
-        undercloud_mac=$(sudo virsh domiflist undercloud | grep default | \
+    if [ -n "$RC_FILE_PATH" ]; then
+        echo "RC_FILE_PATH is set: ${RC_FILE_PATH}...skipping detecting UC IP"
+    else
+        echo "Gathering IP information for Apex installer VM"
+        ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
+        if sudo virsh list | grep undercloud; then
+            echo "Installer VM detected"
+            undercloud_mac=$(sudo virsh domiflist undercloud | grep default | \
                       grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
-        export INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'})
-        export sshkey_vol="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
-        sudo scp $ssh_options root@${INSTALLER_IP}:/home/stack/stackrc ${HOME}/stackrc
-        export stackrc_vol="-v ${HOME}/stackrc:/home/opnfv/functest/conf/stackrc"
-
-        if sudo iptables -C FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then
-            sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
-        fi
-        if sudo iptables -C FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then
-          sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
+            export INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'})
+            export sshkey_vol="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
+            sudo scp $ssh_options root@${INSTALLER_IP}:/home/stack/stackrc ${HOME}/stackrc
+            export stackrc_vol="-v ${HOME}/stackrc:/home/opnfv/functest/conf/stackrc"
+
+            if sudo iptables -C FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then
+                sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
+            fi
+            if sudo iptables -C FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable 2> ${redirect}; then
+                sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
+            fi
+            echo "Installer ip is ${INSTALLER_IP}"
+        else
+            echo "No available installer VM exists and no credentials provided...exiting"
+            exit 1
         fi
-        echo "Installer ip is ${INSTALLER_IP}"
-    else
-        echo "No available installer VM exists and no credentials provided...exiting"
-        exit 1
     fi
 
 elif [[ ${INSTALLER_TYPE} == 'daisy' ]]; then
index b40b75b..0e041c6 100755 (executable)
@@ -149,29 +149,33 @@ if [ "$installer_type" == "fuel" ]; then
     echo $auth_url >> $dest_path
 
 elif [ "$installer_type" == "apex" ]; then
-    if ! ipcalc -c $installer_ip; then
-      installer_ip=$(sudo virsh domifaddr undercloud | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
-      if [ -z "$installer_ip" ] || ! $(ipcalc -c $installer_ip); then
-        echo "Unable to find valid IP for Apex undercloud: ${installer_ip}"
-        exit 1
-      fi
-    fi
-    verify_connectivity $installer_ip
+    if [ -n "$RC_FILE_PATH" ]; then
+        echo "RC_FILE_PATH is set: ${RC_FILE_PATH}. Copying RC FILE to ${dest_path}"
+        sudo cp -f ${RC_FILE_PATH} ${dest_path}
+    else
+        if ! ipcalc -c $installer_ip; then
+            installer_ip=$(sudo virsh domifaddr undercloud | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
+            if [ -z "$installer_ip" ] || ! $(ipcalc -c $installer_ip); then
+                echo "Unable to find valid IP for Apex undercloud: ${installer_ip}"
+                exit 1
+            fi
+        fi
+        verify_connectivity $installer_ip
 
-    # The credentials file is located in the Instack VM (192.0.2.1)
-    # NOTE: This might change for bare metal deployments
-    info "... from Instack VM $installer_ip..."
-    if [ -f /root/.ssh/id_rsa ]; then
-        chmod 600 /root/.ssh/id_rsa
-    fi
+        # The credentials file is located in the Instack VM (192.0.2.1)
+        # NOTE: This might change for bare metal deployments
+        info "... from Instack VM $installer_ip..."
+        if [ -f /root/.ssh/id_rsa ]; then
+            chmod 600 /root/.ssh/id_rsa
+        fi
 
-    if [ "${BRANCH}" == "stable/fraser" ]; then
-      rc_file=overcloudrc.v3
-    else
-      rc_file=overcloudrc
+        if [ "${BRANCH}" == "stable/fraser" ]; then
+            rc_file=overcloudrc.v3
+        else
+            rc_file=overcloudrc
+        fi
+        sudo scp $ssh_options root@$installer_ip:/home/stack/${rc_file} $dest_path
     fi
-    sudo scp $ssh_options root@$installer_ip:/home/stack/${rc_file} $dest_path
-
 elif [ "$installer_type" == "compass" ]; then
     if [ "${BRANCH}" == "stable/danube" ]; then
         verify_connectivity $installer_ip