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