~ubuntu-branches/debian/jessie/lava-server/jessie

« back to all changes in this revision

Viewing changes to doc/usecasetwo.rst

  • Committer: Package Import Robot
  • Author(s): Neil Williams
  • Date: 2014-06-29 19:29:34 UTC
  • Revision ID: package-import@ubuntu.com-20140629192934-ue8hrzzpye9isevt
Tags: upstream-2014.05.30.09
ImportĀ upstreamĀ versionĀ 2014.05.30.09

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.. index:: multiple devices
 
2
 
 
3
.. _use_case_two:
 
4
 
 
5
Use Case Two - Setting up the same job on multiple devices
 
6
**********************************************************
 
7
 
 
8
One test definition (or one set of test definitions) to be run on
 
9
multiple devices of the same device type.
 
10
 
 
11
Source Code
 
12
===========
 
13
 
 
14
The test definition itself could be an unchanged singlenode test definition, e.g.
 
15
 
 
16
 https://git.linaro.org/qa/test-definitions.git/blob/HEAD:/ubuntu/smoke-tests-basic.yaml
 
17
 
 
18
Alternatively, it could use the MultiNode API to synchronise the devices, e.g.
 
19
 
 
20
  https://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/multinode01.yaml
 
21
 
 
22
  https://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/multinode02.yaml
 
23
 
 
24
  https://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/multinode03.yaml
 
25
 
 
26
Requirements
 
27
============
 
28
 
 
29
 * Multiple devices running the same test definition.
 
30
 * Running multiple test definitions at the same time on all devices in the group.
 
31
 * Synchronising multiple devices during a test.
 
32
 * Filter the results by device name.
 
33
 
 
34
Preparing the YAML
 
35
==================
 
36
 
 
37
In the first part of this use case, the same YAML file is to be used to
 
38
test multiple devices. Select your YAML file and, if appropriate, edit
 
39
the name in the metadata.
 
40
 
 
41
Preparing the JSON
 
42
===================
 
43
 
 
44
The change from a standard single-node JSON file is to expand the device_type
 
45
or device field to a device_group.
 
46
 
 
47
The change for multiple devices in MultiNode is within the ``device_group``. To run the test
 
48
multiple devices of the same type, simply increase the ``count``:
 
49
 
 
50
::
 
51
 
 
52
 {
 
53
    "device_group": [
 
54
        {
 
55
            "role": "bear",
 
56
            "count": 2,
 
57
            "device_type": "panda"
 
58
        }
 
59
 }
 
60
 
 
61
If the rest of the JSON refers to a ``role`` other than the one specified
 
62
in the ``device_group``, those JSON sections are ignored.
 
63
 
 
64
If other actions in the JSON do not mention a ``role``, the action will
 
65
occur on all devices in the ``device_group``. So with a single role,
 
66
it only matters that a role exists in the ``device_group``.
 
67
 
 
68
actions
 
69
-------
 
70
 
 
71
::
 
72
 
 
73
 {
 
74
        {
 
75
            "command": "deploy_linaro_image",
 
76
            "parameters": {
 
77
                "image": "https://releases.linaro.org/13.03/ubuntu/panda/panda-quantal_developer_20130328-278.img.gz"
 
78
            }
 
79
           "role": "bear"
 
80
        }
 
81
 }
 
82
 
 
83
lava_test_shell
 
84
^^^^^^^^^^^^^^^
 
85
 
 
86
To run multiple test definitions from one or multiple testdef repositories,
 
87
expand the testdef_repos array:
 
88
 
 
89
.. tip:: Remember the JSON syntax.
 
90
 
 
91
 - continuations need commas, completions do not.
 
92
 
 
93
::
 
94
 
 
95
 {
 
96
        {
 
97
            "command": "lava_test_shell",
 
98
            "parameters": {
 
99
                "testdef_repos": [
 
100
                    {
 
101
                        "git-repo": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git",
 
102
                        "testdef": "multinode01.yaml"
 
103
                    },
 
104
                    {
 
105
                        "git-repo": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git",
 
106
                        "testdef": "multinode02.yaml"
 
107
                    },
 
108
                    {
 
109
                        "git-repo": "git://git.linaro.org/people/neilwilliams/multinode-yaml.git",
 
110
                        "testdef": "multinode03.yaml"
 
111
                    }
 
112
                ],
 
113
                "role": "sender"
 
114
            }
 
115
        },
 
116
 }
 
117
 
 
118
submit_results
 
119
^^^^^^^^^^^^^^
 
120
 
 
121
The results for the entire group get aggregated into a single result
 
122
bundle.
 
123
 
 
124
::
 
125
 
 
126
 {
 
127
        {
 
128
            "command": "submit_results_on_host",
 
129
            "parameters": {
 
130
                "stream": "/anonymous/instance-manager/",
 
131
                "server": "http://validation.linaro.org/RPC2/"
 
132
            }
 
133
        }
 
134
 }
 
135
 
 
136
Prepare a filter for the results
 
137
================================
 
138
 
 
139
The filter for this use case uses a ``required attribute``
 
140
of **target.device_type** to only show results for the specified
 
141
devices (to cover reuse of the YAML on other boards later).
 
142
 
 
143
It is also possible to add a second filter which matches a specific **target**
 
144
device.
 
145
 
 
146
Adding synchronisation
 
147
======================
 
148
 
 
149
So far, the multiple devices have been started together but then had no
 
150
further interaction.
 
151
 
 
152
The :ref:`multinode_api` supports communication between devices within
 
153
a group and provides synchronisation primitives. The simplest of these
 
154
primitives, :ref:`lava_sync` was used in :ref:`use_case_one` but there are more
 
155
possibilities available.
 
156
 
 
157
:ref:`lava_sync` is a special case of a :ref:`lava_send` followed by a
 
158
:ref:`lava_wait_all`.
 
159
 
 
160
Sending messages
 
161
----------------
 
162
 
 
163
Messages can be sent using :ref:`lava_send` which is a non-blocking call.
 
164
At a later point, another device in the group can collect the message
 
165
using ``lava-wait`` or ``lava-wait-all`` which will block until
 
166
the message is available.
 
167
 
 
168
The message can be a simple identifier (e.g. 'download' or 'ready') and
 
169
is visible to all devices in the group.
 
170
 
 
171
Key value pairs can also be sent using the API to broadcast particular
 
172
information.
 
173
 
 
174
If multiple devices send the same message ID, the data is collated by
 
175
the LAVA Coordinator. Key value pairs sent with any message ID are
 
176
tagged with the device name which sent the key value pairs.
 
177
 
 
178
Receiving messages
 
179
------------------
 
180
 
 
181
Message reception will block until the message is available.
 
182
 
 
183
For :ref:`lava_wait`, the message is deemed available as soon as any device
 
184
in the group has sent a message with the matching ID. If no devices have
 
185
sent such a message, any device asking for ``lava-wait`` on that ID
 
186
will block until a different board uses ``lava-send`` with the expected
 
187
message ID.
 
188
 
 
189
For :ref:`lava_wait_all`, the message is only deemed available if **all
 
190
devices in the group** have already sent a message with the expected message
 
191
ID. Therefore, using ``lava-wait-all`` requires a preceding
 
192
``lava-send``.
 
193
 
 
194
When using ``lava-wait-all MESSAGEID ROLE``, the message is only deemed
 
195
available if **all devices with the matching role in the group** have
 
196
sent a message with the expected message ID. If the receiving device has
 
197
the specified role, that device must use a ``lava-send`` for the same
 
198
message ID before using ``lava-wait-all MESSAGEID ROLE``.
 
199
 
 
200
::
 
201
 
 
202
        - lava-test-case multinode-send-network --shell lava-send ready
 
203
        - lava-test-case multinode-get-network --shell lava-wait ready
 
204
 
 
205
It is up to the test writer to ensure that when :ref:`lava_wait` is used,
 
206
that the message ID is sufficiently unique that the first use of that
 
207
message ID denotes the correct point in the YAML.
 
208
 
 
209
::
 
210
 
 
211
        - lava-test-case multinode-send-message --shell lava-send sending source=$(lava-self) role=$(lava-role) hostname=$(hostname -f) kernver=$(uname -r) kernhost=$(uname -n)
 
212
        - lava-test-case multinode-wait-message --shell lava-wait-all sending
 
213
 
 
214
This example will wait until all devices in the group have sent the
 
215
message ID ``sending`` (with or without the associated key value pairs).
 
216
 
 
217
Summary
 
218
=======
 
219
 
 
220
http://git.linaro.org/people/neil.williams/multinode-yaml.git/blob_plain/HEAD:/json/panda-only-group.json
 
221
 
 
222
http://multinode.validation.linaro.org/dashboard/image-reports/panda-multinode
 
223