1 .. This work is licensed under a Creative Commons Attribution 4.0 International
3 .. http://creativecommons.org/licenses/by/4.0
4 .. (c) OPNFV, Ericsson AB, Huawei Technologies Co.,Ltd and others.
12 Yardstick supports installation on Ubuntu 14.04 or via a Docker image. The
13 installation procedure on Ubuntu 14.04 or via the docker image are detailed in
16 To use Yardstick you should have access to an OpenStack environment, with at
17 least Nova, Neutron, Glance, Keystone and Heat installed.
19 The steps needed to run Yardstick are:
22 2. Load OpenStack environment variables.
23 3. Create a Neutron external network.
24 4. Build Yardstick flavor and a guest image.
25 5. Load the guest image into the OpenStack environment.
26 6. Create the test configuration .yaml file.
33 The OPNFV deployment is out of the scope of this document but it can be
34 found in http://artifacts.opnfv.org/opnfvdocs/colorado/docs/configguide/index.html.
35 The OPNFV platform is considered as the System Under Test (SUT) in this
38 Several prerequisites are needed for Yardstick:
40 #. A Jumphost to run Yardstick on
41 #. A Docker daemon shall be installed on the Jumphost
42 #. A public/external network created on the SUT
43 #. Connectivity from the Jumphost to the SUT public/external network
45 WARNING: Connectivity from Jumphost is essential and it is of paramount
46 importance to make sure it is working before even considering to install
47 and run Yardstick. Make also sure you understand how your networking is
50 NOTE: **Jumphost** refers to any server which meets the previous
51 requirements. Normally it is the same server from where the OPNFV
52 deployment has been triggered previously.
54 NOTE: If your Jumphost is operating behind a company http proxy and/or
55 Firewall, please consult first the section `Proxy Support`_, towards
56 the end of this document. The section details some tips/tricks which
57 *may* be of help in a proxified environment.
60 Installing Yardstick on Ubuntu 14.04
61 ------------------------------------
63 .. _install-framework:
65 You can install Yardstick framework directly on Ubuntu 14.04 or in an Ubuntu
66 14.04 Docker image. No matter which way you choose to install Yardstick
67 framework, the following installation steps are identical.
69 If you choose to use the Ubuntu 14.04 Docker image, You can pull the Ubuntu
70 14.04 Docker image from Docker hub:
74 docker pull ubuntu:14.04
76 Installing Yardstick framework
77 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
78 Download source code and install python dependencies:
82 git clone https://gerrit.opnfv.org/gerrit/yardstick
87 Installing Yardstick using Docker
88 ---------------------------------
90 Yardstick has a Docker image, this Docker image (**Yardstick-stable**)
91 serves as a replacement for installing the Yardstick framework in a virtual
92 environment (for example as done in :ref:`install-framework`).
93 It is recommended to use this Docker image to run Yardstick test.
95 Pulling the Yardstick Docker image
96 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98 .. _dockerhub: https://hub.docker.com/r/opnfv/yardstick/
100 Pull the Yardstick Docker image ('opnfv/yardstick') from the public dockerhub
101 registry under the OPNFV account: [dockerhub_], with the following docker
104 docker pull opnfv/yardstick:stable
106 After pulling the Docker image, check that it is available with the
107 following docker command::
109 [yardsticker@jumphost ~]$ docker images
110 REPOSITORY TAG IMAGE ID CREATED SIZE
111 opnfv/yardstick stable a4501714757a 1 day ago 915.4 MB
113 Run the Docker image:
117 docker run --privileged=true -it opnfv/yardstick:stable /bin/bash
119 In the container the Yardstick repository is located in the /home/opnfv/repos
123 OpenStack parameters and credentials
124 ------------------------------------
126 Environment variables
127 ^^^^^^^^^^^^^^^^^^^^^
128 Before running Yardstick it is necessary to export OpenStack environment variables
129 from the OpenStack *openrc* file (using the ``source`` command) and export the
130 external network name ``export EXTERNAL_NETWORK="external-network-name"``,
131 the default name for the external network is ``net04_ext``.
133 Credential environment variables in the *openrc* file have to include at least:
140 A sample openrc file may look like this:
142 * export OS_PASSWORD=console
143 * export OS_TENANT_NAME=admin
144 * export OS_AUTH_URL=http://172.16.1.222:35357/v2.0
145 * export OS_USERNAME=admin
146 * export OS_VOLUME_API_VERSION=2
147 * export EXTERNAL_NETWORK=net04_ext
150 Yardstick falvor and guest images
151 ---------------------------------
153 Before executing Yardstick test cases, make sure that yardstick guest image and
154 yardstick flavor are available in OpenStack.
155 Detailed steps about creating yardstick flavor and building yardstick-trusty-server
156 image can be found below.
160 Most of the sample test cases in Yardstick are using an OpenStack flavor called
161 *yardstick-flavor* which deviates from the OpenStack standard m1.tiny flavor by the
162 disk size - instead of 1GB it has 3GB. Other parameters are the same as in m1.tiny.
164 Create yardstick-flavor:
168 nova flavor-create yardstick-flavor 100 512 3 1
173 Building a guest image
174 ^^^^^^^^^^^^^^^^^^^^^^
175 Most of the sample test cases in Yardstick are using a guest image called
176 *yardstick-trusty-server* which deviates from an Ubuntu Cloud Server image
177 containing all the required tools to run test cases supported by Yardstick.
178 Yardstick has a tool for building this custom image. It is necessary to have
179 sudo rights to use this tool.
181 Also you may need install several additional packages to use this tool, by
182 follwing the commands below:
186 apt-get update && apt-get install -y \
190 This image can be built using the following command while in the directory where
191 Yardstick is installed (``~/yardstick`` if the framework is installed
192 by following the commands above):
196 export YARD_IMG_ARCH="amd64"
197 sudo echo "Defaults env_keep += \"YARD_IMG_ARCH\"" >> /etc/sudoers
198 sudo ./tools/yardstick-img-modify tools/ubuntu-server-cloudimg-modify.sh
200 **Warning:** the script will create files by default in:
201 ``/tmp/workspace/yardstick`` and the files will be owned by root!
203 If you are building this guest image in inside a docker container make sure the
204 container is granted with privilege.
206 The created image can be added to OpenStack using the ``glance image-create`` or
207 via the OpenStack Dashboard.
213 glance --os-image-api-version 1 image-create \
214 --name yardstick-image --is-public true \
215 --disk-format qcow2 --container-format bare \
216 --file /tmp/workspace/yardstick/yardstick-image.img
218 Some Yardstick test cases use a Cirros image, you can find one at
219 http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img
222 Automatic flavor and image creation
223 -----------------------------------
224 Yardstick has a script for automatic creating yardstick flavor and building
225 guest images. This script is mainly used in CI, but you can still use it in
226 your local environment.
232 export YARD_IMG_ARCH="amd64"
233 sudo echo "Defaults env_keep += \"YARD_IMG_ARCH\"" >> /etc/sudoers
234 source $YARDSTICK_REPO_DIR/tests/ci/load_images.sh
237 Yardstick default key pair
238 ^^^^^^^^^^^^^^^^^^^^^^^^^^
239 Yardstick uses a SSH key pair to connect to the guest image. This key pair can
240 be found in the ``resources/files`` directory. To run the ``ping-hot.yaml`` test
241 sample, this key pair needs to be imported to the OpenStack environment.
244 Examples and verifying the install
245 ----------------------------------
247 It is recommended to verify that Yardstick was installed successfully
248 by executing some simple commands and test samples. Before executing yardstick
249 test cases make sure yardstick flavor and building yardstick-trusty-server
250 image can be found in glance and openrc file is sourced. Below is an example
251 invocation of yardstick help command and ping.py test sample:
255 yardstick task start samples/ping.yaml
257 Each testing tool supported by Yardstick has a sample configuration file.
258 These configuration files can be found in the **samples** directory.
260 Default location for the output is ``/tmp/yardstick.out``.
263 Deploy InfluxDB and Grafana locally
264 ------------------------------------
266 .. pull docker images
270 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
274 docker pull tutum/influxdb
275 docker pull grafana/grafana
277 Run influxdb and config
278 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
282 docker run -d --name influxdb \
283 -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 \
285 docker exec -it influxdb bash
291 >CREATE USER root WITH PASSWORD 'root' WITH ALL PRIVILEGES
292 >CREATE DATABASE yardstick;
296 Run grafana and config
297 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
301 docker run -d --name grafana -p 3000:3000 grafana/grafana
306 http://{YOUR_IP_HERE}:3000
307 log on using admin/admin and config database resource to be {YOUR_IP_HERE}:8086
309 .. image:: images/Grafana_config.png
311 :alt: Grafana data source configration
313 Config yardstick conf
314 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
315 cp ./etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf
317 vi /etc/yardstick/yardstick.conf
318 Config yardstick.conf
323 dispatcher = influxdb
325 [dispatcher_influxdb]
327 target = http://{YOUR_IP_HERE}:8086
332 Now you can run yardstick test cases and store the results in influxdb
333 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336 Create a test suite for yardstick
337 ------------------------------------
339 A test suite in yardstick is a yaml file which include one or more test cases.
340 Yardstick is able to support running test suite task, so you can customize you
341 own test suite and run it in one task.
343 "tests/opnfv/test_suites" is where yardstick put ci test-suite. A typical test
351 # Fuel integration test task suite
353 schema: "yardstick:suite:0.1"
355 name: "fuel_test_suite"
356 test_cases_dir: "samples/"
361 file_name: iperf3.yaml
363 As you can see, there are two test cases in fuel_test_suite, the syntax is simple
364 here, you must specify the schema and the name, then you just need to list the
365 test cases in the tag "test_cases" and also mark their relative directory in the
366 tag "test_cases_dir".
368 Yardstick test suite also support constraints and task args for each test case.
369 Here is another sample to show this, which is digested from one big test suite.
371 os-nosdn-nofeature-ha.yaml
377 schema: "yardstick:suite:0.1"
379 name: "os-nosdn-nofeature-ha"
380 test_cases_dir: "tests/opnfv/test_cases/"
383 file_name: opnfv_yardstick_tc002.yaml
385 file_name: opnfv_yardstick_tc005.yaml
387 file_name: opnfv_yardstick_tc043.yaml
392 huawei-pod1: '{"pod_info": "etc/yardstick/.../pod.yaml",
393 "host": "node4.LF","target": "node5.LF"}'
395 As you can see in test case "opnfv_yardstick_tc043.yaml", there are two tags, "constraint" and
396 "task_args". "constraint" is where you can specify which installer or pod it can be run in
397 the ci environment. "task_args" is where you can specify the task arguments for each pod.
399 All in all, to create a test suite in yardstick, you just need to create a suite yaml file
400 and add test cases and constraint or task arguments if necessary.