Skip to content

Commit 3287243

Browse files
Merge pull request #1619 from lemoer/pr_getting_started_improvments
doc: extend getting_started
2 parents b249e07 + cc4381b commit 3287243

File tree

2 files changed

+58
-3
lines changed

2 files changed

+58
-3
lines changed

doc/configuration.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3551,6 +3551,8 @@ The logger can be stopped with a call to the stop function:
35513551
Stopping the StepLogger if it has not been started will raise an
35523552
AssertionError, as will starting an already started StepLogger.
35533553

3554+
.. _environment-configuration:
3555+
35543556
Environment Configuration
35553557
-------------------------
35563558
The environment configuration for a test environment consists of a YAML file
@@ -3693,6 +3695,8 @@ See the :ref:`labgrid-device-config` man page for documentation on the
36933695
top-level ``options``, ``images``, ``tools``, and ``examples`` keys in the
36943696
environment configuration.
36953697

3698+
.. _exporter-configuration:
3699+
36963700
Exporter Configuration
36973701
----------------------
36983702
The exporter is configured by using a YAML file (with a syntax similar to the

doc/getting_started.rst

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Start by copying the initial example:
112112
113113
Connect your embedded board (raspberry pi, riotboard, …) to your computer and
114114
adjust the ``port`` parameter of the ``RawSerialPort`` resource and ``username``
115-
and ``password`` of the ShellDriver driver in ``local.yaml``:
115+
and ``password`` of the ShellDriver driver in the environment file ``local.yaml``:
116116

117117
.. code-block:: yaml
118118
@@ -130,6 +130,14 @@ and ``password`` of the ShellDriver driver in ``local.yaml``:
130130
login_prompt: ' login: '
131131
username: 'root'
132132
133+
For, now it is sufficient to know that labgrid tries to "bind" appropriate drivers
134+
and resources to each other automatically if possible. The ``ShellDriver`` will use
135+
the ``SerialDriver`` to connect to the ``RawSerialPort`` resource. If an automatic
136+
binding is not possible due to ambiguity, the bindings can also be specified
137+
explicitly.
138+
139+
More information about this and the environment configuration file in general can
140+
be found :ref:`here <environment-configuration>`.
133141

134142
You can check which device name gets assigned to your USB-Serial converter by
135143
unplugging the converter, running ``dmesg -w`` and plugging it back in. Boot up
@@ -179,11 +187,15 @@ We can simply start the coordinator:
179187
Exporter
180188
~~~~~~~~
181189

190+
The exporter is responsible for exporting resources to the client. It is noted
191+
that drivers are not handled by the exporter. In the distributed case, drivers
192+
are managed by the client.
193+
182194
The exporter needs a configuration file written in YAML syntax, listing
183195
the resources to be exported from the local machine.
184196
The config file contains one or more named resource groups.
185197
Each group contains one or more resource declarations and optionally a location
186-
string (see the :doc:`configuration reference <configuration>` for details).
198+
string.
187199

188200
For example, to export a ``USBSerialPort`` with ``ID_SERIAL_SHORT`` of
189201
``ID23421JLK``, the group name `example-group` and the location
@@ -233,6 +245,9 @@ Additional groups and resources can be added:
233245
match:
234246
ID_SERIAL_SHORT: KSLAH2341J
235247
248+
More information about the exporter configuration file can be found
249+
:ref:`here <exporter-configuration>`.
250+
236251
Restart the exporter to activate the new configuration.
237252

238253
.. Attention::
@@ -277,7 +292,7 @@ To show more details on the exported resources, use ``-v`` (or ``-vv``):
277292
'params': {'host': 'netio1', 'index': 3, 'model': 'netio'}}
278293
...
279294
280-
You can now add a place with:
295+
You can now add a place to the coordinator with:
281296

282297
.. code-block:: bash
283298
@@ -309,6 +324,42 @@ See :ref:`remote-usage` for some more advanced features.
309324
For a complete reference have a look at the :doc:`labgrid-client(1) <man/client>`
310325
man page.
311326

327+
Now, to connect drivers to the resources, you can configure an environment file,
328+
which we call ``remote.yaml`` in this case:
329+
330+
.. code-block:: yaml
331+
332+
targets:
333+
main:
334+
resources:
335+
RemotePlace:
336+
name: myplace
337+
drivers:
338+
SerialDriver: {}
339+
ShellDriver:
340+
prompt: 'root@[\w-]+:[^ ]+ '
341+
login_prompt: ' login: '
342+
username: 'root'
343+
344+
The ``RemotePlace`` resource makes all resources available that are assigned to
345+
to the place ``myplace`` on your coordinator.
346+
347+
Now, this environment file can be used interactively with the client:
348+
349+
.. code-block:: bash
350+
351+
labgrid-venv $ labgrid-client -c remote.yaml acquire
352+
labgrid-venv $ labgrid-client -c remote.yaml console
353+
labgrid-venv $ labgrid-client -c remote.yaml release
354+
355+
or directly with a test:
356+
357+
.. code-block:: bash
358+
359+
labgrid-venv $ labgrid-client -c remote.yaml acquire
360+
labgrid-venv $ pytest --lg-env remote.yaml test_shell.py
361+
labgrid-venv $ labgrid-client -c remote.yaml release
362+
312363
.. _remote-getting-started-systemd-files:
313364

314365
Systemd files

0 commit comments

Comments
 (0)