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.
13 Yardstick supports installation by Docker or directly in Ubuntu. The
14 installation procedure for Docker and direct installation are detailed in
17 To use Yardstick you should have access to an OpenStack environment, with at
18 least Nova, Neutron, Glance, Keystone and Heat installed.
20 The steps needed to run Yardstick are:
23 2. Load OpenStack environment variables.
24 #. Create Yardstick flavor.
25 #. Build a guest image and load it into the OpenStack environment.
26 #. Create the test configuration ``.yaml`` file and run the test case/suite.
32 The OPNFV deployment is out of the scope of this document and can be found `here <http://artifacts.opnfv.org/opnfvdocs/colorado/docs/configguide/index.html>`_. The OPNFV platform is considered as the System Under Test (SUT) in this document.
34 Several prerequisites are needed for Yardstick:
36 #. A Jumphost to run Yardstick on
37 #. A Docker daemon or a virtual environment installed on the Jumphost
38 #. A public/external network created on the SUT
39 #. Connectivity from the Jumphost to the SUT public/external network
41 **NOTE:** *Jumphost* refers to any server which meets the previous
42 requirements. Normally it is the same server from where the OPNFV
43 deployment has been triggered.
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:** If your Jumphost is operating behind a company http proxy and/or
51 Firewall, please consult first the section `Proxy Support (**Todo**)`_, towards
52 the end of this document. That section details some tips/tricks which
53 *may* be of help in a proxified environment.
56 Install Yardstick using Docker (**recommended**)
57 ---------------------------------------------------
59 Yardstick has a Docker image. It is recommended to use this Docker image to run Yardstick test.
61 Prepare the Yardstick container
62 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
64 .. _dockerhub: https://hub.docker.com/r/opnfv/yardstick/
66 Pull the Yardstick Docker image (``opnfv/yardstick``) from the public dockerhub
67 registry under the OPNFV account: dockerhub_, with the following docker
70 docker pull opnfv/yardstick:stable
72 After pulling the Docker image, check that it is available with the
73 following docker command::
75 [yardsticker@jumphost ~]$ docker images
76 REPOSITORY TAG IMAGE ID CREATED SIZE
77 opnfv/yardstick stable a4501714757a 1 day ago 915.4 MB
79 Run the Docker image to get a Yardstick container::
81 docker run -itd --privileged -v /var/run/docker.sock:/var/run/docker.sock -p 8888:5000 -e INSTALLER_IP=192.168.200.2 -e INSTALLER_TYPE=compass --name yardstick opnfv/yardstick:stable
85 +----------------------------------------------+------------------------------+
86 | parameters | Detail |
87 +==============================================+==============================+
88 | -itd | -i: interactive, Keep STDIN |
89 | | open even if not attached. |
90 | | -t: allocate a pseudo-TTY. |
91 | | -d: run container in |
92 | | detached mode, in the |
94 +----------------------------------------------+------------------------------+
95 | --privileged | If you want to build |
96 | | ``yardstick-image`` in |
97 | | Yardstick container, this |
98 | | parameter is needed. |
99 +----------------------------------------------+------------------------------+
100 | -e INSTALLER_IP=192.168.200.2 | If you want to use yardstick |
101 | | env prepare command(or |
102 | -e INSTALLER_TYPE=compass | related API) to load the |
103 | | images that Yardstick needs, |
104 | | these parameters should be |
106 | | The INSTALLER_IP and |
107 | | INSTALLER_TYPE are depending |
108 | | on your OpenStack installer. |
109 | | Currently Apex, Compass, |
110 | | Fuel and Joid are supported. |
111 | | If you use other installers, |
112 | | such as devstack, these |
113 | | parameters can be ignores. |
114 +----------------------------------------------+------------------------------+
115 | -p 8888:5000 | If you want to call |
116 | | Yardstick API out of |
117 | | Yardstick container, this |
118 | | parameter is needed. |
119 +----------------------------------------------+------------------------------+
120 | -v /var/run/docker.sock:/var/run/docker.sock | If you want to use yardstick |
121 | | env grafana/influxdb to |
122 | | create a grafana/influxdb |
123 | | container out of Yardstick |
124 | | container, this parameter is |
126 +----------------------------------------------+------------------------------+
127 | --name yardstick | The name for this container, |
128 | | not needed and can be |
129 | | defined by the user. |
130 +----------------------------------------------+------------------------------+
132 Configure the Yardstick container environment
133 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
135 There are three ways to configure environments for running Yardstick, which will be shown in the following sections. Before that, enter the Yardstick container::
137 docker exec -it yardstick /bin/bash
139 and then configure Yardstick environments in the Yardstick container.
141 The first way (**recommended**)
142 ###################################
144 In the Yardstick container, the Yardstick repository is located in the ``/home/opnfv/repos`` directory. Yardstick provides a CLI to prepare OpenStack environment variables and create Yardstick flavor and guest images automatically::
146 yardstick env prepare
148 **NOTE**: The above command just works for four OPNFV installers -- **Apex**, **Compass**, **Fuel** and **Joid**.
154 Export OpenStack environment variables
155 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
157 Before running Yardstick it is necessary to export OpenStack environment variables::
161 Environment variables in the ``openrc`` file have to include at least:
167 * ``EXTERNAL_NETWORK``
169 A sample `openrc` file may look like this::
171 export OS_PASSWORD=console
172 export OS_TENANT_NAME=admin
173 export OS_AUTH_URL=http://172.16.1.222:35357/v2.0
174 export OS_USERNAME=admin
175 export OS_VOLUME_API_VERSION=2
176 export EXTERNAL_NETWORK=net04_ext
178 Manually create Yardstick falvor and guest images
179 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
181 Before executing Yardstick test cases, make sure that Yardstick flavor and guest image are available in OpenStack. Detailed steps about creating the Yardstick flavor and building the Yardstick guest image can be found below.
183 Most of the sample test cases in Yardstick are using an OpenStack flavor called
184 ``yardstick-flavor`` which deviates from the OpenStack standard ``m1.tiny`` flavor by the disk size - instead of 1GB it has 3GB. Other parameters are the same as in ``m1.tiny``.
186 Create ``yardstick-flavor``::
188 nova flavor-create yardstick-flavor 100 512 3 1
190 Most of the sample test cases in Yardstick are using a guest image called
191 ``yardstick-image`` which deviates from an Ubuntu Cloud Server image
192 containing all the required tools to run test cases supported by Yardstick.
193 Yardstick has a tool for building this custom image. It is necessary to have
194 ``sudo`` rights to use this tool.
196 Also you may need install several additional packages to use this tool, by
197 follwing the commands below::
199 sudo apt-get update && sudo apt-get install -y qemu-utils kpartx
201 This image can be built using the following command in the directory where Yardstick is installed::
203 sudo tools/yardstick-img-modify tools/ubuntu-server-cloudimg-modify.sh
205 **Warning:** Before building the guest image inside the Yardstick container, make sure the container is granted with privilege. The script will create files by default in ``/tmp/workspace/yardstick`` and the files will be owned by root!
207 The created image can be added to OpenStack using the ``glance image-create`` or via the OpenStack Dashboard. Example command is::
209 glance --os-image-api-version 1 image-create \
210 --name yardstick-image --is-public true \
211 --disk-format qcow2 --container-format bare \
212 --file /tmp/workspace/yardstick/yardstick-image.img
214 .. _`Cirros 0.3.5`: http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
215 .. _`Ubuntu 14.04`: https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
217 Some Yardstick test cases use a `Cirros 0.3.5`_ image and/or a `Ubuntu 14.04`_ image. Add Cirros and Ubuntu images to OpenStack::
219 openstack image create \
220 --disk-format qcow2 \
221 --container-format bare \
222 --file $cirros_image_file \
225 openstack image create \
226 --disk-format qcow2 \
227 --container-format bare \
228 --file $ubuntu_image_file \
235 Similar to the second way, the first step is also to `Export OpenStack environment variables`_. Then the following steps should be done.
237 Automatically create Yardstcik flavor and guest images
238 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
240 Yardstick has a script for automatically creating Yardstick flavor and building
241 Yardstick guest images. This script is mainly used for CI and can be also used in the local environment::
243 source $YARDSTICK_REPO_DIR/tests/ci/load_images.sh
246 Delete the Yardstick container
247 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
249 If you want to uninstall Yardstick, just delete the Yardstick container::
251 docker stop yardstick && docker rm yardstick
254 Install Yardstick directly in Ubuntu
255 ---------------------------------------
257 .. _install-framework:
259 Alternatively you can install Yardstick framework directly in Ubuntu or in an Ubuntu Docker image. No matter which way you choose to install Yardstick, the following installation steps are identical.
261 If you choose to use the Ubuntu Docker image, you can pull the Ubuntu
262 Docker image from Docker hub::
264 docker pull ubuntu:16.04
268 ^^^^^^^^^^^^^^^^^^^^^
270 Create a virtual environment::
272 virtualenv ~/yardstick_venv
273 source ~/yardstick_venv/bin/activate
275 Download the source code and install Yardstick from it::
277 git clone https://gerrit.opnfv.org/gerrit/yardstick
282 Configure the Yardstick environment (**Todo**)
283 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
285 For installing Yardstick directly in Ubuntu, the ``yardstick env`` command is not available. You need to prepare OpenStack environment variables and create Yardstick flavor and guest images manually.
289 ^^^^^^^^^^^^^^^^^^^^^^
291 For unistalling Yardstick, just delete the virtual environment::
293 rm -rf ~/yardstick_venv
296 Verify the installation
297 -----------------------------
299 It is recommended to verify that Yardstick was installed successfully
300 by executing some simple commands and test samples. Before executing Yardstick
301 test cases make sure ``yardstick-flavor`` and ``yardstick-image`` can be found in OpenStack and the ``openrc`` file is sourced. Below is an example
302 invocation of Yardstick ``help`` command and ``ping.py`` test sample::
305 yardstick task start samples/ping.yaml
307 **NOTE:** The above commands could be run in both the Yardstick container and the Ubuntu directly.
309 Each testing tool supported by Yardstick has a sample configuration file.
310 These configuration files can be found in the ``samples`` directory.
312 Default location for the output is ``/tmp/yardstick.out``.
315 Deploy InfluxDB and Grafana using Docker
316 -------------------------------------------
318 Without InfluxDB, Yardstick stores results for runnning test case in the file
319 ``/tmp/yardstick.out``. However, it's unconvenient to retrieve and display
320 test results. So we will show how to use InfluxDB to store data and use
321 Grafana to display data in the following sections.
323 Automatically deploy InfluxDB and Grafana containers (**recommended**)
324 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
326 Firstly, enter the Yardstick container::
328 docker exec -it yardstick /bin/bash
330 Secondly, create InfluxDB container and configure with the following command::
332 yardstick env influxdb
334 Thirdly, create and configure Grafana container::
336 yardstick env grafana
338 Then you can run a test case and visit http://host_ip:3000 (``admin``/``admin``) to see the results.
340 **NOTE:** Executing ``yardstick env`` command to deploy InfluxDB and Grafana requires Jumphost's docker API version => 1.24. Run the following command to check the docker API version on the Jumphost::
344 Manually deploy InfluxDB and Grafana containers
345 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
347 You could also deploy influxDB and Grafana containers manually on the Jumphost.
348 The following sections show how to do.
350 .. pull docker images
357 docker pull tutum/influxdb
358 docker pull grafana/grafana
360 Run and configure influxDB
361 ###############################
365 docker run -d --name influxdb \
366 -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 \
368 docker exec -it influxdb bash
373 >CREATE USER root WITH PASSWORD 'root' WITH ALL PRIVILEGES
374 >CREATE DATABASE yardstick;
378 Run and configure Grafana
379 ###############################
383 docker run -d --name grafana -p 3000:3000 grafana/grafana
385 Log on http://{YOUR_IP_HERE}:3000 using ``admin``/``admin`` and configure database resource to be ``{YOUR_IP_HERE}:8086``.
387 .. image:: images/Grafana_config.png
389 :alt: Grafana data source configration
391 Configure ``yardstick.conf``
392 ##############################
396 docker exec -it yardstick /bin/bash
397 cp etc/yardstick/yardstick.conf.sample /etc/yardstick/yardstick.conf
398 vi /etc/yardstick/yardstick.conf
400 Modify ``yardstick.conf``::
404 dispatcher = influxdb
406 [dispatcher_influxdb]
408 target = http://{YOUR_IP_HERE}:8086
413 Now you can run Yardstick test cases and store the results in influxDB.
416 Deploy InfluxDB and Grafana directly in Ubuntu (**Todo**)
417 -----------------------------------------------------------
420 Create a test suite for Yardstick
421 ------------------------------------
423 A test suite in yardstick is a yaml file which include one or more test cases.
424 Yardstick is able to support running test suite task, so you can customize your
425 own test suite and run it in one task.
427 ``tests/opnfv/test_suites`` is the folder where Yardstick puts CI test suite. A typical test suite is like below (the ``fuel_test_suite.yaml`` example)::
430 # Fuel integration test task suite
432 schema: "yardstick:suite:0.1"
434 name: "fuel_test_suite"
435 test_cases_dir: "samples/"
440 file_name: iperf3.yaml
442 As you can see, there are two test cases in the ``fuel_test_suite.yaml``. The
443 ``schema`` and the ``name`` must be specified. The test cases should be listed
444 via the tag ``test_cases`` and their relative path is also marked via the tag
447 Yardstick test suite also supports constraints and task args for each test
448 case. Here is another sample (the ``os-nosdn-nofeature-ha.yaml`` example) to
449 show this, which is digested from one big test suite::
453 schema: "yardstick:suite:0.1"
455 name: "os-nosdn-nofeature-ha"
456 test_cases_dir: "tests/opnfv/test_cases/"
459 file_name: opnfv_yardstick_tc002.yaml
461 file_name: opnfv_yardstick_tc005.yaml
463 file_name: opnfv_yardstick_tc043.yaml
468 huawei-pod1: '{"pod_info": "etc/yardstick/.../pod.yaml",
469 "host": "node4.LF","target": "node5.LF"}'
471 As you can see in test case ``opnfv_yardstick_tc043.yaml``, there are two
472 tags, ``constraint`` and ``task_args``. ``constraint`` is to specify which
473 installer or pod it can be run in the CI environment. ``task_args`` is to
474 specify the task arguments for each pod.
476 All in all, to create a test suite in Yardstick, you just need to create a
477 yaml file and add test cases, constraint or task arguments if necessary.
480 Proxy Support (**Todo**)
481 ---------------------------