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