OTBR HTTP API
generate_thread_network
Initialize a network with random values, include PAN ID, Extended PAN ID and Network Key.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"generate_thread_network",
{}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
export_thread_network
Export the network configuration, the configuration file format is passphrase|datasetactive
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"export_thread_network",
{}
]
}'
Response parameters:
Field |
Type |
Description |
filename |
string |
The name of the exported file |
path |
string |
The path of the exported file |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"filename": "thread_network.conf",
"path": "/tmp/thread_network.conf"
}
}
import_thread_network
If there is no interface to pass parameters, use the configuration file to import the network configuration.
Request parameters:
Field |
Type |
Description |
Passphrase |
string |
Thread network Passphrase, a user-defined character string that serves as Commissioner Credential and |
ActiveDataset |
string |
Operational Dataset TLVs. |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"import_thread_network",
{}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
get_status
Get the Thread network status
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_status",
{}
]
}'
Response parameters:
Field |
Type |
Description |
OpenThreadVersionAPI |
string |
OpenThread API version |
OTBRVersion |
string |
ot-br-posix version |
ThreadVersion |
string |
Thread Specification version, v1.1 , v1.2, v1.3 |
Network |
object |
Thread network information |
Network.Channel |
number |
Thread network channel. The value ranges from 11 to 26 |
Network.ExtPanId |
string |
Thread network Extended PAN ID. Its length is limited to 16 bytes of UTF-8 encoded characters |
Network.NetworkKey |
string |
Thread network key, which is 32 bytes long UTF-8 encoded characters |
Network.NetworkName |
string |
Thread network name. Its length is limited to 1 to 16 characters |
Network.PanId |
number |
Thread network PAN ID, value range: 0<= PAN ID <65535 or 0x0<= PAN ID<0xFFFF |
Network.PSKc |
string |
Thread network PSKc, PSKc is algorithmically generated by Passphrase, ExtendedPanId, and NetworkName, |
Network.Passphrase |
string |
Thread network Passphrase, a user-defined character string that serves as Commissioner Credential and |
Network.OnMeshPrefix |
array |
On-Mesh Prefix |
Network.LeaderData |
object |
Leader data |
Network.LeaderData.PartitionId |
number |
Partition ID of the leader node |
Network.LeaderData.Weighting |
number |
Weighting of the leader node |
Network.LeaderData.DataVersion |
number |
Data Version of the leader node |
Network.LeaderData.StableDataVersion |
number |
Stable Data Version of the leader node |
Network.LeaderData.LeaderRouterId |
number |
Leader Router ID of the leader node |
Network.IPv6 |
array |
IPv6 information |
Network.ActiveDataset |
string |
Operational Dataset TLVs. |
RCP |
object |
RCP information |
RCP.State |
number |
The state of RCP module, disabled=0, detached=1, child=2, router=3 or leader=4 |
RCP.RCPVersion |
string |
RCP version |
RCP.ExtAddress |
string |
IEEE 802.15.4 Extended Address |
RCP.EUI64 |
string |
The factory-assigned IEEE EUI-64 |
RCP.TXPower |
number |
The transmit power in dBm |
RCP.Rloc16 |
number |
Thread RLOC16 value |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
scan
Scan peripheral Thread devices.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"scan",
{}
]
}'
Response parameters:
Field |
Type |
Description |
ScanList |
array |
Scan list |
ScanList.IsJoinable |
bool |
Whether the Thread node is allowed to join |
ScanList.Channel |
number |
Channel of the Thread node |
ScanList.Rssi |
number |
Signal strength of the Thread node |
ScanList.Lqi |
number |
Link quality indicator of the Thread node |
ScanList.NetworkName |
string |
Network name of the Thread node |
ScanList.ExtPanId |
string |
Extended PAN ID of the Thread node |
ScanList.PanId |
number |
PAN ID of the Thread node |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}
set_config
Create a new Thread network or modify the current Thread network.
Request parameters:
Field |
Type |
Description |
NetworkName |
string |
Thread network name, its length is limited to 1~16 characters |
ExtPanId |
string |
Thread Network Extended PAN ID |
PanId |
number |
Thread network PAN ID |
Passphrase |
string |
Thread network Passphrase, a user-defined character string that serves as Commissioner Credential and |
NetworkKey |
string |
Thread network key, its length is 32 bytes UTF-8 encoded characters |
Channel |
number |
Thread network channel, the value range is 11-26 |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"set_config",
{
"NetworkName": "OpenThread",
"Passphrase": "654321",
"PanId": "0x1234",
"ExtPanId": "1122334455667788",
"NetworkKey": "7fa541ccdcece042b07ac34c98620a4c",
"Channel": "13"
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
set_txpower
Set the transmit power of the Thread device.
Request parameters:
Field |
Type |
Description |
TXPower |
number |
The transmit power in dBm |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"set_txpower",
{
"TXPower": 8
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
stop
Stop the Thread network of the device.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"stop",
{}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
start
Start the Thread network
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"start",
{}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
join
Join the Thread network.
Request parameters:
Field |
Type |
Description |
CredentialType |
string |
Supported values are 'networkKeyType' and 'pskdType' |
NetworkKey |
string |
Thread network key, which is 32 bytes long UTF-8 encoded characters |
PSKd |
string |
The Joiner Credential is a device-specific string of all uppercase alphanumeric characters |
Channel |
number |
Thread network channel |
PanId |
number |
Thread network PAN ID |
ExtendedPanId |
number |
Thread network ExtendedPanId |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"join",
{
"CredentialType": "networkKeyType",
"NetworkKey": "1ed99ba54e1b2bbbfe36b576cecaca8f",
"Channel": 11,
"PanId": "0x3d32"
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
add_joiner
Add Joiners.
Request parameters:
Field |
Type |
Description |
PSKd |
string |
The Joiner Credential is a device-specific string of all uppercase alphanumeric characters |
Timeout |
number |
Joiner timeout in seconds. Default 120s |
EUI64 |
string |
The IEEE EUI-64 of the Joiner or '*' to match any Joiner. |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"add_joiner",
{
"PSKd": "654321",
"EUI64": "9483c4ea62f8cfcd",
"Timeout": 120
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
export_joiner_list
Export the Joiner information to /tmp/thread_devices, the file is a cvs format, and its data format is 'Joiner EUI64,Joiner Credential'.
Request parameters:
Field |
Type |
Description |
Timeout |
number |
Joiner timeout in seconds. Default 120s |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"export_joiner_list",
{}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
import_joiner_list
Import Joiner list.
Request parameters:
Field |
Type |
Description |
Timeout |
number |
Joiner timeout in seconds. Default 120s |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"import_joiner_list",
{
"Timeout": 120
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
rejoin_all
Start Commissining and add Joiner entry.
Request parameters:
Field |
Type |
Description |
Timeout |
number |
Joiner timeout in seconds. Default 120s |
Type |
number |
Supported values are 1: Only Timeout, 2: Only Joined, 3: ALL |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"rejoin_all",
{
"Timeout": 120,
"Type": 3
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. -1:Invalied parameter |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
remove_joiner_list
Delete Joiner entries.
Request parameters:
Field |
Type |
Description |
DeviceList |
array |
DeviceList |
DeviceList[x] |
string |
Joiner EUI64 |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"remove_joiners",
{
"DeviceList": [
"9483c4ea62f8cfcd",
"9483c4ea62f8cfcf"
]
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
get_joiner_list
Get the Joiner list.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_joiner_list",
{}
]
}'
Response parameters:
Field |
Type |
Description |
DeviceList |
array |
DeviceList |
DeviceList.EUI64 |
string |
Joiner EUI64 |
DeviceList.Status |
number |
Status of new devices not connected to the network. Supported values are 0: Reday to Join, 1: Joining, 2: Joined, 3: Timeout |
DeviceList.Timeout |
number |
Joiner network access timeout |
DeviceList.AddTime |
number |
Timestamp added |
DeviceList.JoinedTime |
number |
The Joiner successfully obtained the credential timestamp |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"DeviceList": [
{
"Timeout": 120,
"PSKd": "AAAAAA",
"Status": 0,
"EUI64": "94deb8fffef6e101"
}
]
}
}
get_network_data
Get Thread network topology map data.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_network_data",
{}
]
}'
Response parameters:
Field |
Type |
Description |
ExtAddress |
string |
IEEE 802.15.4 Extended Address |
Name |
string |
The name of the user-defined Thread network node. |
Rloc16 |
number |
The Thread RLOC16 value. |
Rloc16s |
string |
The Thread RLOC16 value in hex string. |
Version |
string |
Thread version. |
IsBorderRouter |
bool |
IsBorderRouter. |
IsLeader |
bool |
IsLeader. |
IsThisDevice |
bool |
IsThisDevice. |
NeighborRouterTable |
object |
NeighborRouterTable. |
NeighborRouterTable.Name |
string |
NeighborRouterTable.Name |
NeighborRouterTable.ExtAddress |
string |
NeighborRouterTable.ExtAddress |
NeighborRouterTable.Rloc16 |
number |
NeighborRouterTable.Rloc16 |
NeighborRouterTable.ConnectionTime |
string |
NeighborRouterTable.ConnectionTime |
NeighborRouterTable.FrameErrorRate |
object |
NeighborRouterTable.FrameErrorRate |
NeighborRouterTable.LastRssi |
object |
NeighborRouterTable.LastRssi |
NeighborRouterTable.LinkMargin |
object |
NeighborRouterTable.LinkMargin |
NeighborRouterTable.MessageErrorRate |
object |
NeighborRouterTable.MessageErrorRate |
NeighborRouterTable.Version |
object |
NeighborRouterTable.Version |
ChildTable |
object |
ChildTable |
ChildTable.ExtAddress |
string |
ChildTable.ExtAddress |
ChildTable.Name |
number |
ChildTable.Name |
ChildTable.Age |
number |
ChildTable.Age |
ChildTable.AvgRssi |
number |
ChildTable.AvgRssi |
ChildTable.ConnectionTime |
string |
ChildTable.ConnectionTime |
ChildTable.CslChannel |
number |
ChildTable.CslChannel |
ChildTable.CslPeriod |
number |
ChildTable.CslPeriod |
ChildTable.CslSync |
number |
ChildTable.CslSync |
ChildTable.DeviceType |
number |
ChildTable.DeviceType |
ChildTable.FrameErrorRate |
number |
ChildTable.FrameErrorRate |
ChildTable.MessageErrorRate |
object |
ChildTable.MessageErrorRate |
ChildTable.IP6AddressList |
object |
ChildTable.IP6AddressList |
ChildTable.IsBorderRouter |
object |
ChildTable.IsBorderRouter |
ChildTable.IsThisDevice |
object |
ChildTable.IsThisDevice |
ChildTable.LastRssi |
object |
ChildTable.LastRssi |
ChildTable.LinkMargin |
object |
ChildTable.LinkMargin |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}
get_leader_data
Get Thread Leader data.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_leader_data",
{}
]
}'
Response parameters:
Field |
Type |
Description |
LeaderData |
object |
Leader node information in the Thread network |
LeaderData.PartitionId |
number |
Partition ID of the leader node |
LeaderData.Weighting |
number |
Weighting of the Leader node |
LeaderData.DataVersion |
number |
Data Version of the Leader node |
LeaderData.StableDataVersion |
number |
Stable Data Version of the Leader node |
LeaderData.LeaderRouterId |
number |
Leader Router ID of the Leader node |
Response sample:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}
get_buffer_info
Get Buffer Info.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_buffer_info",
{}
]
}'
Response parameters:
Field |
Type |
Description |
6loReassemblyQueue |
string |
6loReassemblyQueue |
6loSendQueue |
string |
6loSendQueue |
ApplicationCoapQueue |
string |
ApplicationCoapQueue |
CoapQueue |
string |
CoapQueue |
CoapSecureQueue |
string |
CoapSecureQueue |
FreeBuffers |
string |
FreeBuffers |
Ip6Queue |
string |
Ip6Queue |
MaxUsedBuffers |
string |
MaxUsedBuffers |
MleQueue |
string |
MleQueue |
MplQueue |
string |
MplQueue |
TotalBuffers |
string |
TotalBuffers |
Response sample:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}
export_network_data
Export Thread network diagnostic data
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"export_network_data",
{}
]
}'
Response parameters:
Field |
Type |
Description |
file_path |
string |
The file path |
file_name |
string |
The file name |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"file_path": "/js/thread_network_diagnostics.json",
"file_name": "thread_network_diagnostics.json"
}
}
get_neighbor_list
desc
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_neighbor_list",
{}
]
}'
Response parameters:
Field |
Type |
Description |
NeighborNumber |
number |
The number of neighbor |
NeighborList |
array |
NeighborList |
NeighborList.Role |
string |
Neighbor network node roles,'R' or 'C' |
NeighborList.Rloc16 |
number |
RLOC16 |
NeighborList.Age |
number |
Time last heard |
NeighborList.AvgRssi |
number |
Average RSSI |
NeighborList.LastRssi |
number |
Last observed RSSI |
NeighborList.Mode |
object |
the Thread Device Mode value: - -no flags set (rx-off-when-idle, minimal Thread device, stable network data) |
NeighborList.ExtAddress |
string |
IEEE 802.15.4 Extended Address |
NeighborList.LinkQualityIn |
number |
Link Quality In |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}
get_bbr_status
Get Backbone Router status information
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_bbr_status",
{}
]
}'
Response parameters:
Field |
Type |
Description |
Enable |
bool |
Whether to enable the BackBone Router |
State |
string |
Represents the Backbone Router Status, the values of State are Disabled, Secondary, Primary |
MlrTimeout |
number |
The minimum value of Multicast Listener Registration Timeout (in seconds) is 300s, and the maximum value is 24d |
SequenceNumber |
number |
Sequence Number |
ReregistrationDelay |
number |
Reregistration Delay (in seconds) |
Jitter |
number |
Jitter |
Ifname |
string |
Current backboneIfName |
Ifnames |
array |
Supported backboneIfName |
Ifnames[x] |
string |
Supported backboneIfName |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"State": "Primary",
"Ifname": "br-lan",
"SequenceNumber": 5,
"Ifnames": [
"eth0",
"br-lan"
],
"MlrTimeout": 3600,
"Jitter": 5,
"Error": 0,
"ReregistrationDelay": 5
}
}
set_bbr_config
Set Backbone router config
Request parameters:
Field |
Type |
Description |
MlrTimeout |
number |
The minimum value of Multicast Listener Registration Timeout (in seconds) is 300s, and the maximum value is 24d |
SequenceNumber |
number |
Sequence Number |
ReregistrationDelay |
number |
Reregistration Delay (in seconds) |
Jitter |
number |
Jitter |
IfName |
string |
backboneIfName |
Enable |
bool |
Enable Backbone router function |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"set_bbr_config",
{
"MlrTimeout": 3500,
"SequenceNumber": 30,
"ReregistrationDelay": 1000,
"Jitter": 10
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
set_commissioning
Set commissioner status
Request parameters:
Field |
Type |
Description |
Enable |
bool |
Enable Commissioner |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"set_commissioner",
{
"Enable": true
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
get_srp_server_service
Get SRP Server Service.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_srp_server_service",
{}
]
}'
Response parameters:
Field |
Type |
Description |
Services |
array |
SRP Services |
Services.InstanceName |
string |
The service instance name |
Services.Deleted |
bool |
If Deleted is true then no other information |
Services.Subtypes |
string |
The service subtypes |
Services.Port |
number |
The service port number |
Services.Priority |
number |
The service priority |
Services.Weight |
number |
The service weight |
Services.Ttl |
number |
The service ttl |
Services.TXT |
array |
The service txt record |
Services.Host |
string |
The service host name |
Services.Address |
array |
The service host address |
Services.Lease |
number |
The service lease |
Services.KeyLease |
number |
The service key-lease |
ServicesNumber |
number |
The service number |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}
get_srp_server_config
Get SRP Server config.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_srp_server_config",
{}
]
}'
Response parameters:
Field |
Type |
Description |
Enable |
bool |
Enable SRP Server |
DomainName |
string |
The SRP Server domain name |
MinLease |
number |
The minimum LEASE interval in seconds. mMinLease <= mMaxLease, mMinLease <= mMinKeyLease |
MaxLease |
number |
The maximum LEASE interval in seconds. mMaxLease <= mMaxKeyLease |
MinKeyLease |
number |
The minimum KEY-LEASE interval in seconds. mMinKeyLease <= mMaxKeyLease |
MaxKeyLease |
number |
The maximum KEY-LEASE interval in seconds |
SeqNum |
number |
The sequence number used with anycast address mode. |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message. |
Response sample:
{
"jsonrpc": "2.0",
"id": 1,
"result": {}
}
set_srp_server_config
Set SRP Server config.
Request parameters:
Field |
Type |
Description |
Enable |
bool |
Enable SRP Server |
DomainName |
string |
The SRP Server domain name |
MinLease |
number |
The minimum LEASE interval in seconds. mMinLease <= mMaxLease, mMinLease <= mMinKeyLease |
MaxLease |
number |
The maximum LEASE interval in seconds. mMaxLease <= mMaxKeyLease |
MinKeyLease |
number |
The minimum KEY-LEASE interval in seconds. mMinKeyLease <= mMaxKeyLease |
MaxKeyLease |
number |
The maximum KEY-LEASE interval in seconds |
SeqNum |
number |
The sequence number used with anycast address mode. The sequence number is included in "DNS/SRP Service Anycast Address" entry published in the Network Data.Front end does not need to display |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"set_srp_server_config",
{
"Enable": true,
"DomainName": "default.service.arpa.",
"MinLease": 1800,
"MaxLease": 86400,
"MinKeyLease": 86400,
"MaxKeyLease": 1209600
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
get_nat64_status
Get NAT64 Status
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"get_nat64_status",
{}
]
}'
Response parameters:
Field |
Type |
Description |
Enable |
bool |
Enable NAT64 |
PrefixManager |
string |
show the state of NAT64 PrefixManager [Disable,NotRunning,Idle,Active] |
Translator |
string |
show the state of NAT64 translator [Disable,NotRunning,Active] |
Cidr |
string |
show the CIDR of NAT64 |
Mappings |
array |
Mappings |
Mappings.ipv4 |
string |
show the IPv4 value |
Mappings.ipv6 |
string |
show the IPv6 value |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"Translator": "Active",
"PrefixManager": "Active",
"Mappings": [
{
"ipv6": "fda1:20d6:69d5:1:24b6:6d65:7a84:d94f",
"ipv4": "192.168.255.254"
}
],
"Enable": true,
"Cidr": "192.168.255.0/24"
}
}
set_nat64_config
Set NAT64 config.
Request parameters:
Field |
Type |
Description |
Enable |
bool |
Enable NAT64 Translator |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"set_nat64_config",
{
"Enable": true
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
set_device_name
Set device name, it will show in topology.
Request parameters:
Field |
Type |
Description |
Name |
string |
Name |
ExtAddress |
string |
ExtAddress |
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"set_device_name",
{
"ExtAddress": "1241B519B4A43AA7",
"Name": "test"
}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}
force_to_leader
Try to force the device role from router to leader.
Request sample:
curl -k http://127.0.0.1/rpc -H 'glinet: 1' -d '
{
"jsonrpc": "2.0",
"id": "0",
"method": "call",
"params": [
"",
"otbr",
"force_to_leader",
{}
]
}'
Response parameters:
Field |
Type |
Description |
err_code option |
number |
Error code. |
err_msg option |
string |
Error message |
Response sample:
{
"id": "0",
"jsonrpc": "2.0",
"result": {
"err_code": 0
}
}