Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
otci/ | 11-Mar-2024 | - | 3,399 | 2,218 | ||
tests/ | 11-Mar-2024 | - | 746 | 570 | ||
LICENSE | D | 11-Mar-2024 | 1.5 KiB | 26 | 23 | |
README.md | D | 11-Mar-2024 | 1.4 KiB | 54 | 39 | |
setup.py | D | 11-Mar-2024 | 2.3 KiB | 51 | 20 |
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