mirror of
https://github.com/espressif/openthread.git
synced 2026-09-11 03:30:09 +00:00
[nexus] add mechanism to emulate node reset (#11662)
This commit adds a new mechanism to emulate a node reset on `Nexus::Node`. This is realized by resetting all platform components while ensuring the non-volatile `mSettings` remains unchanged, then reinitializing the `ot::Instance` by invoking its constructor. This is used to add a new `test_full_network_reset` test, which emulates a full simultaneous reset of all nodes in a large network, tracking how long it takes for the network to stabilize after the reset event.
This commit is contained in:
@@ -32,6 +32,26 @@
|
||||
namespace ot {
|
||||
namespace Nexus {
|
||||
|
||||
void Node::Reset(void)
|
||||
{
|
||||
Instance *instance = &GetInstance();
|
||||
uint32_t id = GetId();
|
||||
|
||||
mRadio.Reset();
|
||||
mAlarm.Reset();
|
||||
mMdns.Reset();
|
||||
mPendingTasklet = false;
|
||||
#if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE
|
||||
mTrel.Reset();
|
||||
#endif
|
||||
|
||||
instance->~Instance();
|
||||
|
||||
instance = new (instance) Instance();
|
||||
instance->SetId(id);
|
||||
instance->AfterInit();
|
||||
}
|
||||
|
||||
void Node::Form(void)
|
||||
{
|
||||
MeshCoP::Dataset::Info datasetInfo;
|
||||
|
||||
Reference in New Issue
Block a user