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

..--

BUILD.gnD11-Mar-20242.6 KiB7670

CMakeLists.txtD11-Mar-20242.1 KiB6054

Makefile.amD11-Mar-20247 KiB18766

README.mdD11-Mar-202451.5 KiB2,8222,039

README_COAP.mdD11-Mar-20245.8 KiB243180

README_COAPS.mdD11-Mar-20244.8 KiB264192

README_COMMISSIONER.mdD11-Mar-20244.4 KiB227157

README_COMMISSIONING.mdD11-Mar-20242.1 KiB11889

README_DATASET.mdD11-Mar-20249.7 KiB544396

README_HISTORY.mdD11-Mar-202421.8 KiB391331

README_JOINER.mdD11-Mar-20241.2 KiB8859

README_NETDATA.mdD11-Mar-20247.2 KiB309225

README_SRP.mdD11-Mar-20243.8 KiB185148

README_SRP_CLIENT.mdD11-Mar-20247.8 KiB412287

README_SRP_SERVER.mdD11-Mar-20242.6 KiB163120

README_TCP.mdD11-Mar-20244.1 KiB203139

README_UDP.mdD11-Mar-20243.4 KiB210145

cli.cppD11-Mar-2024144.3 KiB5,1724,251

cli.hppD11-Mar-202436.9 KiB1,037723

cli_coap.cppD11-Mar-202430.9 KiB939752

cli_coap.hppD11-Mar-20247.8 KiB232150

cli_coap_secure.cppD11-Mar-202423.3 KiB766608

cli_coap_secure.hppD11-Mar-20247 KiB209127

cli_commissioner.cppD11-Mar-202413.2 KiB461345

cli_commissioner.hppD11-Mar-20245.3 KiB14673

cli_config.hD11-Mar-20243.9 KiB11832

cli_dataset.cppD11-Mar-202424.8 KiB956781

cli_dataset.hppD11-Mar-20245.2 KiB15187

cli_history.cppD11-Mar-202415.7 KiB489356

cli_history.hppD11-Mar-20244.2 KiB13059

cli_joiner.cppD11-Mar-20244.9 KiB175106

cli_joiner.hppD11-Mar-20243.3 KiB11143

cli_network_data.cppD11-Mar-202410.8 KiB448317

cli_network_data.hppD11-Mar-20244.3 KiB14558

cli_srp_client.cppD11-Mar-202418.8 KiB620440

cli_srp_client.hppD11-Mar-20245 KiB14474

cli_srp_server.cppD11-Mar-20249.4 KiB299205

cli_srp_server.hppD11-Mar-20243.7 KiB11847

cli_tcp.cppD11-Mar-202416.9 KiB521382

cli_tcp.hppD11-Mar-20246.4 KiB16089

cli_udp.cppD11-Mar-20248.3 KiB311206

cli_udp.hppD11-Mar-20243.8 KiB11749

ftd.cmakeD11-Mar-20242 KiB5144

mtd.cmakeD11-Mar-20242 KiB5144

x509_cert_key.hppD11-Mar-20245.3 KiB11847

README.md

1# OpenThread CLI Reference
2
3The OpenThread CLI exposes configuration and management APIs via a command line interface. Use the CLI to play with OpenThread, which can also be used with additional application code. The OpenThread test scripts use the CLI to execute test cases.
4
5## Separator and escaping characters
6
7The whitespace character (`' '`) is used to delimit the command name and the different arguments, together with tab (`'\t'`) and new line characters (`'\r'`, `'\n'`).
8
9Some arguments might require to accept whitespaces on them. For those cases the backslash character (`'\'`) can be used to escape separators or the backslash itself.
10
11Example:
12
13```bash
14> networkname Test\ Network
15Done
16> networkname
17Test Network
18Done
19>
20```
21
22## OpenThread Command List
23
24- [ba](#ba)
25- [bbr](#bbr)
26- [br](#br)
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- [commissioner](README_COMMISSIONER.md)
38- [contextreusedelay](#contextreusedelay)
39- [counters](#counters)
40- [csl](#csl)
41- [dataset](README_DATASET.md)
42- [delaytimermin](#delaytimermin)
43- [diag](#diag)
44- [discover](#discover-channel)
45- [dns](#dns-config)
46- [domainname](#domainname)
47- [dua](#dua-iid)
48- [eidcache](#eidcache)
49- [eui64](#eui64)
50- [extaddr](#extaddr)
51- [extpanid](#extpanid)
52- [factoryreset](#factoryreset)
53- [fake](#fake)
54- [fem](#fem)
55- [history](README_HISTORY.md)
56- [ifconfig](#ifconfig)
57- [ipaddr](#ipaddr)
58- [ipmaddr](#ipmaddr)
59- [joiner](README_JOINER.md)
60- [joinerport](#joinerport-port)
61- [keysequence](#keysequence-counter)
62- [leaderdata](#leaderdata)
63- [leaderweight](#leaderweight)
64- [linkmetrics](#linkmetrics-mgmt-ipaddr-enhanced-ack-clear)
65- [linkquality](#linkquality-extaddr)
66- [log](#log-filename-filename)
67- [mac](#mac-retries-direct)
68- [macfilter](#macfilter)
69- [mliid](#mliid-iid)
70- [mlr](#mlr-reg-ipaddr--timeout)
71- [mode](#mode)
72- [multiradio](#multiradio)
73- [neighbor](#neighbor-list)
74- [netdata](README_NETDATA.md)
75- [netstat](#netstat)
76- [networkdiagnostic](#networkdiagnostic-get-addr-type-)
77- [networkidtimeout](#networkidtimeout)
78- [networkkey](#networkkey)
79- [networkname](#networkname)
80- [networktime](#networktime)
81- [panid](#panid)
82- [parent](#parent)
83- [parentpriority](#parentpriority)
84- [partitionid](#partitionid)
85- [ping](#ping--i-source-ipaddr-size-count-interval-hoplimit-timeout)
86- [pollperiod](#pollperiod-pollperiod)
87- [preferrouterid](#preferrouterid-routerid)
88- [prefix](#prefix)
89- [promiscuous](#promiscuous)
90- [pskc](#pskc--p-keypassphrase)
91- [rcp](#rcp)
92- [region](#region)
93- [releaserouterid](#releaserouterid-routerid)
94- [reset](#reset)
95- [rloc16](#rloc16)
96- [route](#route-add-prefix-s-prf)
97- [router](#router-list)
98- [routerdowngradethreshold](#routerdowngradethreshold)
99- [routereligible](#routereligible)
100- [routerselectionjitter](#routerselectionjitter)
101- [routerupgradethreshold](#routerupgradethreshold)
102- [scan](#scan-channel)
103- [service](#service)
104- [singleton](#singleton)
105- [sntp](#sntp-query-sntp-server-ip-sntp-server-port)
106- [state](#state)
107- [srp](README_SRP.md)
108- [thread](#thread-start)
109- [trel](#trel-enable)
110- [txpower](#txpower)
111- [udp](README_UDP.md)
112- [unsecureport](#unsecureport-add-port)
113- [version](#version)
114
115## OpenThread Command Details
116
117### bbr
118
119Show current Primary Backbone Router information for Thread 1.2 device.
120
121```bash
122> bbr
123BBR Primary:
124server16: 0xE400
125seqno:    10
126delay:    120 secs
127timeout:  300 secs
128Done
129```
130
131```bash
132> bbr
133BBR Primary: None
134Done
135```
136
137### bbr mgmt dua \<status\|coap-code\> [meshLocalIid]
138
139Configure 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.
140
141Only for testing/reference device.
142
143known status value:
144
145- 0: ST_DUA_SUCCESS
146- 1: ST_DUA_REREGISTER
147- 2: ST_DUA_INVALID
148- 3: ST_DUA_DUPLICATE
149- 4: ST_DUA_NO_RESOURCES
150- 5: ST_DUA_BBR_NOT_PRIMARY
151- 6: ST_DUA_GENERAL_FAILURE
152- 160: COAP code 5.00
153
154```bash
155> bbr mgmt dua 1 2f7c235e5025a2fd
156Done
157> bbr mgmt dua 160
158Done
159```
160
161### bbr mgmt mlr listener
162
163Show the Multicast Listeners.
164
165Only for testing/reference Backbone Router device.
166
167```bash
168> bbr mgmt mlr listener
169ff04:0:0:0:0:0:0:abcd 3534000
170ff04:0:0:0:0:0:0:eeee 3537610
171Done
172```
173
174### bbr mgmt mlr listener add \<ipaddr\> \[\<timeout\>\]
175
176Add a Multicast Listener with a given IPv6 multicast address and timeout (in seconds).
177
178Only for testing/reference Backbone Router device.
179
180```bash
181> bbr mgmt mlr listener add ff04::1
182Done
183> bbr mgmt mlr listener add ff04::2 300
184Done
185> bbr mgmt mlr listener
186ff04:0:0:0:0:0:0:2 261
187ff04:0:0:0:0:0:0:1 3522
188Done
189```
190
191### bbr mgmt mlr listener clear
192
193Removes all the Multicast Listeners.
194
195Only for testing/reference Backbone Router device.
196
197```bash
198> bbr mgmt mlr listener clear
199Done
200> bbr mgmt mlr listener
201Done
202```
203
204### bbr mgmt mlr response \<status\>
205
206Configure the response status for the next MLR.req.
207
208Only for testing/reference device.
209
210Known status values:
211
212- 0: ST_MLR_SUCCESS
213- 2: ST_MLR_INVALID
214- 3: ST_MLR_NO_PERSISTENT
215- 4: ST_MLR_NO_RESOURCES
216- 5: ST_MLR_BBR_NOT_PRIMARY
217- 6: ST_MLR_GENERAL_FAILURE
218
219```bash
220> bbr mgmt mlr response 2
221Done
222```
223
224### bbr state
225
226Show local Backbone state ([`Disabled`,`Primary`, `Secondary`]) for Thread 1.2 FTD.
227
228`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
229
230```bash
231> bbr state
232Disabled
233Done
234
235> bbr state
236Primary
237Done
238
239> bbr state
240Secondary
241Done
242```
243
244### bbr enable
245
246Enable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggerred for attached device if there is no Backbone Router Service in Thread Network Data.
247
248`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
249
250```bash
251> bbr enable
252Done
253```
254
255### bbr disable
256
257Disable Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggerred if Backbone Router is Primary state. o `OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
258
259```bash
260> bbr disable
261Done
262```
263
264### bbr register
265
266Register Backbone Router Service for Thread 1.2 FTD. `SRV_DATA.ntf` would be triggerred for attached device.
267
268`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
269
270```bash
271> bbr register
272Done
273```
274
275### bbr config
276
277Show local Backbone Router configuration for Thread 1.2 FTD.
278
279`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
280
281```bash
282> bbr config
283seqno:    10
284delay:    120 secs
285timeout:  300 secs
286Done
287```
288
289### bbr config \[seqno \<seqno\>\] \[delay \<delay\>\] \[timeout \<timeout\>\]
290
291Configure 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.
292
293`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
294
295```bash
296> bbr config seqno 20 delay 30
297Done
298```
299
300### bbr jitter
301
302Show jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
303
304`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
305
306```bash
307> bbr jitter
30820
309Done
310```
311
312### bbr jitter \<jitter\>
313
314Set jitter (in seconds) for Backbone Router registration for Thread 1.2 FTD.
315
316`OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE` is required.
317
318```bash
319> bbr jitter 10
320Done
321```
322
323### ba
324
325Show current Border Agent information.
326
327### ba port
328
329Print border agent service port.
330
331```bash
332> ba port
33349152
334Done
335```
336
337### ba state
338
339Print border agent state.
340
341```bash
342> ba state
343Started
344Done
345```
346
347### br
348
349Enbale/disable the Border Routing functionality.
350
351```bash
352> br enable
353Done
354```
355
356```bash
357> br disable
358Done
359```
360
361### br omrprefix
362
363Get the randomly generated off-mesh-routable prefix of the Border Router.
364
365```bash
366> br omrprefix
367fdfc:1ff5:1512:5622::/64
368Done
369```
370
371### br onlinkprefix
372
373Get the randomly generated on-link prefix of the Border Router.
374
375```bash
376> br onlinkprefix
377fd41:2650:a6f5:0::/64
378Done
379```
380
381### bufferinfo
382
383Show the current message buffer information.
384
385```bash
386> bufferinfo
387total: 40
388free: 40
3896lo send: 0 0
3906lo reas: 0 0
391ip6: 0 0
392mpl: 0 0
393mle: 0 0
394arp: 0 0
395coap: 0 0
396coap secure: 0 0
397application coap: 0 0
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| Extended MAC     |
635+-----+--------+------------+------------+-------+------+-+-+-+---+---+-------+------------------+
636|   1 | 0xc801 |        240 |         24 |     3 |  131 |1|0|0|  3| 0 |     0 | 4ecede68435358ac |
637|   2 | 0xc802 |        240 |          2 |     3 |  131 |0|0|0|  3| 1 |     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
651Net Data: 184
652Timeout: 100
653Age: 0
654Link Quality In: 3
655RSSI: -20
656Done
657```
658
659### childip
660
661Get the list of IP addresses stored for MTD children.
662
663```bash
664> childip
6653401: fdde:ad00:beef:0:3037:3e03:8c5f:bc0c
666Done
667```
668
669### childip max
670
671Get the maximum number of IP addresses that each MTD child may register with this device as parent.
672
673```bash
674> childip max
6754
676Done
677```
678
679### childip max \<count\>
680
681Set 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.
682
683`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
684
685```bash
686> childip max 2
687Done
688```
689
690### childmax
691
692Get the Thread maximum number of allowed children.
693
694```bash
695> childmax
6965
697Done
698```
699
700### childmax \<count\>
701
702Set the Thread maximum number of allowed children.
703
704```bash
705> childmax 2
706Done
707```
708
709### childsupervision interval
710
711Get the Child Supervision Interval value.
712
713Child supervision feature provides a mechanism for parent to ensure that a message is sent to each sleepy child within the supervision interval. If there is no transmission to the child within the supervision interval, OpenThread enqueues and sends a supervision message (a data message with empty payload) to the child. This command can only be used with FTD devices.
714
715```bash
716> childsupervision interval
71730
718Done
719```
720
721### childsupervision interval \<interval\>
722
723Set the Child Supervision Interval value. This command can only be used with FTD devices.
724
725```bash
726> childsupervision interval 30
727Done
728```
729
730### childsupervision checktimeout
731
732Get the Child Supervision Check Timeout value.
733
734If 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).
735
736```bash
737> childsupervision checktimeout
73830
739Done
740```
741
742### childsupervision checktimeout \<timeout\>
743
744Set the Child Supervision Check Timeout value.
745
746```bash
747> childsupervision checktimeout 30
748Done
749```
750
751### childtimeout
752
753Get the Thread Child Timeout value.
754
755```bash
756> childtimeout
757300
758Done
759```
760
761### childtimeout \<timeout\>
762
763Set the Thread Child Timeout value.
764
765```bash
766> childtimeout 300
767Done
768```
769
770### contextreusedelay
771
772Get the CONTEXT_ID_REUSE_DELAY value.
773
774```bash
775> contextreusedelay
77611
777Done
778```
779
780### contextreusedelay \<delay\>
781
782Set the CONTEXT_ID_REUSE_DELAY value.
783
784```bash
785> contextreusedelay 11
786Done
787```
788
789### counters
790
791Get the supported counter names.
792
793```bash
794> counters
795ip
796mac
797mle
798Done
799```
800
801### counters \<countername\>
802
803Get the counter value.
804
805```bash
806> counters mac
807TxTotal: 10
808    TxUnicast: 3
809    TxBroadcast: 7
810    TxAckRequested: 3
811    TxAcked: 3
812    TxNoAckRequested: 7
813    TxData: 10
814    TxDataPoll: 0
815    TxBeacon: 0
816    TxBeaconRequest: 0
817    TxOther: 0
818    TxRetry: 0
819    TxErrCca: 0
820    TxErrBusyChannel: 0
821RxTotal: 2
822    RxUnicast: 1
823    RxBroadcast: 1
824    RxData: 2
825    RxDataPoll: 0
826    RxBeacon: 0
827    RxBeaconRequest: 0
828    RxOther: 0
829    RxAddressFiltered: 0
830    RxDestAddrFiltered: 0
831    RxDuplicated: 0
832    RxErrNoFrame: 0
833    RxErrNoUnknownNeighbor: 0
834    RxErrInvalidSrcAddr: 0
835    RxErrSec: 0
836    RxErrFcs: 0
837    RxErrOther: 0
838Done
839> counters mle
840Role Disabled: 0
841Role Detached: 1
842Role Child: 0
843Role Router: 0
844Role Leader: 1
845Attach Attempts: 1
846Partition Id Changes: 1
847Better Partition Attach Attempts: 0
848Parent Changes: 0
849Done
850> counters ip
851TxSuccess: 10
852TxFailed: 0
853RxSuccess: 5
854RxFailed: 0
855Done
856```
857
858### counters \<countername\> reset
859
860Reset the counter value.
861
862```bash
863> counters mac reset
864Done
865> counters mle reset
866Done
867> counters ip reset
868Done
869```
870
871### csl
872
873Get the CSL configuration.
874
875```bash
876> csl
877Channel: 11
878Period: 1000 (in units of 10 symbols), 160ms
879Timeout: 1000s
880Done
881```
882
883### csl channel \<channel\>
884
885Set CSL channel.
886
887```bash
888> csl channel 20
889Done
890```
891
892### csl period \<period\>
893
894Set CSL period in units of 10 symbols. Disable CSL by setting this parameter to `0`.
895
896```bash
897> csl period 3000
898Done
899```
900
901### csl timeout \<timeout\>
902
903Set the CSL timeout in seconds.
904
905```bash
906> csl timeout 10
907Done
908```
909
910### networktime
911
912Get the Thread network time and the time sync parameters.
913
914```bash
915> networktime
916Network Time:     21084154us (synchronized)
917Time Sync Period: 100s
918XTAL Threshold:   300ppm
919Done
920```
921
922### networktime \<timesyncperiod\> \<xtalthreshold\>
923
924Set time sync parameters
925
926- timesyncperiod: The time synchronization period, in seconds.
927- xtalthreshold: The XTAL accuracy threshold for a device to become Router-Capable device, in PPM.
928
929```bash
930> networktime 100 300
931Done
932```
933
934### delaytimermin
935
936Get the minimal delay timer (in seconds).
937
938```bash
939> delaytimermin
94030
941Done
942```
943
944### delaytimermin \<delaytimermin\>
945
946Set the minimal delay timer (in seconds).
947
948```bash
949> delaytimermin 60
950Done
951```
952
953### discover \[channel\]
954
955Perform an MLE Discovery operation.
956
957- channel: The channel to discover on. If no channel is provided, the discovery will cover all valid channels.
958
959```bash
960> discover
961| J | Network Name     | Extended PAN     | PAN  | MAC Address      | Ch | dBm | LQI |
962+---+------------------+------------------+------+------------------+----+-----+-----+
963| 0 | OpenThread       | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 |   0 |
964Done
965```
966
967### dns config
968
969Get the default query config used by DNS client.
970
971The config includes the server IPv6 address and port, response timeout in msec (wait time to rx response), maximum tx attempts before reporting failure, boolean flag to indicate whether the server can resolve the query recursively or not.
972
973```bash
974> dns config
975Server: [fd00:0:0:0:0:0:0:1]:1234
976ResponseTimeout: 5000 ms
977MaxTxAttempts: 2
978RecursionDesired: no
979Done
980>
981```
982
983### dns config \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
984
985Set the default query config.
986
987```bash
988> dns config fd00::1 1234 5000 2 0
989Done
990
991> dns config
992Server: [fd00:0:0:0:0:0:0:1]:1234
993ResponseTimeout: 5000 ms
994MaxTxAttempts: 2
995RecursionDesired: no
996Done
997```
998
999We 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.
1000
1001```bash
1002> dns config fd00::2
1003Done
1004
1005> dns config
1006Server: [fd00:0:0:0:0:0:0:2]:53
1007ResponseTimeout: 3000 ms
1008MaxTxAttempts: 3
1009RecursionDesired: yes
1010Done
1011```
1012
1013### dns resolve \<hostname\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1014
1015Send DNS Query to obtain IPv6 address for given hostname.
1016
1017The 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`).
1018
1019```bash
1020> dns resolve ipv6.google.com
1021> DNS response for ipv6.google.com - 2a00:1450:401b:801:0:0:0:200e TTL: 300
1022```
1023
1024### dns browse \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1025
1026Send a browse (service instance enumeration) DNS query to get the list of services for given service-name.
1027
1028The 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`).
1029
1030```bash
1031> dns browse _service._udp.example.com
1032DNS browse response for _service._udp.example.com.
1033inst1
1034    Port:1234, Priority:1, Weight:2, TTL:7200
1035    Host:host.example.com.
1036    HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1037    TXT:[a=6531, b=6c12] TTL:7300
1038instance2
1039    Port:1234, Priority:1, Weight:2, TTL:7200
1040    Host:host.example.com.
1041    HostAddress:fd00:0:0:0:0:0:0:abcd TTL:7200
1042    TXT:[a=1234] TTL:7300
1043Done
1044```
1045
1046### dns service \<service-instance-label\> \<service-name\> \[DNS server IP\] \[DNS server port\] \[response timeout (ms)\] \[max tx attempts\] \[recursion desired (boolean)\]
1047
1048Send 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).
1049
1050The 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`).
1051
1052### dns compression \[enable|disable\]
1053
1054Enable/Disable the "DNS name compression" mode.
1055
1056By 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.
1057
1058This is intended for testing only and available under `REFERENCE_DEVICE` config.
1059
1060Get the current "DNS name compression" mode.
1061
1062```
1063> dns compression
1064Enabled
1065```
1066
1067Set the "DNS name compression" mode.
1068
1069```
1070> dns compression disable
1071Done
1072>
1073>
1074> dns compression
1075Disabled
1076Done
1077```
1078
1079### domainname
1080
1081Get the Thread Domain Name for Thread 1.2 device.
1082
1083```bash
1084> domainname
1085Thread
1086Done
1087```
1088
1089### domainname \<name\>
1090
1091Set the Thread Domain Name for Thread 1.2 device.
1092
1093```bash
1094> domainname Test\ Thread
1095Done
1096```
1097
1098### dua iid
1099
1100Get the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1101
1102```bash
1103> dua iid
11040004000300020001
1105Done
1106```
1107
1108### dua iid \<iid\>
1109
1110Set the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1111
1112```bash
1113> dua iid 0004000300020001
1114Done
1115```
1116
1117### dua iid clear
1118
1119Clear the Interface Identifier mannually specified for Thread Domain Unicast Address on Thread 1.2 device.
1120
1121```bash
1122> dua iid clear
1123Done
1124```
1125
1126### eidcache
1127
1128Print the EID-to-RLOC cache entries.
1129
1130```bash
1131> eidcache
1132fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d 2000 cache canEvict=1 transTime=0 eid=fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7d
1133fd49:caf4:a29f:dc0e:97fc:69dd:3c16:df7f fffe retry canEvict=1 timeout=10 retryDelay=30
1134Done
1135```
1136
1137### eui64
1138
1139Get the factory-assigned IEEE EUI-64.
1140
1141```bash
1142> eui64
11430615aae900124b00
1144Done
1145```
1146
1147### extaddr
1148
1149Get the IEEE 802.15.4 Extended Address.
1150
1151```bash
1152> extaddr
1153dead00beef00cafe
1154Done
1155```
1156
1157### extaddr \<extaddr\>
1158
1159Set the IEEE 802.15.4 Extended Address.
1160
1161```bash
1162> extaddr dead00beef00cafe
1163dead00beef00cafe
1164Done
1165```
1166
1167### extpanid
1168
1169Get the Thread Extended PAN ID value.
1170
1171**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1172
1173```bash
1174> extpanid
1175dead00beef00cafe
1176Done
1177```
1178
1179### extpanid \<extpanid\>
1180
1181Set the Thread Extended PAN ID value.
1182
1183```bash
1184> extpanid dead00beef00cafe
1185Done
1186```
1187
1188### factoryreset
1189
1190Delete all stored settings, and signal a platform reset.
1191
1192```bash
1193> factoryreset
1194```
1195
1196### fake
1197
1198Send fake Thread messages.
1199
1200Note: Only for certification test.
1201
1202#### fake /a/an \<dst-ipaddr\> \<target\> \<meshLocalIid\>
1203
1204```bash
1205> fake /a/an fdde:ad00:beef:0:0:ff:fe00:a800 fd00:7d03:7d03:7d03:55f2:bb6a:7a43:a03b 1111222233334444
1206Done
1207```
1208
1209### fem
1210
1211Get external FEM parameters.
1212
1213```bash
1214> fem
1215LNA gain 11 dBm
1216Done
1217```
1218
1219### fem lnagain
1220
1221Get the Rx LNA gain in dBm of the external FEM.
1222
1223```bash
1224> fem lnagain
122511
1226Done
1227```
1228
1229### fem lnagain \<LNA gain\>
1230
1231Set the Rx LNA gain in dBm of the external FEM.
1232
1233```bash
1234> fem lnagain 8
1235Done
1236```
1237
1238### ifconfig
1239
1240Show the status of the IPv6 interface.
1241
1242```bash
1243> ifconfig
1244down
1245Done
1246```
1247
1248### ifconfig up
1249
1250Bring up the IPv6 interface.
1251
1252```bash
1253> ifconfig up
1254Done
1255```
1256
1257### ifconfig down
1258
1259Bring down the IPv6 interface.
1260
1261```bash
1262> ifconfig down
1263Done
1264```
1265
1266### ipaddr
1267
1268List all IPv6 addresses assigned to the Thread interface.
1269
1270```bash
1271> ipaddr
1272fdde:ad00:beef:0:0:ff:fe00:0
1273fdde:ad00:beef:0:558:f56b:d688:799
1274fe80:0:0:0:f3d9:2a82:c8d8:fe43
1275Done
1276```
1277
1278### ipaddr add \<ipaddr\>
1279
1280Add an IPv6 address to the Thread interface.
1281
1282```bash
1283> ipaddr add 2001::dead:beef:cafe
1284Done
1285```
1286
1287### ipaddr del \<ipaddr\>
1288
1289Delete an IPv6 address from the Thread interface.
1290
1291```bash
1292> ipaddr del 2001::dead:beef:cafe
1293Done
1294```
1295
1296### ipaddr linklocal
1297
1298Print Thread link-local IPv6 address.
1299
1300```bash
1301> ipaddr linklocal
1302fe80:0:0:0:f3d9:2a82:c8d8:fe43
1303Done
1304```
1305
1306### ipaddr mleid
1307
1308Print Thread Mesh Local EID address.
1309
1310```bash
1311> ipaddr mleid
1312fdde:ad00:beef:0:558:f56b:d688:799
1313Done
1314```
1315
1316### ipaddr rloc
1317
1318Print Thread Routing Locator (RLOC) address.
1319
1320```bash
1321> ipaddr rloc
1322fdde:ad00:beef:0:0:ff:fe00:0
1323Done
1324```
1325
1326### ipmaddr
1327
1328List all IPv6 multicast addresses subscribed to the Thread interface.
1329
1330```bash
1331> ipmaddr
1332ff05:0:0:0:0:0:0:1
1333ff33:40:fdde:ad00:beef:0:0:1
1334ff32:40:fdde:ad00:beef:0:0:1
1335Done
1336```
1337
1338### ipmaddr add \<ipaddr\>
1339
1340Subscribe the Thread interface to the IPv6 multicast address.
1341
1342```bash
1343> ipmaddr add ff05::1
1344Done
1345```
1346
1347### ipmaddr del \<ipaddr\>
1348
1349Unsubscribe the Thread interface to the IPv6 multicast address.
1350
1351```bash
1352> ipmaddr del ff05::1
1353Done
1354```
1355
1356### ipmaddr llatn
1357
1358Get the Link-Local All Thread Nodes multicast address.
1359
1360```
1361> ipmaddr llatn
1362ff32:40:fdde:ad00:beef:0:0:1
1363Done
1364```
1365
1366### ipmaddr promiscuous
1367
1368Get multicast promiscuous mode.
1369
1370```bash
1371> ipmaddr promiscuous
1372Disabled
1373Done
1374```
1375
1376### ipmaddr promiscuous enable
1377
1378Enable multicast promiscuous mode.
1379
1380```bash
1381> ipmaddr promiscuous enable
1382Done
1383```
1384
1385### ipmaddr promiscuous disable
1386
1387Disable multicast promiscuous mode.
1388
1389```bash
1390> ipmaddr promiscuous disable
1391Done
1392```
1393
1394### ipmaddr rlatn
1395
1396Get the Realm-Local All Thread Nodes multicast address.
1397
1398```
1399> ipmaddr rlatn
1400ff33:40:fdde:ad00:beef:0:0:1
1401Done
1402```
1403
1404### joinerport \<port\>
1405
1406Set the Joiner port.
1407
1408```bash
1409> joinerport 1000
1410Done
1411```
1412
1413### keysequence counter
1414
1415Get the Thread Key Sequence Counter.
1416
1417```bash
1418> keysequence counter
141910
1420Done
1421```
1422
1423### keysequence counter \<counter\>
1424
1425Set the Thread Key Sequence Counter.
1426
1427```bash
1428> keysequence counter 10
1429Done
1430```
1431
1432### keysequence guardtime
1433
1434Get Thread Key Switch Guard Time (in hours)
1435
1436```bash
1437> keysequence guardtime
14380
1439Done
1440```
1441
1442### keysequence guardtime \<guardtime\>
1443
1444Set Thread Key Switch Guard Time (in hours) 0 means Thread Key Switch imediately if key index match
1445
1446```bash
1447> keysequence guardtime 0
1448Done
1449```
1450
1451### leaderdata
1452
1453Show the Thread Leader Data.
1454
1455```bash
1456> leaderdata
1457Partition ID: 1077744240
1458Weighting: 64
1459Data Version: 109
1460Stable Data Version: 211
1461Leader Router ID: 60
1462Done
1463```
1464
1465### leaderweight
1466
1467Get the Thread Leader Weight.
1468
1469```bash
1470> leaderweight
1471128
1472Done
1473```
1474
1475### leaderweight \<weight\>
1476
1477Set the Thread Leader Weight.
1478
1479```bash
1480> leaderweight 128
1481Done
1482```
1483
1484### linkmetrics mgmt \<ipaddr\> enhanced-ack clear
1485
1486Send a Link Metrics Management Request to clear an Enhanced-ACK Based Probing.
1487
1488- ipaddr: Peer address (SHOULD be link local address of the neighboring device).
1489
1490```bash
1491> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack clear
1492Done
1493> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1494Status: Success
1495```
1496
1497### linkmetrics mgmt \<ipaddr\> enhanced-ack register [qmr][r]
1498
1499Send a Link Metrics Management Request to register an Enhanced-ACK Based Probing.
1500
1501- ipaddr: Peer address.
1502- qmr: This specifies what metrics to query. At most two options are allowed to select (per spec 4.11.3.4.4.6).
1503  - q: Layer 2 LQI.
1504  - m: Link Margin.
1505  - r: RSSI.
1506- 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.
1507
1508```bash
1509> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm
1510Done
1511> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1512Status: Success
1513
1514> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 enhanced-ack register qm r
1515Done
1516> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1517Status: Cannot support new series
1518```
1519
1520### linkmetrics mgmt \<ipaddr\> forward \<seriesid\> [ldraX][pqmr]
1521
1522Send a Link Metrics Management Request to configure a Forward Tracking Series.
1523
1524- ipaddr: Peer address.
1525- seriesid: The Series ID.
1526- ldraX: This specifies which frames are to be accounted.
1527  - l: MLE Link Probe.
1528  - d: MAC Data.
1529  - r: MAC Data Request.
1530  - a: MAC Ack.
1531  - 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.
1532- pqmr: This specifies what metrics to query.
1533  - p: Layer 2 Number of PDUs received.
1534  - q: Layer 2 LQI.
1535  - m: Link Margin.
1536  - r: RSSI.
1537
1538```bash
1539> linkmetrics mgmt fe80:0:0:0:3092:f334:1455:1ad2 forward 1 dra pqmr
1540Done
1541> Received Link Metrics Management Response from: fe80:0:0:0:3092:f334:1455:1ad2
1542Status: SUCCESS
1543```
1544
1545### linkmetrics probe \<ipaddr\> \<seriesid\> \<length\>
1546
1547Send a MLE Link Probe message to the peer.
1548
1549- ipaddr: Peer address.
1550- seriesid: The Series ID for which this Probe message targets at.
1551- length: The length of the Probe message, valid range: [0, 64].
1552
1553```bash
1554> linkmetrics probe fe80:0:0:0:3092:f334:1455:1ad2 1 10
1555Done
1556```
1557
1558### linkmetrics query \<ipaddr\> single [pqmr]
1559
1560Perform a Link Metrics query (Single Probe).
1561
1562- ipaddr: Peer address.
1563- pqmr: This specifies what metrics to query.
1564- p: Layer 2 Number of PDUs received.
1565- q: Layer 2 LQI.
1566- m: Link Margin.
1567- r: RSSI.
1568
1569```bash
1570> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 single qmr
1571Done
1572> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1573
1574 - LQI: 76 (Exponential Moving Average)
1575 - Margin: 82 (dB) (Exponential Moving Average)
1576 - RSSI: -18 (dBm) (Exponential Moving Average)
1577```
1578
1579### linkmetrics query \<ipaddr\> forward \<seriesid\>
1580
1581Perform a Link Metrics query (Forward Tracking Series).
1582
1583- ipaddr: Peer address.
1584- seriesid: The Series ID.
1585
1586```bash
1587> linkmetrics query fe80:0:0:0:3092:f334:1455:1ad2 forward 1
1588Done
1589> Received Link Metrics Report from: fe80:0:0:0:3092:f334:1455:1ad2
1590
1591 - PDU Counter: 2 (Count/Summation)
1592 - LQI: 76 (Exponential Moving Average)
1593 - Margin: 82 (dB) (Exponential Moving Average)
1594 - RSSI: -18 (dBm) (Exponential Moving Average)
1595```
1596
1597### linkquality \<extaddr\>
1598
1599Get the link quality on the link to a given extended address.
1600
1601```bash
1602> linkquality 36c1dd7a4f5201ff
16033
1604Done
1605```
1606
1607### linkquality \<extaddr\> \<linkquality\>
1608
1609Set the link quality on the link to a given extended address.
1610
1611```bash
1612> linkquality 36c1dd7a4f5201ff 3
1613Done
1614```
1615
1616### log filename \<filename\>
1617
1618- Note: Simulation Only, ie: `OPENTHREAD_EXAMPLES_SIMULATION`
1619- Requires `OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART`
1620
1621Specifies filename to capture otPlatLog() messages, useful when debugging automated test scripts on Linux when logging disrupts the automated test scripts.
1622
1623### log level
1624
1625Get the log level.
1626
1627```bash
1628> log level
16291
1630Done
1631```
1632
1633### log level \<level\>
1634
1635Set the log level.
1636
1637```bash
1638> log level 4
1639Done
1640```
1641
1642### mliid \<iid\>
1643
1644Set the Mesh Local IID.
1645
1646It must be used before Thread stack is enabled.
1647
1648Only for testing/reference device.
1649
1650```bash
1651> mliid 1122334455667788
1652Done
1653```
1654
1655### mlr reg \<ipaddr\> ... [timeout]
1656
1657Register Multicast Listeners to Primary Backbone Router, with an optional `timeout` (in seconds).
1658
1659Omit `timeout` to use the default MLR timeout on the Primary Backbone Router.
1660
1661Use `timeout = 0` to deregister Multicast Listeners.
1662
1663NOTE: Only for Thread 1.2 Commissioner FTD device.
1664
1665```bash
1666> mlr reg ff04::1
1667status 0, 0 failed
1668Done
1669> mlr reg ff04::1 ff04::2 ff02::1
1670status 2, 1 failed
1671ff02:0:0:0:0:0:0:1
1672Done
1673> mlr reg ff04::1 ff04::2 1000
1674status 0, 0 failed
1675Done
1676> mlr reg ff04::1 ff04::2 0
1677status 0, 0 failed
1678Done
1679```
1680
1681### mode
1682
1683Get the Thread Device Mode value.
1684
1685- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
1686- r: rx-on-when-idle
1687- d: Full Thread Device
1688- n: Full Network Data
1689
1690```bash
1691> mode
1692rdn
1693Done
1694```
1695
1696### mode [rdn]
1697
1698Set the Thread Device Mode value.
1699
1700- -: no flags set (rx-off-when-idle, minimal Thread device, stable network data)
1701- r: rx-on-when-idle
1702- d: Full Thread Device
1703- n: Full Network Data
1704
1705```bash
1706> mode rdn
1707Done
1708```
1709
1710```bash
1711> mode -
1712Done
1713```
1714
1715### multiradio
1716
1717Get the list of supported radio links by the device.
1718
1719This command is always available, even when only a single radio is supported by the device.
1720
1721```bash
1722> multiradio
1723[15.4, TREL]
1724Done
1725```
1726
1727### multiradio neighbor list
1728
1729Get the list of neighbors and their supported radios and their preference.
1730
1731This command is only available when device supports more than one radio link.
1732
1733```bash
1734> multiradio neighbor list
1735ExtAddr:3a65bc38dbe4a5be, RLOC16:0xcc00, Radios:[15.4(255), TREL(255)]
1736ExtAddr:17df23452ee4a4be, RLOC16:0x1300, Radios:[15.4(255)]
1737Done
1738```
1739
1740### multiradio neighbor \<ext address\>
1741
1742Get the radio info for specific neighbor with a given extended address.
1743
1744This command is only available when device supports more than one radio link.
1745
1746```bash
1747> multiradio neighbor 3a65bc38dbe4a5be
1748[15.4(255), TREL(255)]
1749Done
1750```
1751
1752### neighbor list
1753
1754List RLOC16 of neighbors.
1755
1756```bash
1757> neighbor list
17580xcc01 0xc800 0xf000
1759Done
1760```
1761
1762### neighbor table
1763
1764Print table of neighbors.
1765
1766```bash
1767> neighbor table
1768| Role | RLOC16 | Age | Avg RSSI | Last RSSI |R|D|N| Extended MAC     |
1769+------+--------+-----+----------+-----------+-+-+-+------------------+
1770|   C  | 0xcc01 |  96 |      -46 |       -46 |1|1|1| 1eb9ba8a6522636b |
1771|   R  | 0xc800 |   2 |      -29 |       -29 |1|1|1| 9a91556102c39ddb |
1772|   R  | 0xf000 |   3 |      -28 |       -28 |1|1|1| 0ad7ed6beaa6016d |
1773Done
1774```
1775
1776### netstat
1777
1778List all UDP sockets.
1779
1780```bash
1781> netstat
1782| Local Address                                   | Peer Address                                    |
1783+-------------------------------------------------+-------------------------------------------------+
1784| [0:0:0:0:0:0:0:0]:49153                         | [0:0:0:0:0:0:0:0]:0                             |
1785| [0:0:0:0:0:0:0:0]:49152                         | [0:0:0:0:0:0:0:0]:0                             |
1786| [0:0:0:0:0:0:0:0]:61631                         | [0:0:0:0:0:0:0:0]:0                             |
1787| [0:0:0:0:0:0:0:0]:19788                         | [0:0:0:0:0:0:0:0]:0                             |
1788Done
1789```
1790
1791### networkdiagnostic get \<addr\> \<type\> ..
1792
1793Send network diagnostic request to retrieve tlv of \<type\>s.
1794
1795If \<addr\> is unicast address, `Diagnostic Get` will be sent. if \<addr\> is multicast address, `Diagnostic Query` will be sent.
1796
1797```bash
1798> networkdiagnostic get fdde:ad00:beef:0:0:ff:fe00:fc00 0 1 6
1799> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c000608640b0f674074c503
1800Ext Address: '0e336e1c41494e1c'
1801Rloc16: 0x0c00
1802Leader Data:
1803    PartitionId: 0x640b0f67
1804    Weighting: 64
1805    DataVersion: 116
1806    StableDataVersion: 197
1807    LeaderRouterId: 0x03
1808Done
1809
1810> networkdiagnostic get ff02::1 0 1
1811> DIAG_GET.rsp/ans: 00080e336e1c41494e1c01020c00
1812Ext Address: '0e336e1c41494e1c'
1813Rloc16: 0x0c00
1814Done
1815DIAG_GET.rsp/ans: 00083efcdb7e3f9eb0f201021800
1816Ext Address: '3efcdb7e3f9eb0f2'
1817Rloc16: 0x1800
1818Done
1819```
1820
1821### networkdiagnostic reset \<addr\> \<type\> ..
1822
1823Send network diagnostic request to reset \<addr\>'s tlv of \<type\>s. Currently only `MAC Counters`(9) is supported.
1824
1825```bash
1826> diagnostic reset fd00:db8::ff:fe00:0 9
1827Done
1828```
1829
1830### networkidtimeout
1831
1832Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
1833
1834```bash
1835> networkidtimeout
1836120
1837Done
1838```
1839
1840### networkidtimeout \<timeout\>
1841
1842Set the NETWORK_ID_TIMEOUT parameter used in the Router role.
1843
1844```bash
1845> networkidtimeout 120
1846Done
1847```
1848
1849### networkkey
1850
1851Get the Thread Network Key value.
1852
1853```bash
1854> networkkey
185500112233445566778899aabbccddeeff
1856Done
1857```
1858
1859### networkkey \<key\>
1860
1861Set the Thread Network Key value.
1862
1863```bash
1864> networkkey 00112233445566778899aabbccddeeff
1865Done
1866```
1867
1868### networkname
1869
1870Get the Thread Network Name.
1871
1872```bash
1873> networkname
1874OpenThread
1875Done
1876```
1877
1878### networkname \<name\>
1879
1880Set the Thread Network Name.
1881
1882**NOTE** The current commissioning credential becomes stale after changing this value. Use [pskc](#pskc--p-keypassphrase) to reset.
1883
1884```bash
1885> networkname OpenThread
1886Done
1887```
1888
1889### panid
1890
1891Get the IEEE 802.15.4 PAN ID value.
1892
1893```bash
1894> panid
18950xdead
1896Done
1897```
1898
1899### panid \<panid\>
1900
1901Set the IEEE 802.15.4 PAN ID value.
1902
1903```bash
1904> panid 0xdead
1905Done
1906```
1907
1908### parent
1909
1910Get the diagnostic information for a Thread Router as parent.
1911
1912Note: When operating as a Thread Router, 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.
1913
1914```bash
1915> parent
1916Ext Addr: be1857c6c21dce55
1917Rloc: 5c00
1918Link Quality In: 3
1919Link Quality Out: 3
1920Age: 20
1921Done
1922```
1923
1924### parentpriority
1925
1926Get the assigned parent priority value, -2 means not assigned.
1927
1928```bash
1929> parentpriority
19301
1931Done
1932```
1933
1934### parentpriority \<parentpriority\>
1935
1936Set the assigned parent priority value: 1, 0, -1 or -2.
1937
1938```bash
1939> parentpriority 1
1940Done
1941```
1942
1943### partitionid
1944
1945Get the Thread Network Partition ID.
1946
1947```bash
1948> partitionid
19494294967295
1950Done
1951```
1952
1953### partitionid preferred
1954
1955Get the preferred Thread Leader Partition ID.
1956
1957`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
1958
1959```bash
1960> partitionid preferred
19614294967295
1962Done
1963```
1964
1965### partitionid preferred \<partitionid\>
1966
1967Set the preferred Thread Leader Partition ID.
1968
1969`OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` is required.
1970
1971```bash
1972> partitionid preferred 0xffffffff
1973Done
1974```
1975
1976### ping \[-I source\] \<ipaddr\> \[size\] \[count\] \[interval\] \[hoplimit\] \[timeout\]
1977
1978Send an ICMPv6 Echo Request.
1979
1980- source: The source IPv6 address of the echo request.
1981- size: The number of data bytes to be sent.
1982- count: The number of ICMPv6 Echo Requests to be sent.
1983- interval: The interval between two consecutive ICMPv6 Echo Requests in seconds. The value may have fractional form, for example `0.5`.
1984- hoplimit: The hoplimit of ICMPv6 Echo Request to be sent.
1985- 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`.
1986
1987```bash
1988> ping fd00:db8:0:0:76b:6a05:3ae9:a61a
1989> 16 bytes from fd00:db8:0:0:76b:6a05:3ae9:a61a: icmp_seq=5 hlim=64 time=0ms
19901 packets transmitted, 1 packets received. Packet loss = 0.0%. Round-trip min/avg/max = 0/0.0/0 ms.
1991Done
1992
1993> ping -I fd00:db8:0:0:76b:6a05:3ae9:a61a ff02::1 100 1 1 1
1994> 108 bytes from fd00:db8:0:0:f605:fb4b:d429:d59a: icmp_seq=4 hlim=64 time=7ms
19951 packets transmitted, 1 packets received. Round-trip min/avg/max = 7/7.0/7 ms.
1996Done
1997```
1998
1999### ping stop
2000
2001Stop sending ICMPv6 Echo Requests.
2002
2003```bash
2004> ping stop
2005Done
2006```
2007
2008### pollperiod
2009
2010Get the customized data poll period of sleepy end device (milliseconds). Only for certification test
2011
2012```bash
2013> pollperiod
20140
2015Done
2016```
2017
2018### pollperiod \<pollperiod\>
2019
2020Set the customized data poll period for sleepy end device (milliseconds >= 10ms). Only for certification test
2021
2022```bash
2023> pollperiod 10
2024Done
2025```
2026
2027### pskc [-p] \<key\>|\<passphrase\>
2028
2029With `-p` generate pskc from \<passphrase\> (UTF-8 encoded) together with **current** network name and extended PAN ID, otherwise set pskc as \<key\> (hex format).
2030
2031```bash
2032> pskc 67c0c203aa0b042bfb5381c47aef4d9e
2033Done
2034> pskc -p 123456
2035Done
2036```
2037
2038### preferrouterid \<routerid\>
2039
2040Prefer a Router ID when solicit router id from Leader.
2041
2042```bash
2043> preferrouterid 16
2044Done
2045```
2046
2047### prefix
2048
2049Get the prefix list in the local Network Data. Note: For the Thread 1.2 border router with backbone capability, the local Domain Prefix would be listed as well (with flag `D`), with preceeding `-` if backbone functionality is disabled.
2050
2051```bash
2052> prefix
20532001:dead:beef:cafe::/64 paros med
2054- fd00:7d03:7d03:7d03::/64 prosD med
2055Done
2056```
2057
2058### prefix add \<prefix\> [padcrosnD][prf]
2059
2060Add a valid prefix to the Network Data.
2061
2062Note: The Domain Prefix flag (`D`) is only available for Thread 1.2.
2063
2064- p: Preferred flag
2065- a: Stateless IPv6 Address Autoconfiguration flag
2066- d: DHCPv6 IPv6 Address Configuration flag
2067- c: DHCPv6 Other Configuration flag
2068- r: Default Route flag
2069- o: On Mesh flag
2070- s: Stable flag
2071- n: Nd Dns flag
2072- D: Domain Prefix flag
2073- prf: Default router preference, which may be 'high', 'med', or 'low'.
2074
2075```bash
2076> prefix add 2001:dead:beef:cafe::/64 paros med
2077Done
2078
2079> prefix add fd00:7d03:7d03:7d03::/64 prosD med
2080Done
2081```
2082
2083### prefix meshlocal
2084
2085Get the mesh local prefix.
2086
2087```bash
2088> prefix meshlocal
2089fdde:ad00:beef:0::/64
2090Done
2091```
2092
2093### prefix remove \<prefix\>
2094
2095Invalidate a prefix in the Network Data.
2096
2097```bash
2098> prefix remove 2001:dead:beef:cafe::/64
2099Done
2100```
2101
2102### promiscuous
2103
2104Get radio promiscuous property.
2105
2106```bash
2107> promiscuous
2108Disabled
2109Done
2110```
2111
2112### promiscuous enable
2113
2114Enable radio promiscuous operation and print raw packet content.
2115
2116```bash
2117> promiscuous enable
2118Done
2119```
2120
2121### promiscuous disable
2122
2123Disable radio promiscuous operation.
2124
2125```bash
2126> promiscuous disable
2127Done
2128```
2129
2130### rcp
2131
2132RCP-related commands.
2133
2134### region
2135
2136Set the radio region, this can affect the transmit power limit.
2137
2138```bash
2139> region US
2140Done
2141> region
2142US
2143Done
2144```
2145
2146### rcp version
2147
2148Print RCP version string.
2149
2150```bash
2151> rcp version
2152OPENTHREAD/20191113-00825-g82053cc9d-dirty; SIMULATION; Jun  4 2020 17:53:16
2153Done
2154```
2155
2156### releaserouterid \<routerid\>
2157
2158Release a Router ID that has been allocated by the device in the Leader role.
2159
2160```bash
2161> releaserouterid 16
2162Done
2163```
2164
2165### reset
2166
2167Signal a platform reset.
2168
2169```bash
2170> reset
2171```
2172
2173### rloc16
2174
2175Get the Thread RLOC16 value.
2176
2177```bash
2178> rloc16
21790xdead
2180Done
2181```
2182
2183### route
2184
2185Get the external route list in the local Network Data.
2186
2187```bash
2188> route
21892001:dead:beef:cafe::/64 s med
2190Done
2191```
2192
2193### route add \<prefix\> [sn][prf]
2194
2195Add a valid external route to the Network Data.
2196
2197- s: Stable flag
2198- n: NAT64 flag
2199- prf: Default Router Preference, which may be: 'high', 'med', or 'low'.
2200
2201```bash
2202> route add 2001:dead:beef:cafe::/64 s med
2203Done
2204```
2205
2206### route remove \<prefix\>
2207
2208Invalidate a external route in the Network Data.
2209
2210```bash
2211> route remove 2001:dead:beef:cafe::/64
2212Done
2213```
2214
2215### router list
2216
2217List allocated Router IDs.
2218
2219```bash
2220> router list
22218 24 50
2222Done
2223```
2224
2225### router table
2226
2227Print table of routers.
2228
2229```bash
2230> router table
2231| ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC     | Link |
2232+----+--------+----------+-----------+-------+--------+-----+------------------+------+
2233| 22 | 0x5800 |       63 |         0 |     0 |      0 |   0 | 0aeb8196c9f61658 |    0 |
2234| 49 | 0xc400 |       63 |         0 |     3 |      3 |   0 | faa1c03908e2dbf2 |    1 |
2235Done
2236```
2237
2238### router \<id\>
2239
2240Print diagnostic information for a Thread Router. The `id` may be a Router ID or an RLOC16.
2241
2242```bash
2243> router 50
2244Alloc: 1
2245Router ID: 50
2246Rloc: c800
2247Next Hop: c800
2248Link: 1
2249Ext Addr: e2b3540590b0fd87
2250Cost: 0
2251Link Quality In: 3
2252Link Quality Out: 3
2253Age: 3
2254Done
2255```
2256
2257```bash
2258> router 0xc800
2259Alloc: 1
2260Router ID: 50
2261Rloc: c800
2262Next Hop: c800
2263Link: 1
2264Ext Addr: e2b3540590b0fd87
2265Cost: 0
2266Link Quality In: 3
2267Link Quality Out: 3
2268Age: 7
2269Done
2270```
2271
2272### routerdowngradethreshold
2273
2274Get the ROUTER_DOWNGRADE_THRESHOLD value.
2275
2276```bash
2277> routerdowngradethreshold
227823
2279Done
2280```
2281
2282### routerdowngradethreshold \<threshold\>
2283
2284Set the ROUTER_DOWNGRADE_THRESHOLD value.
2285
2286```bash
2287> routerdowngradethreshold 23
2288Done
2289```
2290
2291### routereligible
2292
2293Indicates whether the router role is enabled or disabled.
2294
2295```bash
2296> routereligible
2297Enabled
2298Done
2299```
2300
2301### routereligible enable
2302
2303Enable the router role.
2304
2305```bash
2306> routereligible enable
2307Done
2308```
2309
2310### routereligible disable
2311
2312Disable the router role.
2313
2314```bash
2315> routereligible disable
2316Done
2317```
2318
2319### routerselectionjitter
2320
2321Get the ROUTER_SELECTION_JITTER value.
2322
2323```bash
2324> routerselectionjitter
2325120
2326Done
2327```
2328
2329### routerselectionjitter \<jitter\>
2330
2331Set the ROUTER_SELECTION_JITTER value.
2332
2333```bash
2334> routerselectionjitter 120
2335Done
2336```
2337
2338### routerupgradethreshold
2339
2340Get the ROUTER_UPGRADE_THRESHOLD value.
2341
2342```bash
2343> routerupgradethreshold
234416
2345Done
2346```
2347
2348### routerupgradethreshold \<threshold\>
2349
2350Set the ROUTER_UPGRADE_THRESHOLD value.
2351
2352```bash
2353> routerupgradethreshold 16
2354Done
2355```
2356
2357### scan \[channel\]
2358
2359Perform an IEEE 802.15.4 Active Scan.
2360
2361- channel: The channel to scan on. If no channel is provided, the active scan will cover all valid channels.
2362
2363```bash
2364> scan
2365| J | Network Name     | Extended PAN     | PAN  | MAC Address      | Ch | dBm | LQI |
2366+---+------------------+------------------+------+------------------+----+-----+-----+
2367| 0 | OpenThread       | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 |   0 |
2368Done
2369```
2370
2371### scan energy \[duration\] \[channel\]
2372
2373Perform an IEEE 802.15.4 Energy Scan.
2374
2375- duration: The time in milliseconds to spend scanning each channel.
2376
2377```bash
2378> scan energy 10
2379| Ch | RSSI |
2380+----+------+
2381| 11 |  -59 |
2382| 12 |  -62 |
2383| 13 |  -67 |
2384| 14 |  -61 |
2385| 15 |  -87 |
2386| 16 |  -86 |
2387| 17 |  -86 |
2388| 18 |  -52 |
2389| 19 |  -58 |
2390| 20 |  -82 |
2391| 21 |  -76 |
2392| 22 |  -82 |
2393| 23 |  -74 |
2394| 24 |  -81 |
2395| 25 |  -88 |
2396| 26 |  -71 |
2397Done
2398```
2399
2400```bash
2401> scan energy 10 20
2402| Ch | RSSI |
2403+----+------+
2404| 20 |  -82 |
2405Done
2406```
2407
2408### service
2409
2410Module for controlling service registration in Network Data. Each change in service registration must be sent to leader by `netdata register` command before taking effect.
2411
2412### service add \<enterpriseNumber\> \<serviceData\> \<serverData\>
2413
2414Add service to the Network Data.
2415
2416- enterpriseNumber: IANA enterprise number
2417- serviceData: hex-encoded binary service data
2418- serverData: hex-encoded binary server data
2419
2420```bash
2421> service add 44970 112233 aabbcc
2422Done
2423> netdata register
2424Done
2425```
2426
2427### service remove \<enterpriseNumber\> \<serviceData\>
2428
2429Remove service from Network Data.
2430
2431- enterpriseNumber: IANA enterprise number
2432- serviceData: hext-encoded binary service data
2433
2434```bash
2435> service remove 44970 112233
2436Done
2437> netdata register
2438Done
2439```
2440
2441### singleton
2442
2443Return true when there are no other nodes in the network, otherwise return false.
2444
2445```bash
2446> singleton
2447true or false
2448Done
2449```
2450
2451### sntp query \[SNTP server IP\] \[SNTP server port\]
2452
2453Send SNTP Query to obtain current unix epoch time (from 1st January 1970). The latter two parameters have following default values:
2454
2455- NTP server IP: 2001:4860:4806:8:: (Google IPv6 NTP Server)
2456- NTP server port: 123
2457
2458```bash
2459> sntp query
2460> SNTP response - Unix time: 1540894725 (era: 0)
2461```
2462
2463You can use NAT64 of OpenThread Border Router to reach e.g. Google IPv4 NTP Server:
2464
2465```bash
2466> sntp query 64:ff9b::d8ef:2308
2467> SNTP response - Unix time: 1540898611 (era: 0)
2468```
2469
2470### state
2471
2472Return state of current state.
2473
2474```bash
2475> state
2476offline, disabled, detached, child, router or leader
2477Done
2478```
2479
2480### state <state>
2481
2482Try to switch to state `detached`, `child`, `router` or `leader`.
2483
2484```bash
2485> state leader
2486Done
2487```
2488
2489### thread start
2490
2491Enable Thread protocol operation and attach to a Thread network.
2492
2493```bash
2494> thread start
2495Done
2496```
2497
2498### thread stop
2499
2500Disable Thread protocol operation and detach from a Thread network.
2501
2502```bash
2503> thread stop
2504Done
2505```
2506
2507### thread version
2508
2509Get the Thread Version number.
2510
2511```bash
2512> thread version
25132
2514Done
2515```
2516
2517### trel enable
2518
2519Enable TREL radio link.
2520
2521`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required.
2522
2523Note: TREL radio link can be enabled only when a valid TREL URL was specified.
2524
2525```bash
2526> trel enable
2527Done
2528```
2529
2530### trel disable
2531
2532Disable TREL radio link.
2533
2534`OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE` is required.
2535
2536```bash
2537> trel disable
2538Done
2539```
2540
2541### txpower
2542
2543Get the transmit power in dBm.
2544
2545```bash
2546> txpower
2547-10 dBm
2548Done
2549```
2550
2551### txpower \<txpower\>
2552
2553Set the transmit power in dBm.
2554
2555```bash
2556> txpower -10
2557Done
2558```
2559
2560### unsecureport add \<port\>
2561
2562Add a port to the allowed unsecured port list.
2563
2564```bash
2565> unsecureport add 1234
2566Done
2567```
2568
2569### unsecureport remove \<port\>
2570
2571Remove a port from the allowed unsecured port list.
2572
2573```bash
2574> unsecureport remove 1234
2575Done
2576```
2577
2578### unsecureport remove all
2579
2580Remove all ports from the allowed unsecured port list.
2581
2582```bash
2583> unsecureport remove all
2584Done
2585```
2586
2587### unsecureport get
2588
2589Print all ports from the allowed unsecured port list.
2590
2591```bash
2592> unsecureport get
25931234
2594Done
2595```
2596
2597### version
2598
2599Print the build version information.
2600
2601```bash
2602> version
2603OPENTHREAD/gf4f2f04; Jul  1 2016 17:00:09
2604Done
2605```
2606
2607### version api
2608
2609Print API version number.
2610
2611```bash
2612> version api
261328
2614Done
2615```
2616
2617### mac retries direct
2618
2619Get the number of direct TX retries on the MAC layer.
2620
2621```bash
2622> mac retries direct
26233
2624Done
2625```
2626
2627### mac retries direct \<number\>
2628
2629Set the number of direct TX retries on the MAC layer.
2630
2631```bash
2632> mac retries direct 5
2633Done
2634```
2635
2636### mac retries indirect
2637
2638Get the number of indirect TX retries on the MAC layer.
2639
2640```bash
2641> mac retries indirect
26423
2643Done
2644```
2645
2646### mac retries indirect \<number\>
2647
2648Set the number of indirect TX retries on the MAC layer.
2649
2650```bash
2651> mac retries indirect 5
2652Done
2653```
2654
2655### mac send \<op\>
2656
2657Instruct 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.
2658
2659```bash
2660> mac send datarequest
2661Done
2662```
2663
2664```bash
2665> mac send emptydata
2666Done
2667```
2668
2669### macfilter
2670
2671List the macfilter status, including address and received signal strength filter settings.
2672
2673```bash
2674> macfilter
2675Address Mode: Allowlist
26760f6127e33af6b403 : rss -95 (lqi 1)
26770f6127e33af6b402
2678RssIn List:
26790f6127e33af6b403 : rss -95 (lqi 1)
2680Default rss : -50 (lqi 3)
2681Done
2682```
2683
2684### macfilter addr
2685
2686List the address filter status.
2687
2688```bash
2689> macfilter addr
2690Allowlist
26910f6127e33af6b403 : rss -95 (lqi 1)
26920f6127e33af6b402
2693Done
2694```
2695
2696### macfilter addr disable
2697
2698Disable address filter mode.
2699
2700```bash
2701> macfilter addr disable
2702Done
2703```
2704
2705### macfilter addr allowlist
2706
2707Enable allowlist address filter mode.
2708
2709```bash
2710> macfilter addr allowlist
2711Done
2712```
2713
2714### macfilter addr denylist
2715
2716Enable denylist address filter mode.
2717
2718```bash
2719> macfilter addr denylist
2720Done
2721```
2722
2723### macfilter addr add \<extaddr\> \[rss\]
2724
2725Add an IEEE 802.15.4 Extended Address to the address filter, and fixed the received singal strength for the messages from the address if rss is specified.
2726
2727```bash
2728> macfilter addr add 0f6127e33af6b403 -95
2729Done
2730```
2731
2732```bash
2733> macfilter addr add 0f6127e33af6b402
2734Done
2735```
2736
2737### macfilter addr remove \<extaddr\>
2738
2739Remove the IEEE802.15.4 Extended Address from the address filter.
2740
2741```bash
2742> macfilter addr remove 0f6127e33af6b402
2743Done
2744```
2745
2746### macfilter addr clear
2747
2748Clear all the IEEE802.15.4 Extended Addresses from the address filter.
2749
2750```bash
2751> macfilter addr clear
2752Done
2753```
2754
2755### macfilter rss
2756
2757List the rss filter status
2758
2759```bash
2760> macfilter rss
27610f6127e33af6b403 : rss -95 (lqi 1)
2762Default rss: -50 (lqi 3)
2763Done
2764```
2765
2766### macfilter rss add \<extaddr\> \<rss\>
2767
2768Set 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.
2769
2770```bash
2771> macfilter rss add * -50
2772Done
2773```
2774
2775```bash
2776> macfilter rss add 0f6127e33af6b404 -85
2777Done
2778```
2779
2780### macfilter rss add-lqi \<extaddr\> \<lqi\>
2781
2782Set 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
2783
2784```bash
2785> macfilter rss add-lqi * 3
2786Done
2787```
2788
2789```bash
2790> macfilter rss add 0f6127e33af6b404 2
2791Done
2792```
2793
2794### macfilter rss remove \<extaddr\>
2795
2796Removes 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.
2797
2798```bash
2799> macfilter rss remove *
2800Done
2801```
2802
2803```bash
2804> macfilter rss remove 0f6127e33af6b404
2805Done
2806```
2807
2808### macfilter rss clear
2809
2810Clear all the received signal strength or received link quality settings.
2811
2812```bash
2813> macfilter rss clear
2814Done
2815```
2816
2817### diag
2818
2819Factory Diagnostics module is enabled only when building OpenThread with `OPENTHREAD_CONFIG_DIAG_ENABLE=1` option. Go [diagnostics module][diag] for more information.
2820
2821[diag]: ../../src/core/diags/README.md
2822

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

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, onrcb
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, onrcb
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: 13
40   Channel Mask: 0x07fff800
41   Ext PAN ID: d63e8e3e495ebbc3
42   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
43   Network Key: dfd34f0f05cad978ec4e32b0413038ff
44   Network Name: OpenThread-8f28
45   PAN ID: 0x8f28
46   PSKc: c23a76e98f1a6483639b1ac1271e2e27
47   Security Policy: 0, onrcb
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: 13
99   Channel Mask: 0x07fff800
100   Ext PAN ID: d63e8e3e495ebbc3
101   Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
102   Network Key: dfd34f0f05cad978ec4e32b0413038ff
103   Network Name: OpenThread-8f28
104   PAN ID: 0x8f28
105   PSKc: c23a76e98f1a6483639b1ac1271e2e27
106   Security Policy: 0, onrcb
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
133## Command Details
134
135### help
136
137Usage: `dataset help`
138
139Print dataset help menu.
140
141```bash
142> dataset help
143help
144active
145activetimestamp
146channel
147channelmask
148clear
149commit
150delay
151extpanid
152init
153meshlocalprefix
154mgmtgetcommand
155mgmtsetcommand
156networkkey
157networkname
158panid
159pending
160pendingtimestamp
161pskc
162securitypolicy
163Done
164```
165
166### active
167
168Usage: `dataset active [-x]`
169
170Print Active Operational Dataset in human-readable form.
171
172```bash
173> dataset active
174Active Timestamp: 1
175Channel: 13
176Channel Mask: 0x07fff800
177Ext PAN ID: d63e8e3e495ebbc3
178Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
179Network Key: dfd34f0f05cad978ec4e32b0413038ff
180Network Name: OpenThread-8f28
181PAN ID: 0x8f28
182PSKc: c23a76e98f1a6483639b1ac1271e2e27
183Security Policy: 0, onrcb
184Done
185```
186
187Print Active Operational Dataset as hex-encoded TLVs.
188
189```bash
190> dataset active -x
1910e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
192Done
193```
194
195### activetimestamp
196
197Usage: `dataset activetimestamp [timestamp]`
198
199Get active timestamp.
200
201```bash
202> dataset activetimestamp
203123456789
204Done
205```
206
207Set active timestamp.
208
209```bash
210> dataset activetimestamp 123456789
211Done
212```
213
214### channel
215
216Usage: `channel [channel]`
217
218Get channel.
219
220```bash
221> dataset channel
22212
223Done
224```
225
226Set channel.
227
228```bash
229> dataset channel 12
230Done
231```
232
233### channelmask
234
235Usage: `dataset channelmask [channelmask]`
236
237Get channel mask.
238
239```bash
240> dataset channelmask
2410x07fff800
242Done
243```
244
245Set channel mask.
246
247```bash
248> dataset channelmask 0x07fff800
249Done
250```
251
252### clear
253
254Usage: `dataset clear`
255
256Reset operational dataset buffer.
257
258```bash
259> dataset clear
260Done
261```
262
263### commit
264
265Usage: `dataset commit <active|pending>`
266
267Commit operational dataset buffer to active/pending operational dataset.
268
269```bash
270> dataset commit active
271Done
272```
273
274### delay
275
276Usage: `dataset delay [delay]`
277
278Get delay timer value.
279
280```bash
281> dataset delay
2821000
283Done
284```
285
286Set delay timer value.
287
288```bash
289> dataset delay 1000
290Done
291```
292
293### extpanid
294
295Usage: `dataset extpanid [extpanid]`
296
297Get extended panid.
298
299```bash
300> dataset extpanid
301000db80123456789
302Done
303```
304
305Set extended panid.
306
307**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
308
309```bash
310> dataset extpanid 000db80123456789
311Done
312```
313
314### init
315
316Usage: `dataset init <active|new|pending|tlvs <hex-encoded TLVs>>`
317
318Initialize operational dataset buffer.
319
320```bash
321> dataset init new
322Done
323```
324
325### meshlocalprefix
326
327Usage: `dataset meshlocalprefix [prefix]`
328
329Get mesh local prefix.
330
331```bash
332> dataset meshlocalprefix
333fd00:db8:0:0::/64
334Done
335```
336
337Set mesh local prefix.
338
339```bash
340> dataset meshlocalprefix fd00:db8::
341Done
342```
343
344### mgmtgetcommand
345
346Usage: `dataset mgmtgetcommand <active|pending> [address <destination>] [TLV list] [-x]`
347
348Send MGMT_ACTIVE_GET or MGMT_PENDING_GET.
349
350```bash
351> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp securitypolicy
352Done
353```
354
355### mgmtsetcommand
356
357Usage: `dataset mgmtsetcommand <active|pending> [TLV Type list] [-x]`
358
359Send MGMT_ACTIVE_SET or MGMT_PENDING_SET.
360
361```bash
362> dataset mgmtsetcommand active activetimestamp 123 securitypolicy 1 onrcb
363Done
364```
365
366### networkkey
367
368Usage: `dataset networkkey [key]`
369
370Get network key
371
372```bash
373> dataset networkkey
37400112233445566778899aabbccddeeff
375Done
376```
377
378Set network key.
379
380```bash
381> dataset networkkey 00112233445566778899aabbccddeeff
382Done
383```
384
385### networkname
386
387Usage: `dataset networkname [name]`
388
389Get network name.
390
391```bash
392> datset networkname
393OpenThread
394Done
395```
396
397Set network name.
398
399**NOTE** The commissioning credential in the dataset buffer becomes stale after changing this value. Use [pskc](#pskc) to reset.
400
401```bash
402> dataset networkname OpenThread
403Done
404```
405
406### panid
407
408Usage: `dataset panid [panid]`
409
410Get panid.
411
412```bash
413> dataset panid
4140x1234
415Done
416```
417
418Set panid.
419
420```bash
421> dataset panid 0x1234
422Done
423```
424
425### pending
426
427Usage: `dataset pending [-x]`
428
429Print Pending Operational Dataset in human-readable form.
430
431```bash
432> dataset pending
433Pending Timestamp: 2
434Active Timestamp: 15
435Channel: 16
436Channel Mask: 0x07fff800
437Delay: 58706
438Ext PAN ID: d63e8e3e495ebbc3
439Mesh Local Prefix: fd3d:b50b:f96d:722d::/64
440Network Key: dfd34f0f05cad978ec4e32b0413038ff
441Network Name: OpenThread-8f28
442PAN ID: 0x8f28
443PSKc: c23a76e98f1a6483639b1ac1271e2e27
444Security Policy: 0, onrcb
445Done
446```
447
448Print Pending Operational Dataset as hex-encoded TLVs.
449
450```bash
451> dataset pending -x
4520e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
453Done
454```
455
456### pendingtimestamp
457
458Usage: `dataset pendingtimestamp [timestamp]`
459
460Get pending timestamp.
461
462```bash
463> dataset pendingtimestamp
464123456789
465Done
466```
467
468Set pending timestamp.
469
470```bash
471> dataset pendingtimestamp 123456789
472Done
473```
474
475### pskc
476
477Usage: `pskc [-p] [<key>|<passphrase>]`
478
479Get pskc.
480
481```bash
482> dataset pskc
48367c0c203aa0b042bfb5381c47aef4d9e
484Done
485```
486
487Set pskc.
488
489With `-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).
490
491```bash
492> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e
493Done
494> dataset pskc -p 123456
495Done
496```
497
498### securitypolicy
499
500Usage: `dataset securitypolicy [<rotationtime> [onrcbCepR]]`
501
502Get security policy.
503
504```bash
505> dataset securitypolicy
506672 onrcb
507Done
508```
509
510Set security policy.
511
512- o: Obtaining the Network Key for out-of-band commissioning is enabled.
513- n: Native Commissioning using PSKc is allowed.
514- r: Thread 1.x Routers are enabled.
515- c: External Commissioner authentication is allowed using PSKc.
516- b: Thread 1.x Beacons are enabled.
517- C: Thread 1.2 Commercial Commissioning is enabled.
518- e: Thread 1.2 Autonomous Enrollment is enabled.
519- p: Thread 1.2 Network Key Provisioning is enabled.
520- R: Non-CCM routers are allowed in Thread 1.2 CCM networks.
521
522```bash
523> dataset securitypolicy 672 onrcb
524Done
525```
526
527### set
528
529Usage: `dataset set <active|pending> <dataset>`
530
531Set the Active Operational Dataset using hex-encoded TLVs.
532
533```bash
534dataset set active 0e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
535Done
536```
537
538Set the Pending Operational Dataset using hex-encoded TLVs.
539
540```bash
541dataset set pending 0e080000000000010000000300001035060004001fffe002084eb74ab03c56e6d00708fdc7fe165c83a67805108e2104f183e698da87e96efc1e45aa51030f4f70656e5468726561642d383631310102861104108d6273023d82c841eff0e68db86f35740c030000ff
542Done
543```
544

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- [neighbor](#neighbor)
15- [netinfo](#netinfo)
16- [rx](#rx)
17- [rxtx](#rxtx)
18- [tx](#tx)
19
20## Timestamp Format
21
22Recorded 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.
23
24```bash
25> history netinfo
26| Age                  | Role     | Mode | RLOC16 | Partition ID |
27+----------------------+----------+------+--------+--------------+
28|         02:31:50.628 | leader   | rdn  | 0x2000 |    151029327 |
29|         02:31:53.262 | detached | rdn  | 0xfffe |            0 |
30|         02:31:54.663 | detached | rdn  | 0x2000 |            0 |
31Done
32```
33
34For 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`.
35
36Timestamps 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`.
37
38## Command Details
39
40### help
41
42Usage: `history help`
43
44Print SRP client help menu.
45
46```bash
47> history help
48help
49neighbor
50netinfo
51rx
52rxtx
53tx
54Done
55>
56```
57
58### neighbor
59
60Usage `history neighbor [list] [<num-entries>]`
61
62Print the neighbor table history. Each entry provides:
63
64- Type: Child or Router
65- Event: Added, Removed, Changed (e.g., mode change).
66- Extended Address
67- RLOC16
68- MLE Link Mode
69- Average RSS (in dBm) of received frames from neighbor at the time the entry was recorded
70
71Print the neighbor history as a table.
72
73```bash
74> history neighbor
75| Age                  | Type   | Event     | Extended Address | RLOC16 | Mode | Ave RSS |
76+----------------------+--------+-----------+------------------+--------+------+---------+
77|         00:00:29.233 | Child  | Added     | ae5105292f0b9169 | 0x8404 | -    |     -20 |
78|         00:01:38.368 | Child  | Removed   | ae5105292f0b9169 | 0x8401 | -    |     -20 |
79|         00:04:27.181 | Child  | Changed   | ae5105292f0b9169 | 0x8401 | -    |     -20 |
80|         00:04:51.236 | Router | Added     | 865c7ca38a5fa960 | 0x9400 | rdn  |     -20 |
81|         00:04:51.587 | Child  | Removed   | 865c7ca38a5fa960 | 0x8402 | rdn  |     -20 |
82|         00:05:22.764 | Child  | Changed   | ae5105292f0b9169 | 0x8401 | rn   |     -20 |
83|         00:06:40.764 | Child  | Added     | 4ec99efc874a1841 | 0x8403 | r    |     -20 |
84|         00:06:44.060 | Child  | Added     | 865c7ca38a5fa960 | 0x8402 | rdn  |     -20 |
85|         00:06:49.515 | Child  | Added     | ae5105292f0b9169 | 0x8401 | -    |     -20 |
86Done
87```
88
89Print the neighbor history as a list.
90
91```bash
92
93> history neighbor list
9400:00:34.753 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8404 mode:- rss:-20
9500:01:43.888 -> type:Child event:Removed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
9600:04:32.701 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
9700:04:56.756 -> type:Router event:Added extaddr:865c7ca38a5fa960 rloc16:0x9400 mode:rdn rss:-20
9800:04:57.107 -> type:Child event:Removed extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
9900:05:28.284 -> type:Child event:Changed extaddr:ae5105292f0b9169 rloc16:0x8401 mode:rn rss:-20
10000:06:46.284 -> type:Child event:Added extaddr:4ec99efc874a1841 rloc16:0x8403 mode:r rss:-20
10100:06:49.580 -> type:Child event:Added extaddr:865c7ca38a5fa960 rloc16:0x8402 mode:rdn rss:-20
10200:06:55.035 -> type:Child event:Added extaddr:ae5105292f0b9169 rloc16:0x8401 mode:- rss:-20
103Done
104```
105
106### netinfo
107
108Usage `history netinfo [list] [<num-entries>]`
109
110Print the Network Info history. Each Network Info provides:
111
112- Device Role
113- MLE Link Mode
114- RLOC16
115- Partition ID
116
117Print the Network Info history as a table.
118
119```bash
120> history netinfo
121| Age                  | Role     | Mode | RLOC16 | Partition ID |
122+----------------------+----------+------+--------+--------------+
123|         00:00:10.069 | router   | rdn  | 0x6000 |    151029327 |
124|         00:02:09.337 | child    | rdn  | 0x2001 |    151029327 |
125|         00:02:09.338 | child    | rdn  | 0x2001 |    151029327 |
126|         00:07:40.806 | child    | -    | 0x2001 |    151029327 |
127|         00:07:42.297 | detached | -    | 0x6000 |            0 |
128|         00:07:42.968 | disabled | -    | 0x6000 |            0 |
129Done
130```
131
132Print the Network Info history as a list.
133
134```bash
135> history netinfo list
13600:00:59.467 -> role:router mode:rdn rloc16:0x6000 partition-id:151029327
13700:02:58.735 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
13800:02:58.736 -> role:child mode:rdn rloc16:0x2001 partition-id:151029327
13900:08:30.204 -> role:child mode:- rloc16:0x2001 partition-id:151029327
14000:08:31.695 -> role:detached mode:- rloc16:0x6000 partition-id:0
14100:08:32.366 -> role:disabled mode:- rloc16:0x6000 partition-id:0
142Done
143```
144
145Print only the latest 2 entries.
146
147```bash
148> history netinfo 2
149| Age                  | Role     | Mode | RLOC16 | Partition ID |
150+----------------------+----------+------+--------+--------------+
151|         00:02:05.451 | router   | rdn  | 0x6000 |    151029327 |
152|         00:04:04.719 | child    | rdn  | 0x2001 |    151029327 |
153Done
154```
155
156### rx
157
158Usage `history rx [list] [<num-entries>]`
159
160Print the IPv6 message RX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
161
162Print the IPv6 message RX history as a table:
163
164```bash
165> history rx
166| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
167+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
168|                      | UDP              |    50 | 0xbd26 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
169|         00:00:07.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
170|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
171+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
172|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x4800 |  15.4 |
173|         00:00:09.263 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0                                    |
174|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
175+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
176|                      | UDP              |    12 | 0x3f7d | yes |  net |  -20 | RX | 0x4800 |  15.4 |
177|         00:00:09.302 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631                                |
178|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631                                |
179+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
180|                      | ICMP6(EchoReqst) |    16 | 0x942c | yes | norm |  -20 | RX | 0x4800 |  15.4 |
181|         00:00:09.304 | src: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0                               |
182|                      | dst: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0                               |
183+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
184|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x4800 |  15.4 |
185|         00:00:09.304 | src: [fdde:ad00:beef:0:0:ff:fe00:4800]:0                                    |
186|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
187+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
188|                      | UDP              |    50 | 0x2e37 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
189|         00:00:21.622 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
190|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
191+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
192|                      | UDP              |    50 | 0xe177 |  no |  net |  -20 | RX | 0x4800 |  15.4 |
193|         00:00:26.640 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
194|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
195+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
196|                      | UDP              |   165 | 0x82ee | yes |  net |  -20 | RX | 0x4800 |  15.4 |
197|         00:00:30.000 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
198|                      | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
199+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
200|                      | UDP              |    93 | 0x52df |  no |  net |  -20 | RX | unknwn |  15.4 |
201|         00:00:30.480 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
202|                      | dst: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
203+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
204|                      | UDP              |    50 | 0x5ccf |  no |  net |  -20 | RX | unknwn |  15.4 |
205|         00:00:30.772 | src: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
206|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
207Done
208
209```
210
211Print the latest 5 entries of the IPv6 message RX history as a list:
212
213```bash
214> history rx list 4
21500:00:13.368
216    type:UDP len:50 cheksum:0xbd26 sec:no prio:net rss:-20 from:0x4800 radio:15.4
217    src:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
218    dst:[ff02:0:0:0:0:0:0:1]:19788
21900:00:14.991
220    type:HopOpts len:44 cheksum:0x0000 sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
221    src:[fdde:ad00:beef:0:0:ff:fe00:4800]:0
222    dst:[ff03:0:0:0:0:0:0:2]:0
22300:00:15.030
224    type:UDP len:12 cheksum:0x3f7d sec:yes prio:net rss:-20 from:0x4800 radio:15.4
225    src:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
226    dst:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
22700:00:15.032
228    type:ICMP6(EchoReqst) len:16 cheksum:0x942c sec:yes prio:norm rss:-20 from:0x4800 radio:15.4
229    src:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
230    dst:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
231Done
232```
233
234### rxtx
235
236Usage `history rxtx [list] [<num-entries>]`
237
238Print the combined IPv6 message RX and TX history in either table or list format. Each entry provides:
239
240- IPv6 message type: UDP, TCP, ICMP6 (and its subtype), etc.
241- IPv6 payload length (excludes the IPv6 header).
242- Source IPv6 address and port number.
243- Destination IPv6 address and port number (port number is valid for UDP/TCP, it is zero otherwise).
244- Whether or not link-layer security was used.
245- Message priority: low, norm, high, net (for Thread control messages).
246- Message checksum (valid for UDP, TCP, or ICMP6 message)
247- RSS: Received Signal Strength (in dBm) - averaged over all received fragment frames that formed the message. For TX history `NA` (not applicable) is used.
248- 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.
249- 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.
250- 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).
251
252Print the IPv6 message RX and TX history as a table:
253
254```bash
255> history rxtx
256| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
257+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
258|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
259|         00:00:09.267 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0                                     |
260|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
261+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
262|                      | UDP              |    12 | 0x6c6b | yes |  net |  -20 | RX | 0x0800 |  15.4 |
263|         00:00:09.290 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:61631                                 |
264|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:801]:61631                                 |
265+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
266|                      | ICMP6(EchoReqst) |    16 | 0xc6a2 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
267|         00:00:09.292 | src: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0                               |
268|                      | dst: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0                               |
269+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
270|                      | ICMP6(EchoReply) |    16 | 0xc5a2 | yes | norm |  NA  | TX | 0x0800 |  15.4 |
271|         00:00:09.292 | src: [fdde:ad00:beef:0:af4c:3644:882a:3698]:0                               |
272|                      | dst: [fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0                               |
273+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
274|                      | UDP              |    50 | 0xaa0d | yes |  net |  NA  | TX | 0x0800 |  15.4 |
275|         00:00:09.294 | src: [fdde:ad00:beef:0:0:ff:fe00:801]:61631                                 |
276|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:800]:61631                                 |
277+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
278|                      | HopOpts          |    44 | 0x0000 | yes | norm |  -20 | RX | 0x0800 |  15.4 |
279|         00:00:09.296 | src: [fdde:ad00:beef:0:0:ff:fe00:800]:0                                     |
280|                      | dst: [ff03:0:0:0:0:0:0:2]:0                                                 |
281+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
282|                      | UDP              |    50 | 0xc1d8 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
283|         00:00:09.569 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
284|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
285+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
286|                      | UDP              |    50 | 0x3cb1 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
287|         00:00:16.519 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
288|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
289+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
290|                      | UDP              |    50 | 0xeda0 |  no |  net |  -20 | RX | 0x0800 |  15.4 |
291|         00:00:20.599 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
292|                      | dst: [ff02:0:0:0:0:0:0:1]:19788                                             |
293+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
294|                      | UDP              |   165 | 0xbdfa | yes |  net |  -20 | RX | 0x0800 |  15.4 |
295|         00:00:21.059 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
296|                      | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
297+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
298|                      | UDP              |    64 | 0x1c11 |  no |  net |  NA  | TX | 0x0800 |  15.4 |
299|         00:00:21.062 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
300|                      | dst: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
301+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
302|                      | UDP              |    93 | 0xedff |  no |  net |  -20 | RX | unknwn |  15.4 |
303|         00:00:21.474 | src: [fe80:0:0:0:54d9:5153:ffc6:df26]:19788                                 |
304|                      | dst: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
305+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
306|                      | UDP              |    44 | 0xd383 |  no |  net |  NA  | TX | bcast  |  15.4 |
307|         00:00:21.811 | src: [fe80:0:0:0:8893:c2cc:d983:1e1c]:19788                                 |
308|                      | dst: [ff02:0:0:0:0:0:0:2]:19788                                             |
309Done
310```
311
312Print the latest 5 entries of the IPv6 message RX history as a list:
313
314```bash
315> history rxtx list 5
316
31700:00:02.100
318    type:UDP len:50 cheksum:0xd843 sec:no prio:net rss:-20 from:0x0800 radio:15.4
319    src:[fe80:0:0:0:54d9:5153:ffc6:df26]:19788
320    dst:[ff02:0:0:0:0:0:0:1]:19788
32100:00:15.331
322    type:HopOpts len:44 cheksum:0x0000 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
323    src:[fdde:ad00:beef:0:0:ff:fe00:800]:0
324    dst:[ff03:0:0:0:0:0:0:2]:0
32500:00:15.354
326    type:UDP len:12 cheksum:0x6c6b sec:yes prio:net rss:-20 from:0x0800 radio:15.4
327    src:[fdde:ad00:beef:0:0:ff:fe00:800]:61631
328    dst:[fdde:ad00:beef:0:0:ff:fe00:801]:61631
32900:00:15.356
330    type:ICMP6(EchoReqst) len:16 cheksum:0xc6a2 sec:yes prio:norm rss:-20 from:0x0800 radio:15.4
331    src:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
332    dst:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
33300:00:15.356
334    type:ICMP6(EchoReply) len:16 cheksum:0xc5a2 sec:yes prio:norm tx-success:yes to:0x0800 radio:15.4
335    src:[fdde:ad00:beef:0:af4c:3644:882a:3698]:0
336    dst:[fdde:ad00:beef:0:efe8:4910:cf95:dee9]:0
337```
338
339### tx
340
341Usage `history tx [list] [<num-entries>]`
342
343Print the IPv6 message TX history in either table or list format. Entries provide same information and follow same format as in `history rxtx` command.
344
345Print the IPv6 message TX history as a table (10 latest entries):
346
347```bash
348> history tx
349| Age                  | Type             | Len   | Chksum | Sec | Prio | RSS  |Dir | Neighb | Radio |
350+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
351|                      | ICMP6(EchoReply) |    16 | 0x932c | yes | norm |  NA  | TX | 0x4800 |  15.4 |
352|         00:00:18.798 | src: [fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0                               |
353|                      | dst: [fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0                               |
354+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
355|                      | UDP              |    50 | 0xce87 | yes |  net |  NA  | TX | 0x4800 |  15.4 |
356|         00:00:18.800 | src: [fdde:ad00:beef:0:0:ff:fe00:4801]:61631                                |
357|                      | dst: [fdde:ad00:beef:0:0:ff:fe00:4800]:61631                                |
358+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
359|                      | UDP              |    64 | 0xf7ba |  no |  net |  NA  | TX | 0x4800 |  15.4 |
360|         00:00:39.499 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
361|                      | dst: [fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788                                 |
362+----------------------+------------------+-------+--------+-----+------+------+----+--------+-------+
363|                      | UDP              |    44 | 0x26d4 |  no |  net |  NA  | TX | bcast  |  15.4 |
364|         00:00:40.256 | src: [fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788                                  |
365|                      | dst: [ff02:0:0:0:0:0:0:2]:19788                                             |
366Done
367```
368
369Print the IPv6 message TX history as a list:
370
371```bash
372history tx list
37300:00:23.957
374    type:ICMP6(EchoReply) len:16 cheksum:0x932c sec:yes prio:norm tx-success:yes to:0x4800 radio:15.4
375    src:[fdde:ad00:beef:0:dc0e:d6b3:f180:b75b]:0
376    dst:[fdde:ad00:beef:0:ac09:a16b:3204:dc09]:0
37700:00:23.959
378    type:UDP len:50 cheksum:0xce87 sec:yes prio:net tx-success:yes to:0x4800 radio:15.4
379    src:[fdde:ad00:beef:0:0:ff:fe00:4801]:61631
380    dst:[fdde:ad00:beef:0:0:ff:fe00:4800]:61631
38100:00:44.658
382    type:UDP len:64 cheksum:0xf7ba sec:no prio:net tx-success:yes to:0x4800 radio:15.4
383    src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
384    dst:[fe80:0:0:0:d03d:d3e7:cc5e:7cd7]:19788
38500:00:45.415
386    type:UDP len:44 cheksum:0x26d4 sec:no prio:net tx-success:yes to:0xffff radio:15.4
387    src:[fe80:0:0:0:a4a5:bbac:a8e:bd07]:19788
388    dst:[ff02:0:0:0:0:0:0:2]:19788
389Done
390```
391

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- [stop](#stop)
14
15## Command Details
16
17### help
18
19Usage: `joiner help`
20
21Print joiner help menu.
22
23```bash
24> joiner help
25help
26id
27start
28stop
29Done
30```
31
32### discerner
33
34Usage: `joiner discerner [discerner]`
35
36Print or set the Joiner Discerner. Note this value takes the place of the place of EUI-64 during the joiner session of Thread commissioning.
37
38- discerner: `clear` to clear discerner, `number/length` to set discerner
39
40```bash
41> joiner discerner 0xabc/12
42Done
43> joiner discerner
440xabc/12
45Done
46> joiner discerner clear
47Done
48```
49
50### id
51
52Usage: `joiner id`
53
54Print the Joiner ID.
55
56```bash
57> joiner id
58d65e64fa83f81cf7
59Done
60```
61
62### start
63
64Usage: `joiner start <pskd> [provisioning-url]`
65
66Start the Joiner role.
67
68- pskd: Pre-Shared Key for the Joiner.
69- provisioning-url: Provisioning URL for the Joiner (optional).
70
71This command will cause the device to start the Joiner process.
72
73```bash
74> joiner start J01NM3
75Done
76```
77
78### stop
79
80Usage: `joiner stop`
81
82Stop the Joiner role.
83
84```bash
85> joiner stop
86Done
87```
88

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, onrcb
31   Done
32   ```
33
342. Commit new dataset to the Active Operational Dataset in non-volatile storage.
35
36   ```bash
37   dataset commit active
38   Done
39   ```
40
413. Enable Thread interface
42
43   ```bash
44   > ifconfig up
45   Done
46   > thread start
47   Done
48   ```
49
504. Observe IPv6 addresses assigned to the Thread inteface.
51
52   ```bash
53   > ipaddr
54   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
55   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
56   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
57   fe80:0:0:0:a40b:197f:593d:ca61
58   Done
59   ```
60
615. Register an IPv6 prefix assigned to the Thread network.
62
63   ```bash
64   > prefix add fd00:dead:beef:cafe::/64 paros
65   Done
66   > netdata register
67   Done
68   ```
69
706. Observe Thread Network Data.
71
72   ```bash
73   > netdata show
74   Prefixes:
75   fd00:dead:beef:cafe::/64 paros med dc00
76   Routes:
77   Services:
78   Done
79   ```
80
817. Observe IPv6 addresses assigned to the Thread interface.
82
83   ```bash
84   > ipaddr
85   fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa
86   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
87   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
88   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
89   fe80:0:0:0:a40b:197f:593d:ca61
90   Done
91   ```
92
93### Attach to Existing Network
94
95Only the Network Key is required for a device to attach to a Thread network.
96
97While not required, specifying the channel avoids the need to search across multiple channels, improving both latency and efficiency of the attach process.
98
99After the device successfully attaches to a Thread network, the device will retrieve the complete Active Operational Dataset.
100
1011. Create a partial Active Operational Dataset.
102
103   ```bash
104   > dataset networkkey dfd34f0f05cad978ec4e32b0413038ff
105   Done
106   > dataset commit active
107   Done
108   ```
109
1102. Enable Thread interface.
111
112   ```bash
113   > ifconfig up
114   Done
115   > thread start
116   Done
117   ```
118
1193. After attaching, observe Thread Network Data.
120
121   ```bash
122   > netdata show
123   Prefixes:
124   fd00:dead:beef:cafe::/64 paros med dc00
125   Routes:
126   Services:
127   Done
128   ```
129
1304. Observe IPv6 addresses assigned to the Thread interface.
131
132   ```bash
133   > ipaddr
134   fd00:dead:beef:cafe:4da8:5234:4aa2:4cfa
135   fd3d:b50b:f96d:722d:0:ff:fe00:fc00
136   fd3d:b50b:f96d:722d:0:ff:fe00:dc00
137   fd3d:b50b:f96d:722d:393c:462d:e8d2:db32
138   fe80:0:0:0:a40b:197f:593d:ca61
139   Done
140   ```
141
142## Command List
143
144- [help](#help)
145- [publish](#publish)
146- [register](#register)
147- [show](#show)
148- [steeringdata](#steeringdata-check-eui64discerner)
149- [unpublish](#unpublish)
150
151## Command Details
152
153### help
154
155Usage: `netdata help`
156
157Print netdata help menu.
158
159```bash
160> netdata help
161help
162publish
163register
164show
165steeringdata
166unpublish
167Done
168```
169
170### publish
171
172The 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.
173
174The Publisher requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
175
176### publish dnssrp
177
178Publish DNS/SRP service entry.
179
180This command requires `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE`.
181
182The following formats are available: :
183
184- `netdata publish dnssrp anycast <seq-num>` to publish "DNS/SRP Service Anycast Address" with a given sequence number.
185- `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.
186- `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.
187
188A 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).
189
190```bash
191> netdata publish dnssrp anycast 1
192Done
193
194> netdata publish dnssrp unicast fd00::1234 51525
195Done
196
197> netdata publish dnssrp unicast 50152
198Done
199```
200
201### publish prefix \<prefix\> [padcrosnD][prf]
202
203Publish an on-mesh prefix entry.
204
205- p: Preferred flag
206- a: Stateless IPv6 Address Autoconfiguration flag
207- d: DHCPv6 IPv6 Address Configuration flag
208- c: DHCPv6 Other Configuration flag
209- r: Default Route flag
210- o: On Mesh flag
211- s: Stable flag
212- n: Nd Dns flag
213- D: Domain Prefix flag (only available for Thread 1.2).
214- prf: Preference, which may be 'high', 'med', or 'low'.
215
216```bash
217> netdata publish prefix fd00:1234:5678::/64 paos med
218Done
219```
220
221### publish route \<prefix\> [sn][prf]
222
223Publish an external route entry.
224
225- s: Stable flag
226- n: NAT64 flag
227- prf: Preference, which may be: 'high', 'med', or 'low'.
228
229```bash
230> netdata publish route fd00:1234:5678::/64 s high
231Done
232```
233
234### register
235
236Usage: `netdata register`
237
238Register configured prefixes, routes, and services with the Leader.
239
240```bash
241> netdata register
242Done
243```
244
245### show
246
247Usage: `netdata show [-x]`
248
249Print Network Data received from the Leader.
250
251```bash
252> netdata show
253Prefixes:
254fd00:dead:beef:cafe::/64 paros med dc00
255Routes:
256Services:
257Done
258```
259
260Print Network Data as hex-encoded TLVs.
261
262```bash
263> netdata show -x
26408040b02174703140040fd00deadbeefcafe0504dc00330007021140
265Done
266```
267
268### netdata steeringdata check \<eui64\>|\<discerner\>
269
270Check whether the steering data includes a joiner.
271
272- eui64: The IEEE EUI-64 of the Joiner.
273- discerner: The Joiner discerner in format `number/length`.
274
275```bash
276> netdata steeringdata check d45e64fa83f81cf7
277Done
278> netdata steeringdata check 0xabc/12
279Done
280> netdata steeringdata check 0xdef/12
281Error 23: NotFound
282```
283
284### unpublish
285
286This command unpublishes a previously published Network Data entry.
287
288This command requires `OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE`.
289
290### unpublish dnssrp
291
292Unpublishes DNS/SRP Service entry (available when `OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE` is enabled):
293
294- `netdata unpublish dnssrp` to unpublish "DNS/SRP Service" entry (anycast or unciast).
295
296```bash
297> netdata unpublish dnssrp
298Done
299```
300
301### unpublish \<prefix\>
302
303Unpublishes a previously published on-mesh prefix or external route entry.
304
305```bash
306> netdata unpublish fd00:1234:5678::/64
307Done
308```
309

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, onrcb
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    TXT: 00
135    host: my-host.default.service.arpa.
136    addresses: [fded:5114:8263:1fe1:44f9:cc06:4a2d:534]
137Done
138```
139
140Make sure it shows `deleted: false` for both host and service commands.
141
142### Remove the service
143
144A service can be removed through the client node:
145
146```bash
147> srp client service remove my-service _ipps._tcp
148Done
149```
150
151Confirm on the server node that the service has been removed:
152
153```bash
154> srp server service
155my-service._ipps._tcp.default.service.arpa.
156    deleted: true
157Done
158```
159
160The service entry is listed because the name of service is not removed.
161
162### Remove the host and service names
163
164A host and service, along with their names, can be removed through the client node:
165
166```bash
167> srp client host remove 1
168Done
169```
170
171Confirm on the server node that no host or service entries are listed:
172
173```bash
174> srp server host
175Done
176> srp server service
177Done
178>
179```
180
181## CLI Reference
182
183- [SRP Client CLI Reference](README_SRP_CLIENT.md)
184- [SRP Server CLI Reference](README_SRP_SERVER.md)
185

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

README_SRP_SERVER.md

1# OpenThread CLI - SRP Server
2
3## Quick Start
4
5See [README_SRP.md](README_SRP.md).
6
7## Command List
8
9- [help](#help)
10- [disable](#disable)
11- [domain](#domain)
12- [enable](#enable)
13- [host](#host)
14- [lease](#lease)
15- [service](#service)
16- [state](#state)
17
18## Command Details
19
20### help
21
22Usage: `srp server help`
23
24Print SRP server help menu.
25
26```bash
27> srp server help
28disable
29domain
30enable
31help
32host
33lease
34service
35state
36Done
37```
38
39### disable
40
41Usage: `srp server disable`
42
43Disable the SRP server.
44
45```bash
46> srp server disable
47Done
48```
49
50### domain
51
52Usage: `srp server domain [domain-name]`
53
54Get the domain.
55
56```bash
57> srp server domain
58default.service.arpa.
59Done
60```
61
62Set the domain.
63
64```bash
65> srp server domain thread.service.arpa.
66Done
67```
68
69### enable
70
71Usage: `srp server enable`
72
73Enable the SRP server.
74
75```bash
76> srp server enable
77Done
78```
79
80### host
81
82Usage: `srp server host`
83
84Print information of all registered hosts.
85
86```bash
87> srp server host
88srp-api-test-1.default.service.arpa.
89    deleted: false
90    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
91srp-api-test-0.default.service.arpa.
92    deleted: false
93    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
94Done
95```
96
97### lease
98
99Usage: `srp server lease [<min-lease>] [<max-lease>] [<min-key-lease>] [<max-key-lease>]`
100
101Get LEASE and KEY-LEASE values.
102
103```bash
104> srp server lease
105min lease: 1800
106max lease: 7200
107min key-lease: 86400
108max key-lease: 1209600
109Done
110```
111
112Set LEASE and KEY-LEASE values.
113
114```bash
115> srp server lease 1800 7200 86400 1209600
116Done
117```
118
119### service
120
121Usage: `srp server service`
122
123Print information of all registered services.
124
125```bash
126> srp server service
127srp-api-test-1._ipps._tcp.default.service.arpa.
128    deleted: false
129    subtypes: (null)
130    port: 49152
131    priority: 0
132    weight: 0
133    TXT: 0130
134    host: srp-api-test-1.default.service.arpa.
135    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
136srp-api-test-0._ipps._tcp.default.service.arpa.
137    deleted: false
138    subtypes: _sub1,_sub2
139    port: 49152
140    priority: 0
141    weight: 0
142    TXT: 0130
143    host: srp-api-test-0.default.service.arpa.
144    addresses: [fdde:ad00:beef:0:0:ff:fe00:fc10]
145Done
146```
147
148### state
149
150Usage: `srp server state`
151
152Print the state of the SRP server. It could be `disabled`, `stopped` or `running`.
153
154- disabled: The SRP server is not enabled.
155- stopped: The SRP server is enabled but not active due to existing SRP servers already active in the Thread network. The SRP server may become active when existing SRP servers are no longer active within the Thread network.
156- running: The SRP server is active and will handle service registrations.
157
158```bash
159> srp server state
160running
161Done
162```
163

README_TCP.md

1# OpenThread CLI - TCP Example
2
3The OpenThread TCP APIs may be invoked via the OpenThread CLI.
4
5## Quick Start
6
7### Form Network
8
9Form a network with at least two devices.
10
11### Node 1
12
13On node 1, initialize the TCP CLI module and listen for incoming connections using the example TCP listener.
14
15```bash
16> tcp init
17> tcp listen :: 30000
18```
19
20The `::` specifies the IPv6 Unspecified Address.
21
22### Node 2
23
24On node 2, initialize the TCP CLI module, connect to node 1, and send a simple message.
25
26```bash
27> tcp init
28> tcp connect fe80:0:0:0:a8df:580a:860:ffa4 30000
29> tcp send hello
30```
31
32### Result
33
34After running the `tcp connect` command on node 1, you should see a printout on node 1 similar to below:
35
36```bash
37TCP: Connection established
38```
39
40In addition, you should also see a printout on node 2 similar to below:
41
42```bash
43Accepted connection from [fe80:0:0:0:8f3:f602:bf9b:52f2]:49152
44TCP: Connection established
45```
46
47After running the `tcp send` command on node 1, you should see a printout on node 2 similar to below:
48
49```bash
50TCP: Received 5 bytes: hello
51```
52
53For a more in-depth example, see [this video](https://youtu.be/ppZ784YUKlI).
54
55## Command List
56
57- [help](#help)
58- [init](#init-size)
59- [deinit](#deinit)
60- [bind](#bind-ip-port)
61- [connect](#connect-ip-port)
62- [send](#send-message)
63- [benchmark](#benchmark-size)
64- [sendend](#sendend)
65- [abort](#abort)
66- [listen](#listen-ip-port)
67- [stoplistening](#stoplistening)
68
69## Command Details
70
71### abort
72
73Unceremoniously ends the TCP connection, if one exists, associated with the example TCP endpoint, transitioning the TCP endpoint to the closed state.
74
75```bash
76> tcp abort
77TCP: Connection reset
78Done
79```
80
81### benchmark [\<size\>]
82
83Transfers the specified number of bytes using the TCP connection currently associated with the example TCP endpoint (this TCP connection must be established before using this command).
84
85- size: the number of bytes to send for the benchmark. If it is left unspecified, the default size is used.
86
87```bash
88> tcp benchmark
89Done
90TCP Benchmark Complete: Transferred 73728 bytes in 7233 milliseconds
91TCP Goodput: 81.546 kb/s
92```
93
94### bind \<ip\> \<port\>
95
96Associates a name (i.e. IPv6 address and port) to the example TCP endpoint.
97
98- ip: the IPv6 address or the unspecified IPv6 address (`::`).
99- port: the TCP port.
100
101```bash
102> tcp bind :: 30000
103Done
104```
105
106### connect \<ip\> \<port\>
107
108Establishes a connection with the specified peer.
109
110If the connection establishment is successful, the resulting TCP connection is associated with the example TCP endpoint.
111
112- ip: the peer's IPv6 address.
113- port: the peer's TCP port.
114
115```bash
116> tcp connect fe80:0:0:0:a8df:580a:860:ffa4 30000
117Done
118TCP: Connection established
119```
120
121### deinit
122
123Deinitializes the example TCP listener and the example TCP endpoint.
124
125```bash
126> tcp deinit
127Done
128```
129
130### help
131
132List the TCP CLI commands.
133
134```bash
135> tcp help
136abort
137benchmark
138bind
139connect
140deinit
141help
142init
143listen
144send-message
145sendend
146stoplistening
147Done
148```
149
150### init [\<size\>]
151
152Initializes the example TCP listener and the example TCP endpoint.
153
154- size: the size of the receive buffer to associate with the example TCP endpoint. If left unspecified, the maximum size is used.
155
156```bash
157> tcp init
158Done
159```
160
161### listen \<ip\> \<port\>
162
163Uses the example TCP listener to listen for incoming connections on the specified name (i.e. IPv6 address and port).
164
165If 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.
166
167- ip: the IPv6 address or the unspecified IPv6 address (`::`).
168- port: the TCP port.
169
170```bash
171> tcp listen :: 30000
172Done
173```
174
175### send \<message\>
176
177Send data over the TCP connection associated with the example TCP endpoint.
178
179- message: the message to send.
180
181```bash
182> tcp send hello
183Done
184```
185
186### sendend
187
188Sends 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.
189
190```bash
191> tcp sendend
192Done
193```
194
195### stoplistening
196
197Stops listening for incoming TCP connections using the example TCP listener.
198
199```bash
200> tcp stoplistening
201Done
202```
203

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 IPv6 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
107### linksecurity
108
109Indicates whether the link security is enabled or disabled.
110
111```bash
112> udp linksecurity
113Enabled
114Done
115```
116
117### linksecurity enable
118
119Enable link security.
120
121```bash
122> udp linksecurity enable
123Done
124```
125
126### linksecurity disable
127
128Disable link security.
129
130```bash
131> udp linksecurity disable
132Done
133```
134
135### open
136
137Opens the example socket.
138
139```bash
140> udp open
141Done
142```
143
144### send \<ip\> \<port\> \<message\>
145
146Send a UDP message.
147
148- ip: the IPv6 destination address.
149- port: the UDP destination port.
150- message: the message to send.
151
152```bash
153> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 hello
154Done
155```
156
157### send \<ip\> \<port\> \<type\> \<value\>
158
159Send a few bytes over UDP.
160
161- ip: the IPv6 destination address.
162- port: the UDP destination port.
163- type: the type of the message:
164  - `-t`: text payload in the `value`, same as without specifying the type.
165  - `-s`: autogenerated payload with specified length indicated in the `value`.
166  - `-x`: binary data in hexadecimal representation in the `value`.
167
168```bash
169> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -t hello
170Done
171
172> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -x 68656c6c6f
173Done
174
175> udp send fdde:ad00:beef:0:bb1:ebd6:ad10:f33 1234 -s 800
176Done
177
178```
179
180### send \<message\>
181
182Send a UDP message on a connected socket.
183
184- message: the message to send.
185
186```bash
187> udp send hello
188Done
189```
190
191### send \<type\> \<value\>
192
193Send a few bytes over UDP.
194
195- type: the type of the message:
196  - `-t`: text payload in the `value`, same as without specifying the type.
197  - `-s`: autogenerated payload with specified length indicated in the `value`.
198  - `-x`: binary data in hexadecimal representation in the `value`.
199
200```bash
201> udp send -t hello
202Done
203
204> udp send -x 68656c6c6f
205Done
206
207> udp send -s 800
208Done
209```
210