2022-01-11 02:36:50 -05:00
# Openthread Extension Commands
2022-01-04 07:45:37 -05:00
2022-01-11 02:36:50 -05:00
The ESP OpenThread examples provide a series of extension commands in addition to the standard [OpenThread CLI ](https://github.com/openthread/openthread/blob/main/src/cli/README.md ).
The extension commands are available in the following examples:
2022-01-04 07:45:37 -05:00
* [ot_cli ](../ot_cli )
* [ot_br ](../ot_br )
2022-01-11 02:36:50 -05:00
## Enabling the extension commands
2022-01-04 07:45:37 -05:00
2022-01-11 02:36:50 -05:00
To enable OpenThread extension commands, the following Kconfig option needs to be enabled:
`OpenThread Extension CLI` -> `Enable Espressif's extended features` .
2022-01-04 07:45:37 -05:00
2022-01-11 02:36:50 -05:00
## Commands
2022-01-04 07:45:37 -05:00
* [iperf ](#iperf )
* [tcpsockclient ](#tcpsockclient )
* [tcpsockserver ](#tcpsockserver )
* [udpsockclient ](#udpsockclient )
* [udpsockserver ](#udpsockserver )
* [wifi ](#wifi )
### iperf
2022-01-11 02:36:50 -05:00
Iperf is a tool for performing TCP or UDP throughput on the Thread network.
For running iperf, you need to have two Thread devices on the same network.
* General Options
2022-01-04 07:45:37 -05:00
```bash
iperf
---iperf parameter---
-s : server mode, only receive
-u : upd mode
2022-01-11 02:36:50 -05:00
-V : use IPV6 address
2022-01-04 07:45:37 -05:00
-c < addr > : client mode, only transmit
-i < interval > : seconds between periodic bandwidth reports
-t < time > : time in seconds to transmit for (default 10 secs)
-p < port > : server port to listen on/connect to
-l < len_send_buf > : the lenth of send buffer
---example---
2022-01-11 02:36:50 -05:00
create a tcp server : iperf -s -i 3 -p 5001 -t 60
2022-01-04 07:45:37 -05:00
create a udp client : iperf -c < addr > -u -i 3 -t 60 -p 5001 -l 512
Done
```
2022-01-11 02:36:50 -05:00
* Typical usage
2022-01-04 07:45:37 -05:00
2022-01-11 02:36:50 -05:00
For measuring the TCP throughput, first create an iperf service on one node:
2022-01-04 07:45:37 -05:00
```bash
2022-01-11 02:36:50 -05:00
> iperf -V -s -t 20 -i 3 -p 5001
2022-01-04 07:45:37 -05:00
Done
```
2022-01-11 02:36:50 -05:00
Then create an iperf client connecting to the service on another node. Here we use `fdde:ad00:beef:0:a7c6:6311:9c8c:271b` as the example service address.
2022-01-04 07:45:37 -05:00
```bash
> iperf -V -c fdde:ad00:beef:0:a7c6:6311:9c8c:271b -t 20 -i 1 -p 5001 -l 85
Done
Interval Bandwidth
0- 1 sec 0.05 Mbits/sec
1- 2 sec 0.05 Mbits/sec
2- 3 sec 0.05 Mbits/sec
3- 4 sec 0.05 Mbits/sec
4- 5 sec 0.05 Mbits/sec
...
19- 20 sec 0.05 Mbits/sec
0- 20 sec 0.05 Mbits/sec
```
2022-01-11 02:36:50 -05:00
For measuring the UDP throughput, first create an iperf service similarly:
2022-01-04 07:45:37 -05:00
```bash
2022-01-11 02:36:50 -05:00
> iperf -V -u -s -t 20 -i 3 -p 5001
2022-01-04 07:45:37 -05:00
Done
```
2022-01-11 02:36:50 -05:00
Then create an iperf client:
2022-01-04 07:45:37 -05:00
```bash
2022-01-11 02:36:50 -05:00
> iperf -V -u -c fdde:ad00:beef:0:a7c6:6311:9c8c:271b -t 20 -i 1 -p 5001 -l 85
2022-01-04 07:45:37 -05:00
Done
```
### tcpsockserver
Used for creating a tcp server.
```bash
> tcpsockserver
Done
I (1310225) ot_socket: Socket created
I (1310225) ot_socket: Socket bound, port 12345
I (1310225) ot_socket: Socket listening, timeout is 30 seconds
```
2022-01-11 02:36:50 -05:00
### tcpsockclient
2022-01-04 07:45:37 -05:00
2022-01-11 02:36:50 -05:00
Used for creating a tcp client.
2022-01-04 07:45:37 -05:00
```bash
2022-01-11 02:36:50 -05:00
> tcpsockclient fdde:ad00:beef:0:a7c6:6311:9c8c:271b
2022-01-04 07:45:37 -05:00
Done
ot_socket: Socket created, connecting to fdde:ad00:beef:0:a7c6:6311:9c8c:271b:12345
ot_socket: Successfully connected
...
```
### udpsockserver
Used for creating a udp server.
```bash
> udpsockserver
Done
I (1310225) ot_socket: Socket created
I (1310225) ot_socket: Socket bound, port 12345
I (1310225) ot_socket: Socket listening, timeout is 30 seconds
```
2022-01-11 02:36:50 -05:00
### udpsockclient
2022-01-04 07:45:37 -05:00
2022-01-11 02:36:50 -05:00
Used for creating a udp client. Note that the client shall be connected to the same Thread network as the server.
2022-01-04 07:45:37 -05:00
```bash
2022-01-11 02:36:50 -05:00
> udpsockclient fdde:ad00:beef:0:a7c6:6311:9c8c:271b
2022-01-04 07:45:37 -05:00
Done
2022-01-11 02:36:50 -05:00
ot_socket: Socket created, connecting to fdde:ad00:beef:0:a7c6:6311:9c8c:271b:12345
ot_socket: Successfully connected
...
2022-01-04 07:45:37 -05:00
```