-
-
Notifications
You must be signed in to change notification settings - Fork 277
Hi, this is probably rather a "discussion" than an "issue"...
Currently I'll have around 8 places. A place consists of a DUT and a RPi with the labgrid-exporter(s) as systemd service, [labgrid v24.1]. Originally I liked to put my 8 RemotePlaces into one target "lab" in the exporter config. Then I used 8 different client environments. Doing it as in the configs down below, I could merge the client environments into one. But now I end up with 8 targets, providing the same name as RemotePlace. I know similar things were described in the documentation, but I could not figure out, neither found examples (this might be the small issue: please provide some .yaml examples with multiple RemotePlaces).
Questions:
- What is the difference between a "target" and a "resources/RemotePlace" from a setup point of view?
- Isn't there a way to declare a single target "lab" and in the client environment do a list of several "RemotePlace" names? Can you provide a snippet for this case?
- Most configs are the same, but some will have the usbsdmux attached, so as below UNIT01. So, how to merge redundant parts of the labgrid-client config, and setting up individually additional features?
- I need several NetworkService e.g. on UNIT03 I need a NetworkService on 1.2.3.49 (RPi) and another one 1.2.3.50 (DUT) - how to configure this case for the labgrid-exporter and for the labgrid-client?
- Also open for further issue in my configs.. I'd like to implement power control rather as driver, but this will be another issue. Somehow this approach fits me currently.
Labgrid-client Environment (reduced..)
targets:
UNIT01:
resources:
RemotePlace:
name: 'UNIT01'
drivers:
ExternalPowerDriver:
cmd_on: 'ssh pi@${LG_PLACE} sudo /usr/bin/gpio26.sh start'
cmd_off: 'ssh pi@${LG_PLACE} sudo /usr/bin/gpio26.sh stop'
cmd_cycle: 'ssh pi@${LG_PLACE} "sudo /usr/bin/gpio26.sh stop && sleep 1 && sudo /usr/bin/gpio26.sh start"'
SerialDriver: {}
SSHDriver:
keyfile: '~/.ssh/id_ed25519__foo'
USBSDMuxDriver: {}
UNIT03:
resources:
RemotePlace:
name: 'UNIT03'
drivers:
ExternalPowerDriver:
cmd_on: 'ssh pi@${LG_PLACE} sudo /usr/bin/gpio26.sh start'
cmd_off: 'ssh pi@${LG_PLACE} sudo /usr/bin/gpio26.sh stop'
cmd_cycle: 'ssh pi@${LG_PLACE} "sudo /usr/bin/gpio26.sh stop && sleep 1 && sudo /usr/bin/gpio26.sh start"'
SerialDriver: {}
SSHDriver:
keyfile: '~/.ssh/id_ed25519__foo'
tools:
usbsdmux: '${BASE}/../../venv/bin/usbsdmux'
options:
crossbar_url: 'ws://foo:20408/ws'
Labgrid-exporter UNIT01
UNIT01:
location: UNIT01
USBSerialPort:
match:
ID_PATH: platform-3f980000.usb-usb-0:1.1.3:1.1
speed: 115200
NetworkInterface:
ifname: eth0
NetworkService:
address: '1.2.3.17'
username: 'pi'
USBSDMuxDevice:
match:
ID_SERIAL_SHORT: '000000001197'
Labgrid-exporter UNIT03
UNIT03:
location: UNIT03
USBSerialPort:
match:
ID_PATH: platform-fd500000.pcie-pci-.&checktime(0000,01,00,':').0-usb-0:1.2:1.1
speed: 115200
NetworkInterface:
ifname: eth0
NetworkService:
address: '1.2.3.49'
username: 'pi'
All reactions
Replies: 4 comments 2 replies
- A
targetis a combination of resource and driver information while aRemotePlaceonly encodes resource information. - What do you mean with "single target lab"? The intention is very much to have a environment yaml configuration per target if each target runs it's own testsuite.
- See WIP: yaml include #799 for discussions on YAML includes. If you do have the same board multiple times I'd suggest templating outside of labgrid.
- Configure multiple
NetworkServiceswithadd-named-matchand bind to them inside the YAML. Not that within labgrid we explicitly care about interactions with the target and not running arbitrary commands on the exporter. For that a library likeparamikomay be better suited. - The Raspberry Pis could export the GPIOs as SysFSGPIO and than the GPIODigitalOutputDriver can use the GPIO and the DigitalOutputPowerDriver can use it for power switching.
All reactions
Thank you for answering!
-
Ok
-
Ok, I totally misunderstood the definition of "target"
-
Ok
-
Hum, I don't really understand your answer. In my case I have several places. A place setup consists of a RPi and a DUT. On the RPi runs the labgrid-exporter. I tried adding somehow
add-named-matchin the exporter yaml without success (isn't that actually rule matching?).
I really appreciate having possibilities to do lc ssh in labgrid. I'd like further to have something like lc ssh @dut or lc ssh @rpi. If this does not work, of course I may use external libraries, or stick to the shell as well and ssh to the DUT directly.
So, questions are: do I understand correctly, labgrid is not doing this exactly, then I'd need some external lib, right? And, may I still ask you to provide me some yaml snippet how this add-named-match looks like?
- The gpio story... well, the scripts I'm using I was using before labgrid and it was easier to kick them from out of labgrid the same way. I tried with sysfsgpio but unfortunately it never worked for me.
I tried as follows on the labgrid-exporter, using gpio5 - would be gpiochip0 5
$ cat /etc/labgrid/exporter.yaml
lab:
location: UNIT08
USBSerialPort:
match:
ID_PATH: platform-3f980000.usb-usb-0:1.1.3:1.1
speed: 115200
NetworkInterface: # ethernet
ifname: eth0
NetworkService:
address: '1.2.3.129'
username: 'pi'
SysfsGPIO:
index: 5
then starting the exporter, logs show this
...
2024年08月29日T23:55:37 marked as broken: start failed
1970年01月01日T01:00:00
{'cls': 'NetworkSysfsGPIO', 'params': OrderedDict(), 'acquired': '<broken>', 'avail': False}
2024年08月29日T23:55:37 ExporterSession.onUserError(): "OSError: [Errno 22] Invalid argument"
Traceback (most recent call last):
File "/opt/labgrid-venv/lib/python3.11/site-packages/txaio/aio.py", line 487, in done
res = f.result()
^^^^^^^^^^
File "/opt/labgrid-venv/lib/python3.11/site-packages/labgrid/remote/exporter.py", line 797, in acquire
resource.acquire(place_name)
File "/opt/labgrid-venv/lib/python3.11/site-packages/labgrid/remote/exporter.py", line 170, in acquire
self.poll()
File "/opt/labgrid-venv/lib/python3.11/site-packages/labgrid/remote/exporter.py", line 139, in poll
self.start()
File "/opt/labgrid-venv/lib/python3.11/site-packages/labgrid/remote/exporter.py", line 113, in start
self._start(start_params)
File "/opt/labgrid-venv/lib/python3.11/site-packages/labgrid/remote/exporter.py", line 615, in _start
with open(export_sysfs_path, mode='wb') as export:
OSError: [Errno 22] Invalid argument
...
My labgrid-client cannot see any provided GPIOs. Also, in the end I would need to use 4 different gpios. My scripts above worked quite well and are reachable from shell as well. Anyway, I'd rather love to see gpio power switching directly from off labgrid, though. Could you help me? What am I doing wrong in my exporter config?
All reactions
The libgpio gpiochipN and line number mapping to SysFSGpio's index number is not straight forward. Take a look at /sys/class/gpio and you will find something like gpiochip512. The 512 is the index number for pin 1 on a Raspi4. So if you want pin 5, use index 516 (512 + 5 - 1)
SysfsGPIO:
index: 516
then in your env.yaml file,
drivers:
- GpioDigitalOutputDriver:
- DigitalOutputPowerDriver:
Then in your strategy, bind "power" to PowerProtocol"
If you need active low, you will have to keep using your scripts. If you want active_low integrated into labgrid, please help support getting PR #1609 merged.
All reactions
Thank you so much, for the example! Sorry I saw this answer far too late.
At the time, I did a GPIO script (ab)using systemd as server, such that I could systemctl start GPIOxy and systemctl stop GPIOxy`. Nowadays, I guess GPIOs might be better driven by DBUS directly by the libgpio. The script served me still using the exact same command for development on the hardware in a rather hacky setup. I'd not recommend this approach for general usage.
All reactions
I am also interested in understanding how I can write strategies/pytests which use multiple places. My use case is setting up a mesh network across multiple DUTs. But I also need the ability to use just one DUT to do individual device tests. Therefore each DUT has it's own RemotePlace.
Can you give an example on how to set up the env.yaml to control multiple DUTs, a strategy to set the state of multiple DUTs and lastly pytest examples which work with multiple DUTs?
All reactions
Exactly, this seems like the logical next step for many test setups. Were anyone ever able to do this?