diff --git a/README.md b/README.md index 9784459e6..8377b0cb5 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,21 @@ real. Using [`labgrid`](https://labgrid.readthedocs.io/en/latest/) to control the devices, the framework offers a simple way to write tests and run them on different hardware. -## Requirements +## Testing + +This section provides information on how to run tests using OpenWrt Testing, +either on real or emulated devices. If you want to deploy real devices for +testing, please see the *Lab Setup* section.. + +### Requirements + +There are multiple ways to run tests, on real or emulated devices. - An OpenWrt firmware image - Python and [`uv`](https://docs.astral.sh/uv/) -- QEMU +- QEMU (for emulated devices) - -## Setup +### Setup For maximum convenience, clone the repository inside the `openwrt.git` repository as `tests/`: @@ -51,8 +58,6 @@ You can run tests via the Makefile or directly using `pytest`. You can start runtime and shell tests via the Makefile. -#### Runtime tests - ```shell cd /path/to/openwrt.git make tests/x86-64 V=s @@ -145,3 +150,50 @@ Lastly, unlock your device when you're done: ```shell uv run labgrid-client unlock ``` + +## Lab Setup + +Setting up a new lab involves several steps and is a fun and curious process, +however some precise and forward thinking is required to ensure a successful +setup. This section describes a low-cost setup usable for network communities +and individuals. Larger setups will be added in the future. + +### Concept + +The general idea is to have independent labs (i.e. coordinator and exporter) and +connect them over a global coordinator, which has access to all labs. Developers +and CI can access individual labs over the global coordinator, the graphic below +gives an idea. + +![](docs/img/labnet_overview.png) + +This decentralized approach allows labs to function even if the global +coordinator is down. Also access management can be individually controlled, i.e. +which developer may access which lab or at what time automated CIs run tests. + +### Requirements + +* Coordinator/Exporter (i.e **RaspberryPi 5**) +* PoE switch (i.e. **Zyxel GS1900-8HP**) +* PoE Splitter (12v, 5v, etc.) +* Devices-Under-Test (DUTs) +* Some cables +* A guest wifi + +### Setup + +For a minimal setup, a single device runs the coordinator and exporter at the +same time, from now on called controller. The controller is connected to a PoE +switch, managing network and power. A serial to USB-to-serial converter is +needed for each *Device Under Test* (DUT) as well as a PoE splitter. + +> [!NOTE] +> Larger setups may run multiple exporters, each connected to a separate PoE +> switch. + +![](docs/img/labnet_setup.png) + +### Conroller + +The controller should be setup via Ansible, which install `labgrid` as well as +all required tools. diff --git a/docs/img/labnet_overview.png b/docs/img/labnet_overview.png new file mode 100644 index 000000000..b89bd5e3c Binary files /dev/null and b/docs/img/labnet_overview.png differ diff --git a/docs/img/labnet_setup.png b/docs/img/labnet_setup.png new file mode 100644 index 000000000..4c3f94297 Binary files /dev/null and b/docs/img/labnet_setup.png differ diff --git a/docs/labs/aparcar.md b/docs/labs/aparcar.md new file mode 100644 index 000000000..2a3e6084c --- /dev/null +++ b/docs/labs/aparcar.md @@ -0,0 +1,57 @@ +# Devices in LeineLab Testlab + +## Coordinator/Exporter + +### Raspberry Pi 5 + +- Ethernet (eth0): Connection to Switch +- Hardware serial: Not connected +- GPIO: Not connected +- USB: Connected to USB Serial converters and a USB hub + +## Switch + +### Zyxel GS1900-10HP Switch + +- Ethernet Ports: + - Port 1 (eth): Connected to managed switch untagged VLAN 101 + - Port 2 (eth): Connected to managed switch untagged VLAN 102 + - Port 3 (eth): Connected to managed switch untagged VLAN 103 + - Port 4 (eth): Connected to managed switch untagged VLAN 104 + - Port 5 (eth): Connected to managed switch untagged VLAN 105 + - Port 6 (eth): Connected to managed switch untagged VLAN 106 + - Port 7 (eth): Connected to managed switch untagged VLAN 107 + - Port 8 (eth): Connected to managed switch untagged VLAN 108 + - Port 9 (sfp): Connected to unmanaged switch untagged VLAN 200 + - Port 10 (sfp): Connected to Raspberry Pi 5 + +## DUT + +### genexis_pulse-ex400 + +- WAN Port: Connected to unmanaged switch +- LAN-Port 1: Connected to managed switch VLAN 101 + +### tplink_tl-wdr3600-v1 + +- WAN Port: Connected to unmanaged switch +- LAN-Port 1: Connected to managed switch VLAN 102 + +### openwrt_one + +- WAN Port: Connected to managed switch VLAN 103 +- LAN-Port 1: Connected to managed switch VLAN 104 + +### bananapi_bpi-r4 + +- WAN Port: Connected to unmanaged switch +- LAN-Port 1: Connected to managed switch VLAN 105 + +### glinet_gl-mt6000 + +- WAN Port: Connected to unmanaged switch +- LAN-Port 1: Connected to managed switch VLAN 107 + +### rpi-4 + +- LAN-Port 1: Connected to managed switch VLAN 108 diff --git a/docs/labs/leinelab.md b/docs/labs/leinelab.md index 91b7a49eb..aa6562f02 100644 --- a/docs/labs/leinelab.md +++ b/docs/labs/leinelab.md @@ -1,22 +1,24 @@ # Devices in LeineLab Testlab ## Coordinator/Exporter + - Raspberry Pi 3 - - Ethernet (eth0): Uplink - - USB NIC (eth1): Connected to LAN iface of TPLink 1043 - - Hardware serial: Connected to hardware serial of TPLink 1043 - - GPIO: Control power and reset-pin of TPLink 1043 via Relays + - Ethernet (eth0): Uplink + - USB NIC (eth1): Connected to LAN iface of TPLink 1043 + - Hardware serial: Connected to hardware serial of TPLink 1043 + - GPIO: Control power and reset-pin of TPLink 1043 via Relays ## DUT + - TPLink 1043 - - WAN-Port: Uplink - - LAN-Port 1: Connected to USB NIC of Raspberry Pi - - LAN-Port 2: n/c - - LAN-Port 3: n/c - - LAN-Port 4: n/c - - Serial: Connected to hardware serial of TPLink 1043 - - Power: Controlled by relais via GPIO - - Reset-Pin: Controlled by relais via GPIO + - WAN-Port: Uplink + - LAN-Port 1: Connected to USB NIC of Raspberry Pi + - LAN-Port 2: n/c + - LAN-Port 3: n/c + - LAN-Port 4: n/c + - Serial: Connected to hardware serial of TPLink 1043 + - Power: Controlled by relais via GPIO + - Reset-Pin: Controlled by relais via GPIO ## Misc Hardware