diff options
Diffstat (limited to 'tests/ci')
-rwxr-xr-x | tests/ci/clean_images.sh | 29 | ||||
-rw-r--r-- | tests/ci/docker/Makefile | 36 | ||||
-rw-r--r-- | tests/ci/docker/yardstick-ci/Dockerfile | 55 | ||||
-rwxr-xr-x | tests/ci/docker/yardstick-ci/exec_tests.sh | 55 | ||||
-rwxr-xr-x | tests/ci/load_images.sh | 237 | ||||
-rwxr-xr-x | tests/ci/prepare_env.sh | 31 | ||||
-rw-r--r-- | tests/ci/report_config.yaml | 7 | ||||
-rw-r--r-- | tests/ci/requirements.txt | 79 | ||||
-rwxr-xr-x | tests/ci/yardstick-verify | 162 |
9 files changed, 326 insertions, 365 deletions
diff --git a/tests/ci/clean_images.sh b/tests/ci/clean_images.sh new file mode 100755 index 000000000..b1942160b --- /dev/null +++ b/tests/ci/clean_images.sh @@ -0,0 +1,29 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB, Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Clean the images and flavor before running yardstick test suites. + +cleanup() +{ + echo + echo "========== Cleanup ==========" + + if ! glance image-list; then + return + fi + + for image in $(glance image-list | grep -e cirros-0.3.3 -e yardstick-image -e Ubuntu-14.04 \ + -e yardstick-vivid-kernel | awk '{print $2}'); do + echo "Deleting image $image..." + glance image-delete $image || true + done + + nova flavor-delete yardstick-flavor &> /dev/null || true +} diff --git a/tests/ci/docker/Makefile b/tests/ci/docker/Makefile deleted file mode 100644 index 036d67db3..000000000 --- a/tests/ci/docker/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -SHELL = /bin/bash - -IMAGE = opnfv/yardstick - -DOCKER_TAG = brahmaputra.0 - -.PHONY: all -all: .docker - -.docker: - /usr/bin/docker build --rm=true --no-cache=true -t $(IMAGE):$(DOCKER_TAG) yardstick-ci - /usr/bin/docker tag -f $(IMAGE):$(DOCKER_TAG) $(IMAGE):latest - touch .docker - - -.PHONY: clean -clean: - @docker ps | grep $(IMAGE) | awk '{print $$1}' | xargs -r docker stop - @docker ps -a | grep $(IMAGE) | awk '{print $$1}' | xargs -r docker rm - @echo "Docker images to remove:" - @docker images | head -1 && docker images | grep $(IMAGE) || true - @image_tags=($$(docker images | grep $(IMAGE) | awk '{print $$2}')) ; \ - for tag in "$${image_tags[@]}"; do \ - echo "Removing docker image $(IMAGE):$$tag..." ; \ - docker rmi $(IMAGE):$$tag ; \ - done - rm -f .docker diff --git a/tests/ci/docker/yardstick-ci/Dockerfile b/tests/ci/docker/yardstick-ci/Dockerfile deleted file mode 100644 index da755d11d..000000000 --- a/tests/ci/docker/yardstick-ci/Dockerfile +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -FROM ubuntu:14.04 - -LABEL image=opnfv/yardstick - -# GIT repo directory -ENV REPOS_DIR /home/opnfv/repos - -# Yardstick repo -ENV YARDSTICK_REPO_DIR ${REPOS_DIR}/yardstick -ENV RELENG_REPO_DIR ${REPOS_DIR}/releng - -RUN apt-get update && apt-get install -y \ - wget \ - expect \ - curl \ - git \ - sshpass \ - qemu-utils \ - kpartx \ - libffi-dev \ - libssl-dev \ - python \ - python-dev \ - libxml2-dev \ - libxslt1-dev \ - python-setuptools && \ - easy_install -U setuptools - -RUN apt-get -y autoremove && \ - apt-get clean - -RUN mkdir -p ${REPOS_DIR} - -RUN git config --global http.sslVerify false -RUN git clone https://gerrit.opnfv.org/gerrit/yardstick ${YARDSTICK_REPO_DIR} -RUN git clone https://gerrit.opnfv.org/gerrit/releng ${RELENG_REPO_DIR} - -# install yardstick + dependencies -RUN cd ${YARDSTICK_REPO_DIR} && easy_install -U pip -RUN cd ${YARDSTICK_REPO_DIR} && pip install -r tests/ci/requirements.txt -RUN cd ${YARDSTICK_REPO_DIR} && pip install . - -ADD http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img /home/opnfv/images/ -ADD http://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img /home/opnfv/images/ - -COPY ./exec_tests.sh /usr/local/bin/ diff --git a/tests/ci/docker/yardstick-ci/exec_tests.sh b/tests/ci/docker/yardstick-ci/exec_tests.sh deleted file mode 100755 index 9aee240da..000000000 --- a/tests/ci/docker/yardstick-ci/exec_tests.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -set -e - -: ${YARDSTICK_REPO:='https://gerrit.opnfv.org/gerrit/yardstick'} -: ${YARDSTICK_REPO_DIR:='/home/opnfv/repos/yardstick'} -: ${YARDSTICK_BRANCH:='master'} # branch, tag, sha1 or refspec - -: ${RELENG_REPO:='https://gerrit.opnfv.org/gerrit/releng'} -: ${RELENG_REPO_DIR:='/home/opnfv/repos/releng'} -: ${RELENG_BRANCH:='master'} # branch, tag, sha1 or refspec - -git_checkout() -{ - if git cat-file -e $1^{commit} 2>/dev/null; then - # branch, tag or sha1 object - git checkout $1 - else - # refspec / changeset - git fetch --tags --progress $2 $1 - git checkout FETCH_HEAD - fi -} - -echo -echo "INFO: Updating releng -> $RELENG_BRANCH" -if [ ! -d $RELENG_REPO_DIR ]; then - git clone $RELENG_REPO $RELENG_REPO_DIR -fi -cd $RELENG_REPO_DIR -git checkout master && git pull -git_checkout $RELENG_BRANCH $RELENG_REPO - -echo -echo "INFO: Updating yardstick -> $YARDSTICK_BRANCH" -if [ ! -d $YARDSTICK_REPO_DIR ]; then - git clone $YARDSTICK_REPO $YARDSTICK_REPO_DIR -fi -cd $YARDSTICK_REPO_DIR -git checkout master && git pull -git_checkout $YARDSTICK_BRANCH $YARDSTICK_REPO - -# setup the environment -source $YARDSTICK_REPO_DIR/tests/ci/prepare_env.sh - -# execute tests -$YARDSTICK_REPO_DIR/tests/ci/yardstick-verify $@ diff --git a/tests/ci/load_images.sh b/tests/ci/load_images.sh new file mode 100755 index 000000000..405d72076 --- /dev/null +++ b/tests/ci/load_images.sh @@ -0,0 +1,237 @@ +#!/bin/bash +############################################################################## +# Copyright (c) 2015 Ericsson AB, Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +# Set up the environment to run yardstick test suites. + +set -e + +YARD_IMG_ARCH=amd64 +export YARD_IMG_ARCH + +if ! grep -q "Defaults env_keep += \"YARD_IMG_ARCH\"" "/etc/sudoers"; then + sudo echo "Defaults env_keep += \"YARD_IMG_ARCH YARDSTICK_REPO_DIR\"" >> /etc/sudoers +fi + +ARCH_SCRIPT="test -f /etc/fuel_openstack_arch && grep -q arm64 /etc/fuel_openstack_arch" +if [ "$INSTALLER_TYPE" == "fuel" ]; then + sshpass -p r00tme ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -l root $INSTALLER_IP "${ARCH_SCRIPT}" && YARD_IMG_ARCH=arm64 +fi + +UCA_HOST="cloud-images.ubuntu.com" +if [ $YARD_IMG_ARCH = "arm64" ]; then + export VIVID_IMG_URL="http://${UCA_HOST}/vivid/current/vivid-server-cloudimg-arm64.tar.gz" + if ! grep -q "Defaults env_keep += \"VIVID_IMG_URL\"" "/etc/sudoers"; then + sudo echo "Defaults env_keep += \"VIVID_IMG_URL\"" >> /etc/sudoers + fi +fi + +build_yardstick_image() +{ + echo + echo "========== Build yardstick cloud image ==========" + + if [[ "$DEPLOY_SCENARIO" == *"-lxd-"* ]]; then + local cmd="sudo $(which yardstick-img-lxd-modify) $(pwd)/tools/ubuntu-server-cloudimg-modify.sh" + + # Build the image. Retry once if the build fails + $cmd || $cmd + + if [ ! -f $RAW_IMAGE ]; then + echo "Failed building RAW image" + exit 1 + fi + else + local cmd="sudo $(which yardstick-img-modify) $(pwd)/tools/ubuntu-server-cloudimg-modify.sh" + + # Build the image. Retry once if the build fails + $cmd || $cmd + + if [ ! -f $QCOW_IMAGE ]; then + echo "Failed building QCOW image" + exit 1 + fi + fi +} + +load_yardstick_image() +{ + echo + echo "========== Loading yardstick cloud image ==========" + EXTRA_PARAMS="" + if [ $YARD_IMG_ARCH = "arm64" ]; then + VIVID_IMAGE="/tmp/vivid-server-cloudimg-arm64.tar.gz" + VIVID_KERNEL="/tmp/vivid-server-cloudimg-arm64-vmlinuz-generic" + cd /tmp + if [ ! -f $VIVID_IMAGE ]; then + wget $VIVID_IMG_URL + fi + if [ ! -f $VIVID_KERNEL ]; then + tar zxf $VIVID_IMAGE $(basename $VIVID_KERNEL) + fi + create_vivid_kernel=$(glance --os-image-api-version 1 image-create \ + --name yardstick-vivid-kernel \ + --is-public true --disk-format qcow2 \ + --container-format bare \ + --file $VIVID_KERNEL) + + GLANCE_KERNEL_ID=$(echo "$create_vivid_kernel" | grep " id " | awk '{print $(NF-1)}') + if [ -z "$GLANCE_KERNEL_ID" ]; then + echo 'Failed uploading kernel to cloud'. + exit 1 + fi + + command_line="root=/dev/vdb1 console=tty0 console=ttyS0 console=ttyAMA0 rw" + + EXTRA_PARAMS="--property kernel_id=$GLANCE_KERNEL_ID --property os_command_line=\"$command_line\"" + + rm -f $VIVID_KERNEL $VIVID_IMAGE + cd $YARDSTICK_REPO_DIR + 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 [[ "$DEPLOY_SCENARIO" == *"-lxd-"* ]]; then + output=$(eval glance --os-image-api-version 1 image-create \ + --name yardstick-image \ + --is-public true --disk-format root-tar \ + --container-format bare \ + $EXTRA_PARAMS \ + --file $RAW_IMAGE) + else + output=$(eval glance --os-image-api-version 1 image-create \ + --name yardstick-image \ + --is-public true --disk-format qcow2 \ + --container-format bare \ + $EXTRA_PARAMS \ + --file $QCOW_IMAGE) + fi + + echo "$output" + + GLANCE_IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}') + + if [ -z "$GLANCE_IMAGE_ID" ]; then + echo 'Failed uploading image to cloud'. + exit 1 + fi + + if [ "$DEPLOY_SCENARIO" == *"-lxd-"* ]; then + sudo rm -f $RAW_IMAGE + else + sudo rm -f $QCOW_IMAGE + fi + + echo "Glance image id: $GLANCE_IMAGE_ID" +} + +load_cirros_image() +{ + echo + echo "========== Loading cirros cloud image ==========" + + local image_file=/home/opnfv/images/cirros-0.3.3-x86_64-disk.img + + EXTRA_PARAMS="" + # 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 + + output=$(glance image-create \ + --name cirros-0.3.3 \ + --disk-format qcow2 \ + --container-format bare \ + $EXTRA_PARAMS \ + --file $image_file) + echo "$output" + + CIRROS_IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}') + if [ -z "$CIRROS_IMAGE_ID" ]; then + echo 'Failed uploading cirros image to cloud'. + exit 1 + fi + + 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 + + EXTRA_PARAMS="" + # 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 + + output=$(glance image-create \ + --name Ubuntu-14.04 \ + --disk-format qcow2 \ + --container-format bare \ + $EXTRA_PARAMS \ + --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" +} + +create_nova_flavor() +{ + if ! nova flavor-list | grep -q yardstick-flavor; then + echo + echo "========== Create nova flavor ==========" + # Create the nova flavor used by some sample test cases + nova flavor-create yardstick-flavor 100 512 3 1 + # DPDK-enabled OVS requires guest memory to be backed by large pages + if [[ "$DEPLOY_SCENARIO" == *"-ovs-"* ]]; then + nova flavor-key yardstick-flavor set hw:mem_page_size=large + fi + # VPP requires guest memory to be backed by large pages + if [[ "$DEPLOY_SCENARIO" == *"-fdio-"* ]]; then + nova flavor-key yardstick-flavor set hw:mem_page_size=large + fi + fi +} + +main() +{ + QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-image.img" + RAW_IMAGE="/tmp/workspace/yardstick/yardstick-image.tar.gz" + + build_yardstick_image + load_yardstick_image + if [ $YARD_IMG_ARCH = "arm64" ]; then + sed -i 's/image: cirros-0.3.3/image: TestVM/g' tests/opnfv/test_cases/opnfv_yardstick_tc002.yaml \ + samples/ping.yaml + #We have overlapping IP with the real network + for filename in tests/opnfv/test_cases/*; do + sed -i "s/cidr: '10.0.1.0\/24'/cidr: '10.3.1.0\/24'/g" $filename + done + else + load_cirros_image + load_ubuntu_image + fi + create_nova_flavor +} + +main diff --git a/tests/ci/prepare_env.sh b/tests/ci/prepare_env.sh index d9f8257ae..be59b7f37 100755 --- a/tests/ci/prepare_env.sh +++ b/tests/ci/prepare_env.sh @@ -15,7 +15,6 @@ : ${NODE_NAME:='unknown'} : ${EXTERNAL_NETWORK:='admin_floating_net'} - # Extract network name from EXTERNAL_NETWORK # e.g. EXTERNAL_NETWORK='ext-net;flat;192.168.0.2;192.168.0.253;192.168.0.1;192.168.0.0/24' export EXTERNAL_NETWORK=$(echo $EXTERNAL_NETWORK | cut -f1 -d \;) @@ -83,5 +82,33 @@ if [ "$INSTALLER_TYPE" == "fuel" ]; then echo "Fetching id_rsa file from jump_server $INSTALLER_IP..." sshpass -p r00tme scp 2>/dev/null $ssh_options \ root@${INSTALLER_IP}:~/.ssh/id_rsa /root/.ssh/id_rsa &> /dev/null -fi + sshpass -p r00tme ssh 2>/dev/null $ssh_options \ + root@${INSTALLER_IP} fuel node>fuel_node + + # update fuel node id and ip info according to the CI env + controller_IDs=($(cat fuel_node|grep controller|awk '{print $1}')) + compute_IDs=($(cat fuel_node|grep compute|awk '{print $1}')) + controller_ips=($(cat fuel_node|grep controller|awk '{print $10}')) + compute_ips=($(cat fuel_node|grep compute|awk '{print $10}')) + + pod_yaml="./etc/yardstick/nodes/fuel_baremetal/pod.yaml" + node_line_num=($(grep -n node[1-5] $pod_yaml | awk -F: '{print $1}')) + + if [[ ${controller_ips[0]} ]]; then + sed -i "${node_line_num[0]}s/node1/node${controller_IDs[0]}/;s/ip1/${controller_ips[0]}/" $pod_yaml; + fi + if [[ ${controller_ips[1]} ]]; then + sed -i "${node_line_num[1]}s/node2/node${controller_IDs[1]}/;s/ip2/${controller_ips[1]}/" $pod_yaml; + fi + if [[ ${controller_ips[2]} ]]; then + sed -i "${node_line_num[2]}s/node3/node${controller_IDs[2]}/;s/ip3/${controller_ips[2]}/" $pod_yaml; + fi + if [[ ${compute_ips[0]} ]]; then + sed -i "${node_line_num[3]}s/node4/node${compute_IDs[0]}/;s/ip4/${compute_ips[0]}/" $pod_yaml; + fi + if [[ ${compute_ips[1]} ]]; then + sed -i "${node_line_num[4]}s/node5/node${compute_IDs[1]}/;s/ip5/${compute_ips[1]}/" $pod_yaml; + fi + +fi diff --git a/tests/ci/report_config.yaml b/tests/ci/report_config.yaml new file mode 100644 index 000000000..5346e608b --- /dev/null +++ b/tests/ci/report_config.yaml @@ -0,0 +1,7 @@ +reporting: + - + name: apex + scenario: + - + os-nosdn-ovs-noha + diff --git a/tests/ci/requirements.txt b/tests/ci/requirements.txt deleted file mode 100644 index 4d1a16993..000000000 --- a/tests/ci/requirements.txt +++ /dev/null @@ -1,79 +0,0 @@ -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -appdirs==1.4.0 -Babel==2.2.0 -backport-ipaddress==0.1 -cliff==2.0.0 -cmd2==0.6.8 -coverage==4.1b2 -debtcollector==1.3.0 -ecdsa==0.13 -extras==0.0.3 -fixtures==1.4.0 -flake8==2.5.4 -funcsigs==0.4 -functools32==3.2.3.post2 -futures==3.0.5 -iso8601==0.1.11 -Jinja2==2.8 -jsonpatch==1.13 -jsonpointer==1.10 -jsonschema==2.5.1 -keystoneauth1==2.3.0 -linecache2==1.0.0 -lxml==3.5.0 -MarkupSafe==0.23 -mccabe==0.4.0 -mock==1.3.0 -monotonic==1.0 -msgpack-python==0.4.7 -netaddr==0.7.18 -netifaces==0.10.4 -nose==1.3.7 -openstacksdk==0.8.1 -os-client-config==1.16.0 -oslo.config==3.9.0 -oslo.i18n==3.4.0 -oslo.serialization==2.4.0 -oslo.utils==3.7.0 -paramiko==1.16.0 -pbr==1.8.1 -pep8==1.7.0 -positional==1.0.1 -prettytable==0.7.2 -pycrypto==2.6.1 -pyflakes==1.0.0 -pyparsing==2.1.0 -pyrsistent==0.11.12 -python-cinderclient==1.6.0 -python-glanceclient==2.0.0 -python-heatclient==1.0.0 -python-keystoneclient==2.3.1 -python-mimeparse==1.5.1 -python-neutronclient==4.1.1 -python-novaclient==3.3.0 -python-openstackclient==2.2.0 -python-subunit==1.2.0 -python-swiftclient==3.0.0 -pytz==2015.7 -PyYAML==3.11 -requests==2.9.1 -requestsexceptions==1.1.3 -scp==0.10.2 -simplejson==3.8.2 -six==1.10.0 -stevedore==1.12.0 -testrepository==0.0.20 -testtools==2.0.0 -traceback2==1.4.0 -unicodecsv==0.14.1 -unittest2==1.1.0 -warlock==1.2.0 -wrapt==1.10.6 diff --git a/tests/ci/yardstick-verify b/tests/ci/yardstick-verify index eafadf987..7644c96c4 100755 --- a/tests/ci/yardstick-verify +++ b/tests/ci/yardstick-verify @@ -71,23 +71,6 @@ done shift $[OPTIND - 1] TEST_SUITES=$@ -cleanup() -{ - echo - echo "========== Cleanup ==========" - - if ! glance image-list; then - return - fi - - 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 - - nova flavor-delete yardstick-flavor &> /dev/null || true -} - exitcode="" error_exit() @@ -151,105 +134,23 @@ remove_storperf() fi } -build_yardstick_image() -{ - echo - echo "========== Build yardstick cloud image ==========" - - local cmd="sudo $(which yardstick-img-modify) $(pwd)/tools/ubuntu-server-cloudimg-modify.sh" - - # Build the image. Retry once if the build fails. - $cmd || $cmd - - if [ ! -f $QCOW_IMAGE ]; then - echo "Failed building QCOW image" - exit 1 - fi -} - -create_nova_flavor() -{ - if ! nova flavor-list | grep -q yardstick-flavor; then - echo - echo "========== Create nova flavor ==========" - # Create the nova flavor used by some sample test cases - nova flavor-create yardstick-flavor 100 512 3 1 - # DPDK-enabled OVS requires guest memory to be backed by large pages - if [[ "$DEPLOY_SCENARIO" == *"-ovs-"* ]]; then - nova flavor-key yardstick-flavor set hw:mem_page_size=large - fi - fi -} - -load_cirros_image() -{ - echo - echo "========== Loading cirros cloud image ==========" - - local image_file=/home/opnfv/images/cirros-0.3.3-x86_64-disk.img - - output=$(glance image-create \ - --name cirros-0.3.3 \ - --disk-format qcow2 \ - --container-format bare \ - --file $image_file) - echo "$output" - - CIRROS_IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}') - if [ -z "$CIRROS_IMAGE_ID" ]; then - echo 'Failed uploading cirros image to cloud'. - exit 1 - fi - - 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" -} +report(){ -load_yardstick_image() -{ echo - echo "========== Loading yardstick cloud image ==========" - - output=$(glance --os-image-api-version 1 image-create \ - --name yardstick-trusty-server \ - --is-public true --disk-format qcow2 \ - --container-format bare \ - --file $QCOW_IMAGE) - echo "$output" - - GLANCE_IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}') - - if [ -z "$GLANCE_IMAGE_ID" ]; then - echo 'Failed uploading image to cloud'. - exit 1 - fi - - sudo rm -f $QCOW_IMAGE - - echo "Glance image id: $GLANCE_IMAGE_ID" + echo "========== Reporting Status ==========" + 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\":\"$(basename ${YARDSTICK_BRANCH})\", + \"scenario\":\"${DEPLOY_SCENARIO}\", + \"description\": \"yardstick ci scenario status\", + \"criteria\":\"$1\", + \"start_date\":\"$2\", + \"stop_date\":\"$3\", + \"details\":\"\"}" \ + ${DISPATCHER_HTTP_TARGET} } run_test() @@ -259,9 +160,9 @@ run_test() mkdir -p /etc/yardstick - cat << EOF >> /etc/yardstick/yardstick.conf + cat << EOF > /etc/yardstick/yardstick.conf [DEFAULT] -debug = True +debug = False dispatcher = ${DISPATCHER_TYPE} [dispatcher_file] @@ -296,7 +197,7 @@ EOF # Mark the test suite failed but continue # running the remaining test suites. - (( failed++ )) + (( ++failed )) fi if [ ${DISPATCHER_TYPE} = file ]; then echo "---------------------------" @@ -313,23 +214,13 @@ EOF - local sceanrio_status="SUCCESS" + local scenario_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} + + report $scenario_status $start_date $stop_date if [ $failed -gt 0 ]; then echo "---------------------------" @@ -427,18 +318,13 @@ main() # install yardstick install_yardstick + source $YARDSTICK_REPO_DIR/tests/ci/clean_images.sh + cleanup trap "error_exit" EXIT SIGTERM - QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-trusty-server.img" - - build_yardstick_image - load_yardstick_image - load_cirros_image - load_ubuntu_image - create_nova_flavor - + source $YARDSTICK_REPO_DIR/tests/ci/load_images.sh install_storperf run_test remove_storperf |