xref: /aosp_15_r20/external/openthread/tools/harness-thci/README.md (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1*cfb92d14SAndroid Build Coastguard Worker# THCI & Test Environment Setup
2*cfb92d14SAndroid Build Coastguard Worker
3*cfb92d14SAndroid Build Coastguard WorkerTHCI (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*cfb92d14SAndroid Build Coastguard Worker
5*cfb92d14SAndroid Build Coastguard WorkerCurrently, there are two THCI implementations for OpenThread:
6*cfb92d14SAndroid Build Coastguard Worker
7*cfb92d14SAndroid Build Coastguard Worker- OpenThread CLI — Based on the CC2538 example platform, which is included in the current Thread Test Harness Software release.
8*cfb92d14SAndroid Build Coastguard Worker- OpenThread `wpanctl` — Based on `wpantund` running on a Linux host (for example, a Raspberry Pi 3B) working with a Network Co-Processor (NCP) (for example, a Nordic Semiconductor nRF52840) running an OpenThread NCP image.
9*cfb92d14SAndroid Build Coastguard Worker
10*cfb92d14SAndroid Build Coastguard WorkerPlatform developers should modify the THCI implementation directly to match their platform (for example, serial baud rate). Alternatively, platform developers may follow the instructions below to add a new THCI implementation to the Test Harness.
11*cfb92d14SAndroid Build Coastguard Worker
12*cfb92d14SAndroid Build Coastguard Worker## OpenThread Environment Setup
13*cfb92d14SAndroid Build Coastguard Worker
14*cfb92d14SAndroid Build Coastguard Worker1. Copy "OpenThread.png" to `C:\GRL\Thread1.1\Web\images`.
15*cfb92d14SAndroid Build Coastguard Worker
16*cfb92d14SAndroid Build Coastguard Worker2. Copy "deviceInputFields.xml" to `C:\GRL\Thread1.1\Web\data`.
17*cfb92d14SAndroid Build Coastguard Worker
18*cfb92d14SAndroid Build Coastguard Worker3. Copy "OpenThread.py" to `C:GRL\Thread1.1\Thread_Harness\THCI`.
19*cfb92d14SAndroid Build Coastguard Worker
20*cfb92d14SAndroid Build Coastguard Worker4. Connect the DUT (Device Under Test), a sniffer, and CC2538DK (or other hardware running OpenThread, as the reference device) to the Host PC.
21*cfb92d14SAndroid Build Coastguard Worker
22*cfb92d14SAndroid Build Coastguard Worker5. Launch the Thread Test Harness Software, modify the default configuration if needed, and select **Start**.
23*cfb92d14SAndroid Build Coastguard Worker
24*cfb92d14SAndroid Build Coastguard Worker6. Drag the "OpenThread: TI CC2538DK" reference device to the **Test Bed** section with the desired number.
25*cfb92d14SAndroid Build Coastguard Worker
26*cfb92d14SAndroid Build Coastguard Worker7. Select one or more test cases to execute.
27*cfb92d14SAndroid Build Coastguard Worker
28*cfb92d14SAndroid Build Coastguard Worker## OpenThread WpanCtl Environment Setup
29*cfb92d14SAndroid Build Coastguard Worker
30*cfb92d14SAndroid Build Coastguard Worker1. Copy "OpenThread_WpanCtl.png" to `C:\GRL\Thread1.1\Web\images`.
31*cfb92d14SAndroid Build Coastguard Worker
32*cfb92d14SAndroid Build Coastguard Worker2. Copy "deviceInputFields.xml" to `C:\GRL\Thread1.1\Web\data`.
33*cfb92d14SAndroid Build Coastguard Worker
34*cfb92d14SAndroid Build Coastguard Worker3. Copy "OpenThread_WpanCtl.py" to `C:\GRL\Thread1.1\Thread_Harness\THCI`.
35*cfb92d14SAndroid Build Coastguard Worker
36*cfb92d14SAndroid Build Coastguard Worker4. Connect the NCP board (nRF52840) to the Raspberry Pi's USB port and verify that the `wpanctl` command works.
37*cfb92d14SAndroid Build Coastguard Worker
38*cfb92d14SAndroid Build Coastguard Worker5. Connect the Raspberry Pi's GPIOs (for Raspberry Pi 3B, link Pin8 as TXD, Pin10 as RXD, and Pin14 as GND) with a UART2USB adapter.
39*cfb92d14SAndroid Build Coastguard Worker
40*cfb92d14SAndroid Build Coastguard Worker6. Connect the DUT (with Step 5's adapter), sniffer, and other golden devices (as reference devices) to the Host PC.
41*cfb92d14SAndroid Build Coastguard Worker
42*cfb92d14SAndroid Build Coastguard Worker7. Get the DUT serial port hardware identifier and add a new platform group named OpenThread_WpanCtl in `C:\GRL\Thread1.1\Config\Configuration.ini`. See https://openthread.io/certification/automation-setup#acting_as_a_new_reference_platform for more information.
43*cfb92d14SAndroid Build Coastguard Worker
44*cfb92d14SAndroid Build Coastguard Worker8. Launch the Thread Test Harness Software, modify the default configuration if needed, and select **Start**.
45*cfb92d14SAndroid Build Coastguard Worker
46*cfb92d14SAndroid Build Coastguard Worker9. Drag the "OpenThread_WpanCtl: Wpantund + NCP" reference device to the **Test Bed** section with the desired number.
47*cfb92d14SAndroid Build Coastguard Worker
48*cfb92d14SAndroid Build Coastguard Worker10. Select one or more test cases to execute.
49*cfb92d14SAndroid Build Coastguard Worker
50*cfb92d14SAndroid Build Coastguard WorkerThe above is for the serial connection mode between the DUT and the Host PC. The ssh connection mode is also supported for OpenThread WpanCtl, but it can not be auto-discovered and only can be used via ‘Drag and Add’ way in the ‘Configure Test Bed’ Page of Test Harness. The configuration is as following:
51*cfb92d14SAndroid Build Coastguard Worker
52*cfb92d14SAndroid Build Coastguard Worker1. Make Raspberry Pi and Host PC in the same LAN.
53*cfb92d14SAndroid Build Coastguard Worker
54*cfb92d14SAndroid Build Coastguard Worker2. Login Raspberry Pi, sudo raspi-config, then -> interfacing options -> enable ssh.
55*cfb92d14SAndroid Build Coastguard Worker
56*cfb92d14SAndroid Build Coastguard Worker3. Install python paramiko package to `C:\GRL\Pyton2.7`
57*cfb92d14SAndroid Build Coastguard Worker
58*cfb92d14SAndroid Build Coastguard Worker4. Copy "OpenThread_WpanCtl.png" to `C:\GRL\Thread1.1\Web\images`.
59*cfb92d14SAndroid Build Coastguard Worker
60*cfb92d14SAndroid Build Coastguard Worker5. Modify the Device section "forParam" values referring to the following indication then Copy "deviceInputFields.xml" to `C:\GRL\Thread1.1\Web\data`. TelnetIP : device's IP address Param5 : 'ip' for SSH login Param6 : SSH username Param7 : SSH password Param8 : comma separated CLI prompt, Wpan command prefix, Wpan interface Param9 : comma separated device's setting commands before test
61*cfb92d14SAndroid Build Coastguard Worker
62*cfb92d14SAndroid Build Coastguard Worker6. Copy "OpenThread_WpanCtl.py" to `C:\GRL\Thread1.1\Thread_Harness\THCI`.
63*cfb92d14SAndroid Build Coastguard Worker
64*cfb92d14SAndroid Build Coastguard Worker7. Launch the Thread Test Harness Software, modify the default configuration if needed, and select **Start**.
65*cfb92d14SAndroid Build Coastguard Worker
66*cfb92d14SAndroid Build Coastguard Worker8. Drag the "OpenThread_WpanCtl: Wpantund + NCP (SSH)" reference device to the **Test Bed** section with the desired number. Then fill in the Raspberry Pi IPv4 address and port and click `connect` icon button to get the NCP version.
67*cfb92d14SAndroid Build Coastguard Worker
68*cfb92d14SAndroid Build Coastguard Worker9. Select one or more test cases to execute.
69