The 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.
Automatically start Thread on initialization.
> autostart true Done
Don't automatically start Thread on initialization.
> autostart false Done
Show the status of automatically starting Thread on initialization.
> autostart false Done
List the blacklist entries.
> blacklist Enabled 166e0a0000000002 166e0a0000000003 Done
Add an IEEE 802.15.4 Extended Address to the blacklist.
> blacklist add 166e0a0000000002 Done
Clear all entries from the blacklist.
> blacklist clear Done
Disable MAC blacklist filtering.
> blacklist disable Done
Enable MAC blacklist filtering.
> blacklist enable Done
Remove an IEEE 802.15.4 Extended Address from the blacklist.
> blacklist remove 166e0a0000000002 Done
Show the current message buffer information.
> bufferinfo total: 40 free: 40 6lo send: 0 0 6lo reas: 0 0 ip6: 0 0 mpl: 0 0 mle: 0 0 arp: 0 0 coap: 0 0 Done
Get the IEEE 802.15.4 Channel value.
> channel 11 Done
Set the IEEE 802.15.4 Channel value.
> channel 11 Done
List attached Child IDs.
> child list 1 2 3 6 7 8 Done
Print table of attached children.
> child table | ID | RLOC16 | Timeout | Age | LQ In | C_VN |R|S|D|N| Extended MAC | +-----+--------+------------+------------+-------+------+-+-+-+-+------------------+ | 1 | 0xe001 | 240 | 44 | 3 | 237 |1|1|1|1| d28d7f875888fccb | | 2 | 0xe002 | 240 | 27 | 3 | 237 |0|1|0|1| e2b3540590b0fd87 | Done
Print diagnostic information for an attached Thread Child. The id
may be a Child ID or an RLOC16.
> child 1 Child ID: 1 Rloc: 9c01 Ext Addr: e2b3540590b0fd87 Mode: rsn Net Data: 184 Timeout: 100 Age: 0 Link Quality In: 3 RSSI: -20 Done
Get the Thread maximum number of allowed children.
> childmax 5 Done
Set the Thread maximum number of allowed children.
> childmax 2 Done
Get the Thread Child Timeout value.
> childtimeout 300 Done
Set the Thread Child Timeout value.
> childtimeout 300 Done
Starts the application coap service.
> coap start Coap service started: Done
Stops the application coap service.
> coap start Coap service stopped: Done
Sets the URI-Path for the test resource.
> coap resource test Resource name is 'test': Done > coap resource Resource name is 'test': Done
> coap get fdde:ad00:beef:0:dbaa:f1d0:8afb:30dc test Sending coap message: Done Received coap request from [fdde:ad00:beef:0:dbaa:f1d0:8afb:30dc]: GET coap response sent successfully! Received coap response with payload: 30 > coap put fdde:ad00:beef:0:dbaa:f1d0:8afb:30dc test non-con somePayload Sending coap message: Done Received coap request from [fdde:ad00:beef:0:dbaa:f1d0:8afb:30dc]: PUT with payload: 73 6f 6d 65 50 61 79 6c 6f 61 64 > coap put fdde:ad00:beef:0:dbaa:f1d0:8afb:30dc test con 123 Sending coap message: Done Received coap request from [fdde:ad00:beef:0:dbaa:f1d0:8afb:30dc]: PUT with payload: 31 32 33 coap response sent successfully! Received coap response
Start the Commissioner role.
This command will cause the device to send LEAD_PET and LEAD_KA messages.
> commissioner start Done
Stop the Commissioner role.
This command will cause the device to send LEAD_KA[Reject] messages.
> commissioner stop Done
Add a Joiner entry.
> commissioner joiner add d45e64fa83f81cf7 PSK Done
Remove a Joiner entry.
> commissioner joiner remove d45e64fa83f81cf7 Done
Set the Provisioning URL.
> commissioner provisioningurl http://github.com/openthread/openthread Done
Send a MGMT_ED_SCAN message.
The contents of MGMT_ED_REPORT messages (i.e. Channel Mask and Energy List) are printed as they are received.
> commissioner energy 0x00050000 2 32 1000 fdde:ad00:beef:0:0:ff:fe00:c00 Done Energy: 00050000 0 0 0 0
Send a MGMT_PANID_QUERY message.
The contents of MGMT_PANID_CONFLICT messages (i.e. PAN ID and Channel Mask) are printed as they are received.
> commissioner panid 0xdead 0x7fff800 fdde:ad00:beef:0:0:ff:fe00:c00 Done Conflict: dead, 00000800
Get current commissioner session id.
> commissioner sessionid 0 Done
Get the CONTEXT_ID_REUSE_DELAY value.
> contextreusedelay 11 Done
Set the CONTEXT_ID_REUSE_DELAY value.
> contextreusedelay 11 Done
Get the supported counter names.
>counter mac Done
Get the counter value.
>counter mac TxTotal: 10 TxUnicast: 3 TxBroadcast: 7 TxAckRequested: 3 TxAcked: 3 TxNoAckRequested: 7 TxData: 10 TxDataPoll: 0 TxBeacon: 0 TxBeaconRequest: 0 TxOther: 0 TxRetry: 0 TxErrCca: 0 RxTotal: 2 RxUnicast: 1 RxBroadcast: 1 RxData: 2 RxDataPoll: 0 RxBeacon: 0 RxBeaconRequest: 0 RxOther: 0 RxWhitelistFiltered: 0 RxDestAddrFiltered: 0 RxDuplicated: 0 RxErrNoFrame: 0 RxErrNoUnknownNeighbor: 0 RxErrInvalidSrcAddr: 0 RxErrSec: 0 RxErrFcs: 0 RxErrOther: 0
Print meshcop dataset help menu.
> dataset help help active activetimestamp channel channelmask clear commit delay extpanid masterkey meshlocalprefix mgmtgetcommand mgmtsetcommand networkname panid pending pendingtimestamp pskc securitypolicy Done >
Print meshcop active operational dataset.
> dataset active Active Timestamp: 0 Done
Set active timestamp.
> dataset activestamp 123456789 Done
Set channel.
> dataset channel 12 Done
Set channel mask.
> dataset channelmask e0ff1f00 Done
Reset operational dataset buffer.
> dataset clear Done
Commit operational dataset buffer to active/pending operational dataset.
> dataset commit active Done
Set delay timer value.
> dataset delay 1000 Done
Set extended panid.
> dataset extpanid 000db80123456789 Done
Set master key.
> dataset master 1234567890123456 Done
Set mesh local prefix.
> dataset meshlocalprefix fd00:db8:: Done
Send MGMT_ACTIVE_GET.
> dataset mgmtgetcommand active address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp 123 binary 0001 Done
Send MGMT_ACTIVE_SET.
> dataset mgmtsetcommand active activetimestamp binary 820155 Done
Send MGMT_PENDING_GET.
> dataset mgmtgetcommand pending address fdde:ad00:beef:0:558:f56b:d688:799 activetimestamp binary 0001 Done
Send MGMT_PENDING_SET.
> dataset mgmtsetcommand pending activetimestamp binary 820155 Done
Set network name.
> dataset networkname openthread Done
Set panid.
> dataset panid 0x1234 Done
Print meshcop pending operational dataset.
> dataset pending Done
Set pending timestamp.
> dataset pendingtimestamp 123456789 Done
Set pskc with hex format.
> dataset pskc 67c0c203aa0b042bfb5381c47aef4d9e Done
Set security policy.
> dataset securitypolicy 672 onrcb Done
Get the minimal delay timer (in seconds).
> delaytimermin 30 Done
Set the minimal delay timer (in seconds).
> delaytimermin 60 Done
Perform an MLE Discovery operation.
> discover | J | Network Name | Extended PAN | PAN | MAC Address | Ch | dBm | LQI | +---+------------------+------------------+------+------------------+----+-----+-----+ | 0 | OpenThread | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 | Done
Send DNS Query to obtain IPv6 address for given hostname. The latter two parameters have following default values:
> dns resolve ipv6.google.com > DNS response for ipv6.google.com - [2a00:1450:401b:801:0:0:0:200e] TTL: 300
Print the EID-to-RLOC cache entries.
> eidcache fdde:ad00:beef:0:bb1:ebd6:ad10:f33 ac00 fdde:ad00:beef:0:110a:e041:8399:17cd 6000 Done
Get the factory-assigned IEEE EUI-64.
> eui64 0615aae900124b00 Done
Get the IEEE 802.15.4 Extended Address.
> extaddr dead00beef00cafe Done
Set the IEEE 802.15.4 Extended Address.
> extaddr dead00beef00cafe dead00beef00cafe Done
Get the Thread Extended PAN ID value.
> extpanid dead00beef00cafe Done
Set the Thread Extended PAN ID value.
> extpanid dead00beef00cafe Done
Delete all stored settings, and signal a platform reset.
> factoryreset
Get the HashMac address.
> hashmacaddr e0b220eb7d8dda7e Done
Show the status of the IPv6 interface.
> ifconfig down Done
Bring up the IPv6 interface.
> ifconfig up Done
Bring down the IPv6 interface.
> ifconfig down Done
List all IPv6 addresses assigned to the Thread interface.
> ipaddr fdde:ad00:beef:0:0:ff:fe00:0 fdde:ad00:beef:0:558:f56b:d688:799 fe80:0:0:0:f3d9:2a82:c8d8:fe43 Done
Add an IPv6 address to the Thread interface.
> ipaddr add 2001::dead:beef:cafe Done
Delete an IPv6 address from the Thread interface.
> ipaddr del 2001::dead:beef:cafe Done
List all IPv6 multicast addresses subscribed to the Thread interface.
> ipmaddr ff05:0:0:0:0:0:0:1 ff33:40:fdde:ad00:beef:0:0:1 ff32:40:fdde:ad00:beef:0:0:1 Done
Subscribe the Thread interface to the IPv6 multicast address.
> ipmaddr add ff05::1 Done
Unsubscribe the Thread interface to the IPv6 multicast address.
> ipmaddr del ff05::1 Done
Get multicast promiscuous mode.
> ipmaddr promiscuous Disabled Done
Enable multicast promiscuous mode.
> ipmaddr promiscuous enable Done
Disable multicast promiscuous mode.
> ipmaddr promiscuous disable Done
Start the Joiner role.
This command will cause the device to perform an MLE Discovery and initiate the Thread Commissioning process.
> joiner start PSK Done
Stop the Joiner role.
> joiner stop Done
Set the Joiner port.
> joinerport 1000 Done
Get the Thread Key Sequence Counter.
> keysequence counter 10 Done
Set the Thread Key Sequence Counter.
> keysequence counter 10 Done
Get Thread Key Switch Guard Time (in hours)
> keysequence guardtime 0 Done
Set Thread Key Switch Guard Time (in hours) 0 means Thread Key Switch imediately if key index match
> keysequence guardtime 0 Done
Get the Thread Leader Partition ID.
> leaderpartitionid 4294967295 Done
Set the Thread Leader Partition ID.
> leaderpartitionid 0xffffffff Done
Show the Thread Leader Data.
> leaderdata Partition ID: 1077744240 Weighting: 64 Data Version: 109 Stable Data Version: 211 Leader Router ID: 60 Done
Get the Thread Leader Weight.
> leaderweight 128 Done
Set the Thread Leader Weight.
> leaderweight 128 Done
Get the link quality on the link to a given extended address.
> linkquality 36c1dd7a4f5201ff 3 Done
Set the link quality on the link to a given extended address.
> linkquality 36c1dd7a4f5201ff 3 Done
Get the Thread Master Key value.
> masterkey 00112233445566778899aabbccddeeff Done
Set the Thread Master Key value.
> masterkey 00112233445566778899aabbccddeeff Done
Get the Thread Device Mode value.
> mode rsdn Done
Set the Thread Device Mode value.
> mode rsdn Done
Register local network data with Thread Leader.
> netdataregister Done
Send network diagnostic request to retrieve tlv of <type>s.
If <addr> is unicast address, Diagnostic Get
will be sent. if <addr> is multicast address, Diagnostic Query
will be sent.
> networkdiagnostic get fdde:ad00:beef:0:0:ff:fe00:f400 0 1 6 DIAG_GET.rsp: 00088e18ad17a24b0b740102f400060841dcb82d40bac63d > networkdiagnostic get ff02::1 0 1 DIAG_GET.rsp: 0008567e31a79667a8cc0102f000 DIAG_GET.rsp: 0008aaa7e584759e4e6401025400
Send network diagnostic request to reset <addr>'s tlv of <type>s. Currently only MAC Counters
(9) is supported.
> diagnostic reset fd00:db8::ff:fe00:0 9 Done
Get the NETWORK_ID_TIMEOUT parameter used in the Router role.
> networkidtimeout 120 Done
Set the NETWORK_ID_TIMEOUT parameter used in the Router role.
> networkidtimeout 120 Done
Get the Thread Network Name.
> networkname OpenThread Done
Set the Thread Network Name.
> networkname OpenThread Done
Get the IEEE 802.15.4 PAN ID value.
> panid 0xdead Done
Set the IEEE 802.15.4 PAN ID value.
> panid 0xdead Done
Get the diagnostic information for a Thread Router as parent.
> parent Ext Addr: be1857c6c21dce55 Rloc: 5c00 Link Quality In: 3 Link Quality Out: 3 Age: 20 Done
Get the assigned parent priority value, -2 means not assigned.
> parentpriority 1 Done
Set the assigned parent priority value: 1, 0, -1 or -2.
> parentpriority 1 Done
Send an ICMPv6 Echo Request.
> ping fdde:ad00:beef:0:558:f56b:d688:799 16 bytes from fdde:ad00:beef:0:558:f56b:d688:799: icmp_seq=1 hlim=64 time=28ms
Stop sending ICMPv6 Echo Requests.
> ping stop Done
Get the customized data poll period of sleepy end device (seconds). Only for certification test
> pollperiod 0 Done
Set the customized data poll period for sleepy end device (seconds). Only for certification test
> pollperiod 10 Done
Add a valid prefix to the Network Data.
> prefix add 2001:dead:beef:cafe::/64 paros med Done
Invalidate a prefix in the Network Data.
> prefix remove 2001:dead:beef:cafe::/64 Done
Get radio promiscuous property.
> promiscuous Disabled Done
Enable radio promiscuous operation and print raw packet content.
> promiscuous enable Done
Disable radio promiscuous operation.
> promiscuous disable Done
Release a Router ID that has been allocated by the device in the Leader role.
> releaserouterid 16 Done
Signal a platform reset.
> reset
Get the Thread RLOC16 value.
> rloc16 0xdead Done
Add a valid prefix to the Network Data.
> route add 2001:dead:beef:cafe::/64 s med Done
Invalidate a prefix in the Network Data.
> route remove 2001:dead:beef:cafe::/64 Done
List allocated Router IDs.
> router list 8 24 50 Done
Print table of routers.
> router table | ID | RLOC16 | Next Hop | Path Cost | LQ In | LQ Out | Age | Extended MAC | +----+--------+----------+-----------+-------+--------+-----+------------------+ | 21 | 0x5400 | 21 | 0 | 3 | 3 | 5 | d28d7f875888fccb | | 56 | 0xe000 | 56 | 0 | 0 | 0 | 182 | f2d92a82c8d8fe43 | Done
Print diagnostic information for a Thread Router. The id
may be a Router ID or an RLOC16.
> router 50 Alloc: 1 Router ID: 50 Rloc: c800 Next Hop: c800 Link: 1 Ext Addr: e2b3540590b0fd87 Cost: 0 Link Quality In: 3 Link Quality Out: 3 Age: 3 Done
> router 0xc800 Alloc: 1 Router ID: 50 Rloc: c800 Next Hop: c800 Link: 1 Ext Addr: e2b3540590b0fd87 Cost: 0 Link Quality In: 3 Link Quality Out: 3 Age: 7 Done
Get the ROUTER_DOWNGRADE_THRESHOLD value.
> routerdowngradethreshold 23 Done
Set the ROUTER_DOWNGRADE_THRESHOLD value.
> routerdowngradethreshold 23 Done
Indicates whether the router role is enabled or disabled.
> routerrole Enabled Done
Enable the router role.
> routerrole enable Done
Disable the router role.
> routerrole disable Done
Get the ROUTER_SELECTION_JITTER value.
> routerselectionjitter 120 Done
Set the ROUTER_SELECTION_JITTER value.
> routerselectionjitter 120 Done
Get the ROUTER_UPGRADE_THRESHOLD value.
> routerupgradethreshold 16 Done
Set the ROUTER_UPGRADE_THRESHOLD value.
> routerupgradethreshold 16 Done
Perform an IEEE 802.15.4 Active Scan.
> scan | J | Network Name | Extended PAN | PAN | MAC Address | Ch | dBm | LQI | +---+------------------+------------------+------+------------------+----+-----+-----+ | 0 | OpenThread | dead00beef00cafe | ffff | f1d92a82c8d8fe43 | 11 | -20 | 0 | Done
Return true when there are no other nodes in the network, otherwise return false.
> singleton true or false Done
Return state of current state.
> state offline, disabled, detached, child, router or leader Done
Try to switch to state detached
, child
, router
or leader
.
> state leader Done
Enable Thread protocol operation and attach to a Thread network.
> thread start Done
Disable Thread protocol operation and detach from a Thread network.
> thread stop Done
Get the maximum transmit power in dBm.
> txpowermax -10 dBm Done
Set the maximum transmit power.
> txpowermax -10 Done
Print the build version information.
> version OPENTHREAD/gf4f2f04; Jul 1 2016 17:00:09 Done
List the whitelist entries.
> whitelist Enabled e2b3540590b0fd87 d38d7f875888fccb c467a90a2060fa0e Done
Add an IEEE 802.15.4 Extended Address to the whitelist.
> whitelist add dead00beef00cafe Done
Clear all entries from the whitelist.
> whitelist clear Done
Disable MAC whitelist filtering.
> whitelist disable Done
Enable MAC whitelist filtering.
> whitelist enable Done
Remove an IEEE 802.15.4 Extended Address from the whitelist.
> whitelist remove dead00beef00cafe Done
Diagnostics module is enabled only when building OpenThread with --enable-diag option. Go diagnostics module for more information.