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

..--

BUILD.gnD11-Mar-20242.6 KiB8074

CMakeLists.txtD11-Mar-20242.5 KiB7365

Makefile.amD11-Mar-20247.6 KiB20884

README.mdD11-Mar-202475.8 KiB3,6912,694

README_BR.mdD11-Mar-20243.7 KiB209148

README_COAP.mdD11-Mar-20245.8 KiB243180

README_COAPS.mdD11-Mar-20244.8 KiB264192

README_COMMISSIONER.mdD11-Mar-20245.2 KiB265184

README_COMMISSIONING.mdD11-Mar-20242.1 KiB11889

README_DATASET.mdD11-Mar-202410.4 KiB571418

README_HISTORY.mdD11-Mar-202434.4 KiB653549

README_JOINER.mdD11-Mar-20241.3 KiB10975

README_NETDATA.mdD11-Mar-202410.2 KiB428314

README_SRP.mdD11-Mar-20243.8 KiB188151

README_SRP_CLIENT.mdD11-Mar-20248.7 KiB457320

README_SRP_SERVER.mdD11-Mar-20243.6 KiB219160

README_TCP.mdD11-Mar-20245.2 KiB218149

README_UDP.mdD11-Mar-20244 KiB230159

cli.cppD11-Mar-2024259.9 KiB8,7955,241

cli.hppD11-Mar-202424.6 KiB653383

cli_br.cppD11-Mar-202414 KiB538235

cli_br.hppD11-Mar-20242.9 KiB9732

cli_coap.cppD11-Mar-202431 KiB937748

cli_coap.hppD11-Mar-20246.6 KiB187108

cli_coap_secure.cppD11-Mar-202423.5 KiB761603

cli_coap_secure.hppD11-Mar-20245.7 KiB16687

cli_commissioner.cppD11-Mar-202416 KiB510381

cli_commissioner.hppD11-Mar-20244.2 KiB11646

cli_config.hD11-Mar-20246.1 KiB19050

cli_dataset.cppD11-Mar-202440.4 KiB1,469867

cli_dataset.hppD11-Mar-20243 KiB9333

cli_extension_example.cD11-Mar-20242.3 KiB5820

cli_extension_example.cmakeD11-Mar-20242 KiB4033

cli_history.cppD11-Mar-202429.2 KiB777569

cli_history.hppD11-Mar-20243.7 KiB11042

cli_joiner.cppD11-Mar-20247.6 KiB284115

cli_joiner.hppD11-Mar-20242.9 KiB9227

cli_network_data.cppD11-Mar-202423 KiB869434

cli_network_data.hppD11-Mar-20244.9 KiB14938

cli_output.cppD11-Mar-202411.5 KiB432277

cli_output.hppD11-Mar-202418.6 KiB553145

cli_srp_client.cppD11-Mar-202419.6 KiB643463

cli_srp_client.hppD11-Mar-20243.9 KiB11243

cli_srp_server.cppD11-Mar-202412.9 KiB426294

cli_srp_server.hppD11-Mar-20243 KiB9627

cli_tcp.cppD11-Mar-202430.6 KiB904719

cli_tcp.hppD11-Mar-202411.4 KiB220139

cli_udp.cppD11-Mar-20249.3 KiB327220

cli_udp.hppD11-Mar-20243.1 KiB9126

ftd.cmakeD11-Mar-20242.1 KiB5648

mtd.cmakeD11-Mar-20242.1 KiB5648

radio.cmakeD11-Mar-20242.3 KiB6556

x509_cert_key.hppD11-Mar-20245.3 KiB11847

README.md

1# OpenThread CLI Reference
2
3The OpenThread CLI exposes configuration and management APIs via a command line interface. Use the CLI to play with OpenThread, which can also be used with additional application code. The OpenThread test scripts use the CLI to execute test cases.
4
5## Separator and escaping characters
6
7The whitespace character (`' '`) is used to delimit the command name and the different arguments, together with tab (`'\t'`) and new line characters (`'\r'`, `'\n'`).
8
9Some arguments might require to accept whitespaces on them. For those cases the backslash character (`'\'`) can be used to escape separators or the backslash itself.
10
11Example:
12
13```bash
14> networkname Test\ Network
15Done
16> networkname
17Test Network
18Done
19>
20```
21
22## OpenThread Command List
23
24- [ba](#ba)
25- [bbr](#bbr)
26- [br](README_BR.md)
27- [bufferinfo](#bufferinfo)
28- [ccathreshold](#ccathreshold)
29- [channel](#channel)
30- [child](#child-list)
31- [childip](#childip)
32- [childmax](#childmax)
33- [childsupervision](#childsupervision-interval)
34- [childtimeout](#childtimeout)
35- [coap](README_COAP.md)
36- [coaps](README_COAPS.md)
37- [coex](#coex)
38- [commissioner](README_COMMISSIONER.md)
39- [contextreusedelay](#contextreusedelay)
40- [counters](#counters)
41- [csl](#csl)
42- [dataset](README_DATASET.md)
43- [delaytimermin](#delaytimermin)
44- [deviceprops](#deviceprops)
45- [diag](#diag)
46- [discover](#discover-channel)
47- [dns](#dns-config)
48- [domainname](#domainname)
49- [dua](#dua-iid)
50- [eidcache](#eidcache)
51- [eui64](#eui64)
52- [extaddr](#extaddr)
53- [extpanid](#extpanid)
54- [factoryreset](#factoryreset)
55- [fake](#fake)
56- [fem](#fem)
57- [history](README_HISTORY.md)
58- [ifconfig](#ifconfig)
59- [ipaddr](#ipaddr)
60- [ipmaddr](#ipmaddr)
61- [joiner](README_JOINER.md)
62- [joinerport](#joinerport-port)
63- [keysequence](#keysequence-counter)
64- [leaderdata](#leaderdata)
65- [leaderweight](#leaderweight)
66- [linkmetrics](#linkmetrics-mgmt-ipaddr-enhanced-ack-clear)
67- [locate](#locate)
68- [log](#log-filename-filename)
69- [mac](#mac-retries-direct)
70- [macfilter](#macfilter)
71- [meshdiag](#meshdiag-topology)
72- [mliid](#mliid-iid)
73- [mlr](#mlr-reg-ipaddr--timeout)
74- [mode](#mode)
75- [multiradio](#multiradio)
76- [nat64](#nat64-cidr)
77- [neighbor](#neighbor-list)
78- [netdata](README_NETDATA.md)
79- [netstat](#netstat)
80- [networkdiagnostic](#networkdiagnostic-get-addr-type-)
81- [networkidtimeout](#networkidtimeout)
82- [networkkey](#networkkey)
83- [networkname](#networkname)
84- [networktime](#networktime)
85- [panid](#panid)
86- [parent](#parent)
87- [parentpriority](#parentpriority)
88- [partitionid](#partitionid)
89- [ping](#ping-async--i-source-ipaddr-size-count-interval-hoplimit-timeout)
90- [platform](#platform)
91- [pollperiod](#pollperiod-pollperiod)
92- [preferrouterid](#preferrouterid-routerid)
93- [prefix](#prefix)
94- [promiscuous](#promiscuous)
95- [pskc](#pskc)
96- [pskcref](#pskcref)
97- [radiofilter](#radiofilter)
98- [rcp](#rcp)
99- [region](#region)
100- [releaserouterid](#releaserouterid-routerid)
101- [reset](#reset)
102- [rloc16](#rloc16)
103- [route](#route)
104- [router](#router-list)
105- [routerdowngradethreshold](#routerdowngradethreshold)
106- [routereligible](#routereligible)
107- [routerselectionjitter](#routerselectionjitter)
108- [routerupgradethreshold](#routerupgradethreshold)
109- [childrouterlinks](#childrouterlinks)
110- [scan](#scan-channel)
111- [service](#service)
112- [singleton](#singleton)
113- [sntp](#sntp-query-sntp-server-ip-sntp-server-port)
114- [state](#state)
115- [srp](README_SRP.md)
116- [tcp](README_TCP.md)
117- [thread](#thread-start)
118- [trel](#trel)
119- [tvcheck](#tvcheck-enable)
120- [txpower](#txpower)
121- [udp](README_UDP.md)
122- [unsecureport](#unsecureport-add-port)
123- [uptime](#uptime)
124- [vendor](#vendor-name)
125- [version](#version)
126
127## OpenThread Command Details
128
129### bbr
130
131Show current Primary Backbone Router information for Thread 1.2 device.
132
133```bash
134> bbr
135BBR Primary:
136server16: 0xE400
137seqno:    10
138delay:    120 secs
139timeout:  300 secs
140Done
141```
142
143```bash
144> bbr
145BBR Primary: None
146Done
147```
148
149### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
150
151Configure the response status for DUA.req with meshLocalIid in payload. Without meshLocalIid, simply respond any coming DUA.req next with the specified status or COAP code.
152
153Only for testing/reference device.
154
155known status value:
156
157- 0: ST_DUA_SUCCESS
158- 1: ST_DUA_REREGISTER
159- 2: ST_DUA_INVALID
160- 3: ST_DUA_DUPLICATE
161- 4: ST_DUA_NO_RESOURCES
162- 5: ST_DUA_BBR_NOT_PRIMARY
163- 6: ST_DUA_GENERAL_FAILURE
164- 160: COAP code 5.00
165
166```bash
167> bbr mgmt dua 1 2f7c235e5025a2fd
168Done
169> bbr mgmt dua 160
170Done
171```
172
173### bbr mgmt mlr listener
174
175Show the Multicast Listeners.
176
177Only for testing/reference Backbone Router device.
178
179```bash
180> bbr mgmt mlr listener
181ff04:0:0:0:0:0:0:abcd 3534000
182ff04:0:0:0:0:0:0:eeee 3537610
183Done
184```
185
186### bbr mgmt mlr listener add \<ipaddr\> \[\<timeout\>\]
187
188Add a Multicast Listener with a given IPv6 multicast address and timeout (in seconds).
189
190Only for testing/reference Backbone Router device.
191
192```bash
193> bbr mgmt mlr listener add ff04::1
194Done
195> bbr mgmt mlr listener add ff04::2 300
196Done
197> bbr mgmt mlr listener
198ff04:0:0:0:0:0:0:2 261
199ff04:0:0:0:0:0:0:1 3522
200Done
201```
202
203### bbr mgmt mlr listener clear
204
205Removes all the Multicast Listeners.
206
207Only for testing/reference Backbone Router device.
208
209```bash
210> bbr mgmt mlr listener clear
211Done
212> bbr mgmt mlr listener
213Done
214```
215
216### bbr mgmt mlr response \<status\>
217
218Configure the response status for the next MLR.req.
219
220Only for testing/reference device.
221
222Known status values:
223
224- 0: ST_MLR_SUCCESS
225- 2: ST_MLR_INVALID
226- 3: ST_MLR_NO_PERSISTENT
227- 4: ST_MLR_NO_RESOURCES
228- 5: ST_MLR_BBR_NOT_PRIMARY
229- 6: ST_MLR_GENERAL_FAILURE
230
231```bash
232> bbr mgmt mlr response 2
233Done
234```
235
236### bbr state
237
238Show local Backbone state ([`Disabled`,`Primary`, `Secondary`]) for Thread 1.2 FTD.
239
240`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
241
242```bash
243> bbr state
244Disabled
245Done
246
247> bbr state
248Primary
249Done
250
251> bbr state
252Secondary
253Done
254```
255
256### bbr enable
257
258Enable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggered for attached device if there is no Backbone Router Service in Thread Network Data.
259
260`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
261
262```bash
263> bbr enable
264Done
265```
266
267### bbr disable
268
269Disable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggered if Backbone Router is Primary state. o `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
270
271```bash
272> bbr disable
273Done
274```
275
276### bbr register
277
278Register Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggered for attached device.
279
280`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
281
282```bash
283> bbr register
284Done
285```
286
287### bbr config
288
289Show local Backbone Router configuration for Thread 1.2 FTD.
290
291`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
292
293```bash
294> bbr config
295seqno:    10
296delay:    120 secs
297timeout:  300 secs
298Done
299```
300
301### bbr config \[seqno \<seqno\>\] \[delay \<delay\>\] \[timeout \<timeout\>\]
302
303Configure local Backbone Router configuration for Thread 1.2 FTD. `bbr register` should be issued explicitly to register Backbone Router service to Leader for Secondary Backbone Router. `SRV_DATA.ntf` would be initiated automatically if BBR Dataset changes for Primary Backbone Router.
304
305`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
306
307```bash
308> bbr config seqno 20 delay 30
309Done
310```
311
312### bbr jitter
313
314Show jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
315
316`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
317
318```bash
319> bbr jitter
32020
321Done
322```
323
324### bbr jitter \<jitter\>
325
326Set jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
327
328`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
329
330```bash
331> bbr jitter 10
332Done
333```
334
335### ba
336
337Show current Border Agent information.
338
339### ba port
340
341Print border agent service port.
342
343```bash
344> ba port
34549152
346Done
347```
348
349### ba state
350
351Print border agent state.
352
353```bash
354> ba state
355Started
356Done
357```
358
359### bufferinfo
360
361Show the current message buffer information.
362
363- The `total` shows total number of message buffers in pool.
364- The `free` shows the number of free message buffers.
365- The `max-used` shows the maximum number of used buffers at the same time since OT stack initialization or last `bufferinfo reset`.
366- This is then followed by info about different queues used by OpenThread stack, each line representing info about a queue.
367  - The first number shows number messages in the queue.
368  - The second number shows number of buffers used by all messages in the queue.
369  - The third number shows total number of bytes of all messages in the queue.
370
371```bash
372> bufferinfo
373total: 40
374free: 40
375max-used: 5
3766lo send: 0 0 0
3776lo reas: 0 0 0
378ip6: 0 0 0
379mpl: 0 0 0
380mle: 0 0 0
381coap: 0 0 0
382coap secure: 0 0 0
383application coap: 0 0 0
384Done
385```
386
387### bufferinfo reset
388
389Reset the message buffer counter tracking maximum number buffers in use at the same time.
390
391```bash
392> bufferinfo reset
393Done
394```
395
396### ccathreshold
397
398Get the CCA threshold in dBm measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
399
400```bash
401> ccathreshold
402-75 dBm
403Done
404```
405
406### ccathreshold \<ccathreshold\>
407
408Set the CCA threshold measured at antenna connector per IEEE 802.15.4 - 2015 section 10.1.4.
409
410```bash
411> ccathreshold -62
412Done
413```
414
415### channel
416
417Get the IEEE 802.15.4 Channel value.
418
419```bash
420> channel
42111
422Done
423```
424
425### channel \<channel\>
426
427Set the IEEE 802.15.4 Channel value.
428
429```bash
430> channel 11
431Done
432```
433
434### channel manager
435
436Get channel manager state.
437
438`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
439
440```bash
441channel: 11
442auto: 1
443delay: 120
444interval: 10800
445supported: { 11-26}
446favored: { 11-26}
447Done
448```
449
450### channel manager change \<channel\>
451
452Initiate a channel change with the channel manager.
453
454`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` is required.
455
456```bash
457> channel manager change 11
458channel manager change 11
459Done
460```
461
462### channel manager select \<skip quality check (boolean)\>
463
464Request a channel selection with the channel manager.
465
466`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
467
468```bash
469> channel manager select 1
470channel manager select 1
471Done
472```
473
474### channel manager auto \<enable (boolean)\>
475
476Enable/disable the auto-channel-selection functionality.
477
478`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
479
480```bash
481> channel manager auto 1
482channel manager auto 1
483Done
484```
485
486### channel manager delay \<delay\>
487
488Set the channel change delay (in seconds).
489
490`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
491
492```bash
493> channel manager delay 120
494channel manager delay 120
495Done
496```
497
498### channel manager interval \<interval\>
499
500Set the auto-channel-selection interval (in seconds).
501
502`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
503
504```bash
505> channel manager interval 10800
506channel manager interval 10800
507Done
508```
509
510### channel manager supported \<mask\>
511
512Set the supported channel mask for the auto-channel-selection.
513
514`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
515
516```bash
517> channel manager supported 0x7fffc00
518channel manager supported 0x7fffc00
519Done
520```
521
522### channel manager favored \<mask\>
523
524Set the favored channel mask for the auto-channel-selection.
525
526`OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE` and `OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` are required.
527
528```bash
529> channel manager favored 0x7fffc00
530channel manager favored 0x7fffc00
531Done
532```
533
534### channel monitor
535
536Get current channel monitor state and channel occupancy.
537
538`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
539
540```bash
541> channel monitor
542channel monitor
543enabled: 1
544interval: 41000
545threshold: -75
546window: 960
547count: 10552
548occupancies:
549ch 11 (0x0cb7)  4.96% busy
550ch 12 (0x2e2b) 18.03% busy
551ch 13 (0x2f54) 18.48% busy
552ch 14 (0x0fef)  6.22% busy
553ch 15 (0x1536)  8.28% busy
554ch 16 (0x1746)  9.09% busy
555ch 17 (0x0b8b)  4.50% busy
556ch 18 (0x60a7) 37.75% busy
557ch 19 (0x0810)  3.14% busy
558ch 20 (0x0c2a)  4.75% busy
559ch 21 (0x08dc)  3.46% busy
560ch 22 (0x101d)  6.29% busy
561ch 23 (0x0092)  0.22% busy
562ch 24 (0x0028)  0.06% busy
563ch 25 (0x0063)  0.15% busy
564ch 26 (0x058c)  2.16% busy
565
566Done
567```
568
569### channel monitor start
570
571Start the channel monitor.
572
573`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
574
575```bash
576> channel monitor start
577channel monitor start
578Done
579```
580
581### channel monitor stop
582
583Stop the channel monitor.
584
585`OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE` is required.
586
587```bash
588> channel monitor stop
589channel monitor stop
590Done
591```
592
593### channel preferred
594
595Get preferred channel mask.
596
597```bash
598> channel preferred
5990x7fff800
600Done
601```
602
603### channel supported
604
605Get supported channel mask.
606
607```bash
608> channel supported
6090x7fff800
610Done
611```
612
613### child list
614
615List attached Child IDs.
616
617```bash
618> child list
6191 2 3 6 7 8
620Done
621```
622
623### child table
624
625Print table of attached children.
626
627```bash
628> child table
629| ID  | RLOC16 | Timeout    | Age        | LQ In | C_VN |R|D|N|Ver|CSL|QMsgCnt|Suprvsn| Extended MAC     |
630+-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+-------+------------------+
631|   1 | 0xc801 |        240 |         24 |     3 |  131 |1|0|0|  3| 0 |     0 |   129 | 4ecede68435358ac |
632|   2 | 0xc802 |        240 |          2 |     3 |  131 |0|0|0|  3| 1 |     0 |     0 | a672a601d2ce37d8 |
633Done
634```
635
636### child \<id\>
637
638Print diagnostic information for an attached Thread Child. The `id` may be a Child ID or an RLOC16.
639
640```bash
641> child 1
642Child ID: 1
643Rloc: 9c01
644Ext Addr: e2b3540590b0fd87
645Mode: rn
646CSL Synchronized: 1
647Net Data: 184
648Timeout: 100
649Age: 0
650Link Quality In: 3
651RSSI: -20
652Supervision Interval: 129
653Done
654```
655
656### childip
657
658Get the list of IP addresses stored for MTD children.
659
660```bash
661> childip
6623401: fdde:ad00:beef:0:3037:3e03:8c5f:bc0c
663Done
664```
665
666### childip max
667
668Get the maximum number of IP addresses that each MTD child may register with this device as parent.
669
670```bash
671> childip max
6724
673Done
674```
675
676### childip max \<count\>
677
678Set the maximum number of IP addresses that each MTD child may register with this device as parent. 0 to clear the setting and restore the default.
679
680`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
681
682```bash
683> childip max 2
684Done
685```
686
687### childmax
688
689Get the Thread maximum number of allowed children.
690
691```bash
692> childmax
6935
694Done
695```
696
697### childmax \<count\>
698
699Set the Thread maximum number of allowed children.
700
701```bash
702> childmax 2
703Done
704```
705
706### childsupervision interval
707
708Get the Child Supervision Interval value.
709
710Child supervision feature provides a mechanism for parent to ensure that a message is sent to each sleepy child within the supervision interval. If there is no transmission to the child within the supervision interval, OpenThread enqueues and sends a supervision message (a data message with empty payload) to the child. This command can only be used with FTD devices.
711
712```bash
713> childsupervision interval
71430
715Done
716```
717
718### childsupervision interval \<interval\>
719
720Set the Child Supervision Interval value. This command can only be used with FTD devices.
721
722```bash
723> childsupervision interval 30
724Done
725```
726
727### childsupervision checktimeout
728
729Get the Child Supervision Check Timeout value.
730
731If the device is a sleepy child and it does not hear from its parent within the specified check timeout, it initiates the re-attach process (MLE Child Update Request/Response exchange with its parent).
732
733```bash
734> childsupervision checktimeout
73530
736Done
737```
738
739### childsupervision checktimeout \<timeout\>
740
741Set the Child Supervision Check Timeout value.
742
743```bash
744> childsupervision checktimeout 30
745Done
746```
747
748### childsupervision failcounter
749
750Get the current value of supervision check timeout failure counter.
751
752The counter tracks the number of supervision check failures on the child. It is incremented when the child does not hear from its parent within the specified check timeout interval.
753
754```bash
755> childsupervision failcounter
7560
757Done
758```
759
760### childsupervision failcounter reset
761
762Reset the supervision check timeout failure counter to zero.
763
764```bash
765> childsupervision failcounter reset
766Done
767```
768
769### childtimeout
770
771Get the Thread Child Timeout value.
772
773```bash
774> childtimeout
775300
776Done
777```
778
779### childtimeout \<timeout\>
780
781Set the Thread Child Timeout value.
782
783```bash
784> childtimeout 300
785Done
786```
787
788### coex
789
790Get the coex status.
791
792`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
793
794```bash
795> coex
796Enabled
797Done
798```
799
800### coex disable
801
802Disable coex.
803
804`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
805
806```bash
807> coex disable
808Done
809```
810
811### coex enable
812
813Enable coex.
814
815`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
816
817```bash
818> coex enable
819Done
820```
821
822### coex metrics
823
824Show coex metrics.
825
826`OPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE` is required.
827
828```bash
829> coex metrics
830Stopped: false
831Grant Glitch: 0
832Transmit metrics
833    Request: 0
834    Grant Immediate: 0
835    Grant Wait: 0
836    Grant Wait Activated: 0
837    Grant Wait Timeout: 0
838    Grant Deactivated During Request: 0
839    Delayed Grant: 0
840    Average Request To Grant Time: 0
841Receive metrics
842    Request: 0
843    Grant Immediate: 0
844    Grant Wait: 0
845    Grant Wait Activated: 0
846    Grant Wait Timeout: 0
847    Grant Deactivated During Request: 0
848    Delayed Grant: 0
849    Average Request To Grant Time: 0
850    Grant None: 0
851Done
852```
853
854### contextreusedelay
855
856Get the CONTEXT_ID_REUSE_DELAY value.
857
858```bash
859> contextreusedelay
86011
861Done
862```
863
864### contextreusedelay \<delay\>
865
866Set the CONTEXT_ID_REUSE_DELAY value.
867
868```bash
869> contextreusedelay 11
870Done
871```
872
873### counters
874
875Get the supported counter names.
876
877```bash
878> counters
879br
880ip
881mac
882mle
883Done
884```
885
886### counters \<countername\>
887
888Get the counter value.
889
890Note:
891
892- `OPENTHREAD_CONFIG_UPTIME_ENABLE` is required for MLE role time tracking in `counters mle`
893- `OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE` is required for `counters br`
894
895```bash
896> counters mac
897TxTotal: 10
898    TxUnicast: 3
899    TxBroadcast: 7
900    TxAckRequested: 3
901    TxAcked: 3
902    TxNoAckRequested: 7
903    TxData: 10
904    TxDataPoll: 0
905    TxBeacon: 0
906    TxBeaconRequest: 0
907    TxOther: 0
908    TxRetry: 0
909    TxErrCca: 0
910    TxErrBusyChannel: 0
911RxTotal: 2
912    RxUnicast: 1
913    RxBroadcast: 1
914    RxData: 2
915    RxDataPoll: 0
916    RxBeacon: 0
917    RxBeaconRequest: 0
918    RxOther: 0
919    RxAddressFiltered: 0
920    RxDestAddrFiltered: 0
921    RxDuplicated: 0
922    RxErrNoFrame: 0
923    RxErrNoUnknownNeighbor: 0
924    RxErrInvalidSrcAddr: 0
925    RxErrSec: 0
926    RxErrFcs: 0
927    RxErrOther: 0
928Done
929> counters mle
930Role Disabled: 0
931Role Detached: 1
932Role Child: 0
933Role Router: 0
934Role Leader: 1
935Attach Attempts: 1
936Partition Id Changes: 1
937Better Partition Attach Attempts: 0
938Parent Changes: 0
939Time Disabled Milli: 10026
940Time Detached Milli: 6852
941Time Child Milli: 0
942Time Router Milli: 0
943Time Leader Milli: 16195
944Time Tracked Milli: 33073
945Done
946> counters ip
947TxSuccess: 10
948TxFailed: 0
949RxSuccess: 5
950RxFailed: 0
951Done
952> counters br
953Inbound Unicast: Packets 4 Bytes 320
954Inbound Multicast: Packets 0 Bytes 0
955Outbound Unicast: Packets 2 Bytes 160
956Outbound Multicast: Packets 0 Bytes 0
957RA Rx: 4
958RA TxSuccess: 2
959RA TxFailed: 0
960RS Rx: 0
961RS TxSuccess: 2
962RS TxFailed: 0
963Done
964```
965
966### counters \<countername\> reset
967
968Reset the counter value.
969
970```bash
971> counters mac reset
972Done
973> counters mle reset
974Done
975> counters ip reset
976Done
977```
978
979### csl
980
981Get the CSL configuration.
982
983```bash
984> csl
985Channel: 11
986Period: 1000 (in units of 10 symbols), 160ms
987Timeout: 1000s
988Done
989```
990
991### csl channel \<channel\>
992
993Set CSL channel.
994
995```bash
996> csl channel 20
997Done
998```
999
1000### csl period \<period\>
1001
1002Set CSL period in units of 10 symbols. Disable CSL by setting this parameter to `0`.
1003
1004```bash
1005> csl period 3000
1006Done
1007```
1008
1009### csl timeout \<timeout\>
1010
1011Set the CSL timeout in seconds.
1012
1013```bash
1014> csl timeout 10
1015Done
1016```
1017
1018### networktime
1019
1020Get the Thread network time and the time sync parameters.
1021
1022```bash
1023> networktime
1024Network Time:     21084154us (synchronized)
1025Time Sync Period: 100s
1026XTAL Threshold:   300ppm
1027Done
1028```
1029
1030### networktime \<timesyncperiod\> \<xtalthreshold\>
1031
1032Set time sync parameters
1033
1034- timesyncperiod: The time synchronization period, in seconds.
1035- xtalthreshold: The XTAL accuracy threshold for a device to become Router-Capable device, in PPM.
1036
1037```bash
1038> networktime 100 300
1039Done
1040```
1041
1042### delaytimermin
1043
1044Get the minimal delay timer (in seconds).
1045
1046```bash
1047> delaytimermin
104830
1049Done
1050```
1051
1052### delaytimermin \<delaytimermin\>
1053
1054Set the minimal delay timer (in seconds).
1055
1056```bash
1057> delaytimermin 60
1058Done
1059```
1060
1061### deviceprops
1062
1063Get the current device properties.
1064
1065```bash
1066> deviceprops
1067PowerSupply      : external
1068IsBorderRouter   : yes
1069SupportsCcm      : no
1070IsUnstable       : no
1071WeightAdjustment : 0
1072Done
1073```
1074
1075### deviceprops \<power-supply\> \<is-br\> \<supports-ccm\> \<is-unstable\> \<weight-adjustment\>
1076
1077Set the device properties which are then used to determine and set the Leader Weight.
1078
1079- power-supply: `battery`, `external`, `external-stable`, or `external-unstable`.
1080- weight-adjustment: Valid range is from -16 to +16. Clamped if not within the range.
1081
1082```bash
1083> deviceprops battery 0 0 0 -5
1084Done
1085
1086> deviceprops
1087PowerSupply      : battery
1088IsBorderRouter   : no
1089SupportsCcm      : no
1090IsUnstable       : no
1091WeightAdjustment : -5
1092Done
1093
1094> leaderweight
109551
1096Done
1097```
1098
1099### discover \[channel\]
1100
1101Perform an MLE Discovery operation.
1102
1103- channel: The channel to discover on. If no channel is provided, the discovery will cover all valid channels.
1104
1105```bash
1106> discover
1107| J | Network Name     | Extended PAN     | PAN  | MAC Address      | Ch | dBm | LQI |
1108+---+------------------+------------------+------+------------------+----+-----+-----+
1109| 0 | OpenThread       | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 |   0 |
1110Done
1111```
1112
1113### dns config
1114
1115Get the default query config used by DNS client.
1116
1117The config includes
1118
1119- Server IPv6 address and port
1120- Response timeout in msec (wait time to rx response)
1121- Maximum tx attempts before reporting failure
1122- Boolean flag to indicate whether the server can resolve the query recursively or not.
1123- Service resolution mode which specifies which records to query. Possible options are:
1124  - `srv` : Query for SRV record only.
1125  - `txt` : Query for TXT record only.
1126  - `srv_txt` : Query for both SRV and TXT records in the same message.
1127  - `srv_txt_sep`: Query in parallel for SRV and TXT using separate messages.
1128  - `srv_txt_opt`: Query for TXT/SRV together first, if it fails then query separately.
1129- Whether to allow/disallow NAT64 address translation during address resolution (requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE`)
1130- Transport protocol UDP or TCP (requires `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE`)
1131
1132```bash
1133> dns config
1134Server: [fd00:0:0:0:0:0:0:1]:1234
1135ResponseTimeout: 5000 ms
1136MaxTxAttempts: 2
1137RecursionDesired: no
1138ServiceMode: srv_txt_opt
1139Nat64Mode: allow
1140TransportProtocol: udp
1141Done
1142>
1143```
1144
1145### dns config \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\] \[service mode]
1146
1147Set the default query config.
1148
1149Service mode specifies which records to query. Possible options are:
1150
1151- `def` : Use default option.
1152- `srv` : Query for SRV record only.
1153- `txt` : Query for TXT record only.
1154- `srv_txt` : Query for both SRV and TXT records in the same message.
1155- `srv_txt_sep`: Query in parallel for SRV and TXT using separate messages.
1156- `srv_txt_opt`: Query for TXT/SRV together first, if it fails then query separately.
1157
1158To set protocol effectively to tcp `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE` is required.
1159
1160```bash
1161> dns config fd00::1 1234 5000 2 0 srv_txt_sep tcp
1162Done
1163
1164> dns config
1165Server: [fd00:0:0:0:0:0:0:1]:1234
1166ResponseTimeout: 5000 ms
1167MaxTxAttempts: 2
1168RecursionDesired: no
1169ServiceMode: srv_txt_sep
1170Nat64Mode: allow
1171TransportProtocol: tcp
1172Done
1173```
1174
1175We can leave some of the fields as unspecified (or use value zero). The unspecified fields are replaced by the corresponding OT config option definitions `OPENTHREAD_CONFIG_DNS_CLIENT_DEFAULT_{}` to form the default query config.
1176
1177```bash
1178> dns config fd00::2
1179Done
1180
1181> dns config
1182Server: [fd00:0:0:0:0:0:0:2]:53
1183ResponseTimeout: 3000 ms
1184MaxTxAttempts: 3
1185RecursionDesired: yes
1186Done
1187```
1188
1189### dns resolve \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\] \[transport protocol\]
1190
1191Send DNS Query to obtain IPv6 address for given hostname.
1192
1193The parameters after `hostname` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1194
1195To use tcp, `OPENTHREAD_CONFIG_DNS_CLIENT_OVER_TCP_ENABLE` is required.
1196
1197```bash
1198> dns resolve ipv6.google.com
1199> DNS response for ipv6.google.com - 2a00:1450:401b:801:0:0:0:200e TTL: 300
1200```
1201
1202The DNS server IP can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
1203
1204> Note: The command will return `InvalidState` when the DNS server IP is an IPv4 address but the preferred NAT64 prefix is unavailable.
1205
1206```bash
1207> dns resolve example.com 8.8.8.8
1208Synthesized IPv6 DNS server address: fdde:ad00:beef:2:0:0:808:808
1209DNS response for example.com. - fd4c:9574:3720:2:0:0:5db8:d822 TTL:20456
1210Done
1211```
1212
1213### dns resolve4 \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1214
1215Send DNS query to obtain IPv4 address for a given hostname and provide the NAT64 synthesized IPv6 addresses for the IPv4 addresses from the query response.
1216
1217Requires `OPENTHREAD_CONFIG_DNS_CLIENT_NAT64_ENABLE`.
1218
1219The parameters after `hostname` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1220
1221This command requires a NAT64 prefix to be configured and present in Thread Network Data.
1222
1223For example, if a NAT64 prefix of `2001:db8:122:344::/96` is used within the Thread mesh, the outputted IPv6 address corresponds to an IPv4 address of `142.250.191.78` for the `ipv4.google.com` host:
1224
1225```bash
1226> dns resolve4 ipv4.google.com
1227> DNS response for ipv4.google.com - 2001:db8:122:344:0:0:8efa:bf4e TTL: 20456
1228```
1229
1230### dns browse \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1231
1232Send a browse (service instance enumeration) DNS query to get the list of services for given service-name.
1233
1234The parameters after `service-name` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1235
1236```bash
1237> dns browse _service._udp.example.com
1238DNS browse response for _service._udp.example.com.
1239inst1
1240    Port:1234, Priority:1, Weight:2, TTL:7200
1241    Host:host.example.com.
1242    HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1243    TXT:[a=6531, b=6c12] TTL:7300
1244instance2
1245    Port:1234, Priority:1, Weight:2, TTL:7200
1246    Host:host.example.com.
1247    HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1248    TXT:[a=1234] TTL:7300
1249Done
1250```
1251
1252```bash
1253> dns browse _airplay._tcp.default.service.arpa
1254DNS browse response for _airplay._tcp.default.service.arpa.
1255Gabe's Mac mini
1256    Port:7000, Priority:0, Weight:0, TTL:10
1257    Host:Gabes-Mac-mini.default.service.arpa.
1258    HostAddress:fd97:739d:386a:1:1c2e:d83c:fcbe:9cf4 TTL:10
1259Done
1260```
1261
1262> Note: The DNS server IP can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data. The command will return `InvalidState` when the DNS server IP is an IPv4 address but the preferred NAT64 prefix is unavailable. When testing DNS-SD discovery proxy, the zone is not `local` and instead should be `default.service.arpa`.
1263
1264### dns service \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1265
1266Send a service instance resolution DNS query for a given service instance. Service instance label is provided first, followed by the service name (note that service instance label can contain dot '.' character).
1267
1268The parameters after `service-name` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1269
1270> Note: The DNS server IP can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data. The command will return `InvalidState` when the DNS server IP is an IPv4 address but the preferred NAT64 prefix is unavailable.
1271
1272### dns servicehost \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1273
1274Send a service instance resolution DNS query for a given service instance with a potential follow-up address resolution for the host name discovered for the service instance (if the server/resolver does not provide AAAA/A records for the host name in the response to SRV query).
1275
1276Service instance label is provided first, followed by the service name (note that service instance label can contain dot '.' character).
1277
1278The parameters after `service-name` are optional. Any unspecified (or zero) value for these optional parameters is replaced by the value from the current default config (`dns config`).
1279
1280### dns compression \[enable|disable\]
1281
1282Enable/Disable the "DNS name compression" mode.
1283
1284By default DNS name compression is enabled. When disabled, DNS names are appended as full and never compressed. This is applicable to OpenThread's DNS and SRP client/server modules.
1285
1286This is intended for testing only and available under `REFERENCE_DEVICE` config.
1287
1288Get the current "DNS name compression" mode.
1289
1290```
1291> dns compression
1292Enabled
1293```
1294
1295Set the "DNS name compression" mode.
1296
1297```
1298> dns compression disable
1299Done
1300>
1301>
1302> dns compression
1303Disabled
1304Done
1305```
1306
1307### domainname
1308
1309Get the Thread Domain Name for Thread 1.2 device.
1310
1311```bash
1312> domainname
1313Thread
1314Done
1315```
1316
1317### domainname \<name\>
1318
1319Set the Thread Domain Name for Thread 1.2 device.
1320
1321```bash
1322> domainname Test\ Thread
1323Done
1324```
1325
1326### dua iid
1327
1328Get the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1329
1330```bash
1331> dua iid
13320004000300020001
1333Done
1334```
1335
1336### dua iid \<iid\>
1337
1338Set the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1339
1340```bash
1341> dua iid 0004000300020001
1342Done
1343```
1344
1345### dua iid clear
1346
1347Clear the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1348
1349```bash
1350> dua iid clear
1351Done
1352```
1353
1354### eidcache
1355
1356Print the EID-to-RLOC cache entries.
1357
1358```bash
1359> eidcache
1360fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d 2000 cache canEvict=1 transTime=0 eid=fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d
1361fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7f fffe retry canEvict=1 timeout=10 retryDelay=30
1362Done
1363```
1364
1365### eui64
1366
1367Get the factory-assigned IEEE EUI-64.
1368
1369```bash
1370> eui64
13710615aae900124b00
1372Done
1373```
1374
1375### extaddr
1376
1377Get the IEEE 802.15.4 Extended Address.
1378
1379```bash
1380> extaddr
1381dead00beef00cafe
1382Done
1383```
1384
1385### extaddr \<extaddr\>
1386
1387Set the IEEE 802.15.4 Extended Address.
1388
1389```bash
1390> extaddr dead00beef00cafe
1391dead00beef00cafe
1392Done
1393```
1394
1395### extpanid
1396
1397Get the Thread Extended PAN ID value.
1398
1399**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1400
1401```bash
1402> extpanid
1403dead00beef00cafe
1404Done
1405```
1406
1407### extpanid \<extpanid\>
1408
1409Set the Thread Extended PAN ID value.
1410
1411```bash
1412> extpanid dead00beef00cafe
1413Done
1414```
1415
1416### factoryreset
1417
1418Delete all stored settings, and signal a platform reset.
1419
1420```bash
1421> factoryreset
1422```
1423
1424### fake
1425
1426Send fake Thread messages.
1427
1428Note: Only for certification test.
1429
1430#### fake /a/an \<dst-ipaddr\> \<target\> \<meshLocalIid\>
1431
1432```bash
1433> fake /a/an fdde:ad00:beef:0:0:ff:fe00:a800 fd00:7d03:7d03:7d03:55f2:bb6a:7a43:a03b 1111222233334444
1434Done
1435```
1436
1437### fem
1438
1439Get external FEM parameters.
1440
1441```bash
1442> fem
1443LNA gain 11 dBm
1444Done
1445```
1446
1447### fem lnagain
1448
1449Get the Rx LNA gain in dBm of the external FEM.
1450
1451```bash
1452> fem lnagain
145311
1454Done
1455```
1456
1457### fem lnagain \<LNA gain\>
1458
1459Set the Rx LNA gain in dBm of the external FEM.
1460
1461```bash
1462> fem lnagain 8
1463Done
1464```
1465
1466### ifconfig
1467
1468Show the status of the IPv6 interface.
1469
1470```bash
1471> ifconfig
1472down
1473Done
1474```
1475
1476### ifconfig up
1477
1478Bring up the IPv6 interface.
1479
1480```bash
1481> ifconfig up
1482Done
1483```
1484
1485### ifconfig down
1486
1487Bring down the IPv6 interface.
1488
1489```bash
1490> ifconfig down
1491Done
1492```
1493
1494### ipaddr
1495
1496List all IPv6 addresses assigned to the Thread interface.
1497
1498```bash
1499> ipaddr
1500fdde:ad00:beef:0:0:ff:fe00:0
1501fdde:ad00:beef:0:558:f56b:d688:799
1502fe80:0:0:0:f3d9:2a82:c8d8:fe43
1503Done
1504```
1505
1506Use `-v` to get more verbose informations about the address.
1507
1508```bash
1509> ipaddr -v
1510fdde:ad00:beef:0:0:ff:fe00:0 origin:thread
1511fdde:ad00:beef:0:558:f56b:d688:799 origin:thread
1512fe80:0:0:0:f3d9:2a82:c8d8:fe43 origin:thread
1513Done
1514```
1515
1516### ipaddr add \<ipaddr\>
1517
1518Add an IPv6 address to the Thread interface.
1519
1520```bash
1521> ipaddr add 2001::dead:beef:cafe
1522Done
1523```
1524
1525### ipaddr del \<ipaddr\>
1526
1527Delete an IPv6 address from the Thread interface.
1528
1529```bash
1530> ipaddr del 2001::dead:beef:cafe
1531Done
1532```
1533
1534### ipaddr linklocal
1535
1536Print Thread link-local IPv6 address.
1537
1538```bash
1539> ipaddr linklocal
1540fe80:0:0:0:f3d9:2a82:c8d8:fe43
1541Done
1542```
1543
1544### ipaddr mleid
1545
1546Print Thread Mesh Local EID address.
1547
1548```bash
1549> ipaddr mleid
1550fdde:ad00:beef:0:558:f56b:d688:799
1551Done
1552```
1553
1554### ipaddr rloc
1555
1556Print Thread Routing Locator (RLOC) address.
1557
1558```bash
1559> ipaddr rloc
1560fdde:ad00:beef:0:0:ff:fe00:0
1561Done
1562```
1563
1564### ipmaddr
1565
1566List all IPv6 multicast addresses subscribed to the Thread interface.
1567
1568```bash
1569> ipmaddr
1570ff05:0:0:0:0:0:0:1
1571ff33:40:fdde:ad00:beef:0:0:1
1572ff32:40:fdde:ad00:beef:0:0:1
1573Done
1574```
1575
1576### ipmaddr add \<ipaddr\>
1577
1578Subscribe the Thread interface to the IPv6 multicast address.
1579
1580```bash
1581> ipmaddr add ff05::1
1582Done
1583```
1584
1585### ipmaddr del \<ipaddr\>
1586
1587Unsubscribe the Thread interface to the IPv6 multicast address.
1588
1589```bash
1590> ipmaddr del ff05::1
1591Done
1592```
1593
1594### ipmaddr llatn
1595
1596Get the Link-Local All Thread Nodes multicast address.
1597
1598```
1599> ipmaddr llatn
1600ff32:40:fdde:ad00:beef:0:0:1
1601Done
1602```
1603
1604### ipmaddr promiscuous
1605
1606Get multicast promiscuous mode.
1607
1608```bash
1609> ipmaddr promiscuous
1610Disabled
1611Done
1612```
1613
1614### ipmaddr promiscuous enable
1615
1616Enable multicast promiscuous mode.
1617
1618```bash
1619> ipmaddr promiscuous enable
1620Done
1621```
1622
1623### ipmaddr promiscuous disable
1624
1625Disable multicast promiscuous mode.
1626
1627```bash
1628> ipmaddr promiscuous disable
1629Done
1630```
1631
1632### ipmaddr rlatn
1633
1634Get the Realm-Local All Thread Nodes multicast address.
1635
1636```
1637> ipmaddr rlatn
1638ff33:40:fdde:ad00:beef:0:0:1
1639Done
1640```
1641
1642### joinerport \<port\>
1643
1644Set the Joiner port.
1645
1646```bash
1647> joinerport 1000
1648Done
1649```
1650
1651### keysequence counter
1652
1653Get the Thread Key Sequence Counter.
1654
1655```bash
1656> keysequence counter
165710
1658Done
1659```
1660
1661### keysequence counter \<counter\>
1662
1663Set the Thread Key Sequence Counter.
1664
1665```bash
1666> keysequence counter 10
1667Done
1668```
1669
1670### keysequence guardtime
1671
1672Get Thread Key Switch Guard Time (in hours)
1673
1674```bash
1675> keysequence guardtime
16760
1677Done
1678```
1679
1680### keysequence guardtime \<guardtime\>
1681
1682Set Thread Key Switch Guard Time (in hours) 0 means Thread Key Switch imediately if key index match
1683
1684```bash
1685> keysequence guardtime 0
1686Done
1687```
1688
1689### leaderdata
1690
1691Show the Thread Leader Data.
1692
1693```bash
1694> leaderdata
1695Partition ID: 1077744240
1696Weighting: 64
1697Data Version: 109
1698Stable Data Version: 211
1699Leader Router ID: 60
1700Done
1701```
1702
1703### leaderweight
1704
1705Get the Thread Leader Weight.
1706
1707```bash
1708> leaderweight
1709128
1710Done
1711```
1712
1713### leaderweight \<weight\>
1714
1715Set the Thread Leader Weight.
1716
1717```bash
1718> leaderweight 128
1719Done
1720```
1721
1722### linkmetrics mgmt \<ipaddr\> enhanced-ack clear
1723
1724Send a Link Metrics Management Request to clear an Enhanced-ACK Based Probing.
1725
1726- ipaddr: Peer address (SHOULD be link local address of the neighboring device).
1727
1728```bash
1729> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack clear
1730Done
1731> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1732Status: Success
1733```
1734
1735### linkmetrics mgmt \<ipaddr\> enhanced-ack register [qmr][r]
1736
1737Send a Link Metrics Management Request to register an Enhanced-ACK Based Probing.
1738
1739- ipaddr: Peer address.
1740- qmr: This specifies what metrics to query. At most two options are allowed to select (per spec 4.11.3.4.4.6).
1741  - q: Layer 2 LQI.
1742  - m: Link Margin.
1743  - r: RSSI.
1744- r: This is optional and only used for reference devices. When this option is specified, Type/Average Enum of each Type Id Flags would be set to `reserved`. This is used to verify the Probing Subject correctly handles invalid Type Id Flags. This is only available when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
1745
1746```bash
1747> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm
1748Done
1749> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1750Status: Success
1751
1752> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm r
1753Done
1754> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1755Status: Cannot support new series
1756```
1757
1758### linkmetrics mgmt \<ipaddr\> forward \<seriesid\> [ldraX][pqmr]
1759
1760Send a Link Metrics Management Request to configure a Forward Tracking Series.
1761
1762- ipaddr: Peer address.
1763- seriesid: The Series ID.
1764- ldraX: This specifies which frames are to be accounted.
1765  - l: MLE Link Probe.
1766  - d: MAC Data.
1767  - r: MAC Data Request.
1768  - a: MAC Ack.
1769  - X: This represents none of the above flags, i.e., to stop accounting and remove the series. This can only be used without any other flags.
1770- pqmr: This specifies what metrics to query.
1771  - p: Layer 2 Number of PDUs received.
1772  - q: Layer 2 LQI.
1773  - m: Link Margin.
1774  - r: RSSI.
1775
1776```bash
1777> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 forward 1 dra pqmr
1778Done
1779> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1780Status: SUCCESS
1781```
1782
1783### linkmetrics probe \<ipaddr\> \<seriesid\> \<length\>
1784
1785Send a MLE Link Probe message to the peer.
1786
1787- ipaddr: Peer address.
1788- seriesid: The Series ID for which this Probe message targets at.
1789- length: The length of the Probe message, valid range: [0, 64].
1790
1791```bash
1792> linkmetrics probe fe80:0:0:0:3092:f334:1455:1ad2 1 10
1793Done
1794```
1795
1796### linkmetrics query \<ipaddr\> single [pqmr]
1797
1798Perform a Link Metrics query (Single Probe).
1799
1800- ipaddr: Peer address.
1801- pqmr: This specifies what metrics to query.
1802- p: Layer 2 Number of PDUs received.
1803- q: Layer 2 LQI.
1804- m: Link Margin.
1805- r: RSSI.
1806
1807```bash
1808> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 single qmr
1809Done
1810> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1811
1812 - LQI: 76 (Exponential Moving Average)
1813 - Margin: 82 (dB) (Exponential Moving Average)
1814 - RSSI: -18 (dBm) (Exponential Moving Average)
1815```
1816
1817### linkmetrics query \<ipaddr\> forward \<seriesid\>
1818
1819Perform a Link Metrics query (Forward Tracking Series).
1820
1821- ipaddr: Peer address.
1822- seriesid: The Series ID.
1823
1824```bash
1825> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 forward 1
1826Done
1827> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1828
1829 - PDU Counter: 2 (Count/Summation)
1830 - LQI: 76 (Exponential Moving Average)
1831 - Margin: 82 (dB) (Exponential Moving Average)
1832 - RSSI: -18 (dBm) (Exponential Moving Average)
1833```
1834
1835### locate
1836
1837Gets the current state (`In Progress` or `Idle`) of anycast locator.
1838
1839`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
1840
1841```bash
1842> locate
1843Idle
1844Done
1845
1846> locate fdde:ad00:beef:0:0:ff:fe00:fc10
1847
1848> locate
1849In Progress
1850Done
1851```
1852
1853### locate \<anycastaddr\>
1854
1855Locate the closest destination of an anycast address (i.e., find the destination's mesh local EID and RLOC16).
1856
1857`OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE` is required.
1858
1859The closest destination is determined based on the the current routing table and path costs within the Thread mesh.
1860
1861Locate the leader using its anycast address:
1862
1863```bash
1864> locate fdde:ad00:beef:0:0:ff:fe00:fc00
1865fdde:ad00:beef:0:d9d3:9000:16b:d03b 0xc800
1866Done
1867```
1868
1869Locate the closest destination of a service anycast address:
1870
1871```bash
1872
1873> srp server enable
1874Done
1875
1876> netdata show
1877Prefixes:
1878Routes:
1879Services:
188044970 5d c002 s c800
188144970 5d c002 s cc00
1882Done
1883
1884> locate fdde:ad00:beef:0:0:ff:fe00:fc10
1885fdde:ad00:beef:0:a477:dc98:a4e4:71ea 0xcc00
1886done
1887```
1888
1889### log filename \<filename\>
1890
1891- Note: Simulation Only, ie: `OPENTHREAD_EXAMPLES_SIMULATION`
1892- Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART`
1893
1894Specifies filename to capture otPlatLog() messages, useful when debugging automated test scripts on Linux when logging disrupts the automated test scripts.
1895
1896### log level
1897
1898Get the log level.
1899
1900```bash
1901> log level
19021
1903Done
1904```
1905
1906### log level \<level\>
1907
1908Set the log level.
1909
1910```bash
1911> log level 4
1912Done
1913```
1914
1915### meshdiag topology [ip6-addrs][children]
1916
1917Discover network topology (list of routers and their connections).
1918
1919This command requires `OPENTHREAD_CONFIG_MESH_DIAG_ENABLE` and `OPENTHREAD_FTD`.
1920
1921Parameters are optional and indicate additional items to discover. Can be added in any order.
1922
1923- `ip6-addrs` to discover the list of IPv6 addresses of every router.
1924- `children` to discover the child table of every router.
1925
1926Output lists all discovered routers. Information per router:
1927
1928- Router ID
1929- RLOC16
1930- Extended MAC address
1931- Thread Version (if known).
1932- Whether the router is this device is itself (`me`)
1933- Whether the router is the parent of this device when device is a child (`parent`)
1934- Whether the router is `leader`
1935- Whether the router acts as a border router providing external connectivity (`br`)
1936- List of routers to which this router has a link:
1937  - `3-links`: Router IDs to which this router has a incoming link with link quality 3
1938  - `2-links`: Router IDs to which this router has a incoming link with link quality 2
1939  - `1-links`: Router IDs to which this router has a incoming link with link quality 1
1940  - If a list if empty, it is omitted in the out.
1941- If `ip6-addrs`, list of IPv6 addresses of the router
1942- If `children`, list of all children of the router. Information per child:
1943  - RLOC16
1944  - Incoming Link Quality from perspective of parent to child (zero indicates unknown)
1945  - Child Device mode (`r` rx-on-when-idle, `d` Full Thread Device, `n` Full Network Data, `-` no flags set)
1946  - Whether the child is this device itself (`me`)
1947  - Whether the child acts as a border router providing external connectivity (`br`)
1948
1949Discover network topology:
1950
1951```bash
1952> meshdiag topology
1953id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - me - leader
1954   3-links:{ 46 }
1955id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
1956   3-links:{ 02 51 57 }
1957id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
1958   3-links:{ 51 57 }
1959id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
1960   3-links:{ 33 57 }
1961   2-links:{ 46 }
1962id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
1963   3-links:{ 46 51 }
1964   1-links:{ 33 }
1965Done
1966```
1967
1968Discover network topology with router's IPv6 addresses and children:
1969
1970```bash
1971> meshdiag topology children ip6-addrs
1972id:62 rloc16:0xf800 ext-addr:ce349873897233a5 ver:4 - me - br
1973   3-links:{ 46 }
1974   ip6-addrs:
1975       fdde:ad00:beef:0:0:ff:fe00:f800
1976       fdde:ad00:beef:0:211d:39e9:6b2e:4ad1
1977       fe80:0:0:0:cc34:9873:8972:33a5
1978   children: none
1979id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - leader - br
1980   3-links:{ 46 51 }
1981   ip6-addrs:
1982       fdde:ad00:beef:0:0:ff:fe00:fc00
1983       fdde:ad00:beef:0:0:ff:fe00:800
1984       fdde:ad00:beef:0:8a36:a3eb:47ae:a9b0
1985       fe80:0:0:0:88a5:7d2c:603f:e16c
1986   children:
1987       rloc16:0x0803 lq:3, mode:rn
1988       rloc16:0x0804 lq:3, mode:rdn
1989id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
1990   3-links:{ 57 }
1991   ip6-addrs:
1992       fdde:ad00:beef:0:0:ff:fe00:8400
1993       fdde:ad00:beef:0:824:a126:cf19:a9f4
1994       fe80:0:0:0:d0e5:11a1:46b9:e54d
1995   children: none
1996id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
1997   3-links:{ 02 46 57 }
1998   ip6-addrs:
1999       fdde:ad00:beef:0:0:ff:fe00:cc00
2000       fdde:ad00:beef:0:2986:bba3:12d0:1dd2
2001       fe80:0:0:0:98ab:43ab:abf0:5352
2002   children: none
2003id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2004   3-links:{ 33 51 }
2005   ip6-addrs:
2006       fdde:ad00:beef:0:0:ff:fe00:e400
2007       fdde:ad00:beef:0:87d0:550:bc18:9920
2008       fe80:0:0:0:d8e9:c4c0:e9da:55ff
2009   children:
2010       rloc16:0xe402 lq:3, mode:rn - br
2011       rloc16:0xe403 lq:3, mode:rn
2012id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2013   3-links:{ 02 51 62 }
2014   ip6-addrs:
2015       fdde:ad00:beef:0:0:ff:fe00:b800
2016       fdde:ad00:beef:0:df4d:2994:d85c:c337
2017       fe80:0:0:0:fc10:9d27:7e01:75cc
2018   children: none
2019Done
2020```
2021
2022Discover network topology with children:
2023
2024```bash
2025> meshdiag topology children
2026id:02 rloc16:0x0800 ext-addr:8aa57d2c603fe16c ver:4 - parent - leader - br
2027   3-links:{ 46 51 }
2028   children:
2029       rloc16:0x0803 lq:0, mode:rn
2030       rloc16:0x0804 lq:0, mode:rdn - me
2031id:46 rloc16:0xb800 ext-addr:fe109d277e0175cc ver:4
2032   3-links:{ 02 51 62 }
2033   children: none
2034id:33 rloc16:0x8400 ext-addr:d2e511a146b9e54d ver:4
2035   3-links:{ 57 }
2036   children: none
2037id:51 rloc16:0xcc00 ext-addr:9aab43ababf05352 ver:4
2038   3-links:{ 02 46 57 }
2039   children: none
2040id:57 rloc16:0xe400 ext-addr:dae9c4c0e9da55ff ver:4
2041   3-links:{ 33 51 }
2042   children:
2043       rloc16:0xe402 lq:3, mode:rn - br
2044       rloc16:0xe403 lq:3, mode:rn
2045id:62 rloc16:0xf800 ext-addr:ce349873897233a5 ver:4 - br
2046   3-links:{ 46 }
2047   children: none
2048```
2049
2050### mliid \<iid\>
2051
2052Set the Mesh Local IID.
2053
2054It must be used before Thread stack is enabled.
2055
2056Only for testing/reference device.
2057
2058```bash
2059> mliid 1122334455667788
2060Done
2061```
2062
2063### mlr reg \<ipaddr\> ... [timeout]
2064
2065Register Multicast Listeners to Primary Backbone Router, with an optional `timeout` (in seconds).
2066
2067Omit `timeout` to use the default MLR timeout on the Primary Backbone Router.
2068
2069Use `timeout = 0` to deregister Multicast Listeners.
2070
2071NOTE: Only for Thread 1.2 Commissioner FTD device.
2072
2073```bash
2074> mlr reg ff04::1
2075status 0, 0 failed
2076Done
2077> mlr reg ff04::1 ff04::2 ff02::1
2078status 2, 1 failed
2079ff02:0:0:0:0:0:0:1
2080Done
2081> mlr reg ff04::1 ff04::2 1000
2082status 0, 0 failed
2083Done
2084> mlr reg ff04::1 ff04::2 0
2085status 0, 0 failed
2086Done
2087```
2088
2089### mode
2090
2091Get the Thread Device Mode value.
2092
2093- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
2094- r: rx-on-when-idle
2095- d: Full Thread Device
2096- n: Full Network Data
2097
2098```bash
2099> mode
2100rdn
2101Done
2102```
2103
2104### mode [rdn]
2105
2106Set the Thread Device Mode value.
2107
2108- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
2109- r: rx-on-when-idle
2110- d: Full Thread Device
2111- n: Full Network Data
2112
2113```bash
2114> mode rdn
2115Done
2116```
2117
2118```bash
2119> mode -
2120Done
2121```
2122
2123### multiradio
2124
2125Get the list of supported radio links by the device.
2126
2127This command is always available, even when only a single radio is supported by the device.
2128
2129```bash
2130> multiradio
2131[15.4, TREL]
2132Done
2133```
2134
2135### multiradio neighbor list
2136
2137Get the list of neighbors and their supported radios and their preference.
2138
2139This command is only available when device supports more than one radio link.
2140
2141```bash
2142> multiradio neighbor list
2143ExtAddr:3a65bc38dbe4a5be, RLOC16:0xcc00, Radios:[15.4(255), TREL(255)]
2144ExtAddr:17df23452ee4a4be, RLOC16:0x1300, Radios:[15.4(255)]
2145Done
2146```
2147
2148### multiradio neighbor \<ext address\>
2149
2150Get the radio info for specific neighbor with a given extended address.
2151
2152This command is only available when device supports more than one radio link.
2153
2154```bash
2155> multiradio neighbor 3a65bc38dbe4a5be
2156[15.4(255), TREL(255)]
2157Done
2158```
2159
2160### nat64 cidr
2161
2162Gets the IPv4 configured CIDR in the NAT64 translator.
2163
2164`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2165
2166```bash
2167> nat64 cidr
2168192.168.255.0/24
2169Done
2170```
2171
2172### nat64 disable
2173
2174Disable NAT64 functions, including the translator and the prefix publishing.
2175
2176This command will reset the mapping table in the translator (if NAT64 translator is enabled in the build).
2177
2178`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2179
2180```bash
2181> nat64 disable
2182Done
2183```
2184
2185### nat64 enable
2186
2187Enable NAT64 functions, including the translator and the prefix publishing.
2188
2189This command can be called anytime.
2190
2191`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2192
2193```bash
2194> nat64 enable
2195Done
2196```
2197
2198### nat64 state
2199
2200Gets the state of NAT64 functions.
2201
2202Possible results for prefix manager are (`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required):
2203
2204- `Disabled`: NAT64 prefix manager is disabled.
2205- `NotRunning`: NAT64 prefix manager is enabled, but is not running, probably bacause the routing manager is disabled.
2206- `Idle`: NAT64 prefix manager is enabled and is running, but is not publishing a NAT64 prefix. Usually when there is another border router publishing a NAT64 prefix with higher priority.
2207- `Active`: NAT64 prefix manager is enabled, running and publishing a NAT64 prefix.
2208
2209Possible results for NAT64 translator are (`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required):
2210
2211- `Disabled`: NAT64 translator is disabled.
2212- `NotRunning`: NAT64 translator is enabled, but is not translating packets, probably bacause it is not configued with a NAT64 prefix or a CIDR for NAT64.
2213- `Active`: NAT64 translator is enabled and is translating packets.
2214
2215`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` or `OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` are required.
2216
2217```bash
2218> nat64 state
2219PrefixManager: NotRunning
2220Translator:    NotRunning
2221Done
2222
2223> nat64 state
2224PrefixManager: Idle
2225Translator:    NotRunning
2226Done
2227
2228> nat64 state
2229PrefixManager: Active
2230Translator:    Active
2231Done
2232```
2233
2234### nat64 mappings
2235
2236Get the NAT64 translator mappings.
2237
2238`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2239
2240```bash
2241> nat64 mappings
2242|          | Address                   |        | 4 to 6       | 6 to 4       |
2243+----------+---------------------------+--------+--------------+--------------+
2244| ID       | IPv6       | IPv4         | Expiry | Pkts | Bytes | Pkts | Bytes |
2245+----------+------------+--------------+--------+------+-------+------+-------+
2246| 00021cb9 | fdc7::df79 | 192.168.64.2 |  7196s |    6 |   456 |   11 |  1928 |
2247|          |                                TCP |    0 |     0 |    0 |     0 |
2248|          |                                UDP |    1 |   136 |   16 |  1608 |
2249|          |                               ICMP |    5 |   320 |    5 |   320 |
2250```
2251
2252### nat64 counters
2253
2254Get the NAT64 translator packet and error counters.
2255
2256`OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE` is required.
2257
2258```bash
2259> nat64 counters
2260|               | 4 to 6                  | 6 to 4                  |
2261+---------------+-------------------------+-------------------------+
2262| Protocol      | Pkts     | Bytes        | Pkts     | Bytes        |
2263+---------------+----------+--------------+----------+--------------+
2264|         Total |       11 |          704 |       11 |          704 |
2265|           TCP |        0 |            0 |        0 |            0 |
2266|           UDP |        0 |            0 |        0 |            0 |
2267|          ICMP |       11 |          704 |       11 |          704 |
2268| Errors        | Pkts                    | Pkts                    |
2269+---------------+-------------------------+-------------------------+
2270|         Total |                       8 |                       4 |
2271|   Illegal Pkt |                       0 |                       0 |
2272|   Unsup Proto |                       0 |                       0 |
2273|    No Mapping |                       2 |                       0 |
2274Done
2275```
2276
2277### neighbor linkquality
2278
2279Print link quality info for all neighbors.
2280
2281```bash
2282> neighbor linkquality
2283| RLOC16 | Extended MAC     | Frame Error | Msg Error | Avg RSS | Last RSS | Age   |
2284+--------+------------------+-------------+-----------+---------+----------+-------+
2285| 0xe800 | 9e2fa4e1b84f92db |      0.00 % |    0.00 % |     -46 |      -48 |     1 |
2286| 0xc001 | 0ad7ed6beaa6016d |      4.67 % |    0.08 % |     -68 |      -72 |    10 |
2287Done
2288```
2289
2290### neighbor list
2291
2292List RLOC16 of neighbors.
2293
2294```bash
2295> neighbor list
22960xcc01 0xc800 0xf000
2297Done
2298```
2299
2300### neighbor table
2301
2302Print table of neighbors.
2303
2304```bash
2305> neighbor table
2306| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC     |
2307+------+--------+-----+----------+-----------+-+-+-+------------------+
2308|   C  | 0xcc01 |  96 |      -46 |       -46 |1|1|1| 1eb9ba8a6522636b |
2309|   R  | 0xc800 |   2 |      -29 |       -29 |1|1|1| 9a91556102c39ddb |
2310|   R  | 0xf000 |   3 |      -28 |       -28 |1|1|1| 0ad7ed6beaa6016d |
2311Done
2312```
2313
2314### neighbor conntime
2315
2316Print connection time and age of neighbors.
2317
2318The table provides the following info per neighbor:
2319
2320- RLOC16
2321- Extended MAC address
2322- Age (seconds since last heard from neighbor)
2323- Connection time (seconds since link establishment with neighbor)
2324
2325Duration intervals are formatted as `<hh>:<mm>:<ss>` for hours, minutes, and seconds if the duration is less than one day. If the duration is longer than one day, the format is `<dd>d.<hh>:<mm>:<ss>`.
2326
2327```bash
2328> neighbor conntime
2329| RLOC16 | Extended MAC     | Last Heard (Age) | Connection Time  |
2330+--------+------------------+------------------+------------------+
2331| 0x8401 | 1a28be396a14a318 |         00:00:13 |         00:07:59 |
2332| 0x5c00 | 723ebf0d9eba3264 |         00:00:03 |         00:11:27 |
2333| 0xe800 | ce53628a1e3f5b3c |         00:00:02 |         00:00:15 |
2334Done
2335```
2336
2337### neighbor conntime list
2338
2339Print connection time and age of neighbors.
2340
2341This command is similar to `neighbor conntime`, but it displays the information in a list format. The age and connection time are both displayed in seconds.
2342
2343```bash
2344> neighbor conntime list
23450x8401 1a28be396a14a318 age:63 conn-time:644
23460x5c00 723ebf0d9eba3264 age:23 conn-time:852
23470xe800 ce53628a1e3f5b3c age:23 conn-time:180
2348Done
2349```
2350
2351### netstat
2352
2353List all UDP sockets.
2354
2355```bash
2356> netstat
2357| Local Address                                   | Peer Address                                    |
2358+-------------------------------------------------+-------------------------------------------------+
2359| [0:0:0:0:0:0:0:0]:49153                         | [0:0:0:0:0:0:0:0]:0                             |
2360| [0:0:0:0:0:0:0:0]:49152                         | [0:0:0:0:0:0:0:0]:0                             |
2361| [0:0:0:0:0:0:0:0]:61631                         | [0:0:0:0:0:0:0:0]:0                             |
2362| [0:0:0:0:0:0:0:0]:19788                         | [0:0:0:0:0:0:0:0]:0                             |
2363Done
2364```
2365
2366### networkdiagnostic get \<addr\> \<type\> ..
2367
2368Send network diagnostic request to retrieve tlv of \<type\>s.
2369
2370If \<addr\> is unicast address, `Diagnostic Get` will be sent. if \<addr\> is multicast address, `Diagnostic Query` will be sent.
2371
2372```bash
2373> networkdiagnostic get fdde:ad00:beef:0:0:ff:fe00:fc00 0 1 6
2374> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c000608640b0f674074c503
2375Ext Address: '0e336e1c41494e1c'
2376Rloc16: 0x0c00
2377Leader Data:
2378    PartitionId: 0x640b0f67
2379    Weighting: 64
2380    DataVersion: 116
2381    StableDataVersion: 197
2382    LeaderRouterId: 0x03
2383Done
2384
2385> networkdiagnostic get ff02::1 0 1
2386> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c00
2387Ext Address: '0e336e1c41494e1c'
2388Rloc16: 0x0c00
2389Done
2390DIAG_GET.rsp/ans: 00083efcdb7e3f9eb0f201021800
2391Ext Address: '3efcdb7e3f9eb0f2'
2392Rloc16: 0x1800
2393Done
2394```
2395
2396### networkdiagnostic reset \<addr\> \<type\> ..
2397
2398Send network diagnostic request to reset \<addr\>'s tlv of \<type\>s. Currently only `MAC Counters`(9) is supported.
2399
2400```bash
2401> diagnostic reset fd00:db8::ff:fe00:0 9
2402Done
2403```
2404
2405### networkidtimeout
2406
2407Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
2408
2409```bash
2410> networkidtimeout
2411120
2412Done
2413```
2414
2415### networkidtimeout \<timeout\>
2416
2417Set the NETWORK_ID_TIMEOUT parameter used in the Router role.
2418
2419```bash
2420> networkidtimeout 120
2421Done
2422```
2423
2424### networkkey
2425
2426Get the Thread Network Key value.
2427
2428```bash
2429> networkkey
243000112233445566778899aabbccddeeff
2431Done
2432```
2433
2434### networkkey \<key\>
2435
2436Set the Thread Network Key value.
2437
2438```bash
2439> networkkey 00112233445566778899aabbccddeeff
2440Done
2441```
2442
2443### networkname
2444
2445Get the Thread Network Name.
2446
2447```bash
2448> networkname
2449OpenThread
2450Done
2451```
2452
2453### networkname \<name\>
2454
2455Set the Thread Network Name.
2456
2457**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
2458
2459```bash
2460> networkname OpenThread
2461Done
2462```
2463
2464### panid
2465
2466Get the IEEE 802.15.4 PAN ID value.
2467
2468```bash
2469> panid
24700xdead
2471Done
2472```
2473
2474### panid \<panid\>
2475
2476Set the IEEE 802.15.4 PAN ID value.
2477
2478```bash
2479> panid 0xdead
2480Done
2481```
2482
2483### parent
2484
2485Get the diagnostic information for a Thread Router as parent.
2486
2487Note: When operating as a Thread Router when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled, this command will return the cached information from when the device was previously attached as a Thread Child. Returning cached information is necessary to support the Thread Test Harness - Test Scenario 8.2.x requests the former parent (i.e. Joiner Router's) MAC address even if the device has already promoted to a router.
2488
2489```bash
2490> parent
2491Ext Addr: be1857c6c21dce55
2492Rloc: 5c00
2493Link Quality In: 3
2494Link Quality Out: 3
2495Age: 20
2496Version: 4
2497Done
2498```
2499
2500Note: When `OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE` is enabled, this command will return two extra lines with information relevant for CSL Receiver operation.
2501
2502```bash
2503CSL clock accuracy: 20
2504CSL uncertainty: 5
2505```
2506
2507### parentpriority
2508
2509Get the assigned parent priority value, -2 means not assigned.
2510
2511```bash
2512> parentpriority
25131
2514Done
2515```
2516
2517### parentpriority \<parentpriority\>
2518
2519Set the assigned parent priority value: 1, 0, -1 or -2.
2520
2521```bash
2522> parentpriority 1
2523Done
2524```
2525
2526### partitionid
2527
2528Get the Thread Network Partition ID.
2529
2530```bash
2531> partitionid
25324294967295
2533Done
2534```
2535
2536### partitionid preferred
2537
2538Get the preferred Thread Leader Partition ID.
2539
2540`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2541
2542```bash
2543> partitionid preferred
25444294967295
2545Done
2546```
2547
2548### partitionid preferred \<partitionid\>
2549
2550Set the preferred Thread Leader Partition ID.
2551
2552`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
2553
2554```bash
2555> partitionid preferred 0xffffffff
2556Done
2557```
2558
2559### ping \[async\] \[-I source\] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
2560
2561Send an ICMPv6 Echo Request.
2562
2563- async: Use the non-blocking mode. New commands are allowed before the ping process terminates.
2564- source: The source IPv6 address of the echo request.
2565- size: The number of data bytes to be sent.
2566- count: The number of ICMPv6 Echo Requests to be sent.
2567- interval: The interval between two consecutive ICMPv6 Echo Requests in seconds. The value may have fractional form, for example `0.5`.
2568- hoplimit: The hoplimit of ICMPv6 Echo Request to be sent.
2569- timeout: Time in seconds to wait for the final ICMPv6 Echo Reply after sending out the request. The value may have fractional form, for example `3.5`.
2570
2571```bash
2572> ping fd00:db8:0:0:76b:6a05:3ae9:a61a
2573> 16 bytes from fd00:db8:0:0:76b:6a05:3ae9:a61a: icmp_seq=5 hlim=64 time=0ms
25741 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
2575Done
2576
2577> ping -I fd00:db8:0:0:76b:6a05:3ae9:a61a ff02::1 100 1 1 1
2578> 108 bytes from fd00:db8:0:0:f605:fb4b:d429:d59a: icmp_seq=4 hlim=64 time=7ms
25791 packets transmitted, 1 packets received. Round-trip min/avg/max = 7/7.0/7 ms.
2580Done
2581```
2582
2583The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
2584
2585> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
2586
2587```bash
2588> ping 172.17.0.1
2589Pinging synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
2590> 16 bytes from fdde:ad00:beef:2:0:0:ac11:1: icmp_seq=5 hlim=64 time=0ms
25911 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
2592Done
2593```
2594
2595### ping stop
2596
2597Stop sending ICMPv6 Echo Requests.
2598
2599```bash
2600> ping stop
2601Done
2602```
2603
2604### platform
2605
2606Print the current platform
2607
2608```bash
2609> platform
2610NRF52840
2611Done
2612```
2613
2614### pollperiod
2615
2616Get the customized data poll period of sleepy end device (milliseconds). Only for certification test.
2617
2618```bash
2619> pollperiod
26200
2621Done
2622```
2623
2624### pollperiod \<pollperiod\>
2625
2626Set the customized data poll period for sleepy end device (milliseconds >= 10ms). Only for certification test.
2627
2628```bash
2629> pollperiod 10
2630Done
2631```
2632
2633### pskc
2634
2635Get pskc in hex format.
2636
2637```bash
2638> pskc
263900000000000000000000000000000000
2640Done
2641```
2642
2643### pskc [-p] \<key\>|\<passphrase\>
2644
2645With `-p` generate pskc from \<passphrase\> (UTF-8 encoded) together with **current** network name and extended PAN ID, otherwise set pskc as \<key\> (hex format).
2646
2647```bash
2648> pskc 67c0c203aa0b042bfb5381c47aef4d9e
2649Done
2650> pskc -p 123456
2651Done
2652```
2653
2654### pskcref
2655
2656Get pskc key reference.
2657
2658`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is required.
2659
2660```bash
2661> pskcref
26620x80000000
2663Done
2664```
2665
2666### pskcref \<keyref\>
2667
2668Set pskc key reference as \<keyref\>.
2669
2670`OPENTHREAD_CONFIG_PLATFORM_KEY_REFERENCES_ENABLE` is required.
2671
2672```bash
2673> pskcref 0x20017
2674Done
2675```
2676
2677### preferrouterid \<routerid\>
2678
2679Prefer a Router ID when solicit router id from Leader.
2680
2681```bash
2682> preferrouterid 16
2683Done
2684```
2685
2686### prefix
2687
2688Get the prefix list in the local Network Data. Note: For the Thread 1.2 border router with backbone capability, the local Domain Prefix would be listed as well (with flag `D`), with preceeding `-` if backbone functionality is disabled.
2689
2690```bash
2691> prefix
26922001:dead:beef:cafe::/64 paros med
2693- fd00:7d03:7d03:7d03::/64 prosD med
2694Done
2695```
2696
2697### prefix add \<prefix\> [padcrosnD][prf]
2698
2699Add a valid prefix to the Network Data.
2700
2701Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
2702
2703- p: Preferred flag
2704- a: Stateless IPv6 Address Autoconfiguration flag
2705- d: DHCPv6 IPv6 Address Configuration flag
2706- c: DHCPv6 Other Configuration flag
2707- r: Default Route flag
2708- o: On Mesh flag
2709- s: Stable flag
2710- n: Nd Dns flag
2711- D: Domain Prefix flag
2712- prf: Default router preference, which may be 'high', 'med', or 'low'.
2713
2714```bash
2715> prefix add 2001:dead:beef:cafe::/64 paros med
2716Done
2717
2718> prefix add fd00:7d03:7d03:7d03::/64 prosD med
2719Done
2720```
2721
2722### prefix meshlocal
2723
2724Get the mesh local prefix.
2725
2726```bash
2727> prefix meshlocal
2728fdde:ad00:beef:0::/64
2729Done
2730```
2731
2732### prefix meshlocal <prefix>
2733
2734Set the mesh local prefix.
2735
2736```bash
2737> prefix meshlocal fdde:ad00:beef:0::/64
2738Done
2739```
2740
2741### prefix remove \<prefix\>
2742
2743Invalidate a prefix in the Network Data.
2744
2745```bash
2746> prefix remove 2001:dead:beef:cafe::/64
2747Done
2748```
2749
2750### promiscuous
2751
2752Get radio promiscuous property.
2753
2754```bash
2755> promiscuous
2756Disabled
2757Done
2758```
2759
2760### promiscuous enable
2761
2762Enable radio promiscuous operation and print raw packet content.
2763
2764```bash
2765> promiscuous enable
2766Done
2767```
2768
2769### promiscuous disable
2770
2771Disable radio promiscuous operation.
2772
2773```bash
2774> promiscuous disable
2775Done
2776```
2777
2778### radiofilter
2779
2780`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
2781
2782The radio filter is mainly intended for testing. It can be used to temporarily block all tx/rx on the IEEE 802.15.4 radio.
2783
2784When radio filter is enabled, radio is put to sleep instead of receive (to ensure device does not receive any frame and/or potentially send ack). Also the frame transmission requests return immediately without sending the frame over the air (return "no ack" error if ack is requested, otherwise return success).
2785
2786Get radio filter status (enabled or disabled).
2787
2788```bash
2789> radiofilter
2790Disabled
2791Done
2792```
2793
2794### radiofilter enable
2795
2796`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
2797
2798Enable radio radio filter.
2799
2800```bash
2801> radiofilter enable
2802Done
2803```
2804
2805### radiofilter disable
2806
2807`OPENTHREAD_CONFIG_MAC_FILTER_ENABLE` is required.
2808
2809Disable radio radio filter.
2810
2811```bash
2812> radiofilter disable
2813Done
2814```
2815
2816### rcp
2817
2818RCP-related commands.
2819
2820### region
2821
2822Set the radio region, this can affect the transmit power limit.
2823
2824```bash
2825> region US
2826Done
2827> region
2828US
2829Done
2830```
2831
2832### rcp version
2833
2834Print RCP version string.
2835
2836```bash
2837> rcp version
2838OPENTHREAD/20191113-00825-g82053cc9d-dirty; SIMULATION; Jun  4 2020 17:53:16
2839Done
2840```
2841
2842### releaserouterid \<routerid\>
2843
2844Release a Router ID that has been allocated by the device in the Leader role.
2845
2846```bash
2847> releaserouterid 16
2848Done
2849```
2850
2851### reset
2852
2853Signal a platform reset.
2854
2855```bash
2856> reset
2857```
2858
2859### rloc16
2860
2861Get the Thread RLOC16 value.
2862
2863```bash
2864> rloc16
28650xdead
2866Done
2867```
2868
2869### route
2870
2871Get the external route list in the local Network Data.
2872
2873```bash
2874> route
28752001:dead:beef:cafe::/64 s med
2876Done
2877```
2878
2879### route add \<prefix\> [sn][prf]
2880
2881Add a valid external route to the Network Data.
2882
2883- s: Stable flag
2884- n: NAT64 flag
2885- prf: Default Router Preference, which may be: 'high', 'med', or 'low'.
2886
2887```bash
2888> route add 2001:dead:beef:cafe::/64 s med
2889Done
2890```
2891
2892### route remove \<prefix\>
2893
2894Invalidate a external route in the Network Data.
2895
2896```bash
2897> route remove 2001:dead:beef:cafe::/64
2898Done
2899```
2900
2901### router list
2902
2903List allocated Router IDs.
2904
2905```bash
2906> router list
29078 24 50
2908Done
2909```
2910
2911### router table
2912
2913Print table of routers.
2914
2915```bash
2916> router table
2917| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC     | Link |
2918+----+--------+----------+-----------+-------+--------+-----+------------------+------+
2919| 22 | 0x5800 |       63 |         0 |     0 |      0 |   0 | 0aeb8196c9f61658 |    0 |
2920| 49 | 0xc400 |       63 |         0 |     3 |      3 |   0 | faa1c03908e2dbf2 |    1 |
2921Done
2922```
2923
2924### router \<id\>
2925
2926Print diagnostic information for a Thread Router. The `id` may be a Router ID or an RLOC16.
2927
2928```bash
2929> router 50
2930Alloc: 1
2931Router ID: 50
2932Rloc: c800
2933Next Hop: c800
2934Link: 1
2935Ext Addr: e2b3540590b0fd87
2936Cost: 0
2937Link Quality In: 3
2938Link Quality Out: 3
2939Age: 3
2940Done
2941```
2942
2943```bash
2944> router 0xc800
2945Alloc: 1
2946Router ID: 50
2947Rloc: c800
2948Next Hop: c800
2949Link: 1
2950Ext Addr: e2b3540590b0fd87
2951Cost: 0
2952Link Quality In: 3
2953Link Quality Out: 3
2954Age: 7
2955Done
2956```
2957
2958### routerdowngradethreshold
2959
2960Get the ROUTER_DOWNGRADE_THRESHOLD value.
2961
2962```bash
2963> routerdowngradethreshold
296423
2965Done
2966```
2967
2968### routerdowngradethreshold \<threshold\>
2969
2970Set the ROUTER_DOWNGRADE_THRESHOLD value.
2971
2972```bash
2973> routerdowngradethreshold 23
2974Done
2975```
2976
2977### routereligible
2978
2979Indicates whether the router role is enabled or disabled.
2980
2981```bash
2982> routereligible
2983Enabled
2984Done
2985```
2986
2987### routereligible enable
2988
2989Enable the router role.
2990
2991```bash
2992> routereligible enable
2993Done
2994```
2995
2996### routereligible disable
2997
2998Disable the router role.
2999
3000```bash
3001> routereligible disable
3002Done
3003```
3004
3005### routerselectionjitter
3006
3007Get the ROUTER_SELECTION_JITTER value.
3008
3009```bash
3010> routerselectionjitter
3011120
3012Done
3013```
3014
3015### routerselectionjitter \<jitter\>
3016
3017Set the ROUTER_SELECTION_JITTER value.
3018
3019```bash
3020> routerselectionjitter 120
3021Done
3022```
3023
3024### routerupgradethreshold
3025
3026Get the ROUTER_UPGRADE_THRESHOLD value.
3027
3028```bash
3029> routerupgradethreshold
303016
3031Done
3032```
3033
3034### routerupgradethreshold \<threshold\>
3035
3036Set the ROUTER_UPGRADE_THRESHOLD value.
3037
3038```bash
3039> routerupgradethreshold 16
3040Done
3041```
3042
3043### childrouterlinks
3044
3045Get the MLE_CHILD_ROUTER_LINKS value.
3046
3047```bash
3048> childrouterlinks
304916
3050Done
3051```
3052
3053### childrouterlinks \<number_of_links\>
3054
3055Set the MLE_CHILD_ROUTER_LINKS value.
3056
3057```bash
3058> childrouterlinks 16
3059Done
3060```
3061
3062### scan \[channel\]
3063
3064Perform an IEEE 802.15.4 Active Scan.
3065
3066- channel: The channel to scan on. If no channel is provided, the active scan will cover all valid channels.
3067
3068```bash
3069> scan
3070| PAN  | MAC Address      | Ch | dBm | LQI |
3071+------+------------------+----+-----+-----+
3072| ffff | f1d92a82c8d8fe43 | 11 | -20 |   0 |
3073Done
3074```
3075
3076### scan energy \[duration\] \[channel\]
3077
3078Perform an IEEE 802.15.4 Energy Scan.
3079
3080- duration: The time in milliseconds to spend scanning each channel.
3081
3082```bash
3083> scan energy 10
3084| Ch | RSSI |
3085+----+------+
3086| 11 |  -59 |
3087| 12 |  -62 |
3088| 13 |  -67 |
3089| 14 |  -61 |
3090| 15 |  -87 |
3091| 16 |  -86 |
3092| 17 |  -86 |
3093| 18 |  -52 |
3094| 19 |  -58 |
3095| 20 |  -82 |
3096| 21 |  -76 |
3097| 22 |  -82 |
3098| 23 |  -74 |
3099| 24 |  -81 |
3100| 25 |  -88 |
3101| 26 |  -71 |
3102Done
3103```
3104
3105```bash
3106> scan energy 10 20
3107| Ch | RSSI |
3108+----+------+
3109| 20 |  -82 |
3110Done
3111```
3112
3113### service
3114
3115Module for controlling service registration in Network Data. Each change in service registration must be sent to leader by `netdata register` command before taking effect.
3116
3117### service add \<enterpriseNumber\> \<serviceData\> \<serverData\>
3118
3119Add service to the Network Data.
3120
3121- enterpriseNumber: IANA enterprise number
3122- serviceData: hex-encoded binary service data
3123- serverData: hex-encoded binary server data
3124
3125```bash
3126> service add 44970 112233 aabbcc
3127Done
3128> netdata register
3129Done
3130```
3131
3132### service remove \<enterpriseNumber\> \<serviceData\>
3133
3134Remove service from Network Data.
3135
3136- enterpriseNumber: IANA enterprise number
3137- serviceData: hext-encoded binary service data
3138
3139```bash
3140> service remove 44970 112233
3141Done
3142> netdata register
3143Done
3144```
3145
3146### singleton
3147
3148Return true when there are no other nodes in the network, otherwise return false.
3149
3150```bash
3151> singleton
3152true or false
3153Done
3154```
3155
3156### sntp query \[SNTP server IP\] \[SNTP server port\]
3157
3158Send SNTP Query to obtain current unix epoch time (from 1st January 1970). The latter two parameters have following default values:
3159
3160- NTP server IP: 2001:4860:4806:8:: (Google IPv6 NTP Server)
3161- NTP server port: 123
3162
3163```bash
3164> sntp query
3165> SNTP response - Unix time: 1540894725 (era: 0)
3166```
3167
3168You can use NAT64 of OpenThread Border Router to reach e.g. Google IPv4 NTP Server:
3169
3170```bash
3171> sntp query 64:ff9b::d8ef:2308
3172> SNTP response - Unix time: 1540898611 (era: 0)
3173```
3174
3175### state
3176
3177Return state of current state.
3178
3179```bash
3180> state
3181offline, disabled, detached, child, router or leader
3182Done
3183```
3184
3185### state <state>
3186
3187Try to switch to state `detached`, `child`, `router` or `leader`.
3188
3189```bash
3190> state leader
3191Done
3192```
3193
3194### thread start
3195
3196Enable Thread protocol operation and attach to a Thread network.
3197
3198```bash
3199> thread start
3200Done
3201```
3202
3203### thread stop
3204
3205Disable Thread protocol operation and detach from a Thread network.
3206
3207```bash
3208> thread stop
3209Done
3210```
3211
3212### thread version
3213
3214Get the Thread Version number.
3215
3216```bash
3217> thread version
32182
3219Done
3220```
3221
3222### trel
3223
3224Indicate whether TREL radio operation is enabled or not.
3225
3226`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required for all `trel` sub-commands.
3227
3228```bash
3229> trel
3230Enabled
3231Done
3232```
3233
3234### trel enable
3235
3236Enable TREL operation.
3237
3238```bash
3239> trel enable
3240Done
3241```
3242
3243### trel disable
3244
3245Disable TREL operation.
3246
3247```bash
3248> trel disable
3249Done
3250```
3251
3252### trel filter
3253
3254Indicate whether TREL filter mode is enabled or not
3255
3256When filter mode is enabled, any rx and tx traffic through TREL interface is silently dropped. This is mainly intended for use during testing.
3257
3258```bash
3259> trel filter
3260Disabled
3261Done
3262```
3263
3264### trel filter enable
3265
3266Enable TREL filter mode.
3267
3268```bash
3269> trel filter enable
3270Done
3271```
3272
3273### trel filter disable
3274
3275Disable TREL filter mode.
3276
3277```bash
3278> trel filter disable
3279Done
3280```
3281
3282### trel peers [list]
3283
3284Get the TREL peer table in table format or as a list.
3285
3286```bash
3287> trel peers
3288| No  | Ext MAC Address  | Ext PAN Id       | IPv6 Socket Address                              |
3289+-----+------------------+------------------+--------------------------------------------------+
3290|   1 | 5e5785ba3a63adb9 | f0d9c001f00d2e43 | [fe80:0:0:0:cc79:2a29:d311:1aea]:9202            |
3291|   2 | ce792a29d3111aea | dead00beef00cafe | [fe80:0:0:0:5c57:85ba:3a63:adb9]:9203            |
3292Done
3293
3294> trel peers list
3295001 ExtAddr:5e5785ba3a63adb9 ExtPanId:f0d9c001f00d2e43 SockAddr:[fe80:0:0:0:cc79:2a29:d311:1aea]:9202
3296002 ExtAddr:ce792a29d3111aea ExtPanId:dead00beef00cafe SockAddr:[fe80:0:0:0:5c57:85ba:3a63:adb9]:9203
3297>>>>>>> [trel] implement new TREL model using DNS-SD
3298Done
3299```
3300
3301### tvcheck enable
3302
3303Enable thread version check when upgrading to router or leader.
3304
3305Note: Thread version check is enabled by default.
3306
3307`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
3308
3309```bash
3310> tvcheck enable
3311Done
3312```
3313
3314### tvcheck disable
3315
3316Enable thread version check when upgrading to router or leader.
3317
3318Note: Thread version check is enabled by default.
3319
3320`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
3321
3322```bash
3323> tvcheck disable
3324Done
3325```
3326
3327### txpower
3328
3329Get the transmit power in dBm.
3330
3331```bash
3332> txpower
3333-10 dBm
3334Done
3335```
3336
3337### txpower \<txpower\>
3338
3339Set the transmit power in dBm.
3340
3341```bash
3342> txpower -10
3343Done
3344```
3345
3346### unsecureport add \<port\>
3347
3348Add a port to the allowed unsecured port list.
3349
3350```bash
3351> unsecureport add 1234
3352Done
3353```
3354
3355### unsecureport remove \<port\>
3356
3357Remove a port from the allowed unsecured port list.
3358
3359```bash
3360> unsecureport remove 1234
3361Done
3362```
3363
3364### unsecureport remove all
3365
3366Remove all ports from the allowed unsecured port list.
3367
3368```bash
3369> unsecureport remove all
3370Done
3371```
3372
3373### unsecureport get
3374
3375Print all ports from the allowed unsecured port list.
3376
3377```bash
3378> unsecureport get
33791234
3380Done
3381```
3382
3383### uptime
3384
3385This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
3386
3387Print the OpenThread stack uptime (duration since OpenThread stack initialization).
3388
3389```bash
3390> uptime
339112:46:35.469
3392Done
3393>
3394```
3395
3396### uptime ms
3397
3398This command requires `OPENTHREAD_CONFIG_UPTIME_ENABLE` to be enabled.
3399
3400Print the OpenThread stack uptime in msec.
3401
3402```bash
3403> uptime ms
3404426238
3405Done
3406>
3407```
3408
3409### vendor name
3410
3411This command requires `OPENTHREAD_FTD` or `OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE`.
3412
3413Get the vendor name.
3414
3415```bash
3416> vendor name
3417nest
3418Done
3419```
3420
3421Set the vendor name (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
3422
3423```bash
3424> vendor name nest
3425Done
3426```
3427
3428### vendor model
3429
3430This command requires `OPENTHREAD_FTD` or `OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE`.
3431
3432Get the vendor model.
3433
3434```bash
3435> vendor model
3436Hub Max
3437Done
3438```
3439
3440Set the vendor model (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
3441
3442```bash
3443> vendor model Hub\ Max
3444Done
3445```
3446
3447### vendor swversion
3448
3449This command requires `OPENTHREAD_FTD` or `OPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE`.
3450
3451Get the vendor SW version.
3452
3453```bash
3454> vendor swversion
3455Marble3.5.1
3456Done
3457```
3458
3459Set the vendor SW version (requires `OPENTHREAD_CONFIG_NET_DIAG_VENDOR_INFO_SET_API_ENABLE`).
3460
3461```bash
3462> vendor swversion Marble3.5.1
3463Done
3464```
3465
3466### version
3467
3468Print the build version information.
3469
3470```bash
3471> version
3472OPENTHREAD/gf4f2f04; Jul  1 2016 17:00:09
3473Done
3474```
3475
3476### version api
3477
3478Print API version number.
3479
3480```bash
3481> version api
348228
3483Done
3484```
3485
3486### mac retries direct
3487
3488Get the number of direct TX retries on the MAC layer.
3489
3490```bash
3491> mac retries direct
34923
3493Done
3494```
3495
3496### mac retries direct \<number\>
3497
3498Set the number of direct TX retries on the MAC layer.
3499
3500```bash
3501> mac retries direct 5
3502Done
3503```
3504
3505### mac retries indirect
3506
3507Get the number of indirect TX retries on the MAC layer.
3508
3509```bash
3510> mac retries indirect
35113
3512Done
3513```
3514
3515### mac retries indirect \<number\>
3516
3517Set the number of indirect TX retries on the MAC layer.
3518
3519```bash
3520> mac retries indirect 5
3521Done
3522```
3523
3524### mac send \<op\>
3525
3526Instruct an Rx-Off-When-Idle device to send a mac frame to its parent. The mac frame could be either a mac data request or an empty mac data frame. Use `datarequest` to send a mac data request and `data` to send an empty mac data. This feature is for certification, it can only be used when `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is enabled.
3527
3528```bash
3529> mac send datarequest
3530Done
3531```
3532
3533```bash
3534> mac send emptydata
3535Done
3536```
3537
3538### macfilter
3539
3540List the macfilter status, including address and received signal strength filter settings.
3541
3542```bash
3543> macfilter
3544Address Mode: Allowlist
35450f6127e33af6b403 : rss -95 (lqi 1)
35460f6127e33af6b402
3547RssIn List:
35480f6127e33af6b403 : rss -95 (lqi 1)
3549Default rss : -50 (lqi 3)
3550Done
3551```
3552
3553### macfilter addr
3554
3555List the address filter status.
3556
3557```bash
3558> macfilter addr
3559Allowlist
35600f6127e33af6b403 : rss -95 (lqi 1)
35610f6127e33af6b402
3562Done
3563```
3564
3565### macfilter addr disable
3566
3567Disable address filter mode.
3568
3569```bash
3570> macfilter addr disable
3571Done
3572```
3573
3574### macfilter addr allowlist
3575
3576Enable allowlist address filter mode.
3577
3578```bash
3579> macfilter addr allowlist
3580Done
3581```
3582
3583### macfilter addr denylist
3584
3585Enable denylist address filter mode.
3586
3587```bash
3588> macfilter addr denylist
3589Done
3590```
3591
3592### macfilter addr add \<extaddr\> \[rss\]
3593
3594Add an IEEE 802.15.4 Extended Address to the address filter, and fixed the received singal strength for the messages from the address if rss is specified.
3595
3596```bash
3597> macfilter addr add 0f6127e33af6b403 -95
3598Done
3599```
3600
3601```bash
3602> macfilter addr add 0f6127e33af6b402
3603Done
3604```
3605
3606### macfilter addr remove \<extaddr\>
3607
3608Remove the IEEE802.15.4 Extended Address from the address filter.
3609
3610```bash
3611> macfilter addr remove 0f6127e33af6b402
3612Done
3613```
3614
3615### macfilter addr clear
3616
3617Clear all the IEEE802.15.4 Extended Addresses from the address filter.
3618
3619```bash
3620> macfilter addr clear
3621Done
3622```
3623
3624### macfilter rss
3625
3626List the rss filter status
3627
3628```bash
3629> macfilter rss
36300f6127e33af6b403 : rss -95 (lqi 1)
3631Default rss: -50 (lqi 3)
3632Done
3633```
3634
3635### macfilter rss add \<extaddr\> \<rss\>
3636
3637Set the received signal strength for the messages from the IEEE802.15.4 Extended Address. If extaddr is \*, default received signal strength for all received messages would be set.
3638
3639```bash
3640> macfilter rss add * -50
3641Done
3642```
3643
3644```bash
3645> macfilter rss add 0f6127e33af6b404 -85
3646Done
3647```
3648
3649### macfilter rss add-lqi \<extaddr\> \<lqi\>
3650
3651Set the received link quality for the messages from the IEEE802.15.4 Extended Address. Valid lqi range [0,3] If extaddr is \*, default received link quality for all received messages would be set. Equivalent with 'filter rss add' with similar usage
3652
3653```bash
3654> macfilter rss add-lqi * 3
3655Done
3656```
3657
3658```bash
3659> macfilter rss add 0f6127e33af6b404 2
3660Done
3661```
3662
3663### macfilter rss remove \<extaddr\>
3664
3665Removes the received signal strength or received link quality setting on the Extended Address. If extaddr is \*, default received signal strength or link quality for all received messages would be unset.
3666
3667```bash
3668> macfilter rss remove *
3669Done
3670```
3671
3672```bash
3673> macfilter rss remove 0f6127e33af6b404
3674Done
3675```
3676
3677### macfilter rss clear
3678
3679Clear all the received signal strength or received link quality settings.
3680
3681```bash
3682> macfilter rss clear
3683Done
3684```
3685
3686### diag
3687
3688Factory Diagnostics module is enabled only when building OpenThread with `OPENTHREAD_CONFIG_DIAG_ENABLE=1` option. Go [diagnostics module][diag] for more information.
3689
3690[diag]: ../../src/core/diags/README.md
3691

README_BR.md

1# OpenThread CLI - Border Router (BR)
2
3## Command List
4
5Usage : `br [command] ...`
6
7- [counters](#counters)
8- [disable](#disable)
9- [enable](#enable)
10- [help](#help)
11- [nat64prefix](#nat64prefix)
12- [omrprefix](#omrprefix)
13- [onlinkprefix](#onlinkprefix)
14- [prefixtable](#prefixtable)
15- [rioprf](#rioprf)
16- [state](#state)
17
18## Command Details
19
20### help
21
22Usage: `br help`
23
24Print BR command help menu.
25
26```bash
27> br help
28counters
29disable
30enable
31omrprefix
32onlinkprefix
33prefixtable
34rioprf
35state
36Done
37```
38
39### enable
40
41Usage: `br enable`
42
43Enable the Border Routing functionality.
44
45```bash
46> br enable
47Done
48```
49
50### disable
51
52Usage: `br disable`
53
54Disable the Border Routing functionality.
55
56```bash
57> br disable
58Done
59```
60
61### state
62
63Usage: `br state`
64
65Get the Border Routing state:
66
67- `uninitialized`: Routing Manager is uninitialized.
68- `disabled`: Routing Manager is initialized but disabled.
69- `stopped`: Routing Manager in initialized and enabled but currently stopped.
70- `running`: Routing Manager is initialized, enabled, and running.
71
72```bash
73> br state
74running
75```
76
77### counters
78
79Usage : `br counters`
80
81Get the Border Router counter.
82
83```bash
84> br counters
85Inbound Unicast: Packets 4 Bytes 320
86Inbound Multicast: Packets 0 Bytes 0
87Outbound Unicast: Packets 2 Bytes 160
88Outbound Multicast: Packets 0 Bytes 0
89RA Rx: 4
90RA TxSuccess: 2
91RA TxFailed: 0
92RS Rx: 0
93RS TxSuccess: 2
94RS TxFailed: 0
95Done
96```
97
98### omrprefix
99
100Usage: `br omrprefix [local|favored]`
101
102Get local or favored or both off-mesh-routable prefixes of the Border Router.
103
104```bash
105> br omrprefix
106Local: fdfc:1ff5:1512:5622::/64
107Favored: fdfc:1ff5:1512:5622::/64 prf:low
108Done
109
110> br omrprefix favored
111fdfc:1ff5:1512:5622::/64 prf:low
112Done
113
114> br omrprefix local
115fdfc:1ff5:1512:5622::/64
116Done
117```
118
119### onlinkprefix
120
121Usage: `br onlinkprefix [local|favored]`
122
123Get local or favored or both on-link prefixes of the Border Router.
124
125```bash
126> br onlinkprefix
127Local: fd41:2650:a6f5:0::/64
128Favored: 2600::0:1234:da12::/64
129Done
130
131> br onlinkprefix favored
1322600::0:1234:da12::/64
133Done
134
135> br onlinkprefix local
136fd41:2650:a6f5:0::/64
137Done
138```
139
140### nat64prefix
141
142Usage: `br nat64prefix [local|favored]`
143
144Get local or favored or both NAT64 prefixes of the Border Router.
145
146`OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE` is required.
147
148```bash
149> br nat64prefix
150Local: fd14:1078:b3d5:b0b0:0:0::/96
151Favored: fd14:1078:b3d5:b0b0:0:0::/96 prf:low
152Done
153
154> br nat64prefix favored
155fd14:1078:b3d5:b0b0:0:0::/96 prf:low
156Done
157
158> br nat64prefix
159fd14:1078:b3d5:b0b0:0:0::/96
160Done
161```
162
163### prefixtable
164
165Usage: `br prefixtable`
166
167Get the discovered prefixes by Border Routing Manager on the infrastructure link.
168
169```bash
170> br prefixtable
171prefix:fd00:1234:5678:0::/64, on-link:no, ms-since-rx:29526, lifetime:1800, route-prf:med, router:ff02:0:0:0:0:0:0:1
172prefix:1200:abba:baba:0::/64, on-link:yes, ms-since-rx:29527, lifetime:1800, preferred:1800, router:ff02:0:0:0:0:0:0:1
173Done
174```
175
176### rioprf
177
178Usage: `br rioprf`
179
180Get the preference used when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
181
182```bash
183> br rioprf
184med
185Done
186```
187
188### rioprf \<prf\>
189
190Usage: `br rioprf high|med|low`
191
192Set the preference (which may be 'high', 'med', or 'low') to use when advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message.
193
194```bash
195> br rioprf low
196Done
197```
198
199### rioprf clear
200
201Usage: `br rioprf clear`
202
203Clear a previously set preference value for advertising Route Info Options (e.g., for discovered OMR prefixes) in emitted Router Advertisement message. When cleared BR will use device's role to determine the RIO preference: Medium preference when in router/leader role and low preference when in child role.
204
205```bash
206> br rioprf clear
207Done
208```
209

README_COAP.md

1# OpenThread CLI - CoAP Example
2
3The OpenThread CoAP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, setup CoAP server with resource `test-resource`.
14
15```bash
16> coap start
17Done
18> coap resource test-resource
19Done
20```
21
22### Node 2
23
24```bash
25> coap start
26Done
27> coap get fdde:ad00:beef:0:d395:daee:a75:3964 test-resource
28Done
29coap response from [fdde:ad00:beef:0:2780:9423:166c:1aac] with payload: 30
30> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
31Done
32coap response from [fdde:ad00:beef:0:2780:9423:166c:1aac]
33```
34
35### Result
36
37On node 1, you should see output similar to below:
38
39```bash
40coap request from [fdde:ad00:beef:0:b3:e3f6:2dcc:4b79] GET
41coap response sent
42coap request from [fdde:ad00:beef:0:b3:e3f6:2dcc:4b79] PUT with payload: 7061796c6f6164
43coap response sent
44```
45
46## Command List
47
48- [help](#help)
49- [cancel](#cancel)
50- [delete](#delete-address-uri-path-type-payload)
51- [get](#get-address-uri-path-type)
52- [observe](#observe-address-uri-path-type)
53- [parameters](#parameters)
54- [post](#post-address-uri-path-type-payload)
55- [put](#put-address-uri-path-type-payload)
56- [resource](#resource-uri-path)
57- [set](#set-new-content)
58- [start](#start)
59- [stop](#stop)
60
61## Command Details
62
63### help
64
65```bash
66> coap help
67help
68cancel
69delete
70get
71observe
72parameters
73post
74put
75resource
76set
77start
78stop
79Done
80```
81
82List the CoAP CLI commands.
83
84### cancel
85
86Request the cancellation of an existing observation subscription to a remote resource.
87
88```bash
89> coap cancel
90Done
91```
92
93### delete \<address\> \<uri-path\> \[type\] \[payload\]
94
95- address: IPv6 address of the CoAP server.
96- uri-path: URI path of the resource.
97- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
98- payload: CoAP request payload.
99
100```bash
101> coap delete fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
102Done
103```
104
105### get \<address\> \<uri-path\> \[type\]
106
107- address: IPv6 address of the CoAP server.
108- uri-path: URI path of the resource.
109- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" if the response should be transferred block-wise. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
110
111```bash
112> coap get fdde:ad00:beef:0:2780:9423:166c:1aac test-resource
113Done
114```
115
116```bash
117> coap get fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024
118Done
119```
120
121### observe \<address\> \<uri-path\> \[type\]
122
123This is the same a `get`, but the `Observe` parameter will be sent, set to 0 triggering a subscription request.
124
125- address: IPv6 address of the CoAP server.
126- uri-path: URI path of the resource.
127- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
128
129```bash
130> coap observe fdde:ad00:beef:0:2780:9423:166c:1aac test-resource
131Done
132```
133
134### parameters \<type\> \["default"|<ack_timeout\> <ack_random_factor_numerator\> <ack_random_factor_denominator\> <max_retransmit\>\]
135
136Sets transmission parameters for the following interactions.
137
138- type: "request" for CoAP requests and "response" for CoAP responses.
139
140If no more parameters are given, the command prints the current configuration:
141
142```bash
143> coap parameters request
144Transmission parameters for request:
145ACK_TIMEOUT=1000 ms, ACK_RANDOM_FACTOR=255/254, MAX_RETRANSMIT=2
146Done
147```
148
149If `"default"` is given, the command sets the default configuration for the transmission parameters.
150
151```bash
152> coap parameters request default
153Transmission parameters for request:
154default
155Done
156```
157
158Also, you can specify the transmission parameters in the command line:
159
160- ack_timeout (0~UINT32_MAX): RFC7252 ACK_TIMEOUT, in milliseconds.
161- ack_random_factor_numerator, ack_random_factor_denominator (0~255): RFC7252 ACK_RANDOM_FACTOR=ack_random_factor_numerator/ack_random_factor_denominator.
162- max_retransmit (0~255): RFC7252 MAX_RETRANSMIT.
163
164```bash
165> coap parameters request 1000 255 254 2
166Transmission parameters for request:
167ACK_TIMEOUT=1000 ms, ACK_RANDOM_FACTOR=255/254, MAX_RETRANSMIT=2
168Done
169```
170
171### post \<address\> \<uri-path\> \[type\] \[payload\]
172
173- address: IPv6 address of the CoAP server.
174- uri-path: URI path of the resource.
175- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
176- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
177
178```bash
179> coap post fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
180Done
181```
182
183```bash
184> coap post fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024 10
185Done
186```
187
188### put \<address\> \<uri-path\> \[type\] \[payload\]
189
190- address: IPv6 address of the CoAP server.
191- uri-path: URI path of the resource.
192- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
193- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
194
195```bash
196> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource con payload
197Done
198```
199
200```bash
201> coap put fdde:ad00:beef:0:2780:9423:166c:1aac test-resource block-1024 10
202Done
203```
204
205### resource \[uri-path\]
206
207Sets the URI path for the test resource.
208
209```bash
210> coap resource test-resource
211Done
212> coap resource
213test-resource
214Done
215```
216
217### set \[new-content\]
218
219Sets the content sent by the test resource. If a CoAP client is observing the resource, a notification is sent to that client.
220
221```bash
222> coap set Testing123
223Done
224```
225
226### start
227
228Starts the application coap service.
229
230```bash
231> coap start
232Done
233```
234
235### stop
236
237Stops the application coap service.
238
239```bash
240> coap stop
241Done
242```
243

README_COAPS.md

1# OpenThread CLI - CoAPS Example
2
3The OpenThread CoAPS APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Configure DTLS ciphersuite.
12
13CoAPS uses DTLS to establish a secure, end-to-end connection.
14
15This example supports two ciphersuites:
16
17- TLS_PSK_WITH_AES_128_CCM_8
18
19  ```bash
20  > coaps psk <your-psk> <your-psk-id>
21  Done
22  ```
23
24- TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8
25  ```bash
26  > coaps x509
27  Done
28  ```
29  The X.509 certificate stored in `core/cli/x509_cert_key.hpp`.
30
31### Node 1
32
33On node 1, setup CoAPS server with resource `test-resource`.
34
35```bash
36> coaps start
37Done
38> coaps resource test-resource
39Done
40```
41
42### Node 2
43
44```bash
45> coaps start
46Done
47> coaps connect <peer-ip6-address>
48Done
49coaps connected
50> coaps get test-resource
51Done
52coaps response from fdde:ad00:beef:0:9903:14b:27e0:5744 with payload: 68656c6c6f576f726c6400
53> coaps put test-resource con payload
54Done
55coaps response from fdde:ad00:beef:0:9903:14b:27e0:5744
56```
57
58### Result
59
60On node 1, you should see output similar to below:
61
62```bash
63coaps request from fdde:ad00:beef:0:9e68:576f:714c:f395 GET
64coaps response sent
65coaps request from fdde:ad00:beef:0:9e68:576f:714c:f395 PUT with payload: 7061796c6f6164
66coaps response sent
67```
68
69## Generate Elliptic Curve Private Key and X.509 Certificate
70
71### EC Private Key
72
73```bash
74> openssl ecparam -genkey -name prime256v1 -noout -out ec_private.pem
75```
76
77### X.509 Certificate
78
79```bash
80> openssl req -x509 -new -key ec_private.pem -out x509_cert.pem -days 30
81```
82
83## Command List
84
85- [help](#help)
86- [connect](#connect-address)
87- [delete](#delete-uri-path-type-payload)
88- [disconnect](#disconnect)
89- [get](#get-uri-path-type)
90- [post](#post-uri-path-type-payload)
91- [psk](#psk-psk-pskid)
92- [put](#put-uri-path-type-payload)
93- [resource](#resource-uri-path)
94- [set](#set-new-content)
95- [start](#start)
96- [stop](#stop)
97- [x509](#x509)
98
99## Command Details
100
101### help
102
103```bash
104> coaps help
105help
106connect
107delete
108disconnect
109get
110post
111psk
112put
113resource
114set
115start
116stop
117x509
118Done
119```
120
121List the CoAPS CLI commands.
122
123### connect \<address\>
124
125Establish DTLS session.
126
127- address: IPv6 address of the peer.
128
129```bash
130> coaps connect fdde:ad00:beef:0:9903:14b:27e0:5744
131Done
132coaps connected
133```
134
135### delete \<uri-path\> \[type\] \[payload\]
136
137- uri-path: URI path of the resource.
138- type: "con" for Confirmable or "non-con" for Non-confirmable (default).
139- payload: CoAPS request payload.
140
141```bash
142> coaps delete test-resource con payload
143Done
144```
145
146### disconnect
147
148```bash
149> coaps disconnect
150coaps disconnected
151Done
152```
153
154### get \<uri-path\> \[type\]
155
156- uri-path: URI path of the resource.
157- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" if the response should be transferred block-wise. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
158
159```bash
160> coaps get test-resource
161Done
162```
163
164```bash
165> coaps get test-resource block-1024
166Done
167```
168
169### post \<uri-path\> \[type\] \[payload\]
170
171- uri-path: URI path of the resource.
172- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
173- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
174
175```bash
176> coaps post test-resource con payload
177Done
178```
179
180```bash
181> coaps post test-resource block-1024 10
182Done
183```
184
185### psk \<psk\> \<pskid\>
186
187Set DTLS ciphersuite to `TLS_PSK_WITH_AES_128_CCM_8`.
188
189- psk: pre-shared key
190- pskid: pre-shared key identifier
191
192```bash
193> coaps psk 123 pskid
194Done
195```
196
197### put \<uri-path\> \[type\] \[payload\]
198
199- uri-path: URI path of the resource.
200- type: "con" for Confirmable or "non-con" for Non-confirmable (default). Use "block-<block-size>" to send blocks with random payload. ("block-16","block-32","block-64","block-128","block-256","block-512","block-1024")
201- payload: CoAP request payload. If \[type\] is "block-<block-size>", the amount of blocks to be sent can be set here.
202
203```bash
204> coaps put test-resource con payload
205Done
206```
207
208```bash
209> coaps put test-resource block-1024 10
210Done
211```
212
213### resource \[uri-path\]
214
215Sets the URI path for the test resource.
216
217```bash
218> coaps resource test-resource
219Done
220> coaps resource
221test-resource
222Done
223```
224
225### set \[new-content\]
226
227Sets the content sent by the test resource.
228
229```bash
230> coaps set Testing123
231Done
232```
233
234### start
235
236Starts the application coaps service.
237
238- checkPeerCert: Peer Certificate Check can be disabled by typing false.
239
240```bash
241> coaps start
242Done
243```
244
245### stop
246
247Stops the application coaps service.
248
249```bash
250> coaps stop
251Done
252```
253
254### x509
255
256Set DTLS ciphersuite to `TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8`.
257
258The X.509 certificate stored in [`src/cli/x509_cert_key.hpp`](x509_cert_key.hpp).
259
260```bash
261> coaps x509
262Done
263```
264

README_COMMISSIONER.md

1# OpenThread CLI - Commissioner
2
3## Quick Start
4
5See [README_COMMISSIONING.md](README_COMMISSIONING.md).
6
7## Command List
8
9- [help](#help)
10- [announce](#announce)
11- [energy](#energy)
12- [joiner add](#joiner-add)
13- [joiner remove](#joiner-remove)
14- [joiner table](#joiner-table)
15- [mgmtget](#mgmtget)
16- [mgmtset](#mgmtset)
17- [panid](#panid)
18- [provisioningurl](#provisioningurl)
19- [sessionid](#sessionid)
20- [start](#start)
21- [state](#state)
22- [stop](#stop)
23
24## Command Details
25
26### help
27
28Usage: `commissioner help`
29
30Print commissioner help menu.
31
32```bash
33> commissioner help
34help
35announce
36energy
37joiner
38mgmtget
39mgmtset
40panid
41provisioningurl
42sessionid
43start
44stop
45Done
46```
47
48### announce
49
50Usage: `commissioner announce <mask> <count> <period> <destination>`
51
52Send a `MGMT_ANNOUNCE_BEGIN` message.
53
54- mask: Bitmask identifying channels to send MLE Announce messages.
55- count: Number of MLE Announce transmissions per channel.
56- period: Period between successive MLE Announce transmissions (milliseconds).
57- destination: IPv6 destination for the message (may be multicast).
58
59```bash
60> commissioner announce 0x00050000 2 32 fdde:ad00:beef:0:0:ff:fe00:c00
61Done
62```
63
64### energy
65
66Usage: `commissioner energy <mask> <count> <period> <scanDuration> <destination>`
67
68Send a `MGMT_ED_SCAN` message.
69
70- mask: Bitmask identifying channels to perform IEEE 802.15.4 ED Scans.
71- count: Number of IEEE 802.15.4 ED Scans per channel.
72- period: Period between successive IEEE 802.15.4 ED Scans (milliseconds).
73- scanDuration: IEEE 802.15.4 ScanDuration to use when performing an IEEE 802.15.4 ED Scan (milliseconds).
74- destination: IPv6 destination for the message (may be multicast).
75
76The contents of `MGMT_ED_REPORT` messages (i.e. Channel Mask and Energy List) are printed as they are received.
77
78```bash
79> commissioner energy 0x00050000 2 32 1000 fdde:ad00:beef:0:0:ff:fe00:c00
80Done
81Energy: 00050000 0 0 0 0
82```
83
84### joiner add
85
86Usage: `commissioner joiner add <eui64>|<discerner> <pskd> [timeout]`
87
88Add a Joiner entry.
89
90- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
91- discerner: The Joiner discerner in format `number/length`.
92- pskd: Pre-Shared Key for the Joiner.
93- timeout: joiner timeout in seconds.
94
95```bash
96> commissioner joiner add d45e64fa83f81cf7 J01NME
97Done
98```
99
100```bash
101> commissioner joiner add 0xabc/12 J01NME
102Done
103```
104
105### joiner remove
106
107Usage: `commissioner joiner remove <eui64>|<discerner>`
108
109Remove a Joiner entry.
110
111- eui64: The IEEE EUI-64 of the Joiner or '\*' to match any Joiner.
112- discerner: The Joiner discerner in format `number/length`.
113
114```bash
115> commissioner joiner remove d45e64fa83f81cf7
116Done
117```
118
119```bash
120> commissioner joiner remove 0xabc/12
121Done
122```
123
124### joiner table
125
126Usage: `commissioner joiner table`
127
128List all Joiner entries.
129
130```bash
131> commissioner joiner table
132| ID                    | PSKd                             | Expiration |
133+-----------------------+----------------------------------+------------+
134|                     * |                           J01NME |      81015 |
135|      d45e64fa83f81cf7 |                           J01NME |     101204 |
136| 0x0000000000000abc/12 |                           J01NME |     114360 |
137Done
138```
139
140### mgmtget
141
142Usage: `commissioner mgmtget [locator] [sessionid] [steeringdata] [joinerudpport] [-x <TLV Types>]`
143
144Send a `MGMT_GET` message to the Leader.
145
146```bash
147> commissioner mgmtget locator sessionid
148Done
149```
150
151### mgmtset
152
153Usage: `commissioner mgmtset [locator <locator>] [sessionid <sessionid>] [steeringdata <steeringdata>] [joinerudpport <joinerudpport>] [-x <TLVs>]`
154
155Send a `MGMT_SET` message to the Leader.
156
157```bash
158> commissioner mgmtset joinerudpport 9988
159Done
160```
161
162### panid
163
164Usage: `commissioner panid <panid> <mask> <destination>`
165
166Send a `MGMT_PANID_QUERY` message.
167
168- panid: PAN ID to check for conflicts.
169- mask: Bitmask identifying channels to perform IEEE 802.15.4 Active Scans.
170- destination: IPv6 destination for the message (may be multicast).
171
172The contents of `MGMT_PANID_CONFLICT` messages (i.e. PAN ID and Channel Mask) are printed as they are received.
173
174```bash
175> commissioner panid 0xdead 0x7fff800 fdde:ad00:beef:0:0:ff:fe00:c00
176Done
177Conflict: dead, 00000800
178```
179
180### provisioningurl
181
182Usage: `commissioner provisioningurl <provisioningurl>`
183
184Set the Provisioning URL.
185
186```bash
187> commissioner provisioningurl http://github.com/openthread/openthread
188Done
189```
190
191### sessionid
192
193Usage: `commissioner sessionid`
194
195Get current commissioner session id.
196
197```bash
198> commissioner sessionid
1990
200Done
201```
202
203### id
204
205Usage: `commissioner id`
206
207Get the commissioner id.
208
209```bash
210> commissioner id
211OpenThread Commissioner
212Done
213```
214
215### id \<name\>
216
217Set the commissioner id.
218
219```bash
220> commissioner id "Custom Commissioner Id"
221Done
222```
223
224### start
225
226Usage: `commissioner start`
227
228Start the Commissioner role.
229
230This command will cause the device to send `LEAD_PET` and `LEAD_KA` messages.
231
232```bash
233> commissioner start
234Commissioner: petitioning
235Done
236Commissioner: active
237```
238
239### state
240
241Usage: `commissioner state`
242
243Get Commissioner state.
244
245This command will return the current Commissioner state.
246
247```bash
248> commissioner state
249active
250Done
251```
252
253### stop
254
255Usage: `commissioner stop`
256
257Stop the Commissioner role.
258
259This command will cause the device to send `LEAD_KA[Reject]` messages.
260
261```bash
262> commissioner stop
263Done
264```
265

README_COMMISSIONING.md

1# OpenThread CLI - Commissioning
2
3## Quick Start
4
5### Form Network
6
7Form a network with the device that has Commissioner support.
8
91. Generate and view new network configuration.
10
11   ```bash
12   > dataset init new
13   Done
14   > dataset
15   Active Timestamp: 1
16   Channel: 13
17   Channel Mask: 0x07fff800
18   Ext PAN ID: d63e8e3e495ebbc3
19   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
20   Network Key: dfd34f0f05cad978ec4e32b0413038ff
21   Network Name: OpenThread-8f28
22   PAN ID: 0x8f28
23   PSKc: c23a76e98f1a6483639b1ac1271e2e27
24   Security Policy: 0, onrc
25   Done
26   ```
27
282. Commit new dataset to the Active Operational Dataset in non-volatile storage.
29
30   ```bash
31   dataset commit active
32   Done
33   ```
34
353. Enable Thread interface
36
37   ```bash
38   > ifconfig up
39   Done
40   > thread start
41   Done
42   ```
43
44### Obtain Joiner IEEE EUI-64
45
461. Start the Joiner node and obtain the Joiner's IEEE EUI-64.
47
48   ```bash
49   > eui64
50   18b4300000000002
51   Done
52   ```
53
54### Start Commissioner
55
561. Start the Commissioner Role
57
58   ```bash
59   > commissioner start
60   Commissioner: petitioning
61   Done
62   Commissioner: active
63   ```
64
652. Add the Joiner with the device-specific pre-shared key (PSKd)
66
67   ```bash
68   > commissioner joiner add 18b4300000000002 J01NME
69   Done
70   ```
71
72### Start Joiner
73
741. Factory reset the device.
75
76   ```bash
77   > factoryreset
78   ```
79
802. Start the Joiner process.
81
82   ```bash
83   > ifconfig up
84   Done
85   > joiner start J01NME
86   Done
87   Join success
88   ```
89
903. Attach to Thread network
91
92   ```bash
93   > thread start
94   Done
95   ```
96
974. After successful attach, validate the device has the same Active Operational Dataset as above.
98
99   ```bash
100   > dataset active
101   Active Timestamp: 1
102   Channel: 13
103   Channel Mask: 0x07fff800
104   Ext PAN ID: d63e8e3e495ebbc3
105   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
106   Network Key: dfd34f0f05cad978ec4e32b0413038ff
107   Network Name: OpenThread-8f28
108   PAN ID: 0x8f28
109   PSKc: c23a76e98f1a6483639b1ac1271e2e27
110   Security Policy: 0, onrc
111   Done
112   ```
113
114## CLI Reference
115
116- [Commissioner CLI Reference](README_COMMISSIONER.md)
117- [Joiner CLI Reference](README_JOINER.md)
118

README_DATASET.md

1# OpenThread CLI - Operational Datasets
2
3## Overview
4
5Thread network configuration parameters are managed using Active and Pending Operational Dataset objects.
6
7### Active Operational Dataset
8
9The Active Operational Dataset includes parameters that are currently in use across an entire Thread network. The Active Operational Dataset contains:
10
11- Active Timestamp
12- Channel
13- Channel Mask
14- Extended PAN ID
15- Mesh-Local Prefix
16- Network Name
17- PAN ID
18- PSKc
19- Security Policy
20
21### Pending Operational Dataset
22
23The Pending Operational Dataset is used to communicate changes to the Active Operational Dataset before they take effect. The Pending Operational Dataset contains all the parameters from the Active Operational Dataset, with the addition of:
24
25- Delay Timer
26- Pending Timestamp
27
28## Quick Start
29
30### Form Network
31
321. Generate and view new network configuration.
33
34   ```bash
35   > dataset init new
36   Done
37   > dataset
38   Active Timestamp: 1
39   Channel: 15
40   Channel Mask: 0x07fff800
41   Ext PAN ID: 39758ec8144b07fb
42   Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
43   Network Key: f366cec7a446bab978d90d27abe38f23
44   Network Name: OpenThread-5938
45   PAN ID: 0x5938
46   PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
47   Security Policy: 672 onrc
48   Done
49   ```
50
512. Commit new dataset to the Active Operational Dataset in non-volatile storage.
52
53   ```bash
54   dataset commit active
55   Done
56   ```
57
583. Enable Thread interface
59
60   ```bash
61   > ifconfig up
62   Done
63   > thread start
64   Done
65   ```
66
67### Attach to Existing Network
68
69Only the Network Key is required for a device to attach to a Thread network.
70
71While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
72
73After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
74
751. Create a partial Active Operational Dataset.
76
77   ```bash
78   > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
79   Done
80   > dataset commit active
81   Done
82   ```
83
842. Enable Thread interface.
85
86   ```bash
87   > ifconfig up
88   Done
89   > thread start
90   Done
91   ```
92
933. After attaching, validate that the device received the complete Active Operational Dataset.
94
95   ```bash
96   > dataset active
97   Active Timestamp: 1
98   Channel: 15
99   Channel Mask: 0x07fff800
100   Ext PAN ID: 39758ec8144b07fb
101   Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
102   Network Key: f366cec7a446bab978d90d27abe38f23
103   Network Name: OpenThread-5938
104   PAN ID: 0x5938
105   PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
106   Security Policy: 672 onrc
107   Done
108   ```
109
110## Command List
111
112- [help](#help)
113- [active](#active)
114- [activetimestamp](#activetimestamp)
115- [channel](#channel)
116- [channelmask](#channelmask)
117- [clear](#clear)
118- [commit](#commit)
119- [delay](#delay)
120- [extpanid](#extpanid)
121- [init](#init)
122- [meshlocalprefix](#meshlocalprefix)
123- [mgmtgetcommand](#mgmtgetcommand)
124- [mgmtsetcommand](#mgmtsetcommand)
125- [networkkey](#networkkey)
126- [networkname](#networkname)
127- [panid](#panid)
128- [pending](#pending)
129- [pendingtimestamp](#pendingtimestamp)
130- [pskc](#pskc)
131- [securitypolicy](#securitypolicy)
132- [tlvs](#tlvs)
133
134## Command Details
135
136### help
137
138Usage: `dataset help`
139
140Print dataset help menu.
141
142```bash
143> dataset help
144help
145active
146activetimestamp
147channel
148channelmask
149clear
150commit
151delay
152extpanid
153init
154meshlocalprefix
155mgmtgetcommand
156mgmtsetcommand
157networkkey
158networkname
159panid
160pending
161pendingtimestamp
162pskc
163securitypolicy
164set
165tlvs
166Done
167```
168
169### active
170
171Usage: `dataset active [-x]`
172
173Print Active Operational Dataset in human-readable form.
174
175```bash
176> dataset active
177Active Timestamp: 1
178Channel: 15
179Channel Mask: 0x07fff800
180Ext PAN ID: 39758ec8144b07fb
181Mesh Local Prefix: fdf1:f1ad:d079:7dc0::/64
182Network Key: f366cec7a446bab978d90d27abe38f23
183Network Name: OpenThread-5938
184PAN ID: 0x5938
185PSKc: 3ca67c969efb0d0c74a4d8ee923b576c
186Security Policy: 672 onrc
187Done
188```
189
190Print Active Operational Dataset as hex-encoded TLVs.
191
192```bash
193> dataset active -x
1940e080000000000010000000300000f35060004001fffe0020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8
195Done
196```
197
198### activetimestamp
199
200Usage: `dataset activetimestamp [timestamp]`
201
202Get active timestamp seconds.
203
204```bash
205> dataset activetimestamp
206123456789
207Done
208```
209
210Set active timestamp seconds.
211
212```bash
213> dataset activetimestamp 123456789
214Done
215```
216
217### channel
218
219Usage: `channel [channel]`
220
221Get channel.
222
223```bash
224> dataset channel
22512
226Done
227```
228
229Set channel.
230
231```bash
232> dataset channel 12
233Done
234```
235
236### channelmask
237
238Usage: `dataset channelmask [channelmask]`
239
240Get channel mask.
241
242```bash
243> dataset channelmask
2440x07fff800
245Done
246```
247
248Set channel mask.
249
250```bash
251> dataset channelmask 0x07fff800
252Done
253```
254
255### clear
256
257Usage: `dataset clear`
258
259Reset operational dataset buffer.
260
261```bash
262> dataset clear
263Done
264```
265
266### commit
267
268Usage: `dataset commit <active|pending>`
269
270Commit operational dataset buffer to active/pending operational dataset.
271
272```bash
273> dataset commit active
274Done
275```
276
277### delay
278
279Usage: `dataset delay [delay]`
280
281Get delay timer value.
282
283```bash
284> dataset delay
2851000
286Done
287```
288
289Set delay timer value.
290
291```bash
292> dataset delay 1000
293Done
294```
295
296### extpanid
297
298Usage: `dataset extpanid [extpanid]`
299
300Get extended panid.
301
302```bash
303> dataset extpanid
304000db80123456789
305Done
306```
307
308Set extended panid.
309
310**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
311
312```bash
313> dataset extpanid 000db80123456789
314Done
315```
316
317### init
318
319Usage: `dataset init <active|new|pending|tlvs <hex-encoded TLVs>>`
320
321Initialize operational dataset buffer.
322
323```bash
324> dataset init new
325Done
326```
327
328### meshlocalprefix
329
330Usage: `dataset meshlocalprefix [prefix]`
331
332Get mesh local prefix.
333
334```bash
335> dataset meshlocalprefix
336fd00:db8:0:0::/64
337Done
338```
339
340Set mesh local prefix.
341
342```bash
343> dataset meshlocalprefix fd00:db8::
344Done
345```
346
347### mgmtgetcommand
348
349Usage: `dataset mgmtgetcommand <active|pending> [address <destination>] [TLV list] [-x]`
350
351Send MGMT_ACTIVE_GET or MGMT_PENDING_GET.
352
353```bash
354> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
355Done
356```
357
358### mgmtsetcommand
359
360Usage: `dataset mgmtsetcommand <active|pending> [TLV Type list] [-x]`
361
362Send MGMT_ACTIVE_SET or MGMT_PENDING_SET.
363
364```bash
365> dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrc
366Done
367```
368
369### networkkey
370
371Usage: `dataset networkkey [key]`
372
373Get network key
374
375```bash
376> dataset networkkey
37700112233445566778899aabbccddeeff
378Done
379```
380
381Set network key.
382
383```bash
384> dataset networkkey 00112233445566778899aabbccddeeff
385Done
386```
387
388### networkname
389
390Usage: `dataset networkname [name]`
391
392Get network name.
393
394```bash
395> datset networkname
396OpenThread
397Done
398```
399
400Set network name.
401
402**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
403
404```bash
405> dataset networkname OpenThread
406Done
407```
408
409### panid
410
411Usage: `dataset panid [panid]`
412
413Get panid.
414
415```bash
416> dataset panid
4170x1234
418Done
419```
420
421Set panid.
422
423```bash
424> dataset panid 0x1234
425Done
426```
427
428### pending
429
430Usage: `dataset pending [-x]`
431
432Print Pending Operational Dataset in human-readable form.
433
434```bash
435> dataset pending
436Pending Timestamp: 2
437Active Timestamp: 1
438Channel: 26
439Channel Mask: 0x07fff800
440Delay: 58706
441Ext PAN ID: a74182f4d3f4de41
442Mesh Local Prefix: fd46:c1b9:e159:5574::/64
443Network Key: ed916e454d96fd00184f10a6f5c9e1d3
444Network Name: OpenThread-bff8
445PAN ID: 0xbff8
446PSKc: 264f78414adc683191863d968f72d1b7
447Security Policy: 672 onrc
448Done
449```
450
451Print Pending Operational Dataset as hex-encoded TLVs.
452
453```bash
454> dataset pending -x
4550e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
456Done
457```
458
459### pendingtimestamp
460
461Usage: `dataset pendingtimestamp [timestamp]`
462
463Get pending timestamp seconds.
464
465```bash
466> dataset pendingtimestamp
467123456789
468Done
469```
470
471Set pending timestamp seconds.
472
473```bash
474> dataset pendingtimestamp 123456789
475Done
476```
477
478### pskc
479
480Usage: `pskc [-p] [<key>|<passphrase>]`
481
482Get pskc.
483
484```bash
485> dataset pskc
48667c0c203aa0b042bfb5381c47aef4d9e
487Done
488```
489
490Set pskc.
491
492With `-p`(**only for FTD**) generate pskc from \<passphrase\> (UTF-8 encoded) together with network name and extended PAN ID in the dataset buffer if set or values in the current stack if not, otherwise set pskc as \<key\> (hex format).
493
494```bash
495> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e
496Done
497> dataset pskc -p 123456
498Done
499```
500
501### securitypolicy
502
503Usage: `dataset securitypolicy [<rotationtime> [onrcCepR]]`
504
505Get security policy.
506
507```bash
508> dataset securitypolicy
509672 onrc
510Done
511```
512
513Set security policy.
514
515- o: Obtaining the Network Key for out-of-band commissioning is enabled.
516- n: Native Commissioning using PSKc is allowed.
517- r: Thread 1.x Routers are enabled.
518- c: External Commissioner authentication is allowed using PSKc.
519- C: Thread 1.2 Commercial Commissioning is enabled.
520- e: Thread 1.2 Autonomous Enrollment is enabled.
521- p: Thread 1.2 Network Key Provisioning is enabled.
522- R: Non-CCM routers are allowed in Thread 1.2 CCM networks.
523
524```bash
525> dataset securitypolicy 672 onrc
526Done
527```
528
529### set
530
531Usage: `dataset set <active|pending> <dataset>`
532
533Set the Active Operational Dataset using hex-encoded TLVs.
534
535```bash
536> dataset set active 0e080000000000010000000300000f35060004001fffe0020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8
537Done
538```
539
540Set the Pending Operational Dataset using hex-encoded TLVs.
541
542```bash
543> dataset set pending 0e0800000000000100003308000000000002000034040000b512000300001a35060004001fffe00208a74182f4d3f4de410708fd46c1b9e15955740510ed916e454d96fd00184f10a6f5c9e1d3030f4f70656e5468726561642d626666380102bff80410264f78414adc683191863d968f72d1b70c0402a0f7f8
544Done
545```
546
547### tlvs
548
549Usage: `dataset tlvs`
550
551Convert the Operational Dataset to hex-encoded TLVs.
552
553```bash
554> dataset
555Active Timestamp: 1
556Channel: 22
557Channel Mask: 0x07fff800
558Ext PAN ID: d196fa2040e973b6
559Mesh Local Prefix: fdbb:c310:c48f:3a39::/64
560Network Key: 9929154dbc363218bcd22f907caf5c15
561Network Name: OpenThread-de2b
562PAN ID: 0xde2b
563PSKc: 15b2c16f7ba92ed4bc7b1ee054f1553f
564Security Policy: 672 onrc
565Done
566
567> dataset tlvs
5680e080000000000010000000300001635060004001fffe00208d196fa2040e973b60708fdbbc310c48f3a3905109929154dbc363218bcd22f907caf5c15030f4f70656e5468726561642d646532620102de2b041015b2c16f7ba92ed4bc7b1ee054f1553f0c0402a0f7f8
569Done
570```
571

README_HISTORY.md

1# OpenThread CLI - History Tracker
2
3History Tracker module records history of different events (e.g., RX and TX IPv6 messages or network info changes, etc.) as the Thread network operates. All tracked entries are timestamped.
4
5All commands under `history` require `OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE` feature to be enabled.
6
7The number of entries recorded for each history list is configurable through a set of OpenThread config options, e.g. `OPENTHREAD_CONFIG_HISTORY_TRACKER_NET_INFO_LIST_SIZE` specifies the number of entries in Network Info history list. The History Tracker will keep the most recent entries overwriting oldest one when the list gets full.
8
9## Command List
10
11Usage : `history [command] ...`
12
13- [help](#help)
14- [ipaddr](#ipaddr)
15- [ipmaddr](#ipmaddr)
16- [neighbor](#neighbor)
17- [netinfo](#netinfo)
18- [prefix](#prefix)
19- [route](#route)
20- [router](#router)
21- [rx](#rx)
22- [rxtx](#rxtx)
23- [tx](#tx)
24
25## Timestamp Format
26
27Recorded entries are timestamped. When the history list is printed, the timestamps are shown relative the time the command was issues (i.e., when the list was printed) indicating how long ago the entry was recorded.
28
29```bash
30> history netinfo
31| Age                  | Role     | Mode | RLOC16 | Partition ID |
32+----------------------+----------+------+--------+--------------+
33|         02:31:50.628 | leader   | rdn  | 0x2000 |    151029327 |
34|         02:31:53.262 | detached | rdn  | 0xfffe |            0 |
35|         02:31:54.663 | detached | rdn  | 0x2000 |            0 |
36Done
37```
38
39For example `02:31:50.628` indicates the event was recorded "2 hours, 31 minutes, 50 seconds, and 628 milliseconds ago". Number of days is added for events that are older than 24 hours, e.g., `1 day 11:25:31.179`, or `31 days 03:00:23.931`.
40
41Timestamps use millisecond accuracy and are tacked up to 49 days. If the event is older than 49 days, the entry is still tracked in the list but the timestamp is shown as `more than 49 days`.
42
43## Command Details
44
45### help
46
47Usage: `history help`
48
49Print SRP client help menu.
50
51```bash
52> history help
53help
54ipaddr
55ipmaddr
56neighbor
57netinfo
58prefix
59route
60router
61rx
62rxtx
63tx
64Done
65>
66```
67
68### ipaddr
69
70Usage `history ipaddr [list] [<num-entries>]`
71
72Print the unicast IPv6 address history. Each entry provides:
73
74- Event: Added or Removed.
75- Address: Unicast address along with its prefix length (in bits).
76- Origin: thread, slaac, dhcp6, or manual.
77- Address Scope.
78- Flags: Preferred, Valid, and RLOC (whether the address is RLOC).
79
80Print the unicast IPv6 address history as table.
81
82```bash
83> history ipaddr
84| Age                  | Event   | Address / PrefixLength                      | Origin |Scope| P | V | R |
85+----------------------+---------+---------------------------------------------+--------+-----+---+---+---+
86|         00:00:04.991 | Removed | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64  | slaac  |  14 | Y | Y | N |
87|         00:00:44.647 | Added   | 2001:dead:beef:cafe:c4cb:caba:8d55:e30b/64  | slaac  |  14 | Y | Y | N |
88|         00:01:07.199 | Added   | fd00:0:0:0:0:0:0:1/64                       | manual |  14 | Y | Y | N |
89|         00:02:17.885 | Added   | fdde:ad00:beef:0:0:ff:fe00:fc00/64          | thread |   3 | N | Y | N |
90|         00:02:17.885 | Added   | fdde:ad00:beef:0:0:ff:fe00:5400/64          | thread |   3 | N | Y | Y |
91|         00:02:20.107 | Removed | fdde:ad00:beef:0:0:ff:fe00:5400/64          | thread |   3 | N | Y | Y |
92|         00:02:21.575 | Added   | fdde:ad00:beef:0:0:ff:fe00:5400/64          | thread |   3 | N | Y | Y |
93|         00:02:21.575 | Added   | fdde:ad00:beef:0:ecea:c4fc:ad96:4655/64     | thread |   3 | N | Y | N |
94|         00:02:23.904 | Added   | fe80:0:0:0:3c12:a4d2:fbe0:31ad/64           | thread |   2 | Y | Y | N |
95Done
96```
97
98Print the unicast IPv6 address history as a list (the last 5 entries).
99
100```bash
101> history ipaddr list 5
10200:00:20.327 -> event:Removed address:2001:dead:beef:cafe:c4cb:caba:8d55:e30b prefixlen:64 origin:slaac scope:14 preferred:yes valid:yes rloc:no
10300:00:59.983 -> event:Added address:2001:dead:beef:cafe:c4cb:caba:8d55:e30b prefixlen:64 origin:slaac scope:14 preferred:yes valid:yes rloc:no
10400:01:22.535 -> event:Added address:fd00:0:0:0:0:0:0:1 prefixlen:64 origin:manual scope:14 preferred:yes valid:yes rloc:no
10500:02:33.221 -> event:Added address:fdde:ad00:beef:0:0:ff:fe00:fc00 prefixlen:64 origin:thread scope:3 preferred:no valid:yes rloc:no
10600:02:33.221 -> event:Added address:fdde:ad00:beef:0:0:ff:fe00:5400 prefixlen:64 origin:thread scope:3 preferred:no valid:yes rloc:yes
107Done
108```
109
110### ipmaddr
111
112Usage `history ipmaddr [list] [<num-entries>]`
113
114Print the multicast IPv6 address history. Each entry provides:
115
116- Event: Subscribed or Unsubscribed.
117- Address: Multicast address.
118- Origin: Thread, or Manual.
119
120Print the multicast IPv6 address history as table.
121
122```bash
123> history ipmaddr
124| Age                  | Event        | Multicast Address                       | Origin |
125+----------------------+--------------+-----------------------------------------+--------+
126|         00:00:08.592 | Unsubscribed | ff05:0:0:0:0:0:0:1                      | Manual |
127|         00:01:25.353 | Subscribed   | ff05:0:0:0:0:0:0:1                      | Manual |
128|         00:01:54.953 | Subscribed   | ff03:0:0:0:0:0:0:2                      | Thread |
129|         00:01:54.953 | Subscribed   | ff02:0:0:0:0:0:0:2                      | Thread |
130|         00:01:59.329 | Subscribed   | ff33:40:fdde:ad00:beef:0:0:1            | Thread |
131|         00:01:59.329 | Subscribed   | ff32:40:fdde:ad00:beef:0:0:1            | Thread |
132|         00:02:01.129 | Subscribed   | ff03:0:0:0:0:0:0:fc                     | Thread |
133|         00:02:01.129 | Subscribed   | ff03:0:0:0:0:0:0:1                      | Thread |
134|         00:02:01.129 | Subscribed   | ff02:0:0:0:0:0:0:1                      | Thread |
135Done
136```
137
138Print the multicast IPv6 address history as a list.
139
140```bash
141> history ipmaddr list
14200:00:25.447 -> event:Unsubscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14300:01:42.208 -> event:Subscribed address:ff05:0:0:0:0:0:0:1 origin:Manual
14400:02:11.808 -> event:Subscribed address:ff03:0:0:0:0:0:0:2 origin:Thread
14500:02:11.808 -> event:Subscribed address:ff02:0:0:0:0:0:0:2 origin:Thread
14600:02:16.184 -> event:Subscribed address:ff33:40:fdde:ad00:beef:0:0:1 origin:Thread
14700:02:16.184 -> event:Subscribed address:ff32:40:fdde:ad00:beef:0:0:1 origin:Thread
14800:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:fc origin:Thread
14900:02:17.984 -> event:Subscribed address:ff03:0:0:0:0:0:0:1 origin:Thread
15000:02:17.984 -> event:Subscribed address:ff02:0:0:0:0:0:0:1 origin:Thread
151Done
152```
153
154### neighbor
155
156Usage `history neighbor [list] [<num-entries>]`
157
158Print the neighbor table history. Each entry provides:
159
160- Type: Child or Router
161- Event: Added, Removed, Changed (e.g., mode change).
162- Extended Address
163- RLOC16
164- MLE Link Mode
165- Average RSS (in dBm) of received frames from neighbor at the time the entry was recorded
166
167Print the neighbor history as a table.
168
169```bash
170> history neighbor
171| Age                  | Type   | Event     | Extended Address | RLOC16 | Mode | Ave RSS |
172+----------------------+--------+-----------+------------------+--------+------+---------+
173|         00:00:29.233 | Child  | Added     | ae5105292f0b9169 | 0x8404 | -    |     -20 |
174|         00:01:38.368 | Child  | Removed   | ae5105292f0b9169 | 0x8401 | -    |     -20 |
175|         00:04:27.181 | Child  | Changed   | ae5105292f0b9169 | 0x8401 | -    |     -20 |
176|         00:04:51.236 | Router | Added     | 865c7ca38a5fa960 | 0x9400 | rdn  |     -20 |
177|         00:04:51.587 | Child  | Removed   | 865c7ca38a5fa960 | 0x8402 | rdn  |     -20 |
178|         00:05:22.764 | Child  | Changed   | ae5105292f0b9169 | 0x8401 | rn   |     -20 |
179|         00:06:40.764 | Child  | Added     | 4ec99efc874a1841 | 0x8403 | r    |     -20 |
180|         00:06:44.060 | Child  | Added     | 865c7ca38a5fa960 | 0x8402 | rdn  |     -20 |
181|         00:06:49.515 | Child  | Added     | ae5105292f0b9169 | 0x8401 | -    |     -20 |
182Done
183```
184
185Print the neighbor history as a list.
186
187```bash
188
189> history neighbor list
19000:00:34.753 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8404 mode:- rss:-20
19100:01:43.888 -> type:Child event:Removed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19200:04:32.701 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
19300:04:56.756 -> type:Router event:Added extaddr:865c7ca38a5fa960 rloc16:0x9400 mode:rdn rss:-20
19400:04:57.107 -> type:Child event:Removed extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19500:05:28.284 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:rn rss:-20
19600:06:46.284 -> type:Child event:Added extaddr:4ec99efc874a1841 rloc16:0x8403 mode:r rss:-20
19700:06:49.580 -> type:Child event:Added extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
19800:06:55.035 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
199Done
200```
201
202### netinfo
203
204Usage `history netinfo [list] [<num-entries>]`
205
206Print the Network Info history. Each Network Info provides:
207
208- Device Role
209- MLE Link Mode
210- RLOC16
211- Partition ID
212
213Print the Network Info history as a table.
214
215```bash
216> history netinfo
217| Age                  | Role     | Mode | RLOC16 | Partition ID |
218+----------------------+----------+------+--------+--------------+
219|         00:00:10.069 | router   | rdn  | 0x6000 |    151029327 |
220|         00:02:09.337 | child    | rdn  | 0x2001 |    151029327 |
221|         00:02:09.338 | child    | rdn  | 0x2001 |    151029327 |
222|         00:07:40.806 | child    | -    | 0x2001 |    151029327 |
223|         00:07:42.297 | detached | -    | 0x6000 |            0 |
224|         00:07:42.968 | disabled | -    | 0x6000 |            0 |
225Done
226```
227
228Print the Network Info history as a list.
229
230```bash
231> history netinfo list
23200:00:59.467 -> role:router mode:rdn rloc16:0x6000 partition-id:151029327
23300:02:58.735 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23400:02:58.736 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
23500:08:30.204 -> role:child mode:- rloc16:0x2001 partition-id:151029327
23600:08:31.695 -> role:detached mode:- rloc16:0x6000 partition-id:0
23700:08:32.366 -> role:disabled mode:- rloc16:0x6000 partition-id:0
238Done
239```
240
241Print only the latest 2 entries.
242
243```bash
244> history netinfo 2
245| Age                  | Role     | Mode | RLOC16 | Partition ID |
246+----------------------+----------+------+--------+--------------+
247|         00:02:05.451 | router   | rdn  | 0x6000 |    151029327 |
248|         00:04:04.719 | child    | rdn  | 0x2001 |    151029327 |
249Done
250```
251
252### prefix
253
254Usage `history prefix [list] [<num-entries>]`
255
256Print the Network Data on mesh prefix history. Each item provides:
257
258- Event (`Added` or `Removed`)
259- Prefix
260- Flags
261- Preference (`high`, `med`, `low`)
262- RLOC16
263
264The flags are as follows:
265
266- `p`: Preferred flag
267- `a`: Stateless IPv6 Address Autoconfiguration flag
268- `d`: DHCPv6 IPv6 Address Configuration flag
269- `c`: DHCPv6 Other Configuration flag
270- `r`: Default Route flag
271- `o`: On Mesh flag
272- `s`: Stable flag
273- `n`: Nd Dns flag
274- `D`: Domain Prefix flag
275
276Print the history as a table.
277
278```bash
279> history prefix
280| Age                  | Event   | Prefix                                      | Flags     | Pref | RLOC16 |
281+----------------------+---------+---------------------------------------------+-----------+------+--------+
282|         00:00:10.663 | Added   | fd00:1111:2222:3333::/64                    | paro      | med  | 0x5400 |
283|         00:01:02.054 | Removed | fd00:dead:beef:1::/64                       | paros     | high | 0x5400 |
284|         00:01:21.136 | Added   | fd00:abba:cddd:0::/64                       | paos      | med  | 0x5400 |
285|         00:01:45.144 | Added   | fd00:dead:beef:1::/64                       | paros     | high | 0x3c00 |
286|         00:01:50.944 | Added   | fd00:dead:beef:1::/64                       | paros     | high | 0x5400 |
287|         00:01:59.887 | Added   | fd00:dead:beef:1::/64                       | paros     | med  | 0x8800 |
288Done
289```
290
291Print the history as a list.
292
293```bash
294> history prefix list
29500:04:12.487 -> event:Added prefix:fd00:1111:2222:3333::/64 flags:paro pref:med rloc16:0x5400
29600:05:03.878 -> event:Removed prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
29700:05:22.960 -> event:Added prefix:fd00:abba:cddd:0::/64 flags:paos pref:med rloc16:0x5400
29800:05:46.968 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x3c00
29900:05:52.768 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:high rloc16:0x5400
30000:06:01.711 -> event:Added prefix:fd00:dead:beef:1::/64 flags:paros pref:med rloc16:0x8800
301```
302
303### route
304
305Usage `history route [list] [<num-entries>]`
306
307Print the Network Data external route history. Each item provides:
308
309- Event (`Added` or `Removed`)
310- Route
311- Flags
312- Preference (`high`, `med`, `low`)
313- RLOC16
314
315The flags are as follows:
316
317- `s`: Stable flag
318- `n`: NAT64 flag
319
320Print the history as a table.
321
322```bash
323history route
324| Age                  | Event   | Route                                       | Flags     | Pref | RLOC16 |
325+----------------------+---------+---------------------------------------------+-----------+------+--------+
326|         00:00:05.456 | Removed | fd00:1111:0::/48                            | s         | med  | 0x3c00 |
327|         00:00:29.310 | Added   | fd00:1111:0::/48                            | s         | med  | 0x3c00 |
328|         00:00:42.822 | Added   | fd00:1111:0::/48                            | s         | med  | 0x5400 |
329|         00:01:27.688 | Added   | fd00:aaaa:bbbb:cccc::/64                    | s         | med  | 0x8800 |
330Done
331```
332
333Print the history as a list (last two entries).
334
335```bash
336> history route list 2
33700:00:48.704 -> event:Removed route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
33800:01:12.558 -> event:Added route:fd00:1111:0::/48 flags:s pref:med rloc16:0x3c00
339Done
340```
341
342### router
343
344Usage `history router [list] [<num-entries>]`
345
346Print the route table history. Each item provides:
347
348- Event (`Added`, `Removed`, `NextHopChnaged`, `CostChanged`)
349- Router ID and RLOC16 of router
350- Next Hop (Router ID and RLOC16) - `none` if no next hop.
351- Path cost (old `->` new) - `inf` to indicate infinite path cost.
352
353Print the history as a table.
354
355```bash
356> history router
357| Age                  | Event          | ID (RLOC16) | Next Hop    | Path Cost  |
358+----------------------+----------------+-------------+-------------+------------+
359|         00:00:05.258 | NextHopChanged |  7 (0x1c00) | 34 (0x8800) | inf ->   3 |
360|         00:00:08.604 | NextHopChanged | 34 (0x8800) | 34 (0x8800) | inf ->   2 |
361|         00:00:08.604 | Added          |  7 (0x1c00) |        none | inf -> inf |
362|         00:00:11.931 | Added          | 34 (0x8800) |        none | inf -> inf |
363|         00:00:14.948 | Removed        | 59 (0xec00) |        none | inf -> inf |
364|         00:00:14.948 | Removed        | 54 (0xd800) |        none | inf -> inf |
365|         00:00:14.948 | Removed        | 34 (0x8800) |        none | inf -> inf |
366|         00:00:14.948 | Removed        |  7 (0x1c00) |        none | inf -> inf |
367|         00:00:54.795 | NextHopChanged | 59 (0xec00) | 34 (0x8800) |   1 ->   5 |
368|         00:02:33.735 | NextHopChanged | 54 (0xd800) |        none |  15 -> inf |
369|         00:03:10.915 | CostChanged    | 54 (0xd800) | 34 (0x8800) |  13 ->  15 |
370|         00:03:45.716 | NextHopChanged | 54 (0xd800) | 34 (0x8800) |  15 ->  13 |
371|         00:03:46.188 | CostChanged    | 54 (0xd800) | 59 (0xec00) |  13 ->  15 |
372|         00:04:19.124 | CostChanged    | 54 (0xd800) | 59 (0xec00) |  11 ->  13 |
373|         00:04:52.008 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   9 ->  11 |
374|         00:05:23.176 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   7 ->   9 |
375|         00:05:51.081 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   5 ->   7 |
376|         00:06:48.721 | CostChanged    | 54 (0xd800) | 59 (0xec00) |   3 ->   5 |
377|         00:07:13.792 | NextHopChanged | 54 (0xd800) | 59 (0xec00) |   1 ->   3 |
378|         00:09:28.681 | NextHopChanged |  7 (0x1c00) | 34 (0x8800) | inf ->   3 |
379|         00:09:31.882 | Added          |  7 (0x1c00) |        none | inf -> inf |
380|         00:09:51.240 | NextHopChanged | 54 (0xd800) | 54 (0xd800) | inf ->   1 |
381|         00:09:54.204 | Added          | 54 (0xd800) |        none | inf -> inf |
382|         00:10:20.645 | NextHopChanged | 34 (0x8800) | 34 (0x8800) | inf ->   2 |
383|         00:10:24.242 | NextHopChanged | 59 (0xec00) | 59 (0xec00) | inf ->   1 |
384|         00:10:24.242 | Added          | 34 (0x8800) |        none | inf -> inf |
385|         00:10:41.900 | NextHopChanged | 59 (0xec00) |        none |   1 -> inf |
386|         00:10:42.480 | Added          |  3 (0x0c00) |  3 (0x0c00) | inf -> inf |
387|         00:10:43.614 | Added          | 59 (0xec00) | 59 (0xec00) | inf ->   1 |
388Done
389```
390
391Print the history as a list (last 20 entries).
392
393```bash
394> history router list 20
39500:00:06.959 -> event:NextHopChanged router:7(0x1c00) nexthop:34(0x8800) old-cost:inf new-cost:3
39600:00:10.305 -> event:NextHopChanged router:34(0x8800) nexthop:34(0x8800) old-cost:inf new-cost:2
39700:00:10.305 -> event:Added router:7(0x1c00) nexthop:none old-cost:inf new-cost:inf
39800:00:13.632 -> event:Added router:34(0x8800) nexthop:none old-cost:inf new-cost:inf
39900:00:16.649 -> event:Removed router:59(0xec00) nexthop:none old-cost:inf new-cost:inf
40000:00:16.649 -> event:Removed router:54(0xd800) nexthop:none old-cost:inf new-cost:inf
40100:00:16.649 -> event:Removed router:34(0x8800) nexthop:none old-cost:inf new-cost:inf
40200:00:16.649 -> event:Removed router:7(0x1c00) nexthop:none old-cost:inf new-cost:inf
40300:00:56.496 -> event:NextHopChanged router:59(0xec00) nexthop:34(0x8800) old-cost:1 new-cost:5
40400:02:35.436 -> event:NextHopChanged router:54(0xd800) nexthop:none old-cost:15 new-cost:inf
40500:03:12.616 -> event:CostChanged router:54(0xd800) nexthop:34(0x8800) old-cost:13 new-cost:15
40600:03:47.417 -> event:NextHopChanged router:54(0xd800) nexthop:34(0x8800) old-cost:15 new-cost:13
40700:03:47.889 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:13 new-cost:15
40800:04:20.825 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:11 new-cost:13
40900:04:53.709 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:9 new-cost:11
41000:05:24.877 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:7 new-cost:9
41100:05:52.782 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:5 new-cost:7
41200:06:50.422 -> event:CostChanged router:54(0xd800) nexthop:59(0xec00) old-cost:3 new-cost:5
41300:07:15.493 -> event:NextHopChanged router:54(0xd800) nexthop:59(0xec00) old-cost:1 new-cost:3
41400:09:30.382 -> event:NextHopChanged router:7(0x1c00) nexthop:34(0x8800) old-cost:inf new-cost:3
415Done
416```
417
418### rx
419
420Usage `history rx [list] [<num-entries>]`
421
422Print the IPv6 message RX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
423
424Print the IPv6 message RX history as a table:
425
426```bash
427> history rx
428| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
429+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
430|                      | UDP              |    50 | 0xbd26 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
431|         00:00:07.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
432|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
433+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
434|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x4800 |  15.4 |
435|         00:00:09.263 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0                                    |
436|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
437+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
438|                      | UDP              |    12 | 0x3f7d | yes |  net |  -20 | RX | 0x4800 |  15.4 |
439|         00:00:09.302 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631                                |
440|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631                                |
441+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
442|                      | ICMP6(EchoReqst) |    16 | 0x942c | yes | norm |  -20 | RX | 0x4800 |  15.4 |
443|         00:00:09.304 | src: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0                               |
444|                      | dst: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0                               |
445+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
446|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x4800 |  15.4 |
447|         00:00:09.304 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0                                    |
448|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
449+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
450|                      | UDP              |    50 | 0x2e37 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
451|         00:00:21.622 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
452|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
453+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
454|                      | UDP              |    50 | 0xe177 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
455|         00:00:26.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
456|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
457+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
458|                      | UDP              |   165 | 0x82ee | yes |  net |  -20 | RX | 0x4800 |  15.4 |
459|         00:00:30.000 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
460|                      | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
461+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
462|                      | UDP              |    93 | 0x52df |  no |  net |  -20 | RX | unknwn |  15.4 |
463|         00:00:30.480 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
464|                      | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
465+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
466|                      | UDP              |    50 | 0x5ccf |  no |  net |  -20 | RX | unknwn |  15.4 |
467|         00:00:30.772 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
468|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
469Done
470
471```
472
473Print the latest 5 entries of the IPv6 message RX history as a list:
474
475```bash
476> history rx list 4
47700:00:13.368
478    type:UDP len:50 cheksum:0xbd26 sec:no prio:net rss:-20 from:0x4800 radio:15.4
479    src:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
480    dst:[ff02:0:0:0:0:0:0:1]:19788
48100:00:14.991
482    type:HopOpts len:44 cheksum:0x0000 sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
483    src:[fdde:ad00:beef:0:0:ff:fe00:4800]:0
484    dst:[ff03:0:0:0:0:0:0:2]:0
48500:00:15.030
486    type:UDP len:12 cheksum:0x3f7d sec:yes prio:net rss:-20 from:0x4800 radio:15.4
487    src:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
488    dst:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
48900:00:15.032
490    type:ICMP6(EchoReqst) len:16 cheksum:0x942c sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
491    src:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
492    dst:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
493Done
494```
495
496### rxtx
497
498Usage `history rxtx [list] [<num-entries>]`
499
500Print the combined IPv6 message RX and TX history in either table or list format. Each entry provides:
501
502- IPv6 message type: UDP, TCP, ICMP6 (and its subtype), etc.
503- IPv6 payload length (excludes the IPv6 header).
504- Source IPv6 address and port number.
505- Destination IPv6 address and port number (port number is valid for UDP/TCP, it is zero otherwise).
506- Whether or not link-layer security was used.
507- Message priority: low, norm, high, net (for Thread control messages).
508- Message checksum (valid for UDP, TCP, or ICMP6 message)
509- RSS: Received Signal Strength (in dBm) - averaged over all received fragment frames that formed the message. For TX history `NA` (not applicable) is used.
510- Whether the message was sent or received (`TX` or `RX`). A failed transmission (e.g., if tx was aborted or no ack from peer for any of the message fragments) is indicated with `TX-F` in the table format or `tx-success:no` in the list format.
511- Short address (RLOC16) of neighbor to/from which the message was sent/received. If the frame is broadcast, it is shown as `bcast` in table format or `0xffff` in the list format. If the short address of neighbor is not available, it is shown as `unknwn` in the table format or `0xfffe` in the list format.
512- Radio link on which the message was sent/received (useful when `OPENTHREAD_CONFIG_MULTI_RADIO` is enabled). Can be `15.4`, `trel`, or `all` (if sent on all radio links).
513
514Print the IPv6 message RX and TX history as a table:
515
516```bash
517> history rxtx
518| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
519+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
520|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
521|         00:00:09.267 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0                                     |
522|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
523+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
524|                      | UDP              |    12 | 0x6c6b | yes |  net |  -20 | RX | 0x0800 |  15.4 |
525|         00:00:09.290 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:61631                                 |
526|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:801]:61631                                 |
527+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
528|                      | ICMP6(EchoReqst) |    16 | 0xc6a2 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
529|         00:00:09.292 | src: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0                               |
530|                      | dst: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0                               |
531+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
532|                      | ICMP6(EchoReply) |    16 | 0xc5a2 | yes | norm |  NA  | TX | 0x0800 |  15.4 |
533|         00:00:09.292 | src: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0                               |
534|                      | dst: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0                               |
535+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
536|                      | UDP              |    50 | 0xaa0d | yes |  net |  NA  | TX | 0x0800 |  15.4 |
537|         00:00:09.294 | src: [fdde:ad00:beef:0:0:ff:fe00:801]:61631                                 |
538|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:800]:61631                                 |
539+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
540|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
541|         00:00:09.296 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0                                     |
542|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
543+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
544|                      | UDP              |    50 | 0xc1d8 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
545|         00:00:09.569 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
546|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
547+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
548|                      | UDP              |    50 | 0x3cb1 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
549|         00:00:16.519 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
550|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
551+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
552|                      | UDP              |    50 | 0xeda0 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
553|         00:00:20.599 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
554|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
555+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
556|                      | UDP              |   165 | 0xbdfa | yes |  net |  -20 | RX | 0x0800 |  15.4 |
557|         00:00:21.059 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
558|                      | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
559+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
560|                      | UDP              |    64 | 0x1c11 |  no |  net |  NA  | TX | 0x0800 |  15.4 |
561|         00:00:21.062 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
562|                      | dst: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
563+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
564|                      | UDP              |    93 | 0xedff |  no |  net |  -20 | RX | unknwn |  15.4 |
565|         00:00:21.474 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
566|                      | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
567+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
568|                      | UDP              |    44 | 0xd383 |  no |  net |  NA  | TX | bcast  |  15.4 |
569|         00:00:21.811 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
570|                      | dst: [ff02:0:0:0:0:0:0:2]:19788                                             |
571Done
572```
573
574Print the latest 5 entries of the IPv6 message RX history as a list:
575
576```bash
577> history rxtx list 5
578
57900:00:02.100
580    type:UDP len:50 cheksum:0xd843 sec:no prio:net rss:-20 from:0x0800 radio:15.4
581    src:[fe80:0:0:0:54d9:5153:ffc6:df26]:19788
582    dst:[ff02:0:0:0:0:0:0:1]:19788
58300:00:15.331
584    type:HopOpts len:44 cheksum:0x0000 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
585    src:[fdde:ad00:beef:0:0:ff:fe00:800]:0
586    dst:[ff03:0:0:0:0:0:0:2]:0
58700:00:15.354
588    type:UDP len:12 cheksum:0x6c6b sec:yes prio:net rss:-20 from:0x0800 radio:15.4
589    src:[fdde:ad00:beef:0:0:ff:fe00:800]:61631
590    dst:[fdde:ad00:beef:0:0:ff:fe00:801]:61631
59100:00:15.356
592    type:ICMP6(EchoReqst) len:16 cheksum:0xc6a2 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
593    src:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
594    dst:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
59500:00:15.356
596    type:ICMP6(EchoReply) len:16 cheksum:0xc5a2 sec:yes prio:norm tx-success:yes to:0x0800 radio:15.4
597    src:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
598    dst:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
599```
600
601### tx
602
603Usage `history tx [list] [<num-entries>]`
604
605Print the IPv6 message TX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
606
607Print the IPv6 message TX history as a table (10 latest entries):
608
609```bash
610> history tx
611| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
612+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
613|                      | ICMP6(EchoReply) |    16 | 0x932c | yes | norm |  NA  | TX | 0x4800 |  15.4 |
614|         00:00:18.798 | src: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0                               |
615|                      | dst: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0                               |
616+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
617|                      | UDP              |    50 | 0xce87 | yes |  net |  NA  | TX | 0x4800 |  15.4 |
618|         00:00:18.800 | src: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631                                |
619|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631                                |
620+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
621|                      | UDP              |    64 | 0xf7ba |  no |  net |  NA  | TX | 0x4800 |  15.4 |
622|         00:00:39.499 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
623|                      | dst: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
624+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
625|                      | UDP              |    44 | 0x26d4 |  no |  net |  NA  | TX | bcast  |  15.4 |
626|         00:00:40.256 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
627|                      | dst: [ff02:0:0:0:0:0:0:2]:19788                                             |
628Done
629```
630
631Print the IPv6 message TX history as a list:
632
633```bash
634history tx list
63500:00:23.957
636    type:ICMP6(EchoReply) len:16 cheksum:0x932c sec:yes prio:norm tx-success:yes to:0x4800 radio:15.4
637    src:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
638    dst:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
63900:00:23.959
640    type:UDP len:50 cheksum:0xce87 sec:yes prio:net tx-success:yes to:0x4800 radio:15.4
641    src:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
642    dst:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
64300:00:44.658
644    type:UDP len:64 cheksum:0xf7ba sec:no prio:net tx-success:yes to:0x4800 radio:15.4
645    src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
646    dst:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
64700:00:45.415
648    type:UDP len:44 cheksum:0x26d4 sec:no prio:net tx-success:yes to:0xffff radio:15.4
649    src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
650    dst:[ff02:0:0:0:0:0:0:2]:19788
651Done
652```
653

README_JOINER.md

1# OpenThread CLI - Joiner
2
3## Quick Start
4
5See [README_COMMISSIONING.md](README_COMMISSIONING.md).
6
7## Command List
8
9- [help](#help)
10- [discerner](#discerner)
11- [id](#id)
12- [start](#start)
13- [state](#state)
14- [stop](#stop)
15
16## Command Details
17
18### help
19
20Usage: `joiner help`
21
22Print joiner help menu.
23
24```bash
25> joiner help
26help
27id
28start
29state
30stop
31Done
32```
33
34### discerner
35
36Usage: `joiner discerner [discerner]`
37
38Print or set the Joiner Discerner. Note this value takes the place of the place of EUI-64 during the joiner session of Thread commissioning.
39
40- discerner: `clear` to clear discerner, `number/length` to set discerner
41
42```bash
43> joiner discerner 0xabc/12
44Done
45> joiner discerner
460xabc/12
47Done
48> joiner discerner clear
49Done
50```
51
52### id
53
54Usage: `joiner id`
55
56Print the Joiner ID.
57
58```bash
59> joiner id
60d65e64fa83f81cf7
61Done
62```
63
64### start
65
66Usage: `joiner start <pskd> [provisioning-url]`
67
68Start the Joiner role.
69
70- pskd: Pre-Shared Key for the Joiner.
71- provisioning-url: Provisioning URL for the Joiner (optional).
72
73This command will cause the device to start the Joiner process.
74
75```bash
76> joiner start J01NM3
77Done
78```
79
80### state
81
82Usage: `joiner state`
83
84Print the Joiner state.
85
86- Idle
87- Discover
88- Connecting
89- Connected
90- Entrust
91- Joined
92
93```bash
94> joiner state
95Idle
96Done
97```
98
99### stop
100
101Usage: `joiner stop`
102
103Stop the Joiner role.
104
105```bash
106> joiner stop
107Done
108```
109

README_NETDATA.md

1# OpenThread CLI - Network Data
2
3## Overview
4
5Thread Network Data contains information about Border Routers and other servers available in the Thread network. Border Routers and devices offering services register their information with the Leader. The Leader collects and structures this information within the Thread Network Data and distributes the information to all devices in the Thread Network.
6
7Border Routers may register prefixes assigned to the Thread Network and prefixes that they offer routes for. Services may register any information relevant to the service itself.
8
9Border Router and service information may be stable or temporary. Stable Thread Network Data is distributed to all devices, including Sleepy End Devices (SEDs). Temporary Network Data is distributed to all nodes except SEDs.
10
11## Quick Start
12
13### Form Network and Configure Prefix
14
151. Generate and view new network configuration.
16
17   ```bash
18   > dataset init new
19   Done
20   > dataset
21   Active Timestamp: 1
22   Channel: 13
23   Channel Mask: 0x07fff800
24   Ext PAN ID: d63e8e3e495ebbc3
25   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
26   Network Key: dfd34f0f05cad978ec4e32b0413038ff
27   Network Name: OpenThread-8f28
28   PAN ID: 0x8f28
29   PSKc: c23a76e98f1a6483639b1ac1271e2e27
30   Security Policy: 0, onrc
31   Done
32   ```
33
342. Commit new dataset to the Active Operational Dataset in non-volatile storage.
35
36   ```bash
37   dataset commit active
38   Done
39   ```
40
413. Enable Thread interface
42
43   ```bash
44   > ifconfig up
45   Done
46   > thread start
47   Done
48   ```
49
504. Observe IPv6 addresses assigned to the Thread inteface.
51
52   ```bash
53   > ipaddr
54   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
55   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
56   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
57   fe80:0:0:0:a40b:197f:593d:ca61
58   Done
59   ```
60
615. Register an IPv6 prefix assigned to the Thread network.
62
63   ```bash
64   > prefix add fd00:dead:beef:cafe::/64 paros
65   Done
66   > netdata register
67   Done
68   ```
69
706. Observe Thread Network Data.
71
72   ```bash
73   > netdata show
74   Prefixes:
75   fd00:dead:beef:cafe::/64 paros med dc00
76   Routes:
77   Services:
78   Done
79   ```
80
817. Observe IPv6 addresses assigned to the Thread interface.
82
83   ```bash
84   > ipaddr
85   fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa
86   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
87   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
88   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
89   fe80:0:0:0:a40b:197f:593d:ca61
90   Done
91   ```
92
93### Attach to Existing Network
94
95Only the Network Key is required for a device to attach to a Thread network.
96
97While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
98
99After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
100
1011. Create a partial Active Operational Dataset.
102
103   ```bash
104   > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
105   Done
106   > dataset commit active
107   Done
108   ```
109
1102. Enable Thread interface.
111
112   ```bash
113   > ifconfig up
114   Done
115   > thread start
116   Done
117   ```
118
1193. After attaching, observe Thread Network Data.
120
121   ```bash
122   > netdata show
123   Prefixes:
124   fd00:dead:beef:cafe::/64 paros med dc00
125   Routes:
126   Services:
127   Done
128   ```
129
1304. Observe IPv6 addresses assigned to the Thread interface.
131
132   ```bash
133   > ipaddr
134   fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa
135   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
136   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
137   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
138   fe80:0:0:0:a40b:197f:593d:ca61
139   Done
140   ```
141
142## Command List
143
144- [help](#help)
145- [length](#length)
146- [maxlength](#maxlength)
147- [publish](#publish)
148- [register](#register)
149- [show](#show)
150- [steeringdata](#steeringdata-check-eui64discerner)
151- [unpublish](#unpublish)
152
153## Command Details
154
155### help
156
157Usage: `netdata help`
158
159Print netdata help menu.
160
161```bash
162> netdata help
163length
164maxlength
165publish
166register
167show
168steeringdata
169unpublish
170Done
171```
172
173### length
174
175Usage: `netdata length`
176
177Get the current length of (number of bytes) Partition's Thread Network Data.
178
179```bash
180> netdata length
18123
182Done
183```
184
185### maxlength
186
187Usage: `netdata maxlength`
188
189Get the maximum observed length of the Thread Network Data since OT stack initialization or since the last call to `netdata maxlength reset`.
190
191```bash
192> netdata maxlength
19340
194Done
195```
196
197### maxlength reset
198
199Usage: `netdata maxlength reset`
200
201Reset the tracked maximum length of the Thread Network Data.
202
203```bash
204> netdata maxlength reset
205Done
206```
207
208### publish
209
210The Network Data Publisher provides mechanisms to limit the number of similar Service and/or Prefix (on-mesh prefix or external route) entries in the Thread Network Data by monitoring the Network Data and managing if or when to add or remove entries.
211
212The Publisher requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
213
214### publish dnssrp
215
216Publish DNS/SRP service entry.
217
218This command requires `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE`.
219
220The following formats are available: :
221
222- `netdata publish dnssrp anycast <seq-num>` to publish "DNS/SRP Service Anycast Address" with a given sequence number.
223- `netdata publish dnssrp unicast <address> <port>` to publish "DNS/SRP Service Unicast Address" with given address and port number info. The address/port info is included in Service TLV data.
224- `netdata publish dnssrp unicast <port>` to publish "DNS/SRP Service Unicast Address" with given port number and the device's mesh-local EID for the address. The address and port info is included in Server TLV data.
225
226A new call to `netdata publish dnssrp [anycast|unicast] [...]` command will remove and replace any previous "DNS/SRP Service" entry that was being published (from earlier `netdata publish dnssrp [...]` commands).
227
228```bash
229> netdata publish dnssrp anycast 1
230Done
231
232> netdata publish dnssrp unicast fd00::1234 51525
233Done
234
235> netdata publish dnssrp unicast 50152
236Done
237```
238
239### publish prefix \<prefix\> [padcrosnD][prf]
240
241Publish an on-mesh prefix entry.
242
243- p: Preferred flag
244- a: Stateless IPv6 Address Autoconfiguration flag
245- d: DHCPv6 IPv6 Address Configuration flag
246- c: DHCPv6 Other Configuration flag
247- r: Default Route flag
248- o: On Mesh flag
249- s: Stable flag
250- n: Nd Dns flag
251- D: Domain Prefix flag (only available for Thread 1.2).
252- prf: Preference, which may be 'high', 'med', or 'low'.
253
254```bash
255> netdata publish prefix fd00:1234:5678::/64 paos med
256Done
257```
258
259### publish route \<prefix\> [sn][prf]
260
261Publish an external route entry.
262
263- s: Stable flag
264- n: NAT64 flag
265- prf: Preference, which may be: 'high', 'med', or 'low'.
266
267```bash
268> netdata publish route fd00:1234:5678::/64 s high
269Done
270```
271
272### publish replace \<old prefix\> \<prefix\> [sn][prf]
273
274Replace a previously published external route entry.
275
276If there is no previously published external route matching old prefix, this command behaves similarly to `netdata publish route`. If there is a previously published route entry, it will be replaced with the new prefix. In particular, if the old prefix was already added in the Network Data, the change to the new prefix is immediately reflected in the Network Data (i.e., old prefix is removed and the new prefix is added in the same Network Data registration request to leader). This ensures that route entries in the Network Data are not abruptly removed.
277
278- s: Stable flag
279- n: NAT64 flag
280- prf: Preference, which may be: 'high', 'med', or 'low'.
281
282```bash
283> netdata publish replace ::/0 fd00:1234:5678::/64 s high
284Done
285```
286
287### register
288
289Usage: `netdata register`
290
291Register configured prefixes, routes, and services with the Leader.
292
293```bash
294> netdata register
295Done
296```
297
298### show
299
300Usage: `netdata show [local] [-x]`
301
302Print entries in Network Data, on-mesh prefixes, external routes, services, and 6LoWPAN context information.
303
304On-mesh prefixes are listed under `Prefixes` header:
305
306- The on-mesh prefix
307- Flags
308  - p: Preferred flag
309  - a: Stateless IPv6 Address Autoconfiguration flag
310  - d: DHCPv6 IPv6 Address Configuration flag
311  - c: DHCPv6 Other Configuration flag
312  - r: Default Route flag
313  - o: On Mesh flag
314  - s: Stable flag
315  - n: Nd Dns flag
316  - D: Domain Prefix flag (only available for Thread 1.2).
317- Preference `high`, `med`, or `low`
318- RLOC16 of device which added the on-mesh prefix
319
320External Routes are listed under `Routes` header:
321
322- The route prefix
323- Flags
324  - s: Stable flag
325  - n: NAT64 flag
326- Preference `high`, `med`, or `low`
327- RLOC16 of device which added the route prefix
328
329Service entries are listed under `Services` header:
330
331- Enterprise number
332- Service data (as hex bytes)
333- Server data (as hex bytes)
334- Flags
335  - s: Stable flag
336- RLOC16 of devices which added the service entry
337
3386LoWPAN Context IDs are listed under `Contexts` header:
339
340- The prefix
341- Context ID
342- Compress flag (`c` if marked or `-` otherwise).
343
344Print Network Data received from the Leader.
345
346```bash
347> netdata show
348Prefixes:
349fd00:dead:beef:cafe::/64 paros med a000
350Routes:
351fd00:1234:0:0::/64 s med a000
352fd00:4567:0:0::/64 s med 8000
353Services:
35444970 5d fddead00beef00007bad0069ce45948504d2 s a000
355Contexts:
356fd00:dead:beef:cafe::/64 1 c
357Done
358```
359
360Print Network Data received from the Leader as hex-encoded TLVs.
361
362```bash
363> netdata show -x
36408040b02174703140040fd00deadbeefcafe0504dc00330007021140
365Done
366```
367
368Print local Network Data to sync with Leader.
369
370```bash
371> netdata show local
372Prefixes:
373fd00:dead:beef:cafe::/64 paros med dc00
374Routes:
375Services:
376Done
377```
378
379Print local Network Data to sync with Leader as hex-encoded TLVs.
380
381```bash
382> netdata show local -x
38308040b02174703140040fd00deadbeefcafe0504dc00330007021140
384Done
385```
386
387### netdata steeringdata check \<eui64\>|\<discerner\>
388
389Check whether the steering data includes a joiner.
390
391- eui64: The IEEE EUI-64 of the Joiner.
392- discerner: The Joiner discerner in format `number/length`.
393
394```bash
395> netdata steeringdata check d45e64fa83f81cf7
396Done
397> netdata steeringdata check 0xabc/12
398Done
399> netdata steeringdata check 0xdef/12
400Error 23: NotFound
401```
402
403### unpublish
404
405This command unpublishes a previously published Network Data entry.
406
407This command requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
408
409### unpublish dnssrp
410
411Unpublishes DNS/SRP Service entry (available when `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` is enabled):
412
413- `netdata unpublish dnssrp` to unpublish "DNS/SRP Service" entry (anycast or unciast).
414
415```bash
416> netdata unpublish dnssrp
417Done
418```
419
420### unpublish \<prefix\>
421
422Unpublishes a previously published on-mesh prefix or external route entry.
423
424```bash
425> netdata unpublish fd00:1234:5678::/64
426Done
427```
428

README_SRP.md

1# OpenThread CLI - SRP (Service Registration Protocol)
2
3## Quick Start
4
5### Start SRP Server
6
7Start the SRP Server node:
8
9```bash
10./output/simulation/bin/ot-cli-ftd 1
11```
12
13Setup a Thread network and start the SRP Server:
14
15```bash
16> dataset init new
17Done
18> dataset
19Active Timestamp: 1
20Channel: 22
21Channel Mask: 0x07fff800
22Ext PAN ID: 8d6ed7a05a28fb3b
23Mesh Local Prefix: fded:5114:8263:1fe1::/64
24Network Key: 7fcbae4153cc2955c28440c15d4d4219
25Network Name: OpenThread-f7af
26PAN ID: 0xf7af
27PSKc: b658e40f174e3a11be149b302ef07a0f
28Security Policy: 672, onrc
29Done
30> dataset commit active
31Done
32> ifconfig up
33Done
34> thread start
35Done
36> state
37leader
38Done
39>ipaddr
40fded:5114:8263:1fe1:0:ff:fe00:fc00
41fded:5114:8263:1fe1:0:ff:fe00:c000
42fded:5114:8263:1fe1:68bc:ec03:c1ad:9325
43fe80:0:0:0:a8cd:6e23:df3d:4193
44Done
45> srp server enable
46Done
47```
48
49### Start SRP Client
50
51Start the SRP Client node:
52
53```bash
54./output/simulation/bin/ot-cli-ftd 2
55```
56
57Join the Thread Network and register a `_ipps._tcp` service:
58
59```bash
60> dataset networkkey 7fcbae4153cc2955c28440c15d4d4219
61Done
62> dataset commit active
63Done
64> ifconfig up
65Done
66> thread start
67Done
68> state
69child
70Done
71> ipaddr
72fded:5114:8263:1fe1:0:ff:fe00:c001
73fded:5114:8263:1fe1:44f9:cc06:4a2d:534
74fe80:0:0:0:38dd:fdf7:5fd:24e
75Done
76> srp client host name my-host
77Done
78> srp client host address fded:5114:8263:1fe1:44f9:cc06:4a2d:534
79Done
80> srp client service add my-service _ipps._tcp 12345
81Done
82> srp client autostart enable
83Done
84```
85
86The last command enables the auto-start mode on the client which then monitors the network data to discover available SRP servers within the Thread network and automatically starts the client.
87
88Alternatively, the client can be started manually using the `srp client start`.
89
90The SRP Server listening UDP port (which is `c002`(`49154`) in the example below) can be found from the Server Data (listed by the `netdata show` command).
91
92Make sure the SRP Server address & port are used for the `srp client start` command.
93
94```bash
95> netdata show
96Prefixes:
97Routes:
98Services:
9944970 5d c002 s 8400
100Done
101srp client start fded:5114:8263:1fe1:68bc:ec03:c1ad:9325 49154
102Done
103```
104
105### Verify the service status
106
107Check if the host and service has been successfully registered on the client node:
108
109```bash
110> srp client host
111name:"my-host", state:Registered, addrs:[fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
112Done
113> srp client service
114instance:"my-service", name:"_ipps._tcp", state:Registered, port:12345, priority:0, weight:0
115Done
116```
117
118Make sure it shows `state:Registered` for both host and service commands.
119
120Check the host & service on the server node:
121
122```bash
123> srp server host
124my-host.default.service.arpa.
125    deleted: false
126    addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
127Done
128> srp server service
129my-service._ipps._tcp.default.service.arpa.
130    deleted: false
131    port: 12345
132    priority: 0
133    weight: 0
134    ttl: 7200
135    lease: 7200
136    key-lease: 1209600
137    TXT: []
138    host: my-host.default.service.arpa.
139    addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
140Done
141```
142
143Make sure it shows `deleted: false` for both host and service commands.
144
145### Remove the service
146
147A service can be removed through the client node:
148
149```bash
150> srp client service remove my-service _ipps._tcp
151Done
152```
153
154Confirm on the server node that the service has been removed:
155
156```bash
157> srp server service
158my-service._ipps._tcp.default.service.arpa.
159    deleted: true
160Done
161```
162
163The service entry is listed because the name of service is not removed.
164
165### Remove the host and service names
166
167A host and service, along with their names, can be removed through the client node:
168
169```bash
170> srp client host remove 1
171Done
172```
173
174Confirm on the server node that no host or service entries are listed:
175
176```bash
177> srp server host
178Done
179> srp server service
180Done
181>
182```
183
184## CLI Reference
185
186- [SRP Client CLI Reference](README_SRP_CLIENT.md)
187- [SRP Server CLI Reference](README_SRP_SERVER.md)
188

README_SRP_CLIENT.md

1# OpenThread CLI - SRP Client
2
3## Command List
4
5Usage : `srp client [command] ...`
6
7- [help](#help)
8- [autostart](#autostart)
9- [callback](#callback)
10- [host](#host)
11- [keyleaseinterval](#keyleaseinterval)
12- [leaseinterval](#leaseinterval)
13- [server](#server)
14- [service](#service)
15- [start](#start)
16- [state](#state)
17- [stop](#stop)
18- [ttl](#ttl)
19
20## Command Details
21
22### help
23
24Usage: `srp client help`
25
26Print SRP client help menu.
27
28```bash
29> srp client help
30autostart
31callback
32help
33host
34keyleaseinterval
35leaseinterval
36service
37start
38state
39stop
40ttl
41Done
42```
43
44### autostart
45
46Usage `srp client autostart [enable|disable]`
47
48Enable/Disable auto start mode in SRP client. This command requires `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` feature to be enabled.
49
50Get the current autostart mode.
51
52```bash
53> srp client autostart
54Disabled
55Done
56```
57
58Set the autostart mode.
59
60```bash
61> srp client autostart enable
62Done
63
64> srp client autostart
65Enabled
66Done
67```
68
69### callback
70
71Usage `srp client callback [enable|disable]`
72
73Enable/Disable printing callback events from SRP client.
74
75Get current callback mode
76
77```bash
78> srp client callback
79Disabled
80Done
81```
82
83Set callback mode
84
85```bash
86> srp client callback enable
87Done
88
89> srp client callback
90Enabled
91Done
92```
93
94#### Example
95
96When two services are successfully registered:
97
98```bash
99SRP client callback - error:OK
100Host info:
101    name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
102Service list:
103    instance:"ins2", name:"_test2._udp", state:Registered, port:111, priority:1, weight:1
104    instance:"ins1", name:"_test1._udp,_sub1,_sub2", state:Registered, port:777, priority:0, weight:0
105```
106
107When service `ins2` is removed:
108
109```bash
110SRP client callback - error:OK
111Host info:
112    name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
113Service list:
114    instance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
115Removed service list:
116    instance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Removed, port:111, priority:1, weight:1
117```
118
119When host info (and all services) is removed:
120
121```bash
122SRP client callback - error:OK
123Host info:
124    name:"dev4312", state:Removed, addrs:[fd00:0:0:0:0:0:0:1]
125Service list:
126Removed service list:
127    instance:"ins1", name:"_test1._udp", state:Removed, port:777, priority:0, weight:0
128```
129
130### host
131
132Usage: `srp client host`
133
134Print the full host info (host name, state, list of host addresses).
135
136```bash
137> srp client host
138name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1234, fd00:0:0:0:0:0:0:beef]
139Done
140```
141
142When auto host address mode is enabled.
143
144```bash
145srp client host
146name:"dev1234", state:Registered, addrs:auto
147Done
148```
149
150### host name
151
152Usage: `srp client host name [name]`
153
154Get the host name.
155
156```bash
157> srp client host name
158dev4312
159Done
160```
161
162Set host name (can be set when the host is removed or not yet registered with server).
163
164```bash
165srp client host name dev4312
166Done
167```
168
169### host address
170
171Usage : `srp client host address [auto | <address> ...]`
172
173Indicate auto address mode is enabled.
174
175```bash
176> srp client host address
177auto
178Done
179```
180
181Get the list of host addresses (when auto host address is not enabled).
182
183```bash
184> srp client host address
185fd00:0:0:0:0:0:0:1234
186fd00:0:0:0:0:0:0:beef
187Done
188```
189
190Enable auto host address mode. When enabled client will automatically use all Thread netif unicast addresses excluding all link-local and mesh-local addresses. If there is no valid address, then Mesh Local EID address is added. SRP client will automatically re-register if/when addresses on Thread netif get changed (e.g., new address is added or existing address is removed).
191
192```bash
193> srp client host address auto
194Done
195```
196
197Explicitly set the list of host addresses (can be set while client is running to update the host addresses), also disabled auto host address mode.
198
199```bash
200> srp client host address fd00::cafe
201Done
202```
203
204### host state
205
206Usage: `srp client host state`
207
208Get the host state.
209
210```bash
211> srp client host state
212Registered
213Done
214```
215
216The possible states are (same value for service state):
217
218- `ToAdd`: item to be added/registered.
219- `Adding`: item is being added/registered.
220- `ToRefresh`: item to be refreshed (renew lease).
221- `Refreshing`: item is being refreshed.
222- `ToRemove`: item to be removed.
223- `Removing`: item is being removed.
224- `Registered`: item is registered with server.
225- `Removed`: item is removed.
226
227### host remove
228
229Usage: `srp client host remove [removekeylease] [sendunregtoserver]`
230
231Remove host info and all services from server.
232
233- `removekeylease` is an optional boolean value indicating whether or not the host key lease should also be removed (default is false).
234- `sendunregtoserver` is a another optional boolean value indicating whether or not to send an update message to the server when host info is not yet registered (default is false).
235
236```bash
237> srp client host remove 1
238Done
239```
240
241### host clear
242
243Usage: `srp client host clear`
244
245Clear host info and all services on client (unlike `host remove`, with `host clear` no update is sent to server).
246
247```bash
248> srp client host clear
249Done
250```
251
252### keyleaseinterval
253
254Usage: `srp client keyleaseinterval [interval]`
255
256Get the key lease interval (in seconds).
257
258```bash
259> srp client keyleaseinterval
2601209600
261Done
262>
263```
264
265Set the key lease interval.
266
267```bash
268> srp client keyleaseinterval 864000
269Done
270```
271
272### leaseinterval
273
274Usage: `srp client leaseinterval [interval]`
275
276Get the lease interval (in seconds).
277
278```bash
279> srp client leaseinterval
2807200
281Done
282>
283```
284
285Set the lease interval.
286
287```bash
288> srp client leaseinterval 3600
289Done
290```
291
292### server
293
294Usage: `srp client server`
295
296Print the server socket address (IPv6 address and port number).
297
298```bash
299> srp client server
300[fd00:0:0:0:d88a:618b:384d:e760]:4724
301Done
302```
303
304### server address
305
306Print the server IPv6 address.
307
308```bash
309> srp client server address
310fd00:0:0:0:d88a:618b:384d:e760
311Done
312```
313
314### server port
315
316Print the server port number
317
318```bash
319> srp client server port
3204724
321Done
322```
323
324### service
325
326Usage: `srp client service`
327
328Print the list of services.
329
330```bash
331> srp client service
332instance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Registered, port:111, priority:1, weight:1
333instance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
334Done
335```
336
337### service add
338
339Usage: `srp client service add <instancename> <servicename> <port> [priority] [weight] [txt]`
340
341Add a service with a given instance name, service name, port number, priority, weight and txt values.
342
343The `<servicename>` can optionally include a list of service subtype labels separated by comma.
344
345The priority and weight are optional and if not provided zero will be used. The txt should follow hex-string format and is treated as an already encoded TXT data byte sequence. It is also optional and if not provided it is considered empty.
346
347```bash
348> srp client service add ins1 _test1._udp 777
349Done
350
351> srp client service add ins2 _test2._udp,_sub1,_sub2 111 1 1
352Done
353```
354
355### service remove
356
357Usage: `srp client service remove <instancename> <servicename>`
358
359Remove a service with a give instance name and service name.
360
361```bash
362> srp client service remove ins2 _test2._udp
363Done
364```
365
366### service clear
367
368Usage: `srp client service clear <instancename> <servicename>`
369
370Clear a service with a give instance name and service name (unlike `service remove`, with `service clear` no update is sent to server and the entry is immediately removed from client list).
371
372```bash
373> srp client service clear ins2 _test2._udp
374Done
375```
376
377### service key
378
379Usage `srp client service key [enable|disable]`
380
381Enable/Disable "service key record inclusion" mode in SRP client. This command requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` feature to be enabled.
382
383KEY record is optional in Service Description Instruction (it is required and always included in the Host Description Instruction). The default behavior of SRP client is to not include it. This command is intended to override the default behavior for testing only (in a `REFERENCE_DEVICE` build).
384
385Get the current "service key record inclusion" mode.
386
387```bash
388> srp client service key
389Disabled
390Done
391```
392
393Set the "service key record inclusion" mode.
394
395```bash
396> srp client service key enable
397Done
398
399> srp client service key
400Enabled
401Done
402```
403
404### start
405
406Usage: `srp client start <serveraddr> <serverport>`
407
408Start the SRP client with a given server IPv6 address and port number.
409
410```bash
411> srp client start fd00::d88a:618b:384d:e760 4724
412Done
413```
414
415### state
416
417Usage: `srp client state`
418
419Indicates the state of SRP client, i.e., whether it is enabled or disabled.
420
421```bash
422> srp client state
423Enabled
424Done
425```
426
427### stop
428
429Usage: `srp client stop`
430
431Stop the SRP client.
432
433```bash
434> srp client stop
435Done
436```
437
438### ttl
439
440Usage: `srp client ttl [value]`
441
442Get the TTL (in seconds).
443
444```bash
445> srp client ttl
4467200
447Done
448>
449```
450
451Set the TTL.
452
453```bash
454> srp client ttl 3600
455Done
456```
457

README_SRP_SERVER.md

1# OpenThread CLI - SRP Server
2
3## Quick Start
4
5See [README_SRP.md](README_SRP.md).
6
7## Command List
8
9- [help](#help)
10- [addrmode](#addrmode)
11- [disable](#disable)
12- [domain](#domain)
13- [enable](#enable)
14- [host](#host)
15- [lease](#lease)
16- [seqnum](#seqnum)
17- [service](#service)
18- [state](#state)
19
20## Command Details
21
22### help
23
24Usage: `srp server help`
25
26Print SRP server help menu.
27
28```bash
29> srp server help
30addrmode
31disable
32domain
33enable
34help
35host
36lease
37seqnum
38service
39state
40Done
41```
42
43### addrmode
44
45Usage: `srp server addrmode [unicast|anycast]`
46
47Get or set the address mode used by the SRP server.
48
49Address mode specifies how the address and port number are determined by the SRP server and this is published in the Thread Network Data.
50
51Get the address mode.
52
53```bash
54> srp server addrmode
55unicast
56Done
57```
58
59Set the address mode.
60
61```bash
62> srp server addrmode anycast
63Done
64
65> srp server addrmode
66anycast
67Done
68```
69
70### disable
71
72Usage: `srp server disable`
73
74Disable the SRP server.
75
76```bash
77> srp server disable
78Done
79```
80
81### domain
82
83Usage: `srp server domain [domain-name]`
84
85Get the domain.
86
87```bash
88> srp server domain
89default.service.arpa.
90Done
91```
92
93Set the domain.
94
95```bash
96> srp server domain thread.service.arpa.
97Done
98```
99
100### enable
101
102Usage: `srp server enable`
103
104Enable the SRP server.
105
106```bash
107> srp server enable
108Done
109```
110
111### host
112
113Usage: `srp server host`
114
115Print information of all registered hosts.
116
117```bash
118> srp server host
119srp-api-test-1.default.service.arpa.
120    deleted: false
121    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
122srp-api-test-0.default.service.arpa.
123    deleted: false
124    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
125Done
126```
127
128### lease
129
130Usage: `srp server lease [<min-lease>] [<max-lease>] [<min-key-lease>] [<max-key-lease>]`
131
132Get LEASE and KEY-LEASE values.
133
134```bash
135> srp server lease
136min lease: 1800
137max lease: 7200
138min key-lease: 86400
139max key-lease: 1209600
140Done
141```
142
143Set LEASE and KEY-LEASE values.
144
145```bash
146> srp server lease 1800 7200 86400 1209600
147Done
148```
149
150### seqnum
151
152Usage: `srp server seqnum [<seqnum>]`
153
154Get or set the sequence number used with anycast address mode.
155
156The sequence number is included in "DNS/SRP Service Anycast Address" entry published in the Network Data.
157
158```bash
159> srp server seqnum 20
160Done
161
162> srp server seqnum
16320
164Done
165```
166
167### service
168
169Usage: `srp server service`
170
171Print information of all registered services.
172
173The TXT record is displayed as an array of entries. If an entry has a key, the key will be printed in ASCII format. The value portion will always be printed as hex bytes.
174
175```bash
176> srp server service
177srp-api-test-1._ipps._tcp.default.service.arpa.
178    deleted: false
179    subtypes: (null)
180    port: 49152
181    priority: 0
182    weight: 0
183    ttl: 7200
184    lease: 7200
185    key-lease: 1209600
186    TXT: [616263, xyz=585960]
187    host: srp-api-test-1.default.service.arpa.
188    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
189srp-api-test-0._ipps._tcp.default.service.arpa.
190    deleted: false
191    subtypes: _sub1,_sub2
192    port: 49152
193    priority: 0
194    weight: 0
195    ttl: 3600
196    lease: 3600
197    key-lease: 1209600
198    TXT: [616263, xyz=585960]
199    host: srp-api-test-0.default.service.arpa.
200    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
201Done
202```
203
204### state
205
206Usage: `srp server state`
207
208Print the state of the SRP server. It could be `disabled`, `stopped` or `running`.
209
210- disabled: The SRP server is not enabled.
211- stopped: The SRP server is enabled but not active due to existing SRP servers already active in the Thread network. The SRP server may become active when existing SRP servers are no longer active within the Thread network.
212- running: The SRP server is active and will handle service registrations.
213
214```bash
215> srp server state
216running
217Done
218```
219

README_TCP.md

1# OpenThread CLI - TCP Example
2
3The OpenThread TCP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, initialize the TCP CLI module and listen for incoming connections using the example TCP listener.
14
15```bash
16> tcp init
17> tcp listen :: 30000
18```
19
20The `::` specifies the IPv6 Unspecified Address.
21
22### Node 2
23
24On node 2, initialize the TCP CLI module, connect to node 1, and send a simple message.
25
26```bash
27> tcp init
28> tcp connect fe80:0:0:0:a8df:580a:860:ffa4 30000
29> tcp send hello
30```
31
32### Result
33
34After running the `tcp connect` command on node 1, you should see a printout on node 1 similar to below:
35
36```bash
37TCP: Connection established
38```
39
40In addition, you should also see a printout on node 2 similar to below:
41
42```bash
43Accepted connection from [fe80:0:0:0:8f3:f602:bf9b:52f2]:49152
44TCP: Connection established
45```
46
47After running the `tcp send` command on node 1, you should see a printout on node 2 similar to below:
48
49```bash
50TCP: Received 5 bytes: hello
51```
52
53For a more in-depth example, see [this video](https://youtu.be/ppZ784YUKlI).
54
55## Command List
56
57- [help](#help)
58- [init](#init-size)
59- [deinit](#deinit)
60- [bind](#bind-ip-port)
61- [connect](#connect-ip-port)
62- [send](#send-message)
63- [benchmark](#benchmark-size)
64- [sendend](#sendend)
65- [abort](#abort)
66- [listen](#listen-ip-port)
67- [stoplistening](#stoplistening)
68
69## Command Details
70
71### abort
72
73Unceremoniously ends the TCP connection, if one exists, associated with the example TCP endpoint, transitioning the TCP endpoint to the closed state.
74
75```bash
76> tcp abort
77TCP: Connection reset
78Done
79```
80
81### benchmark [\<size\>]
82
83Transfers the specified number of bytes using the TCP connection currently associated with the example TCP endpoint (this TCP connection must be established before using this command).
84
85- size: the number of bytes to send for the benchmark. If it is left unspecified, the default size is used.
86
87```bash
88> tcp benchmark
89Done
90TCP Benchmark Complete: Transferred 73728 bytes in 7233 milliseconds
91TCP Goodput: 81.546 kb/s
92```
93
94### bind \<ip\> \<port\>
95
96Associates a name (i.e. IPv6 address and port) to the example TCP endpoint.
97
98- ip: the IPv6 address or the unspecified IPv6 address (`::`).
99- port: the TCP port.
100
101```bash
102> tcp bind :: 30000
103Done
104```
105
106### connect \<ip\> \<port\>
107
108Establishes a connection with the specified peer.
109
110If the connection establishment is successful, the resulting TCP connection is associated with the example TCP endpoint.
111
112- ip: the peer's IP address.
113- port: the peer's TCP port.
114
115```bash
116> tcp connect fe80:0:0:0:a8df:580a:860:ffa4 30000
117Done
118TCP: Connection established
119```
120
121The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
122
123> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
124
125```bash
126> tcp connect 172.17.0.1 1234
127Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
128Done
129```
130
131### deinit
132
133Deinitializes the example TCP listener and the example TCP endpoint.
134
135```bash
136> tcp deinit
137Done
138```
139
140### help
141
142List the TCP CLI commands.
143
144```bash
145> tcp help
146abort
147benchmark
148bind
149connect
150deinit
151help
152init
153listen
154send-message
155sendend
156stoplistening
157Done
158```
159
160### init [\<mode\>]&nbsp;[\<size\>]
161
162Initializes the example TCP listener and the example TCP endpoint.
163
164- mode: this specifies the buffering strategy and whether to use TLS. The possible values are "linked", "circular" (default), and "tls".
165- size: the size of the receive buffer to associate with the example TCP endpoint. If left unspecified, the maximum size is used.
166
167If "tls" is used, then the TLS protocol will be used for the connection (on top of TCP). When communicating over TCP between two nodes, either both should use TLS or neither should (a non-TLS endpoint cannot communicate with a TLS endpoint). The first two options, "linked" and "circular", specify that TLS should not be used and specify a buffering strategy to use with TCP; two endpoints of a TCP connection may use different buffering strategies.
168
169The behaviors of "linked" and "circular" buffering are identical, but the option is provided so that users of TCP can inspect the code to see an example of using the two buffering strategies.
170
171```bash
172> tcp init tls
173Done
174```
175
176### listen \<ip\> \<port\>
177
178Uses the example TCP listener to listen for incoming connections on the specified name (i.e. IPv6 address and port).
179
180If no TCP connection is associated with the example TCP endpoint, then any incoming connections matching the specified name are accepted and associated with the example TCP endpoint.
181
182- ip: the IPv6 address or the unspecified IPv6 address (`::`).
183- port: the TCP port.
184
185```bash
186> tcp listen :: 30000
187Done
188```
189
190### send \<message\>
191
192Send data over the TCP connection associated with the example TCP endpoint.
193
194- message: the message to send.
195
196```bash
197> tcp send hello
198Done
199```
200
201### sendend
202
203Sends the "end of stream" signal (i.e., FIN segment) over the TCP connection associated with the example TCP endpoint. This promises the peer that no more data will be sent to it over this TCP connection.
204
205```bash
206> tcp sendend
207Done
208```
209
210### stoplistening
211
212Stops listening for incoming TCP connections using the example TCP listener.
213
214```bash
215> tcp stoplistening
216Done
217```
218

README_UDP.md

1# OpenThread CLI - UDP Example
2
3The OpenThread UDP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, open and bind the example UDP socket.
14
15```bash
16> udp open
17> udp bind :: 1234
18```
19
20The `::` specifies the IPv6 Unspecified Address.
21
22### Node 2
23
24On node 2, open the example UDP socket and send a simple message.
25
26```bash
27> udp open
28> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
29```
30
31### Result
32
33On node 1, you should see a print out similar to below:
34
35```bash
365 bytes from fdde:ad00:beef:0:dac3:6792:e2e:90d8 49153 hello
37```
38
39## Command List
40
41- [help](#help)
42- [bind](#bind-netif-ip-port)
43- [close](#close)
44- [connect](#connect-ip-port)
45- [linksecurity](#linksecurity)
46- [open](#open)
47- [send](#send-ip-port-message)
48
49## Command Details
50
51### help
52
53List the UDP CLI commands.
54
55```bash
56> udp help
57help
58bind
59close
60connect
61open
62send
63Done
64```
65
66### bind [netif] \<ip\> \<port\>
67
68Assigns a name (i.e. IPv6 address and port) to the example socket.
69
70- netif: the network interface to bind to.
71  - not specified: Thread network interface.
72  - `-u`: unspecified network interface.
73  - `-b`: Backbone network interface.
74- ip: the IPv6 address or the unspecified IPv6 address (`::`).
75- port: the UDP port
76
77```bash
78> udp bind :: 1234
79Done
80> udp bind -u :: 1234
81Done
82> udp bind -b :: 1234
83Done
84```
85
86### close
87
88Closes the example socket.
89
90```bash
91> udp close
92Done
93```
94
95### connect \<ip\> \<port\>
96
97Specifies the peer with which the socket is to be associated.
98
99- ip: the peer's IP address.
100- port: the peer's UDP port.
101
102```bash
103> udp connect fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234
104Done
105```
106
107The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
108
109> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
110
111```bash
112> udp connect 172.17.0.1 1234
113Connecting to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
114Done
115```
116
117### linksecurity
118
119Indicates whether the link security is enabled or disabled.
120
121```bash
122> udp linksecurity
123Enabled
124Done
125```
126
127### linksecurity enable
128
129Enable link security.
130
131```bash
132> udp linksecurity enable
133Done
134```
135
136### linksecurity disable
137
138Disable link security.
139
140```bash
141> udp linksecurity disable
142Done
143```
144
145### open
146
147Opens the example socket.
148
149```bash
150> udp open
151Done
152```
153
154### send \<ip\> \<port\> \<message\>
155
156Send a UDP message.
157
158- ip: the destination address.
159- port: the UDP destination port.
160- message: the message to send.
161
162```bash
163> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
164Done
165```
166
167The address can be an IPv4 address, which will be synthesized to an IPv6 address using the preferred NAT64 prefix from the network data.
168
169> Note: The command will return `InvalidState` when the preferred NAT64 prefix is unavailable.
170
171```bash
172> udp send 172.17.0.1 1234
173Sending to synthesized IPv6 address: fdde:ad00:beef:2:0:0:ac11:1
174Done
175```
176
177### send \<ip\> \<port\> \<type\> \<value\>
178
179Send a few bytes over UDP.
180
181- ip: the IPv6 destination address.
182- port: the UDP destination port.
183- type: the type of the message:
184  - `-t`: text payload in the `value`, same as without specifying the type.
185  - `-s`: autogenerated payload with specified length indicated in the `value`.
186  - `-x`: binary data in hexadecimal representation in the `value`.
187
188```bash
189> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -t hello
190Done
191
192> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -x 68656c6c6f
193Done
194
195> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -s 800
196Done
197
198```
199
200### send \<message\>
201
202Send a UDP message on a connected socket.
203
204- message: the message to send.
205
206```bash
207> udp send hello
208Done
209```
210
211### send \<type\> \<value\>
212
213Send a few bytes over UDP.
214
215- type: the type of the message:
216  - `-t`: text payload in the `value`, same as without specifying the type.
217  - `-s`: autogenerated payload with specified length indicated in the `value`.
218  - `-x`: binary data in hexadecimal representation in the `value`.
219
220```bash
221> udp send -t hello
222Done
223
224> udp send -x 68656c6c6f
225Done
226
227> udp send -s 800
228Done
229```
230