• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

otci/03-Aug-2024-3,3992,218

tests/03-Aug-2024-746570

LICENSED03-Aug-20241.5 KiB2623

README.mdD03-Aug-20241.4 KiB5439

setup.pyD03-Aug-20242.3 KiB5120

README.md

1# OpenThread Control Interface
2
3The OpenThread Control Interface (OTCI) is a library which provides uniform python interfaces to connect and control various kinds of devices running OpenThread.
4
5## Supported device types
6
7- OpenThread CLI
8  - SOC device via Serial
9- OpenThread NCP (limited support via [pyspinel](https://pypi.org/project/pyspinel/))
10  - SOC device via Serial
11- [OpenThread Border Router](https://github.com/openthread/ot-br-posix)
12  - OTBR device via SSH
13
14## Example
15
16```python
17import otci
18
19# Connect to an OTBR device via SSH
20node1 = otci.connect_otbr_ssh("192.168.1.101")
21
22# Connect to an OpenThread CLI device via Serial
23node2 = otci.connect_cli_serial("/dev/ttyACM0"))
24
25# Start node1 to become Leader
26node1.dataset_init_buffer()
27node1.dataset_set_buffer(network_name='test', network_key='00112233445566778899aabbccddeeff', panid=0xface, channel=11)
28node1.dataset_commit_buffer('active')
29
30node1.ifconfig_up()
31node1.thread_start()
32node1.wait(5)
33assert node1.get_state() == "leader"
34
35# Start Commissioner on node1
36node1.commissioner_start()
37node1.wait(3)
38
39node1.commissioner_add_joiner("TEST123",eui64='*')
40
41# Start node2
42node2.ifconfig_up()
43node2.set_router_selection_jitter(1)
44
45# Start Joiner on node2 to join the network
46node2.joiner_start("TEST123")
47node2.wait(10, expect_line="Join success")
48
49# Wait for node 2 to become Router
50node2.thread_start()
51node2.wait(5)
52assert node2.get_state() == "router"
53```
54