aboutsummaryrefslogtreecommitdiff
path: root/man/lava-tool.rst
blob: 589ef3ce7685fec850f6a8fe2da47dfedf84aea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
Description
===========

Summary
#######

``lava-tool`` is a command-line tool to interact with LAVA.

Usage
#####

lava-tool [-h] <subcommand> [args]

Optional arguments
##################

  -h, --help            show this help message and exit

Subcommands
###########

Type ``lava-tool <subcommand> -h`` for help on a specific subcommand.

Available subcommands
#####################

data-views
    Show data views defined on the server

      Usage:
        lava-tool data-views [-h] --dashboard-url URL [--verbose-xml-rpc]
        [--experimental-notice]

      Optional arguments:
        -h, --help            show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL   URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc     Show XML-RPC data

      Experimental commands:
        --experimental-notice
            Explain the nature of experimental commands

job-output
    Get job output from the scheduler

      Usage:
        lava-tool job-output [-h] [--overwrite] [--output OUTPUT] SERVER JOB_ID

      Positional arguments:
        SERVER
          Host to download job output from
        JOB_ID
          Job ID to download output file

      Optional arguments:
        -h, --help            show this help message and exit
        --overwrite           Overwrite files on the local disk
        --output OUTPUT, -o OUTPUT
                              Alternate name of the output file

devices-list
    Get list of devices from the scheduler.
      Usage:
        lava-tool devices-list [-h] SERVER
      Positional arguments:
        SERVER
          Host to query for the list of devices

      Optional arguments:
        -h, --help  show this help message and exit

help
    Show a summary of all available commands

deserialize
    Deserialize a bundle on the server

      Usage:
        lava-tool deserialize [-h] --dashboard-url URL [--verbose-xml-rpc] SHA1

      Positional arguments:
        SHA1
          SHA1 of the bundle to deserialize

      Optional arguments:
        -h, --help           show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL  URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc    Show XML-RPC data

get
    Download a bundle from the server

      Usage:
        lava-tool get [-h] --dashboard-url URL [--verbose-xml-rpc]
        [--overwrite] [--output OUTPUT] SHA1

      Positional arguments:
        SHA1
          SHA1 of the bundle to download

      Optional arguments:
        -h, --help            show this help message and exit
        --overwrite           Overwrite files on the local disk
        --output OUTPUT, -o OUTPUT  Alternate name of the output file

      Dashboard specific arguments:
        --dashboard-url URL   URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc     Show XML-RPC data

auth-add
    Add an authentication token

      Usage:
        lava-tool auth-add [-h] [--token-file TOKEN_FILE] [--no-check] HOST

      Positional arguments:
        HOST
          Endpoint to add token for, in the form scheme://username@host. The
          username will default to the currently logged in user.

      Optional arguments:
        -h, --help            show this help message and exit
        --token-file TOKEN_FILE
                              Read the secret from here rather than prompting
                              for it.
        --no-check            By default, a call to the remote server is made
                              to check that the added token works before
                              remembering it. Passing this option prevents this
                              check.

put
    Upload a bundle on the server

      Usage:
        lava-tool put [-h] --dashboard-url URL [--verbose-xml-rpc] LOCAL
        [REMOTE]

      Positional arguments:
        LOCAL
          pathname on the local file system
        REMOTE
          pathname on the server

      Optional arguments:
        -h, --help           show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL  URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc    Show XML-RPC data

bundles
    Show bundles in the specified stream

      Usage:
        lava-tool bundles [-h] --dashboard-url URL [--verbose-xml-rpc]
        [PATHNAME]

      Positional arguments:
        PATHNAME
          pathname on the server (defaults to /anonymous/)

      Optional arguments:
        -h, --help           show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL  URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc    Show XML-RPC data

server-version
    Display dashboard server version

      Usage:
        lava-tool server-version [-h] --dashboard-url URL [--verbose-xml-rpc]

      Optional arguments:
        -h, --help           show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL  URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc    Show XML-RPC data

cancel-job
    Cancel job

      Usage:
        lava-tool cancel-job [-h] SERVER JOB_ID

      Positional arguments:
        SERVER
          Host to cancel job on
        JOB_ID
          Job ID to cancel

      Optional arguments:
        -h, --help            show this help message and exit

resubmit-job
    Resubmit job

      Usage:
        lava-tool resubmit-job [-h] SERVER JOB_ID

      Positional arguments:
        SERVER
          Host to resubmit job on
        JOB_ID
          Job ID to resubmit

      Optional arguments:
        -h, --help            show this help message and exit

version
    Show dashboard client version

      Usage:
        lava-tool version [-h]

      Optional arguments:
        -h, --help            show this help message and exit

query-data-view
    Invoke a specified data view

      Usage:
        lava-tool restore [-h] --dashboard-url URL [--verbose-xml-rpc]
        [--experimental-notice] QUERY

      Positional arguments:
        QUERY
          Data view name and any optional and required arguments

      Optional arguments:
        -h, --help           show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL  URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc    Show XML-RPC data

      Experimental commands:
        --experimental-notice	Explain the nature of experimental commands

submit-job
    Submit a job to lava-scheduler

      Usage:
        lava-tool submit-job [-h] SERVER JSON_FILE

      Positional arguments:
        SERVER
          Host to resubmit job on
        JSON_FILE
          JSON file with test defenition to submit

      Optional arguments:
        -h, --help            show this help message and exit

      Experimental commands:
        --experimental-notice	Explain the nature of experimental commands

streams
    Show streams you have access to

      Usage:
        lava-tool streams [-h] --dashboard-url URL [--verbose-xml-rpc]

      Optional arguments:
        -h, --help           show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL  URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc    Show XML-RPC data

make-stream
    Create a bundle stream on the server

      Usage:
        lava-tool make-stream [-h] --dashboard-url URL [--verbose-xml-rpc]
        [--name NAME] pathname

      Positional arguments:
        pathname
          Pathname of the bundle stream to create

      Optional arguments:
        -h, --help           show this help message and exit
        --name NAME          Name of the bundle stream (description)

      Dashboard specific arguments:
        --dashboard-url URL  URL of your validation dashboard

      Debugging arguments:
        --verbose-xml-rpc    Show XML-RPC data

compare-device-conf
    Compare device configurations and output a diff.

      Usage:
        lava-tool compare-device-conf [-h] [--wdiff] [--use-stored USE_STORED]
        [--dispatcher-config-dir DISPATCHER_CONFIG_DIR] [CONFIGS [CONFIGS ...]]

      Positional arguments:
        CONFIGS
          List of device config paths, at least one, max two.

      Optional arguments:
        -h, --help            show this help message and exit
        --wdiff, -w           Use wdiff for parsing output
        --use-stored USE_STORED, -u USE_STORED
          Use stored device config with specified device
        --dispatcher-config-dir DISPATCHER_CONFIG_DIR
          Where to find the device_type templates.

pull
    Copy bundles and bundle streams from one dashboard to another

      Usage:
        lava-tool pull [-h] --dashboard-url URL [--verbose-xml-rpc]
        [--experimental-notice] FROM [STREAM [STREAM ...]]

      Positional arguments:
        FROM
          URL of the remote validation dashboard

      Optional arguments:
        -h, --help            show this help message and exit

      Dashboard specific arguments:
        --dashboard-url URL   URL of your validation dashboard

        STREAM
          Streams to pull from (all by default)

      Debugging arguments:
        --verbose-xml-rpc     Show XML-RPC data

      Experimental commands:
        --experimental-notice	Explain the nature of experimental commands

      This command checks for two environment varialbes: The value of
      DASHBOARD_URL is used as a replacement for --dashbard-url. The value of
      REMOTE_DASHBOARD_URL as a replacement for FROM. Their presence
      automatically makes the corresponding argument optional.


get-pipeline-device-config
    Get pipeline device configuration to a local file or stdout.

    Usage:
        lava-tool get-pipeline-device-config [-h] [--overwrite]
        [--output OUTPUT] [--output-to-stdout] SERVER DEVICE_HOSTNAME

    Positional arguments:
      SERVER
        Host to download pipeline device configuration from
      DEVICE_HOSTNAME
        HOSTNAME of the pipeline device for which configuration is required

    Optional arguments:
      -h, --help            show this help message and exit
      --overwrite           Overwrite files on the local disk
      --output OUTPUT, -o OUTPUT
                            Alternate name of the output file
      --stdout              Write output to stdout

device-dictionary
    Update or export device dictionary data as jinja2 data. [Superusers only.]
    Either [--update | -u] or [--export | -e] must be used.
    Wraps the import-device-dictionary and export-device-dictionary XMLRPC API
    calls on the specified server.

    Usage: lava-tool device-dictionary [-h] [--update UPDATE] [--export]
                                       SERVER DEVICE_HOSTNAME

    Positional arguments:
      SERVER                Host to query or update the device dictionary on
      DEVICE_HOSTNAME       DEVICE_HOSTNAME to query or update

    Optional arguments:
      -h, --help            show this help message and exit
      --update UPDATE, -u UPDATE
                            Load a jinja2 file to update the device dictionary
      --export, -e          Export the device dictionary for this device as jinja2

LAVA test definitions
#####################

A LAVA Test Definition comprises of two parts:

* the data to setup the test, expressed as a JSON file.
* the instructions to run inside the test, expressed as a YAML file.

This allows the same tests to be easily migrated to a range of different
devices, environments and purposes by using the same YAML files in
multiple JSON files. It also allows tests to be built from a range of
components by aggregating YAML files inside a single JSON file.

Contents of the JSON file
#########################

The JSON file is submitted to the LAVA server and contains:

* Demarcation as a health check or a user test.
* The default timeout of each action within the test.
* The logging level for the test, DEBUG or INFO.
* The name of the test, shown in the list of jobs.
* The location of all support files.
* All parameters necessary to use the support files.
* The declaration of which device(s) to use for the test.
* The location to which the results should be uploaded.
* The JSON determines how the test is deployed onto the device and
  where to find the tests to be run.

Basic JSON file
###############

Your first LAVA test should use the ``DEBUG`` logging level so that it
is easier to see what is happening.

A suitable ``timeout`` for your first tests is 900 seconds.

Make the ``job_name`` descriptive and explanatory, you will want to be
able to tell which job is which when reviewing the results.

Make sure the ``device_type`` matches exactly with one of the suitable
device types listed on the server to which you want to submit this job.

Change the stream to one to which you are allowed to upload results, on
your chosen server.

::

 {
   "health_check": false,
   "logging_level": "DEBUG",
   "timeout": 900,
   "job_name": "kvm-basic-test",
   "device_type": "kvm",
   "actions": [
       {
           "command": "deploy_linaro_image",
           "parameters": {
               "image": "http://images.validation.linaro.org/kvm-debian-wheezy.img.gz"
           }
       },
       {
           "command": "lava_test_shell",
           "parameters": {
               "testdef_repos": [
                   {
                       "git-repo": "git://git.linaro.org/qa/test-definitions.git",
                       "testdef": "ubuntu/smoke-tests-basic.yaml"
                   }
               ],
               "timeout": 900
           }
       },
       {
           "command": "submit_results_on_host",
           "parameters": {
               "stream": "/anonymous/example/",
               "server": "http://localhost/RPC2/"
           }
       }
   ]
 }

Note
####

Always check your JSON syntax. A useful site for this is http://jsonlint.com.
YAML syntax can be checked at http://yaml-online-parser.appspot.com/?yaml=

Bugs and Issues
###############

General hints and tips on :command:`lava-tool` and LAVA are
available on the Linaro wiki: https://wiki.linaro.org/Platform/LAVA/LAVA_Tips.
(Login is not required to read this page, only to edit.)

.. note:: :command:`lava-tool` is intended for user command line interaction.
   For all scripting requirements use XMLRPC support directly. Help on using
   XMLRPC with python is in the API | Available Methods section of the LAVA instance.
   e.g. https://validation.linaro.org/api/help/ Other languages also have XMLRPC support.

Testing changes to lava-tool
############################

Adding new commands to ``lava-tool`` requires changes to the :file:`entrypoints.ini` file
and these changes need to be picked up by setuptools. The local test directory can use
any name - just remember to remove the directory before committing your local changes
for review.

::

 python setup.py install --root=./_dev/lava-tool/ --install-layout=deb
 PYTHONPATH=. python ./_dev/lava-tool/usr/bin/lava-tool --help
 rm -rf ./_dev/