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 both 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. Build OpenThread to generate standalone OpenThread simulation `ot-cli-ftd`. For example, run the following command in the top directory of OpenThread. 14 ```bash 15 $ script/cmake-build simulation 16 ``` 17 Then `ot-cli-ftd` is built in the directory `build/simulation/examples/apps/cli/`. 18 19## Test Harness Environment Setup 20 211. Double click the file `harness\install.bat` on the machine which installed Harness. 22 232. Check the configuration file `C:\GRL\Thread1.2\Thread_Harness\simulation\config.py` 24 25 - Edit the value of `REMOTE_USERNAME` to the username expected to connect to on the remote POSIX environment. 26 - Edit the value of `REMOTE_PASSWORD` to the password corresponding to the username above. 27 - Edit the value of `REMOTE_OT_PATH` to the absolute path where the top directory of the OpenThread repository is located. 28 293. Add the additional simulation device information in `harness\Web\data\deviceInputFields.xml` to `C:\GRL\Thread1.2\Web\data\deviceInputFields.xml`. 30 31## Run Test Harness on Simulation 32 331. On POSIX machine, change directory to the top of OpenThread repository, and run the following commands. 34 35 ```bash 36 $ cd tools/harness-simulation/posix 37 $ python harness_dev_discovery.py \ 38 --interface=eth0 \ 39 --ot1.1=24 \ 40 --sniffer=2 41 ``` 42 43 It starts 24 OT FTD simulations and 2 sniffer simulations and can be discovered on eth0. 44 45 The arguments can be adjusted according to the requirement of test cases. 46 472. Run Test Harness. The information field of the device is encoded as `<node_id>@<ip_addr>`. Choose the proper device as the DUT accordingly. 48 493. Select one or more test cases to start the test. 50