summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile76
-rwxr-xr-xdocker/common.sh107
-rwxr-xr-xdocker/prepare_env.sh210
-rw-r--r--docker/requirements.pip16
-rwxr-xr-xdocker/run_tests.sh215
5 files changed, 624 insertions, 0 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
new file mode 100644
index 000000000..69c2bd48f
--- /dev/null
+++ b/docker/Dockerfile
@@ -0,0 +1,76 @@
+########################################
+# Docker container for FUNCTEST
+########################################
+# Purpose: run all the tests against the POD
+# from a pre-installed docker image
+#
+# Maintained by Jose Lausuch
+# Build:
+# $ docker build -t opnfv/functest:tag .
+#
+# Execution:
+# $ docker run -t -i \
+# -e "INSTALLER_TYPE=fuel|apex|compass|joid \
+# -e "INSTALLER_IP=10.20.0.2/172.30.10.73" \
+# -v $(pwd)/config_functest.yaml:/home/opnfv/functest/conf/config_functest.yaml
+# opnfv/functest /bin/bash
+#
+# NOTE: providing config_functest.yaml is optional. If not provided, it will
+# use the default one located in the repo
+
+
+FROM ubuntu:14.04
+MAINTAINER Jose Lausuch <jose.lausuch@ericsson.com>
+LABEL version="0.1" description="OPNFV Functest Docker container"
+
+ENV HOME /home/opnfv
+ENV repos_dir /home/opnfv/repos
+ENV creds /home/opnfv/functest/conf/openstack.creds
+WORKDIR /home/opnfv
+
+# Packaged dependencies
+RUN apt-get update && apt-get install -y \
+ssh \
+sshpass \
+curl \
+git \
+gcc \
+wget \
+python-dev \
+python-pip \
+bundler \
+postgresql \
+build-essential \
+libpq-dev \
+libxslt-dev \
+libssl-dev \
+libgmp3-dev \
+libxml2-dev \
+libffi-dev \
+crudini \
+ruby1.9.1-dev \
+--no-install-recommends
+
+
+RUN mkdir -p ${repos_dir}
+RUN mkdir -p /root/.ssh
+RUN chmod 700 /root/.ssh
+
+RUN git config --global http.sslVerify false
+RUN git clone -b stable/brahmaputra https://gerrit.opnfv.org/gerrit/functest ${repos_dir}/functest
+RUN git clone https://gerrit.opnfv.org/gerrit/releng ${repos_dir}/releng
+RUN git clone https://gerrit.opnfv.org/gerrit/doctor ${repos_dir}/doctor
+RUN git clone https://github.com/openstack/rally.git ${repos_dir}/rally
+RUN git clone https://github.com/opendaylight/integration.git ${repos_dir}/odl_integration
+RUN git clone -b stable https://github.com/boucherv-orange/clearwater-live-test ${repos_dir}/vims-test
+RUN git clone https://github.com/openstack/networking-bgpvpn ${repos_dir}/bgpvpn
+RUN git clone https://gerrit.onosproject.org/OnosSystemTest ${repos_dir}/onos
+RUN git clone https://github.com/opnfv/promise ${repos_dir}/promise
+
+RUN pip install -r ${repos_dir}/functest/docker/requirements.pip
+RUN pip install -r ${repos_dir}/rally/requirements.txt
+
+ADD http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img /home/opnfv/functest/data/
+
+RUN gpg --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
+RUN curl -L https://get.rvm.io | bash -s stable
diff --git a/docker/common.sh b/docker/common.sh
new file mode 100755
index 000000000..f03572d76
--- /dev/null
+++ b/docker/common.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+#
+# Author: Jose Lausuch (jose.lausuch@ericsson.com)
+#
+# Installs the Functest framework within the Docker container
+# and run the tests automatically
+#
+# If config_functest.yaml is given by the docker run command,
+# it must be run like this:
+#
+# docker run -ti \
+# -e "INSTALLER_TYPE=<something>" \
+# -e "INSTALLER_IP=<ip>" \
+# -v $(pwd)/config_functest.yaml:/home/opnfv/functest/conf/config_functest.yaml \
+# opnfv/functest /bin/bash
+#
+# NOTE: $(pwd)/config_functest.yaml means that it will take the one in the
+# current directory.
+#
+# If it is not provided, take the existing one in the functest repo
+#
+
+# this pull is to be removed right before the B release, once we build
+# a release candidate docker
+cd $repos_dir/functest
+git pull
+
+mkdir -p /home/opnfv/functest/conf
+config_file=/home/opnfv/functest/conf/config_functest.yaml
+if [ ! -f ${config_file} ]; then
+ default_config_file=$(find /home/opnfv/repos -name config_functest.yaml)
+ cp $default_config_file $config_file
+ echo "config_functest.yaml not provided. Using default one"
+fi
+
+
+# Parse config_functest.yaml file
+# TODO: this is not the best way to parse a yaml file in bash...
+
+# Directories
+REPOS_DIR=$(cat $config_file | grep -w dir_repos | awk 'END {print $NF}')
+FUNCTEST_REPO_DIR=$(cat $config_file | grep -w dir_repo_functest | awk 'END {print $NF}')
+RALLY_REPO_DIR=$(cat $config_file | grep -w dir_repo_rally | awk 'END {print $NF}')
+RELENG_REPO_DIR=$(cat $config_file | grep -w dir_repo_releng | awk 'END {print $NF}')
+VIMS_REPO_DIR=$(cat $config_file | grep -w dir_repo_vims_test | awk 'END {print $NF}')
+BGPVPN_REPO_DIR=$(cat $config_file | grep -w dir_repo_bgpvpn | awk 'END {print $NF}')
+
+FUNCTEST_DIR=$(cat $config_file | grep -w dir_functest | awk 'END {print $NF}')
+FUNCTEST_RESULTS_DIR=$(cat $config_file | grep -w dir_results | awk 'END {print $NF}')
+FUNCTEST_CONF_DIR=$(cat $config_file | grep -w dir_functest_conf | awk 'END {print $NF}')
+FUNCTEST_DATA_DIR=$(cat $config_file | grep -w dir_functest_data | awk 'END {print $NF}')
+RALLY_VENV_DIR=$(cat $config_file | grep -w dir_rally_inst | awk 'END {print $NF}')
+
+# Repos
+RALLY_BRANCH=$(cat $config_file | grep -w rally_branch | awk 'END {print $NF}')
+RALLY_COMMIT=$(cat $config_file | grep -w rally_commit | awk 'END {print $NF}')
+FUNCTEST_BRANCH=$(cat $config_file | grep -w functest_branch | awk 'END {print $NF}')
+FUNCTEST_COMMIT=$(cat $config_file | grep -w functest_commit | awk 'END {print $NF}')
+RELENG_BRANCH=$(cat $config_file | grep -w releng_branch | awk 'END {print $NF}')
+RELENG_COMMIT=$(cat $config_file | grep -w releng_commit | awk 'END {print $NF}')
+VIMS_BRANCH=$(cat $config_file | grep -w vims_test_branch | awk 'END {print $NF}')
+VIMS_COMMIT=$(cat $config_file | grep -w vims_test_commit | awk 'END {print $NF}')
+BGPVPN_BRANCH=$(cat $config_file | grep -w bgpvpn_branch | awk 'END {print $NF}')
+BGPVPN_COMMIT=$(cat $config_file | grep -w bgpvpn_commit | awk 'END {print $NF}')
+ONOS_BRANCH=$(cat $config_file | grep -w onos_branch | awk 'END {print $NF}')
+ONOS_COMMIT=$(cat $config_file | grep -w onos_commit | awk 'END {print $NF}')
+PROMISE_BRANCH=$(cat $config_file | grep -w promise_branch | awk 'END {print $NF}')
+PROMISE_COMMIT=$(cat $config_file | grep -w promise_commit | awk 'END {print $NF}')
+
+
+echo "_____Parsed needed data from ${config_file}:"
+echo "####### Directories #######"
+echo "REPOS_DIR=${REPOS_DIR}"
+echo "FUNCTEST_REPO_DIR=${FUNCTEST_REPO_DIR}"
+echo "RALLY_REPO_DIR=${RALLY_REPO_DIR}"
+echo "RELENG_REPO_DIR=${RELENG_REPO_DIR}"
+echo "VIMS_REPO_DIR=${VIMS_REPO_DIR}"
+echo "FUNCTEST_DIR=${FUNCTEST_DIR}"
+echo "FUNCTEST_RESULTS_DIR=${FUNCTEST_RESULTS_DIR}"
+echo "FUNCTEST_CONF_DIR=${FUNCTEST_CONF_DIR}"
+echo "FUNCTEST_DATA_DIR=${FUNCTEST_DATA_DIR}"
+echo "RALLY_VENV_DIR=${RALLY_VENV_DIR}"
+echo "####### Repositories #######"
+echo "FUNCTEST_BRANCH=${FUNCTEST_BRANCH}"
+echo "FUNCTEST_COMMIT=${FUNCTEST_COMMIT}"
+echo "RELENG_BRANCH=${RELENG_BRANCH}"
+echo "RELENG_COMMIT=${RELENG_COMMIT}"
+echo "RALLY_BRANCH=${RALLY_BRANCH}"
+echo "RALLY_COMMIT=${RALLY_COMMIT}"
+echo "VIMS_BRANCH=${VIMS_BRANCH}"
+echo "VIMS_COMMIT=${VIMS_COMMIT}"
+echo "ONOS_BRANCH=${ONOS_BRANCH}"
+echo "ONOS_COMMIT=${ONOS_COMMIT}"
+echo "PROMISE_BRANCH=${PROMISE_BRANCH}"
+echo "PROMISE_COMMIT=${PROMISE_COMMIT}"
+echo "############################"
+
+info () {
+ logger -s -t "FUNCTEST.info" "$*"
+}
+
+
+error () {
+ logger -s -t "FUNCTEST.error" "$*"
+ exit 1
+}
diff --git a/docker/prepare_env.sh b/docker/prepare_env.sh
new file mode 100755
index 000000000..48320d4cc
--- /dev/null
+++ b/docker/prepare_env.sh
@@ -0,0 +1,210 @@
+#!/bin/bash
+
+#
+# Author: Jose Lausuch (jose.lausuch@ericsson.com)
+#
+# Installs the Functest framework within the Docker container
+# and run the tests automatically
+#
+
+usage="Script to prepare the Functest environment.
+
+usage:
+ bash $(basename "$0") [--offline] [-h|--help] [-t <test_name>]
+
+where:
+ -o|--offline optional offline mode (experimental)
+ -h|--help show this help text
+
+examples:
+ $(basename "$0")
+ $(basename "$0") --offline"
+
+offline=false
+
+# Parse parameters
+while [[ $# > 0 ]]
+ do
+ key="$1"
+ case $key in
+ -h|--help)
+ echo "$usage"
+ exit 0
+ shift
+ ;;
+ -o|--offline)
+ offline=true
+ ;;
+ *)
+ error "unknown option $1"
+ exit 1
+ ;;
+ esac
+ shift # past argument or value
+done
+
+BASEDIR=`dirname $0`
+source ${BASEDIR}/common.sh
+
+# Support for Functest offline
+# NOTE: Still not 100% working when running the tests
+
+info "######### Preparing Functest environment #########"
+if [ $offline == false ]; then
+ info "MODE: online"
+else
+ info "MODE: offline"
+fi
+
+# definition of available installer names
+INSTALLERS=(fuel compass apex joid)
+
+if [ ! -f ${FUNCTEST_CONF_DIR}/openstack.creds ]; then
+ # If credentials file is not given, check if environment variables are set
+ # to get the creds using fetch_os_creds.sh later on
+ info "Checking environment variables INSTALLER_TYPE and INSTALLER_IP"
+ if [ -z ${INSTALLER_TYPE} ]; then
+ error "Environment variable 'INSTALLER_TYPE' is not defined."
+ elif [[ ${INSTALLERS[@]} =~ ${INSTALLER_TYPE} ]]; then
+ info "INSTALLER_TYPE env variable found: ${INSTALLER_TYPE}"
+ else
+ error "Invalid environment variable INSTALLER_TYPE=${INSTALLER_TYPE}"
+ fi
+
+ if [ -z ${INSTALLER_IP} ]; then
+ error "Environment variable 'INSTALLER_IP' is not defined."
+ fi
+ info "INSTALLER_IP env variable found: ${INSTALLER_IP}"
+fi
+
+
+if [ $offline == false ]; then
+ # Update repos
+ info "Updating Releng repository...."
+ cd ${RELENG_REPO_DIR}
+ if [ ${RELENG_BRANCH} != "master" ]; then
+ info "Releng repo: checkout ${RELENG_BRANCH} branch..."
+ git checkout ${RELENG_BRANCH}
+ fi
+ info "Releng repo: pulling to latest..."
+ git pull
+ if [ ${RELENG_COMMIT} != "latest" ]; then
+ info "Releng repo: given commit is ${RELENG_COMMIT}. Reseting..."
+ git reset --hard ${RELENG_COMMIT}
+ fi
+
+ info "Updating Rally repository...."
+ cd ${RALLY_REPO_DIR}
+ if [ ${RALLY_BRANCH} != "master" ]; then
+ info "Rally repo: checkout ${RALLY_BRANCH} branch..."
+ git checkout ${RALLY_BRANCH}
+ fi
+ info "Rally repo: pulling to latest..."
+ git pull
+ # We leave the reset command for later.
+
+ info "Updating vIMS test repository...."
+ cd ${VIMS_REPO_DIR}
+ if [ ${VIMS_BRANCH} != "stable" ]; then
+ info "Releng repo: checkout ${VIMS_TEST_BRANCH} branch..."
+ git checkout ${VIMS_BRANCH}
+ fi
+ info "vIMS test repo: pulling to latest..."
+ git pull
+ if [ ${VIMS_COMMIT} != "latest" ]; then
+ info "vIMS test repo: given commit is ${VIMS_TEST_COMMIT}. Reseting..."
+ git reset --hard ${VIMS_COMMIT}
+ fi
+
+ info "Updating BGPVPN repository...."
+ cd ${BGPVPN_REPO_DIR}
+ if [ ${BGPVPN_BRANCH} != "master" ]; then
+ info "BGPVPN repo: checkout ${BGPVPN_BRANCH} branch..."
+ git checkout ${BGPVPN_BRANCH}
+ fi
+ info "BGPVPN repo: pulling to latest..."
+ git pull
+ if [ ${BGPVPN_COMMIT} != "latest" ]; then
+ info "BGPVPN repo: given commit is ${BGPVPN_COMMIT}. Reseting..."
+ git reset --hard ${BGPVPN_COMMIT}
+ fi
+
+ info "Updating ONOS repository...."
+ cd ${ONOS_REPO_DIR}
+ if [ ${ONOS_BRANCH} != "master" ]; then
+ info "ONOS repo: checkout ${ONOS} branch..."
+ git checkout ${ONOS_BRANCH}
+ fi
+ info "ONOS repo: pulling to latest..."
+ git pull
+ if [ ${ONOS_COMMIT} != "latest" ]; then
+ info "ONOS repo: given commit is ${ONOS_COMMIT}. Reseting..."
+ git reset --hard ${ONOS_COMMIT}
+ fi
+
+ info "Updating PROMISE repository...."
+ cd ${PROMISE_REPO_DIR}
+ if [ ${PROMISE_BRANCH} != "master" ]; then
+ info "PROMISE repo: checkout ${PROMISE} branch..."
+ git checkout ${PROMISE_BRANCH}
+ fi
+ info "PROMISE repo: pulling to latest..."
+ git pull
+ if [ ${PROMISE_COMMIT} != "latest" ]; then
+ info "PROMISE repo: given commit is ${PROMISE_COMMIT}. Reseting..."
+ git reset --hard ${PROMISE_COMMIT}
+ fi
+
+fi
+
+# We do this regardless if its online or offline mode.
+# Assumption: the docker image contains a newer rally repo than the given commit.
+if [ ${RALLY_COMMIT} != "latest" ]; then
+ cd ${RALLY_REPO_DIR}
+ info "Rally repo: given commit is ${RALLY_COMMIT}. Reseting..."
+ git reset --hard ${RALLY_COMMIT}
+fi
+
+
+# Create directories
+mkdir -p ${FUNCTEST_CONF_DIR}
+mkdir -p ${FUNCTEST_DATA_DIR}
+mkdir -p ${FUNCTEST_RESULTS_DIR}/ODL
+
+
+
+# Create Openstack credentials file
+if [ ! -f ${FUNCTEST_CONF_DIR}/openstack.creds ]; then
+ ${REPOS_DIR}/releng/utils/fetch_os_creds.sh -d ${FUNCTEST_CONF_DIR}/openstack.creds \
+ -i ${INSTALLER_TYPE} -a ${INSTALLER_IP}
+ retval=$?
+ if [ $retval != 0 ]; then
+ error "Cannot retrieve credentials file from installation. Check logs."
+ exit $retval
+ fi
+else
+ info "OpenStack credentials file given to the docker and stored in ${FUNCTEST_CONF_DIR}/openstack.creds."
+fi
+# Source credentials
+source ${FUNCTEST_CONF_DIR}/openstack.creds
+
+# Check OpenStack
+info "Checking that the basic OpenStack services are functional..."
+${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/check_os.sh
+RETVAL=$?
+if [ $RETVAL -ne 0 ]; then
+ exit 1
+fi
+
+# Prepare Functest Environment
+info "Functest: prepare Functest environment"
+python ${FUNCTEST_REPO_DIR}/testcases/config_functest.py --debug start
+retval=$?
+if [ $retval != 0 ]; then
+ error "Error when configuring Functest environment"
+ exit $retval
+fi
+
+ifconfig eth0 mtu 1450
+
+echo "1" > ${FUNCTEST_CONF_DIR}/env_active
diff --git a/docker/requirements.pip b/docker/requirements.pip
new file mode 100644
index 000000000..8644154cf
--- /dev/null
+++ b/docker/requirements.pip
@@ -0,0 +1,16 @@
+pyyaml==3.10
+gitpython==1.0.1
+python-neutronclient==2.6.0
+python-novaclient==2.28.1
+python-glanceclient==1.1.0
+python-cinderclient==1.4.0
+python-ceilometerclient==1.5.1
+python-keystoneclient==1.6.0
+virtualenv==1.11.4
+pexpect==4.0
+requests==2.8.0
+robotframework==2.9.1
+robotframework-requests==0.3.8
+robotframework-sshlibrary==2.1.1
+configObj==5.0.6
+Flask==0.10.1
diff --git a/docker/run_tests.sh b/docker/run_tests.sh
new file mode 100755
index 000000000..2225791a4
--- /dev/null
+++ b/docker/run_tests.sh
@@ -0,0 +1,215 @@
+#!/bin/bash
+
+#
+# Author: Jose Lausuch (jose.lausuch@ericsson.com)
+#
+# Installs the Functest framework within the Docker container
+# and run the tests automatically
+#
+
+usage="Script to trigger the tests automatically.
+
+usage:
+ bash $(basename "$0") [--offline] [-h|--help] [-t <test_name>]
+
+where:
+ -o|--offline optional offline mode (experimental)
+ -h|--help show this help text
+ -r|--report push results to database (false by default)
+ -t|--test run specific set of tests
+ <test_name> one or more of the following: vping,odl,rally,tempest,vims,onos, promise. Separated by comma.
+
+
+examples:
+ $(basename "$0")
+ $(basename "$0") --test vping,odl
+ $(basename "$0") --offline -t tempest,rally"
+
+
+# Support for Functest offline
+# NOTE: Still not 100% working when running the tests
+offline=false
+report=""
+# Get the list of runnable tests
+# Check if we are in CI mode
+if [[ -n "$DEPLOY_SCENARIO" && "$DEPLOY_SCENARIO" != "none" ]]; then
+ testcase=`cat /home/opnfv/functest/conf/testcase-list.txt`
+ arr_test=("$testcase")
+else
+ arr_test=(vping tempest vims rally)
+fi
+
+function clean_openstack(){
+ echo -e "\n\nCleaning Openstack environment..."
+ python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/clean_openstack.py \
+ --debug
+ echo -e "\n\n"
+}
+
+function run_test(){
+ test_name=$1
+ echo ""
+ echo "----------------------------------------------"
+ echo " Running test case: $i"
+ echo "----------------------------------------------"
+ echo ""
+ case $test_name in
+ "vping")
+ info "Running vPing test..."
+ python ${FUNCTEST_REPO_DIR}/testcases/vPing/CI/libraries/vPing.py \
+ --debug ${report}
+ ;;
+ "odl")
+ info "Running ODL test..."
+ neutron_ip=$(keystone catalog --service identity | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
+ odl_ip=$(keystone catalog --service network | grep publicURL | cut -f3 -d"/" | cut -f1 -d":")
+ usr_name=$(env | grep OS | grep OS_USERNAME | cut -f2 -d'=')
+ password=$(env | grep OS | grep OS_PASSWORD | cut -f2 -d'=')
+ odl_port=8181
+ if [ $INSTALLER_TYPE == "fuel" ]; then
+ odl_port=8282
+ elif [ $INSTALLER_TYPE == "apex" ]; then
+ pass
+ elif [ $INSTALLER_TYPE == "joid" ]; then
+ pass
+ elif [ $INSTALLER_TYPE == "compass" ]; then
+ pass
+ else
+ error "INSTALLER_TYPE not valid."
+ exit 1
+ fi
+ ODL_PORT=$odl_port ODL_IP=$odl_ip NEUTRON_IP=$neutron_ip USR_NAME=$usr_name PASS=$password \
+ ${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/start_tests.sh
+
+ # save ODL results
+ odl_logs="${FUNCTEST_REPO_DIR}/testcases/Controllers/ODL/CI/logs"
+ if [ -d ${odl_logs} ]; then
+ cp -Rf ${odl_logs} ${FUNCTEST_CONF_DIR}/ODL/
+ fi
+ ;;
+ "tempest")
+ info "Running Tempest tests..."
+ python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_tempest.py \
+ --debug -m custom ${report}
+ # save tempest.conf for further troubleshooting
+ tempest_conf="${RALLY_VENV_DIR}/tempest/for-deployment-*/tempest.conf"
+ if [ -f ${tempest_conf} ]; then
+ cp $tempest_conf ${FUNCTEST_CONF_DIR}
+ fi
+ clean_openstack
+ ;;
+ "vims")
+ info "Running vIMS test..."
+ python ${FUNCTEST_REPO_DIR}/testcases/vIMS/CI/vIMS.py \
+ --debug ${report}
+ clean_openstack
+ ;;
+ "rally")
+ info "Running Rally benchmark suite..."
+ cinder type-create volume-test #provisional
+ python ${FUNCTEST_REPO_DIR}/testcases/VIM/OpenStack/CI/libraries/run_rally.py \
+ --debug all ${report}
+ cinder type-delete $(cinder type-list|grep test|awk '{print $2}')
+ clean_openstack
+
+ ;;
+ "bgpvpn_template")
+ info "Running BGPVPN Tempest test case..."
+ tempest_dir=$(find /root/.rally -type d -name for-deploy*)
+ # TODO:
+ # do the call of your test case here.
+ # the bgpvpn repo is cloned in $BGPVPN_REPO_DIR
+ # tempest is installed in $tempest_dir
+ # Suggestion:
+ # mkdir ${tempest_dir}/tempest/api/bgpvpn/
+ # cp ${BGPVPN_REPO_DIR}/networking_bgpvpn_tempest/<whatever you need> \
+ # ${tempest_dir}/tempest/api/bgpvpn/
+ # ${tempest_dir}/run_tempest.sh tempest.api.bgpvpn.<test_case_name>
+ ;;
+ "onos")
+ info "Running ONOS test case..."
+ python ${FUNCTEST_REPO_DIR}/testcases/Controllers/ONOS/Teston/CI/onosfunctest.py
+ ;;
+ "promise")
+ info "Running PROMISE test case..."
+ # TODO
+ ;;
+ "doctor")
+ info "Running Doctor test..."
+ python ${FUNCTEST_REPO_DIR}/testcases/features/doctor.py
+ ;;
+ esac
+}
+
+
+# Parse parameters
+while [[ $# > 0 ]]
+ do
+ key="$1"
+ case $key in
+ -h|--help)
+ echo "$usage"
+ exit 0
+ shift
+ ;;
+ -o|--offline)
+ offline=true
+ ;;
+ -r|--report)
+ report="-r"
+ ;;
+ -t|--test|--tests)
+ TEST="$2"
+ shift
+ ;;
+ *)
+ echo "unknown option $1 $2"
+ exit 1
+ ;;
+ esac
+ shift # past argument or value
+done
+
+BASEDIR=`dirname $0`
+source ${BASEDIR}/common.sh
+
+
+# Check that the given tests are correct
+if [ "${TEST}" != "" ]; then
+ arr_test_exec=(${TEST//,/ })
+ for i in "${arr_test_exec[@]}"; do
+ if [[ " ${arr_test[*]} " != *" $i "* ]]; then
+ error "Unknown test: $i. Available tests are: ${arr_test[@]}"
+ fi
+ done
+ info "Tests to execute: ${TEST}."
+fi
+
+if [ $offline == false ]; then
+ info "MODE: online"
+else
+ info "MODE: offline"
+fi
+
+# Check that the functest environment has been installed
+if [ ! -f ${FUNCTEST_CONF_DIR}/env_active ]; then
+ error "The Functest environment is not installed. \
+ Please run prepare_env.sh before running this script...."
+fi
+
+
+# Source credentials
+info "Sourcing Credentials ${FUNCTEST_CONF_DIR}/openstack.creds to run the tests.."
+source ${FUNCTEST_CONF_DIR}/openstack.creds
+
+# Run tests
+if [ "${TEST}" != "" ]; then
+ for i in "${arr_test_exec[@]}"; do
+ run_test $i
+ done
+else
+ info "Executing all the tests"
+ for i in "${arr_test[@]}"; do
+ run_test $i
+ done
+fi