Add PROX TC into OPNFV test cases
[yardstick.git] / tests / ci / load_images.sh
index caaba9e..7a86abb 100755 (executable)
@@ -29,11 +29,6 @@ if [ "${INSTALLER_TYPE}" == 'fuel' ]; then
 fi
 export YARD_IMG_ARCH
 
-HW_FW_TYPE=""
-if [ "${YARD_IMG_ARCH}" == "arm64" ]; then
-    HW_FW_TYPE=uefi
-fi
-export HW_FW_TYPE
 
 UCA_HOST="cloud-images.ubuntu.com"
 if [ "${YARD_IMG_ARCH}" == "arm64" ]; then
@@ -43,6 +38,12 @@ if [ "${YARD_IMG_ARCH}" == "arm64" ]; then
     fi
 fi
 
+cleanup_loopbacks() {
+    # try again to cleanup loopbacks in case of error
+    losetup -a
+    losetup -O NAME,BACK-FILE | awk '/yardstick/ { print $1 }' | xargs -l1 losetup -v -d || true
+}
+
 build_yardstick_image()
 {
     echo
@@ -56,6 +57,7 @@ build_yardstick_image()
             # Build the image. Retry once if the build fails
             $cmd || $cmd
 
+            cleanup_loopbacks
             if [ ! -f "${RAW_IMAGE}" ]; then
                 echo "Failed building RAW image"
                 exit 1
@@ -67,13 +69,28 @@ build_yardstick_image()
             cd ${ANSIBLE_SCRIPTS} &&\
             ansible-playbook \
                      -e img_property="normal" \
+                     -e YARD_IMG_ARCH=${YARD_IMG_ARCH} \
                      -vvv -i inventory.ini build_yardstick_image.yml
 
+            cleanup_loopbacks
             if [ ! -f "${QCOW_IMAGE}" ]; then
                 echo "Failed building QCOW image"
                 exit 1
             fi
         fi
+        # DPDK compile is not enabled for arm64 yet so disable for now
+        # JIRA: YARSTICK-1124
+        if [[ ! -f "${QCOW_NSB_IMAGE}"  && ${DEPLOY_SCENARIO} == *[_-]ovs_dpdk[_-]* && "${YARD_IMG_ARCH}" != "arm64" ]]; then
+            ansible-playbook \
+                     -e img_property="nsb" \
+                     -e YARD_IMG_ARCH=${YARD_IMG_ARCH} \
+                     -vvv -i inventory.ini build_yardstick_image.yml
+            cleanup_loopbacks
+            if [ ! -f "${QCOW_NSB_IMAGE}" ]; then
+                echo "Failed building QCOW NSB image"
+                exit 1
+            fi
+        fi
     fi
 }
 
@@ -82,18 +99,12 @@ load_yardstick_image()
     echo
     echo "========== Loading yardstick cloud image =========="
     EXTRA_PARAMS=""
-    if [[ "${YARD_IMG_ARCH}" == "arm64" ]]; then
-        EXTRA_PARAMS="--property hw_video_model=vga"
-    fi
 
     # VPP requires guest memory to be backed by large pages
     if [[ "$DEPLOY_SCENARIO" == *"-fdio-"* ]]; then
         EXTRA_PARAMS=$EXTRA_PARAMS" --property hw_mem_page_size=large"
     fi
 
-    if [[ -n "${HW_FW_TYPE}" ]]; then
-        EXTRA_PARAMS=$EXTRA_PARAMS" --property hw_firmware_type=${HW_FW_TYPE}"
-    fi
 
     if [[ "$DEPLOY_SCENARIO" == *"-lxd-"* ]]; then
         output=$(eval openstack ${SECURE} image create \
@@ -111,6 +122,18 @@ load_yardstick_image()
             ${EXTRA_PARAMS} \
             --file ${QCOW_IMAGE} \
             yardstick-image)
+        # DPDK compile is not enabled for arm64 yet so disable NSB images for now
+        # JIRA: YARSTICK-1124
+        if [[ $DEPLOY_SCENARIO == *[_-]ovs_dpdk[_-]* && "${YARD_IMG_ARCH}" != "arm64" ]]; then
+            nsb_output=$(eval openstack ${SECURE} image create \
+                --public \
+                --disk-format qcow2 \
+                --container-format bare \
+                ${EXTRA_PARAMS} \
+                --file ${QCOW_NSB_IMAGE} \
+                yardstick-samplevnfs)
+            echo "$nsb_output"
+        fi
     fi
 
     echo "$output"
@@ -131,7 +154,7 @@ load_cirros_image()
     if [[ "${YARD_IMG_ARCH}" == "arm64" ]]; then
         CIRROS_IMAGE_VERSION="cirros-d161201"
         CIRROS_IMAGE_PATH="/home/opnfv/images/cirros-d161201-aarch64-disk.img"
-        EXTRA_PARAMS="--property hw_video_model=vga --property short_id=ubuntu16.04"
+        EXTRA_PARAMS="--property short_id=ubuntu16.04"
     else
         CIRROS_IMAGE_VERSION="cirros-0.3.5"
         CIRROS_IMAGE_PATH="/home/opnfv/images/cirros-0.3.5-x86_64-disk.img"
@@ -150,9 +173,6 @@ load_cirros_image()
             EXTRA_PARAMS=$EXTRA_PARAMS" --property hw_mem_page_size=large"
         fi
 
-        if [[ -n "${HW_FW_TYPE}" ]]; then
-            EXTRA_PARAMS=$EXTRA_PARAMS" --property hw_firmware_type=${HW_FW_TYPE}"
-        fi
 
         output=$(openstack ${SECURE} image create \
             --disk-format qcow2 \
@@ -231,6 +251,7 @@ create_nova_flavor()
 main()
 {
     QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-image.img"
+    QCOW_NSB_IMAGE="/tmp/workspace/yardstick/yardstick-nsb-image.img"
     RAW_IMAGE="/tmp/workspace/yardstick/yardstick-image.tar.gz"
 
     if [ -f /home/opnfv/images/yardstick-image.img ];then
@@ -250,7 +271,7 @@ main()
     load_yardstick_image
     if [ "${YARD_IMG_ARCH}" == "arm64" ]; then
         #We have overlapping IP with the real network
-        for filename in tests/opnfv/test_cases/*; do
+        for filename in ${YARDSTICK_REPO_DIR}/tests/opnfv/test_cases/*; do
             sed -i "s/cidr: '10.0.1.0\/24'/cidr: '10.3.1.0\/24'/g" "${filename}"
         done
     else