OPTIONS:
-h Show this message
- -r IP address for Result API.
- Default is to store the results to file ($DISPATCHER_FILE_NAME)
- if this option is not present.
+ -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:h" OPTION; do
+while getopts "r:i:h" OPTION; do
case $OPTION in
h)
usage
;;
r)
DISPATCHER_TYPE=http
- DISPATCHER_HTTP_TARGET=http://${OPTARG}/results
+ 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"
echo "Deleting image $image..."
glance image-delete $image || true
done
+
+ nova flavor-delete yardstick-flavor &> /dev/null || true
}
exitcode=""
echo
echo "========== Installing yardstick =========="
- if ! sudo python setup.py install; then
- echo 'Yardstick installation failed!'
- exit 1
- fi
+ # uninstall previous version
+ pip uninstall -y yardstick || true
+
+ # Install yardstick
+ pip install .
}
build_yardstick_image()
echo
echo "========== Build yardstick cloud image =========="
- sudo $(which yardstick-img-modify) $(pwd)/tools/ubuntu-server-cloudimg-modify.sh
+ 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
+ fi
+}
+
load_cirros_image()
{
echo
echo "========== Loading cirros cloud image =========="
- local image_file=
-
- wget http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img -O /tmp/cirros.img
+ 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 /tmp/cirros.img)
+ --file $image_file)
echo "$output"
CIRROS_IMAGE_ID=$(echo "$output" | grep " id " | awk '{print $(NF-1)}')
[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
echo "Running test suite: $suite"
echo "---------------------------"
- if ! yardstick task start --suite $suite; then
+ 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
+ # 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
+ done
- if [ $failed -gt 0 ]; then
+ if [ $failed -gt 0 ]; then
- echo "---------------------------"
- echo "$failed out of ${SUITE_FILES[*]} test suites FAILED"
- echo "---------------------------"
- exit 1
+ echo "---------------------------"
+ echo "$failed out of ${SUITE_FILES[*]} test suites FAILED"
+ echo "---------------------------"
+ exit 1
fi
else
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
}
echo
echo "========== Running Yardstick CI with following parameters =========="
echo "Script options: ${SCRIPT} $SCRIPT_ARGS"
- echo "Result API: ${DISPATCHER_HTTP_TARGET:-$DISPATCHER_FILE_NAME}"
+ 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
-
- # install yardstick
- install_yardstick
+ echo
# check if some necessary variables is set
if [ -z "$OS_AUTH_URL" ]; then
exit 1
fi
- # check if the api is up
- echo "Checking if OS API is working..."
- if ! glance image-list > /dev/null; then
- echo "OS API is down"
- 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 -c name -f value); do
+ echo " external network: $net"
+ done
+
+ # install yardstick
+ install_yardstick
cleanup
build_yardstick_image
load_yardstick_image
load_cirros_image
+ create_nova_flavor
run_test
}