diff --git a/tests/nexus/test_9_2_4.cpp b/tests/nexus/test_9_2_4.cpp index e6e5eb176..0dbe0d08a 100644 --- a/tests/nexus/test_9_2_4.cpp +++ b/tests/nexus/test_9_2_4.cpp @@ -30,8 +30,11 @@ #include #include "meshcop/commissioner.hpp" +#include "meshcop/dataset.hpp" #include "platform/nexus_core.hpp" #include "platform/nexus_node.hpp" +#include "thread/mle.hpp" +#include "thread/thread_netif.hpp" namespace ot { namespace Nexus { @@ -194,6 +197,27 @@ static const uint8_t kSteeringDataStep18[] = {0x11, 0x33, 0x20, 0x44, 0x00, 0x00 */ static constexpr uint8_t kFutureTlvType = 130; +/** + * Initial Channel. + */ +static constexpr uint16_t kInitialChannel = 11; + +/** + * Initial PAN ID. + */ +static constexpr uint16_t kInitialPanId = 0xabcd; + +/** + * Initial Network Key. + */ +static const uint8_t kInitialNetworkKey[] = {0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, + 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee, 0xee}; + +/** + * Initial Mesh-Local Prefix. + */ +static const uint8_t kInitialMeshLocalPrefix[] = {0xfd, 0x00, 0xab, 0xba, 0x00, 0x00, 0x00, 0x00}; + /** * Future TLV Value. */ @@ -251,7 +275,30 @@ void RunTest9_2_4(Topology aTopology, const char *aJsonFile) leader.AllowList(commissioner); commissioner.AllowList(leader); - leader.Form(); + { + MeshCoP::Dataset::Info datasetInfo; + + SuccessOrQuit(datasetInfo.GenerateRandom(leader.GetInstance())); + + datasetInfo.Set(kInitialChannel); + datasetInfo.Set(kInitialPanId); + + { + NetworkKey &networkKey = datasetInfo.Update(); + memcpy(networkKey.m8, kInitialNetworkKey, sizeof(networkKey)); + } + + { + Ip6::NetworkPrefix &prefix = datasetInfo.Update(); + memcpy(prefix.m8, kInitialMeshLocalPrefix, sizeof(prefix.m8)); + } + + leader.Get().SaveLocal(datasetInfo); + + leader.Get().Up(); + SuccessOrQuit(leader.Get().Start()); + } + nexus.AdvanceTime(kFormNetworkTime); VerifyOrQuit(leader.Get().IsLeader());