aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/ci/apexlake-verify29
-rw-r--r--tests/ci/cover.sh75
-rw-r--r--tests/ci/docker/Makefile36
-rw-r--r--tests/ci/docker/yardstick-ci/Dockerfile53
-rwxr-xr-xtests/ci/docker/yardstick-ci/run_tests.sh55
-rwxr-xr-xtests/ci/prepare_env.sh54
-rw-r--r--tests/ci/requirements.txt79
-rwxr-xr-xtests/ci/yardstick-verify369
8 files changed, 750 insertions, 0 deletions
diff --git a/tests/ci/apexlake-verify b/tests/ci/apexlake-verify
new file mode 100755
index 000000000..6a691063f
--- /dev/null
+++ b/tests/ci/apexlake-verify
@@ -0,0 +1,29 @@
+#!/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
+##############################################################################
+
+DPDK_HOST=10.118.36.130
+
+YARDSTICK=/home/user/yardstick
+TESTSUITE=$YARDSTICK/tests/opnfv/test_suites/opnfv_vTC_daily.yaml
+
+: ${INSTALLER_TYPE:='unknown'}
+: ${NODE_NAME:='unknown'}
+: ${DEPLOY_SCENARIO:='unknown'}
+
+commands="
+cd $YARDSTICK
+source /home/user/openrc.dasm
+export INSTALLER_TYPE=$INSTALLER_TYPE
+export NODE_NAME=$NODE_NAME
+export DEPLOY_SCENARIO=$DEPLOY_SCENARIO
+sudo -E yardstick task start --suite $TESTSUITE"
+
+echo "$commands" | ssh -l user $DPDK_HOST 'bash -s'
+exit $?
diff --git a/tests/ci/cover.sh b/tests/ci/cover.sh
new file mode 100644
index 000000000..71833757a
--- /dev/null
+++ b/tests/ci/cover.sh
@@ -0,0 +1,75 @@
+##############################################################################
+# Copyright 2015: Mirantis Inc.
+# All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+# yardstick comment: this is a modified copy of
+# rally/tests/ci/cover.sh
+##############################################################################
+
+show_diff () {
+ head -1 $1
+ diff -U 0 $1 $2 | sed 1,2d
+}
+
+
+run_coverage_test() {
+
+ ALLOWED_EXTRA_MISSING=10
+
+
+ # Stash uncommitted changes, checkout master and save coverage report
+ uncommited=$(git status --porcelain | grep -v "^??")
+ [[ -n $uncommited ]] && git stash > /dev/null
+ git checkout HEAD^
+
+ baseline_report=$(mktemp -t yardstick_coverageXXXXXXX)
+ find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$*"
+ coverage report > $baseline_report
+ baseline_missing=$(awk 'END { print $3 }' $baseline_report)
+
+ # Checkout back and unstash uncommitted changes (if any)
+ git checkout -
+ [[ -n $uncommited ]] && git stash pop > /dev/null
+
+ # Generate and save coverage report
+ current_report=$(mktemp -t yardstick_coverageXXXXXXX)
+ find . -type f -name "*.pyc" -delete && python setup.py testr --coverage --testr-args="$*"
+ coverage report > $current_report
+ current_missing=$(awk 'END { print $3 }' $current_report)
+
+ # Show coverage details
+ allowed_missing=$((baseline_missing+ALLOWED_EXTRA_MISSING))
+
+ echo "Allowed to introduce missing lines : ${ALLOWED_EXTRA_MISSING}"
+ echo "Missing lines in master : ${baseline_missing}"
+ echo "Missing lines in proposed change : ${current_missing}"
+
+ if [ $allowed_missing -gt $current_missing ];
+ then
+ if [ $baseline_missing -lt $current_missing ];
+ then
+ show_diff $baseline_report $current_report
+ echo "I believe you can cover all your code with 100% coverage!"
+ else
+ echo "Thank you! You are awesome! Keep writing unit tests! :)"
+ fi
+ else
+ show_diff $baseline_report $current_report
+ echo "Please write more unit tests, we should keep our test coverage :( "
+ rm $baseline_report $current_report
+ exit 1
+ fi
+
+ rm $baseline_report $current_report
+}
diff --git a/tests/ci/docker/Makefile b/tests/ci/docker/Makefile
new file mode 100644
index 000000000..036d67db3
--- /dev/null
+++ b/tests/ci/docker/Makefile
@@ -0,0 +1,36 @@
+##############################################################################
+# 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
new file mode 100644
index 000000000..a2164a8a2
--- /dev/null
+++ b/tests/ci/docker/yardstick-ci/Dockerfile
@@ -0,0 +1,53 @@
+##############################################################################
+# 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 \
+ 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/
+
+COPY ./run_tests.sh /usr/local/bin/
+
diff --git a/tests/ci/docker/yardstick-ci/run_tests.sh b/tests/ci/docker/yardstick-ci/run_tests.sh
new file mode 100755
index 000000000..680a329ca
--- /dev/null
+++ b/tests/ci/docker/yardstick-ci/run_tests.sh
@@ -0,0 +1,55 @@
+#!/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/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
+
+# run tests
+$YARDSTICK_REPO_DIR/tests/ci/yardstick-verify $@
diff --git a/tests/ci/prepare_env.sh b/tests/ci/prepare_env.sh
new file mode 100755
index 000000000..ed832bc47
--- /dev/null
+++ b/tests/ci/prepare_env.sh
@@ -0,0 +1,54 @@
+#!/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
+##############################################################################
+
+# Perepare the environment to run yardstick ci
+
+: ${DEPLOY_TYPE:='bm'} # Can be any of 'bm' (Bare Metal) or 'virt' (Virtual)
+
+: ${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 \;)
+
+# Create openstack credentials
+echo "INFO: Creating openstack credentials .."
+OPENRC=/home/opnfv/openrc
+INSTALLERS=(apex compass fuel joid)
+
+if [ ! -f $OPENRC ]; then
+ # credentials file is not given, check if environment variables are set
+ # to get the creds using fetch_os_creds.sh later on
+ echo "INFO: Checking environment variables INSTALLER_TYPE and INSTALLER_IP"
+ if [ -z ${INSTALLER_TYPE} ]; then
+ echo "environment variable 'INSTALLER_TYPE' is not defined."
+ exit 1
+ elif [[ ${INSTALLERS[@]} =~ ${INSTALLER_TYPE} ]]; then
+ echo "INSTALLER_TYPE env variable found: ${INSTALLER_TYPE}"
+ else
+ echo "Invalid env variable INSTALLER_TYPE=${INSTALLER_TYPE}"
+ exit 1
+ fi
+
+ if [ "$DEPLOY_TYPE" == "virt" ]; then
+ FETCH_CRED_ARG="-v -d $OPENRC -i ${INSTALLER_TYPE} -a ${INSTALLER_IP}"
+ else
+ FETCH_CRED_ARG="-d $OPENRC -i ${INSTALLER_TYPE} -a ${INSTALLER_IP}"
+ fi
+
+ $RELENG_REPO_DIR/utils/fetch_os_creds.sh $FETCH_CRED_ARG
+
+fi
+
+source $OPENRC
+
+export EXTERNAL_NETWORK INSTALLER_TYPE DEPLOY_TYPE NODE_NAME
diff --git a/tests/ci/requirements.txt b/tests/ci/requirements.txt
new file mode 100644
index 000000000..4d1a16993
--- /dev/null
+++ b/tests/ci/requirements.txt
@@ -0,0 +1,79 @@
+##############################################################################
+# 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
new file mode 100755
index 000000000..c83193574
--- /dev/null
+++ b/tests/ci/yardstick-verify
@@ -0,0 +1,369 @@
+#!/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 up the environment and run yardstick test suites.
+#
+# Example invocation: yardstick-verify -r 10.4.4.4 suite1.yaml suite2.yaml
+#
+# Openstack credentials must be set and the script must be run from its
+# original location in the yardstick repo.
+#
+# This script is intended to be used by the CI pipeline but it may also
+# be invoked manually.
+#
+
+SCRIPT=$0
+SCRIPT_ARGS=$@
+
+usage()
+{
+ cat << EOF
+usage: $0 options [TEST_SUITE ...]
+
+If no test suites are given ping.yaml is run.
+
+OPTIONS:
+ -h Show this message
+ -r Http target (example: -r 213.77.62.197/results)
+ -i Influxdb target (example: -i 127.0.0.1:8086)
+
+ Default target is dump to file ($DISPATCHER_FILE_NAME)
+
+EOF
+}
+
+DISPATCHER_TYPE=file
+DISPATCHER_FILE_NAME="/tmp/yardstick.out"
+DISPATCHER_HTTP_TARGET=
+DISPATCHER_INFLUXDB_TARGET=
+
+while getopts "r:i:h" OPTION; do
+ case $OPTION in
+ h)
+ usage
+ exit 0
+ ;;
+ r)
+ DISPATCHER_TYPE=http
+ DISPATCHER_HTTP_TARGET=http://${OPTARG}
+ DISPATCHER_FILE_NAME=
+ ;;
+ i)
+ DISPATCHER_TYPE=influxdb
+ DISPATCHER_INFLUXDB_TARGET=http://${OPTARG}
+ DISPATCHER_FILE_NAME=
+ ;;
+ *)
+ echo "${OPTION} is not a valid argument"
+ exit 1
+ ;;
+ esac
+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 | 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()
+{
+ local rc=$?
+
+ if [ -z "$exitcode" ]; then
+ # In case of recursive traps (!?)
+ exitcode=$rc
+ fi
+
+ cleanup
+
+ echo "Exiting with RC=$exitcode"
+
+ exit $exitcode
+}
+
+set -o errexit
+set -o pipefail
+
+install_yardstick()
+{
+ echo
+ echo "========== Installing yardstick =========="
+
+ # uninstall previous version
+ pip uninstall -y yardstick || true
+
+ # Install yardstick
+ pip install .
+}
+
+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_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"
+}
+
+run_test()
+{
+ echo
+ echo "========== Running yardstick test suites =========="
+
+ mkdir -p /etc/yardstick
+
+ cat << EOF >> /etc/yardstick/yardstick.conf
+[DEFAULT]
+debug = True
+dispatcher = ${DISPATCHER_TYPE}
+
+[dispatcher_file]
+file_name = ${DISPATCHER_FILE_NAME}
+
+[dispatcher_http]
+timeout = 5
+target = ${DISPATCHER_HTTP_TARGET}
+
+[dispatcher_influxdb]
+timeout = 5
+target = ${DISPATCHER_INFLUXDB_TARGET}
+db_name = yardstick
+username = opnfv
+password = 0pnfv2015
+EOF
+
+ local failed=0
+
+ if [ ${#SUITE_FILES[@]} -gt 0 ]; then
+
+ 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";
+
+ # Mark the test suite failed but continue
+ # running the remaining test suites.
+ (( failed++ ))
+ fi
+ if [ ${DISPATCHER_TYPE} = file ]; then
+ echo "---------------------------"
+ echo "Dump test suite $suite result"
+ echo "---------------------------"
+ if [ -f ${DISPATCHER_FILE_NAME} ]; then
+ cat ${DISPATCHER_FILE_NAME}
+ else
+ echo "Test result file ${DISPATCHER_FILE_NAME} is not exist"
+ fi
+ fi
+
+ done
+
+ if [ $failed -gt 0 ]; then
+
+ echo "---------------------------"
+ echo "$failed out of ${SUITE_FILES[*]} test suites FAILED"
+ echo "---------------------------"
+ exit 1
+ fi
+
+ else
+
+ echo "---------------------------"
+ echo "Running samples/ping.yaml "
+ echo "---------------------------"
+
+ if ! yardstick task start samples/ping.yaml; then
+ echo "Yardstick test FAILED"
+ exit 1
+ fi
+
+ if [ ${DISPATCHER_TYPE} = file ]; then
+ echo "---------------------------"
+ echo "Dump samples/ping.yaml test result"
+ echo "---------------------------"
+ if [ -f ${DISPATCHER_FILE_NAME} ]; then
+ cat ${DISPATCHER_FILE_NAME}
+ else
+ echo "Test result file ${DISPATCHER_FILE_NAME} is not exist"
+ fi
+ fi
+
+ fi
+
+}
+
+main()
+{
+ GITROOT=$(cd $(dirname $0) && git rev-parse --show-toplevel)
+
+ cd $GITROOT
+
+ export YARDSTICK_VERSION=$(git rev-parse HEAD)
+
+ SUITE_FILES=()
+
+ # find the test suite files
+ for suite in $TEST_SUITES; do
+ if [ -f $suite ]; then
+ SUITE_FILES+=($suite)
+ else
+ tsdir=$GITROOT/tests/opnfv/test_suites
+ if [ ! -f $tsdir/$suite ]; then
+ echo "Test suite \"$suite\" does not exist"
+ exit 1
+ fi
+ SUITE_FILES+=($tsdir/$suite)
+ fi
+ done
+
+ echo
+ echo "========== Running Yardstick CI with following parameters =========="
+ echo "Script options: ${SCRIPT} $SCRIPT_ARGS"
+ echo "Dispatcher: ${DISPATCHER_TYPE} ${DISPATCHER_FILE_NAME}"
+ echo "YARDSTICK_VERSION: ${YARDSTICK_VERSION}"
+ echo "Number of test suites: ${#SUITE_FILES[@]}"
+ for suite in ${SUITE_FILES[*]}; do
+ echo " $suite"
+ done
+ echo
+
+ # check if some necessary variables is set
+ if [ -z "$OS_AUTH_URL" ]; then
+ echo "OS_AUTH_URL is unset or empty"
+ exit 1
+ fi
+
+ echo "OS_AUTH_URL is $OS_AUTH_URL"
+ echo
+
+ # check OpenStack services
+ echo "Checking OpenStack services:"
+ for cmd in "glance image-list" "nova list" "heat stack-list"; do
+ echo " checking ${cmd/%\ */} ..."
+ if ! $cmd >/dev/null; then
+ echo "error: command \"$cmd\" failed"
+ exit 1
+ fi
+ done
+
+ echo
+ echo "Checking for External network:"
+ for net in $(neutron net-list --router:external True -c name -f value); do
+ echo " external network: $net"
+ done
+
+ # install yardstick
+ install_yardstick
+
+ cleanup
+
+ trap "error_exit" EXIT SIGTERM
+
+ QCOW_IMAGE="/tmp/workspace/yardstick/yardstick-trusty-server.img"
+
+ build_yardstick_image
+ load_yardstick_image
+ load_cirros_image
+ create_nova_flavor
+
+ run_test
+}
+
+main