| 1 |
.. _labgrid-client: |
| 2 |
|
| 3 |
labgrid-client CLI |
| 4 |
================== |
| 5 |
|
| 6 |
Labgrid is a scalable infrastructure and test architecture for embedded (linux) systems. |
| 7 |
|
| 8 |
This is the client to control a boards status and interface with it on remote machines. |
| 9 |
|
| 10 |
.. currentmodule:: labgrid.remote.client |
| 11 |
|
| 12 |
|
| 13 |
.. autoprogram:: labgrid.remote.client:get_parser(auto_doc_mode=True) |
| 14 |
:prog: labgrid-client |
| 15 |
|
| 16 |
Configuration File |
| 17 |
------------------ |
| 18 |
The configuration file follows the description in ``labgrid-device-config``\(5). |
| 19 |
|
| 20 |
Environment Variables |
| 21 |
--------------------- |
| 22 |
Various labgrid-client commands use the following environment variable: |
| 23 |
|
| 24 |
LG_PLACE |
| 25 |
~~~~~~~~ |
| 26 |
This variable can be used to specify a place without using the ``-p`` option, the ``-p`` option overrides it. |
| 27 |
|
| 28 |
LG_TOKEN |
| 29 |
~~~~~~~~ |
| 30 |
This variable can be used to specify a reservation for the ``wait`` command and |
| 31 |
for the ``+`` place expansion. |
| 32 |
|
| 33 |
LG_STATE |
| 34 |
~~~~~~~~ |
| 35 |
This variable can be used to specify a state which the device transitions into |
| 36 |
before executing a command. Requires a configuration file and a Strategy |
| 37 |
specified for the device. |
| 38 |
|
| 39 |
LG_INITIAL_STATE |
| 40 |
~~~~~~~~~~~~~~~~ |
| 41 |
This variable can be used to specify an initial state the device is known to |
| 42 |
be in. |
| 43 |
This is useful during development. The Strategy used must implement the |
| 44 |
``force()`` method. |
| 45 |
A desired state must be set using ``LG_STATE`` or ``-s``/``--state``. |
| 46 |
|
| 47 |
LG_ENV |
| 48 |
~~~~~~ |
| 49 |
This variable can be used to specify the configuration file to use without |
| 50 |
using the ``--config`` option, the ``--config`` option overrides it. |
| 51 |
|
| 52 |
LG_COORDINATOR |
| 53 |
~~~~~~~~~~~~~~ |
| 54 |
This variable can be used to set the default coordinator in the format |
| 55 |
``HOST[:PORT]`` (instead of using the ``-x`` option). |
| 56 |
|
| 57 |
LG_PROXY |
| 58 |
~~~~~~~~ |
| 59 |
This variable can be used to specify a SSH proxy hostname which should be used |
| 60 |
to connect to the coordinator and any resources which are normally accessed |
| 61 |
directly. |
| 62 |
|
| 63 |
LG_HOSTNAME |
| 64 |
~~~~~~~~~~~ |
| 65 |
Override the hostname used when accessing a resource. Typically only useful for |
| 66 |
CI pipelines where the hostname may not be consistent between pipeline stages. |
| 67 |
|
| 68 |
LG_USERNAME |
| 69 |
~~~~~~~~~~~ |
| 70 |
Override the username used when accessing a resource. Typically only useful for |
| 71 |
CI pipelines where the username may not be consistent between pipeline stages. |
| 72 |
|
| 73 |
LG_SSH_CONNECT_TIMEOUT |
| 74 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 75 |
Set the connection timeout when using SSH (The ``ConnectTimeout`` option). If |
| 76 |
unspecified, defaults to 30 seconds. |
| 77 |
|
| 78 |
LG_AGENT_PREFIX |
| 79 |
~~~~~~~~~~~~~~~~~~~~~~ |
| 80 |
Add a prefix to ``.labgrid_agent_{agent_hash}.py`` allowing specification for |
| 81 |
where on the exporter it should be uploaded to. |
| 82 |
|
| 83 |
Matches |
| 84 |
------- |
| 85 |
Match patterns are used to assign a resource to a specific place. The format is: |
| 86 |
exporter/group/cls/name, exporter is the name of the exporting machine, group is |
| 87 |
a name defined within the exporter, cls is the class of the exported resource |
| 88 |
and name is its name. Wild cards in match patterns are explicitly allowed, * |
| 89 |
matches anything. |
| 90 |
|
| 91 |
Adding Named Resources |
| 92 |
---------------------- |
| 93 |
If a target contains multiple Resources of the same type, named matches need to |
| 94 |
be used to address the individual resources. In addition to the *match* taken by |
| 95 |
``add-match``, ``add-named-match`` also takes a name for the resource. The other |
| 96 |
client commands support the name as an optional parameter and will inform the |
| 97 |
user that a name is required if multiple resources are found, but no name is |
| 98 |
given. |
| 99 |
|
| 100 |
If one of the resources should be used by default when no resource name is |
| 101 |
explicitly specified, it can be named ``default``. |
| 102 |
|
| 103 |
Examples |
| 104 |
-------- |
| 105 |
|
| 106 |
To retrieve a list of places run: |
| 107 |
|
| 108 |
.. code-block:: bash |
| 109 |
|
| 110 |
$ labgrid-client places |
| 111 |
|
| 112 |
To access a place, it needs to be acquired first, this can be done by running |
| 113 |
the ``acquire command`` and passing the placename as a -p parameter: |
| 114 |
|
| 115 |
.. code-block:: bash |
| 116 |
|
| 117 |
$ labgrid-client -p <placename> acquire |
| 118 |
|
| 119 |
Open a console to the acquired place: |
| 120 |
|
| 121 |
.. code-block:: bash |
| 122 |
|
| 123 |
$ labgrid-client -p <placename> console |
| 124 |
|
| 125 |
Add all resources with the group "example-group" to the place example-place: |
| 126 |
|
| 127 |
.. code-block:: bash |
| 128 |
|
| 129 |
$ labgrid-client -p example-place add-match */example-group/*/* |
| 130 |
|
| 131 |
See Also |
| 132 |
-------- |
| 133 |
|
| 134 |
``labgrid-exporter``\(1) |