1 .. This work is licensed under a Creative Commons Attribution 4.0 International
3 .. http://creativecommons.org/licenses/by/4.0
4 .. (c) OPNFV, Intel, Ericsson AB, Huawei Technologies Co. Ltd and others.
7 Convention for heading levels in Yardstick:
8 ======= Heading 0 (reserved for the title in a document)
13 Avoid deeper levels because they do not render well.
19 Once you have yardstick installed, you can start using it to run testcases
20 immediately, through the CLI. You can also define and run new testcases and
21 test suites. This chapter details basic usage (running testcases), as well as
22 more advanced usage (creating your own testcases).
30 ``yardstick testcase list``: This command line would list all test cases in
31 Yardstick. It would show like below::
33 +---------------------------------------------------------------------------------------
34 | Testcase Name | Description
35 +---------------------------------------------------------------------------------------
36 | opnfv_yardstick_tc001 | Measure network throughput using pktgen
37 | opnfv_yardstick_tc002 | measure network latency using ping
38 | opnfv_yardstick_tc005 | Measure Storage IOPS, throughput and latency using fio.
40 +---------------------------------------------------------------------------------------
43 Show a test case config file
44 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46 Take opnfv_yardstick_tc002 for an example. This test case measure network
47 latency. You just need to type in ``yardstick testcase show
48 opnfv_yardstick_tc002``, and the console would show the config yaml of this
53 schema: "yardstick:task:0.1"
55 Yardstick TC002 config file;
56 measure network latency using ping;
58 {% set image = image or "cirros-0.3.5" %}
60 {% set provider = provider or none %}
61 {% set physical_network = physical_network or 'physnet1' %}
62 {% set segmentation_id = segmentation_id or none %}
63 {% set packetsize = packetsize or 100 %}
66 {% for i in range(2) %}
70 packetsize: {{packetsize}}
87 flavor: yardstick-flavor
92 policy: "availability"
104 {% if provider == "vlan" %}
105 provider: {{provider}}
106 physical_network: {{physical_network}}
107 {% if segmentation_id %}
108 segmentation_id: {{segmentation_id}}
113 Run a Yardstick test case
114 ^^^^^^^^^^^^^^^^^^^^^^^^^
116 If you want run a test case, then you need to use ``yardstick task start
117 <test_case_path>`` this command support some parameters as below:
119 +---------------------+--------------------------------------------------+
120 | Parameters | Detail |
121 +=====================+==================================================+
122 | -d | show debug log of yardstick running |
124 +---------------------+--------------------------------------------------+
125 | --task-args | If you want to customize test case parameters, |
126 | | use "--task-args" to pass the value. The format |
127 | | is a json string with parameter key-value pair. |
129 +---------------------+--------------------------------------------------+
130 | --task-args-file | If you want to use yardstick |
131 | | env prepare command(or |
132 | | related API) to load the |
133 +---------------------+--------------------------------------------------+
137 +---------------------+--------------------------------------------------+
138 | --output-file \ | Specify where to output the log. if not pass, |
139 | OUTPUT_FILE_PATH | the default value is |
140 | | "/tmp/yardstick/yardstick.log" |
142 +---------------------+--------------------------------------------------+
143 | --suite \ | run a test suite, TEST_SUITE_PATH specify where |
144 | TEST_SUITE_PATH | the test suite locates |
146 +---------------------+--------------------------------------------------+
149 Run Yardstick in a local environment
150 ------------------------------------
152 We also have a guide about `How to run Yardstick in a local environment`_.
153 This work is contributed by Tapio Tallgren.
155 Create a new testcase for Yardstick
156 -----------------------------------
158 As a user, you may want to define a new testcase in addition to the ones
159 already available in Yardstick. This section will show you how to do this.
161 Each testcase consists of two sections:
163 * ``scenarios`` describes what will be done by the test
164 * ``context`` describes the environment in which the test will be run.
166 Defining the testcase scenarios
167 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
171 Defining the testcase context(s)
172 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
174 Each testcase consists of one or more contexts, which describe the environment
175 in which the testcase will be run.
176 Current available contexts are:
178 * ``Dummy``: this is a no-op context, and is used when there is no environment
179 to set up e.g. when testing whether OpenStack services are available
180 * ``Node``: this context is used to perform operations on baremetal servers
181 * ``Heat``: uses OpenStack to provision the required hosts, networks, etc.
182 * ``Kubernetes``: uses Kubernetes to provision the resources required for the
185 Regardless of the context type, the ``context`` section of the testcase will
186 consist of the following::
190 type: Dummy|Node|Heat|Kubernetes
192 The content of the ``context`` section will vary based on the context type.
197 No additional information is required for the Dummy context::
211 In addition to ``name`` and ``type``, a Heat context requires the following
214 * ``image``: the image to be used to boot VMs
215 * ``flavor``: the flavor to be used for VMs in the context
216 * ``user``: the username for connecting into the VMs
217 * ``networks``: The networks to be created, networks are identified by name
219 * ``name``: network name (required)
220 * (TODO) Any optional attributes
222 * ``servers``: The servers to be created
224 * ``name``: server name
225 * (TODO) Any optional attributes
227 In addition to the required arguments, the following optional arguments can be
228 passed to the Heat context:
230 * ``placement_groups``:
232 * ``name``: the name of the placement group to be created
233 * ``policy``: either ``affinity`` or ``availability``
236 * ``name``: the name of the server group
237 * ``policy``: either ``affinity`` or ``anti-affinity``
239 Combining these elements together, a sample Heat context config looks like:
242 ../../../../yardstick/tests/integration/dummy-scenario-heat-context.yaml
245 Using exisiting HOT Templates
246 '''''''''''''''''''''''''''''
255 Using multiple contexts in a testcase
256 +++++++++++++++++++++++++++++++++++++
258 When using multiple contexts in a testcase, the ``context`` section is replaced
259 by a ``contexts`` section, and each context is separated with a ``-`` line::
275 Typically, a context is torn down after a testcase is run, however, the user
276 may wish to keep an context intact after a testcase is complete.
279 This feature has been implemented for the Heat context only
281 To keep or reuse a context, the ``flags`` option must be specified:
283 * ``no_setup``: skip the deploy stage, and fetch the details of a deployed
285 * ``no_teardown``: skip the undeploy stage, thus keeping the stack intact for
288 If either of these ``flags`` are ``True``, the context information must still
289 be given. By default, these flags are disabled::
299 Create a test suite for Yardstick
300 ---------------------------------
302 A test suite in Yardstick is a .yaml file which includes one or more test
303 cases. Yardstick is able to support running test suite task, so you can
304 customize your own test suite and run it in one task.
306 ``tests/opnfv/test_suites`` is the folder where Yardstick puts CI test suite.
307 A typical test suite is like below (the ``fuel_test_suite.yaml`` example)::
310 # Fuel integration test task suite
312 schema: "yardstick:suite:0.1"
314 name: "fuel_test_suite"
315 test_cases_dir: "samples/"
320 file_name: iperf3.yaml
322 As you can see, there are two test cases in the ``fuel_test_suite.yaml``. The
323 ``schema`` and the ``name`` must be specified. The test cases should be listed
324 via the tag ``test_cases`` and their relative path is also marked via the tag
327 Yardstick test suite also supports constraints and task args for each test
328 case. Here is another sample (the ``os-nosdn-nofeature-ha.yaml`` example) to
329 show this, which is digested from one big test suite::
333 schema: "yardstick:suite:0.1"
335 name: "os-nosdn-nofeature-ha"
336 test_cases_dir: "tests/opnfv/test_cases/"
339 file_name: opnfv_yardstick_tc002.yaml
341 file_name: opnfv_yardstick_tc005.yaml
343 file_name: opnfv_yardstick_tc043.yaml
348 huawei-pod1: '{"pod_info": "etc/yardstick/.../pod.yaml",
349 "host": "node4.LF","target": "node5.LF"}'
351 As you can see in test case ``opnfv_yardstick_tc043.yaml``, there are two
352 tags, ``constraint`` and ``task_args``. ``constraint`` is to specify which
353 installer or pod it can be run in the CI environment. ``task_args`` is to
354 specify the task arguments for each pod.
356 All in all, to create a test suite in Yardstick, you just need to create a
357 yaml file and add test cases, constraint or task arguments if necessary.
362 .. _`How to run Yardstick in a local environment`: https://wiki.opnfv.org/display/yardstick/How+to+run+Yardstick+in+a+local+environment