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
52 ../../../../tests/opnfv/test_cases/opnfv_yardstick_tc002.yaml
55 Run a Yardstick test case
56 ^^^^^^^^^^^^^^^^^^^^^^^^^
58 If you want run a test case, then you need to use ``yardstick task start
59 <test_case_path>`` this command support some parameters as below:
61 +---------------------+--------------------------------------------------+
62 | Parameters | Detail |
63 +=====================+==================================================+
64 | -d | show debug log of yardstick running |
66 +---------------------+--------------------------------------------------+
67 | --task-args | If you want to customize test case parameters, |
68 | | use "--task-args" to pass the value. The format |
69 | | is a json string with parameter key-value pair. |
71 +---------------------+--------------------------------------------------+
72 | --task-args-file | If you want to use yardstick |
73 | | env prepare command(or |
74 | | related API) to load the |
75 +---------------------+--------------------------------------------------+
79 +---------------------+--------------------------------------------------+
80 | --output-file \ | Specify where to output the log. if not pass, |
81 | OUTPUT_FILE_PATH | the default value is |
82 | | "/tmp/yardstick/yardstick.log" |
84 +---------------------+--------------------------------------------------+
85 | --suite \ | run a test suite, TEST_SUITE_PATH specify where |
86 | TEST_SUITE_PATH | the test suite locates |
88 +---------------------+--------------------------------------------------+
91 Run Yardstick in a local environment
92 ------------------------------------
94 We also have a guide about `How to run Yardstick in a local environment`_.
95 This work is contributed by Tapio Tallgren.
97 Create a new testcase for Yardstick
98 -----------------------------------
100 As a user, you may want to define a new testcase in addition to the ones
101 already available in Yardstick. This section will show you how to do this.
103 Each testcase consists of two sections:
105 * ``scenarios`` describes what will be done by the test
106 * ``context`` describes the environment in which the test will be run.
108 Defining the testcase scenarios
109 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
113 Defining the testcase context(s)
114 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
116 Each testcase consists of one or more contexts, which describe the environment
117 in which the testcase will be run.
118 Current available contexts are:
120 * ``Dummy``: this is a no-op context, and is used when there is no environment
121 to set up e.g. when testing whether OpenStack services are available
122 * ``Node``: this context is used to perform operations on baremetal servers
123 * ``Heat``: uses OpenStack to provision the required hosts, networks, etc.
124 * ``Kubernetes``: uses Kubernetes to provision the resources required for the
127 Regardless of the context type, the ``context`` section of the testcase will
128 consist of the following::
132 type: Dummy|Node|Heat|Kubernetes
134 The content of the ``context`` section will vary based on the context type.
139 No additional information is required for the Dummy context::
153 In addition to ``name`` and ``type``, a Heat context requires the following
156 * ``image``: the image to be used to boot VMs
157 * ``flavor``: the flavor to be used for VMs in the context
158 * ``user``: the username for connecting into the VMs
159 * ``networks``: The networks to be created, networks are identified by name
161 * ``name``: network name (required)
162 * (TODO) Any optional attributes
164 * ``servers``: The servers to be created
166 * ``name``: server name
167 * (TODO) Any optional attributes
169 In addition to the required arguments, the following optional arguments can be
170 passed to the Heat context:
172 * ``placement_groups``:
174 * ``name``: the name of the placement group to be created
175 * ``policy``: either ``affinity`` or ``availability``
178 * ``name``: the name of the server group
179 * ``policy``: either ``affinity`` or ``anti-affinity``
181 Combining these elements together, a sample Heat context config looks like:
184 ../../../../yardstick/tests/integration/dummy-scenario-heat-context.yaml
186 :empahsise-lines: 14-
188 Using exisiting HOT Templates
189 '''''''''''''''''''''''''''''
198 Using multiple contexts in a testcase
199 +++++++++++++++++++++++++++++++++++++
201 When using multiple contexts in a testcase, the ``context`` section is replaced
202 by a ``contexts`` section, and each context is separated with a ``-`` line::
218 Typically, a context is torn down after a testcase is run, however, the user
219 may wish to keep an context intact after a testcase is complete.
222 This feature has been implemented for the Heat context only
224 To keep or reuse a context, the ``flags`` option must be specified:
226 * ``no_setup``: skip the deploy stage, and fetch the details of a deployed
228 * ``no_teardown``: skip the undeploy stage, thus keeping the stack intact for
231 If either of these ``flags`` are ``True``, the context information must still
232 be given. By default, these flags are disabled::
242 Create a test suite for Yardstick
243 ---------------------------------
245 A test suite in Yardstick is a .yaml file which includes one or more test
246 cases. Yardstick is able to support running test suite task, so you can
247 customize your own test suite and run it in one task.
249 ``tests/opnfv/test_suites`` is the folder where Yardstick puts CI test suite.
250 A typical test suite is like below (the ``fuel_test_suite.yaml`` example):
253 ../../../../tests/opnfv/test_suites/fuel_test_suite.yaml
256 As you can see, there are two test cases in the ``fuel_test_suite.yaml``. The
257 ``schema`` and the ``name`` must be specified. The test cases should be listed
258 via the tag ``test_cases`` and their relative path is also marked via the tag
261 Yardstick test suite also supports constraints and task args for each test
262 case. Here is another sample (the ``os-nosdn-nofeature-ha.yaml`` example) to
263 show this, which is digested from one big test suite::
267 schema: "yardstick:suite:0.1"
269 name: "os-nosdn-nofeature-ha"
270 test_cases_dir: "tests/opnfv/test_cases/"
273 file_name: opnfv_yardstick_tc002.yaml
275 file_name: opnfv_yardstick_tc005.yaml
277 file_name: opnfv_yardstick_tc043.yaml
282 huawei-pod1: '{"pod_info": "etc/yardstick/.../pod.yaml",
283 "host": "node4.LF","target": "node5.LF"}'
285 As you can see in test case ``opnfv_yardstick_tc043.yaml``, there are two
286 tags, ``constraint`` and ``task_args``. ``constraint`` is to specify which
287 installer or pod it can be run in the CI environment. ``task_args`` is to
288 specify the task arguments for each pod.
290 All in all, to create a test suite in Yardstick, you just need to create a
291 yaml file and add test cases, constraint or task arguments if necessary.
296 .. _`How to run Yardstick in a local environment`: https://wiki.opnfv.org/display/yardstick/How+to+run+Yardstick+in+a+local+environment