README.md
1# Test Harness on Simulation Environment Setup
2
3THCI (Thread Host Controller Interface) is an implementation of the Python abstract class template `IThci`, which is used by the Thread Test Harness Software to control OpenThread-based reference devices according to each test scenario.
4
5SI (Sniffer Interface) is an implementation of the sniffer abstract class template `ISniffer`, which is used by the Thread Test Harness Software to sniff all packets sent by devices.
6
7Both OpenThread simulation and sniffer simulation are required to run on a POSIX environment. However, Harness has to be run on Windows, which is a non-POSIX environment. So two systems are needed, and their setup procedures in detail are listed in the following sections. Either two machines or one machine running two (sub)systems (for example, VM, WSL) is feasible.
8
9Platform developers should modify the THCI implementation and/or the SI implementation directly to match their platform (for example, the path of the OpenThread repository).
10
11## POSIX Environment Setup
12
131. Open the JSON format configuration file `tools/harness-simulation/posix/config.yml`:
14
15 - Edit the value of `ot_path` to the absolute path where the top directory of the OpenThread repository is located. For example, change the value of `ot_path` to `/home/<username>/repo/openthread`.
16 - For each entry in `ot_build.ot`, update the value of `number` to be the number of OT FTD simulations needed with the corresponding version.
17 - For each entry in `ot_build.otbr`, update the value of `number` to be the number of OTBR simulations needed with the corresponding version.
18 - The numbers above can be adjusted according to the requirement of test cases.
19 - Edit the value of `ssh.username` to the username to be used for connecting to the remote POSIX environment.
20 - Edit the value of `ssh.password` to the password corresponding to the username above.
21 - Edit the value of `discovery_ifname` to the network interface that the Harness will connect to.
22
23 Note that it may be time-consuming to build all versions of `ot-cli-ftd`s and OTBR Docker images especially on devices such as Raspberry Pis.
24
252. Run the installation script.
26
27 ```bash
28 $ tools/harness-simulation/posix/install.sh
29 ```
30
31## Test Harness Environment Setup
32
331. Copy the directory `tools/harness-simulation` from the POSIX machine to the Windows machine, and then switch to that directory.
34
352. Double click the file `harness\install.bat` on Windows.
36
37## Run Test Harness on Simulation
38
391. On the POSIX machine, change directory to the top of the OpenThread repository, and run the following commands.
40
41 ```bash
42 $ cd tools/harness-simulation/posix
43 $ ./launch_testbed.py -c config.yml
44 ```
45
46 This example starts several OT FTD simulations, OTBR simulations, and sniffer simulations and can be discovered on `eth0`. The number of each type of simulation is specified in the configuration file `config.yml`.
47
482. Run the Test Harness. The information field of the device is encoded as `<tag>_<node_id>@<ip_addr>`. Choose the desired device as the DUT.
49
503. Select one or more test cases to start the test.
51