add grafan config for ha test cases tc045~tc049
[yardstick.git] / tests / ci / yardstick-verify
index c831935..eafadf9 100755 (executable)
@@ -42,7 +42,7 @@ EOF
 
 DISPATCHER_TYPE=file
 DISPATCHER_FILE_NAME="/tmp/yardstick.out"
-DISPATCHER_HTTP_TARGET=
+DISPATCHER_HTTP_TARGET="http://testresults.opnfv.org/test/api/v1/results"
 DISPATCHER_INFLUXDB_TARGET=
 
 while getopts "r:i:h" OPTION; do
@@ -80,7 +80,7 @@ cleanup()
         return
     fi
 
-    for image in $(glance image-list | grep -e cirros-0.3.3 -e yardstick-trusty-server | awk '{print $2}'); do
+    for image in $(glance image-list | grep -e cirros-0.3.3 -e yardstick-trusty-server -e Ubuntu-14.04 | awk '{print $2}'); do
         echo "Deleting image $image..."
         glance image-delete $image || true
     done
@@ -121,6 +121,36 @@ install_yardstick()
     pip install .
 }
 
+install_storperf()
+{
+    # Install Storper on huawei-pod1
+    if [ "$NODE_NAME" == "huawei-pod1" ]; then
+        echo
+        echo "========== Installing storperf =========="
+
+        if ! yardstick -d plugin install plugin/CI/storperf.yaml; then
+            echo "Install storperf plugin FAILED";
+            exit 1
+        fi
+
+    fi
+}
+
+remove_storperf()
+{
+    # remove Storper from huawei-pod1
+    if [ "$NODE_NAME" == "huawei-pod1" ]; then
+        echo
+        echo "========== Removing storperf =========="
+
+        if ! yardstick -d plugin remove plugin/CI/storperf.yaml; then
+            echo "Remove storperf plugin FAILED";
+            exit 1
+        fi
+
+    fi
+}
+
 build_yardstick_image()
 {
     echo
@@ -174,6 +204,30 @@ load_cirros_image()
     echo "Cirros image id: $CIRROS_IMAGE_ID"
 }
 
+load_ubuntu_image()
+{
+    echo
+    echo "========== Loading ubuntu cloud image =========="
+
+    local ubuntu_image_file=/home/opnfv/images/trusty-server-cloudimg-amd64-disk1.img
+
+    output=$(glance image-create \
+        --name Ubuntu-14.04 \
+        --disk-format qcow2 \
+        --container-format bare \
+        --file $ubuntu_image_file)
+    echo "$output"
+
+    UBUNTU_IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}')
+
+    if [ -z "$UBUNTU_IMAGE_ID" ]; then
+        echo 'Failed uploading UBUNTU image to cloud'.
+        exit 1
+    fi
+
+    echo "Ubuntu image id: $UBUNTU_IMAGE_ID"
+}
+
 load_yardstick_image()
 {
     echo
@@ -226,15 +280,17 @@ password = 0pnfv2015
 EOF
 
     local failed=0
+    local start_date
+    local stop_date
 
     if [ ${#SUITE_FILES[@]} -gt 0 ]; then
 
+        start_date=$(date '+%Y-%m-%d %H:%M:%S')
         for suite in ${SUITE_FILES[*]}; do
 
             echo "---------------------------"
             echo "Running test suite: $suite"
             echo "---------------------------"
-
             if ! yardstick task start --suite $suite; then
                  echo "test suite $suite FAILED";
 
@@ -252,16 +308,35 @@ EOF
                     echo "Test result file ${DISPATCHER_FILE_NAME} is not exist"
                 fi
             fi
-
         done
+        stop_date=$(date '+%Y-%m-%d %H:%M:%S')
+
+
+
+        local sceanrio_status="SUCCESS"
 
         if [ $failed -gt 0 ]; then
+            scenario_status="FAILED"
+        fi
+        curl -i -H 'content-type: application/json' -X POST -d \
+            "{\"project_name\": \"yardstick\",
+              \"case_name\": \"scenario_status\",
+              \"pod_name\":\"${NODE_NAME}\",
+              \"installer\":\"${INSTALLER_TYPE}\",
+              \"version\":\"${YARDSTICK_BRANCH}\",
+              \"scenario\":\"${DEPLOY_SCENARIO}\",
+              \"description\": \"yardstick ci scenario status\",
+              \"start_date\":\"${start_date}\",
+              \"stop_date\":\"${stop_date}\",
+              \"details\":\"${sceanrio_status}\"}" \
+              ${DISPATCHER_HTTP_TARGET}
 
+        if [ $failed -gt 0 ]; then
             echo "---------------------------"
             echo "$failed out of ${SUITE_FILES[*]} test suites FAILED"
             echo "---------------------------"
             exit 1
-         fi
+        fi
 
     else
 
@@ -361,9 +436,12 @@ main()
     build_yardstick_image
     load_yardstick_image
     load_cirros_image
+    load_ubuntu_image
     create_nova_flavor
 
+    install_storperf
     run_test
+    remove_storperf
 }
 
 main