Replies: 1 comment 8 replies
-
Correct, we should use
We suggest changing Active Operational Dataset directly only for testing purpose or when there is no existing network (e.g. the initial
It sounds good to me.
I think providing a API for the user to controller the Thread network state is useful. If the Thread device state is "DISABLED" or "DETACHED", we allow direct modification to Active Operational Dataset. Otherwise, we accepts only changes via the Pending Operational Dataset. So if the user doesn't care about the rest of the device in the network (usually in tests or demo), he/she can disable the network before changing the Active Operational Dataset. |
Beta Was this translation helpful? Give feedback.
-
This is OTBR posix specific, but I am starting this discussion here as the ot-br-posix has no GitHub Discussions.
I've recently added a REST API to set the active dataset by adding a REST API which takes a dataset in TLV form, see openthread/ot-br-posix#1658. This added the following endpoint:
We realized we need more capabilities for our needs. In particular we'd like to have an API to form a new network from individual parameters (network name, channel etc.).
I've looked into openthread/ot-br-posix#537, a previous attempt to extend the REST API. The previous attempt implements the following REST endpoints:
This previous attempts uses APIs such as
otThreadSetExtendedPanId
.Looking at the code two questions came up which I think I know the answer, but prefer to have confirmation on my assumptions:
otThreadSetExtendedPanId
clear the active and pending dataset. Mixing these APIs with dataset APIs seems not a good idea. Is my assumption correct that these are backwards compatibility APIs and probably shouldn't be used for a new implementation?The dataset CLI essentially implements a set of commands to manipulation a dataset. The CLI is stateful. Only one dataset can be manipulated at a time. With
init new
a new dataset with sensible default values (some are random like the network keys etc.) and withinit active
a copy of the current active dataset is initialized for CLI manipulation. Thecommit active
stores it as active dataset.To implement a dataset API in REST, two routes could be followed:
I tend to lean towards resource oriented (as this feels more RESTful to me)
POST
would initialize a new dataset, and update that dataset with whatever data is provided as body.PUT
would not initialize a new dataset, just update the existing active/pending dataset with the new values. If no active dataset iss presentPUT
would return with an error.Also
DELETE
could be implemented to clear the dataset.We also need a way to start the Thread network via REST API. The previous attempt seems to start the interface/Thread network on PUT or POST. We could do the same. However, this would not reflect what the CLI is doing (
commit active
does not start the OTBR). But then, at startup, the OTBR is starting the interface/Thread network implicitly (viaTryResumeNetwork()
) at startup as well...If an implicit state change on manipulating the active dataset is not acceptable, we'd need to have a REST API to manipulate the node state. I have no good idea how that could look like. I tend to lean to a implicit start. From what I understand manipulating the active dataset also implicitly activates changes (in
otDatasetSetActive
), so implicitly starting doesn't feel far off.Any thoughts/guidance welcome!
Beta Was this translation helpful? Give feedback.
All reactions