[unit-test] properly configure operational dataset (#9203)

This commit is contained in:
Jonathan Hui
2023-06-26 17:18:24 -07:00
committed by GitHub
parent 0cc1de7b5a
commit 3f4dcbc2ec
3 changed files with 72 additions and 3 deletions
+8 -1
View File
@@ -31,6 +31,7 @@
#include "test_platform.h"
#include "test_util.hpp"
#include <openthread/dataset_ftd.h>
#include <openthread/srp_client.h>
#include <openthread/srp_server.h>
#include <openthread/thread.h>
@@ -200,7 +201,13 @@ void InitTest(void)
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Initialize Border Router and start Thread operation.
SuccessOrQuit(otLinkSetPanId(sInstance, 0x1234));
otOperationalDataset dataset;
otOperationalDatasetTlvs datasetTlvs;
SuccessOrQuit(otDatasetCreateNewNetwork(sInstance, &dataset));
SuccessOrQuit(otDatasetConvertToTlvs(&dataset, &datasetTlvs));
SuccessOrQuit(otDatasetSetActiveTlvs(sInstance, &datasetTlvs));
SuccessOrQuit(otIp6SetEnabled(sInstance, true));
SuccessOrQuit(otThreadSetEnabled(sInstance, true));