mirror of
https://github.com/espressif/openthread.git
synced 2026-08-16 07:37:47 +00:00
[nexus] remove redundant mInfraIf initializations (#12851)
This commit removes redundant calls to `mInfraIf.Init()` and `mInfraIf.AddAddress()` from various Nexus test cases. The infrastructure interface (`mInfraIf`) is automatically initialized and assigned a link-local address by the core framework when a new `Node` is added. The `InfraIf::Init()` method derives the link-local address from the MAC address and adds it to the interface. Therefore, these explicit manual calls in individual test scripts are unnecessary and can be removed to simplify the test setup.
This commit is contained in:
@@ -152,9 +152,6 @@ void TestMatnTc1(void)
|
||||
|
||||
VerifyOrQuit(router.Get<Mle::Mle>().IsRouter());
|
||||
|
||||
host.mInfraIf.Init(host);
|
||||
host.mInfraIf.AddAddress(host.mInfraIf.GetLinkLocalAddress());
|
||||
|
||||
nexus.AdvanceTime(kStabilizationTime);
|
||||
|
||||
// Add multicast variables to test info manually to ensure verify script sees them.
|
||||
|
||||
@@ -181,9 +181,6 @@ void TestMatnTc10(void)
|
||||
SuccessOrQuit(br2.Get<BackboneRouter::Local>().SetConfig(config));
|
||||
}
|
||||
|
||||
host.mInfraIf.Init(host);
|
||||
host.mInfraIf.AddAddress(host.mInfraIf.GetLinkLocalAddress());
|
||||
|
||||
{
|
||||
Ip6::Address hostGua;
|
||||
SuccessOrQuit(hostGua.FromString(kHostGua));
|
||||
|
||||
@@ -204,9 +204,6 @@ void TestMatnTc21(void)
|
||||
SuccessOrQuit(br2.Get<BorderRouter::RoutingManager>().SetEnabled(true));
|
||||
br2.Get<BackboneRouter::Local>().SetEnabled(true);
|
||||
|
||||
host.mInfraIf.Init(host);
|
||||
host.mInfraIf.AddAddress(host.mInfraIf.GetLinkLocalAddress());
|
||||
|
||||
nexus.AdvanceTime(kStabilizationTime * 2);
|
||||
|
||||
VerifyOrQuit(br1.Get<BackboneRouter::Local>().IsPrimary());
|
||||
|
||||
@@ -183,9 +183,6 @@ void TestMatnTc5(void)
|
||||
SuccessOrQuit(br2.Get<BorderRouter::RoutingManager>().SetEnabled(true));
|
||||
br2.Get<BackboneRouter::Local>().SetEnabled(true);
|
||||
|
||||
host.mInfraIf.Init(host);
|
||||
host.mInfraIf.AddAddress(host.mInfraIf.GetLinkLocalAddress());
|
||||
|
||||
nexus.AdvanceTime(kStabilizationTime * 2);
|
||||
|
||||
VerifyOrQuit(br1.Get<BackboneRouter::Local>().IsPrimary());
|
||||
|
||||
@@ -116,8 +116,6 @@ void Test_1_3_DBR_TC_1(void)
|
||||
* - Pass Criteria: N/A
|
||||
*/
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 2: Device: BR 1 (DUT) Description (DBR-1.1): Enable.");
|
||||
|
||||
|
||||
@@ -162,8 +162,6 @@ void Test_1_3_DBR_TC_10(const char *aJsonFileName)
|
||||
*/
|
||||
Log("Step 0: Eth_1 configures Ethernet link with GUA_1 prefix and multicasts ND RA.");
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
|
||||
{
|
||||
Ip6::Address eth1Gua;
|
||||
SuccessOrQuit(eth1Gua.FromString(kEth1Gua));
|
||||
@@ -188,7 +186,6 @@ void Test_1_3_DBR_TC_10(const char *aJsonFileName)
|
||||
*/
|
||||
Log("Step 1: BR_1 enables and configures OMR prefix and external route to GUA_1.");
|
||||
|
||||
br1.mInfraIf.Init(br1);
|
||||
br1.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
|
||||
br1.Get<BorderRouter::RoutingManager>().Init();
|
||||
|
||||
@@ -124,8 +124,6 @@ void Test_1_3_DBR_TC_2(void)
|
||||
* - Pass Criteria: N/A
|
||||
*/
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
|
||||
br2.AllowList(br1);
|
||||
|
||||
br2.Form();
|
||||
|
||||
@@ -127,8 +127,6 @@ void Test_1_3_DBR_TC_6(void)
|
||||
Log("Step 0: Device: Eth 1 Description (DBR-1.6): Harness configures Ethernet link with an on-link IPv6 GUA prefix "
|
||||
"GUA 1. Eth 1 is configured to multicast ND RAS.");
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
|
||||
{
|
||||
Ip6::Address eth1Gua;
|
||||
SuccessOrQuit(eth1Gua.FromString(kEth1Gua));
|
||||
@@ -147,7 +145,6 @@ void Test_1_3_DBR_TC_6(void)
|
||||
Log("Step 1: Device: Eth 1, BR 2 Description (DBR-1.6): Form topology. Wait for BR_2 to: 1. Register as border "
|
||||
"router in Thread Network Data with an OMR prefix OMR_1 2. Send multicast ND RAS");
|
||||
|
||||
br2.mInfraIf.Init(br2);
|
||||
br2.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
|
||||
br2.Get<BorderRouter::RoutingManager>().Init();
|
||||
@@ -167,7 +164,6 @@ void Test_1_3_DBR_TC_6(void)
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 2: Device: BR 1 (DUT) Description (DBR-1.6): Enable: switch on.");
|
||||
|
||||
br1.mInfraIf.Init(br1);
|
||||
br1.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
|
||||
br1.AllowList(br2);
|
||||
|
||||
@@ -134,7 +134,6 @@ void Test_1_3_DBR_TC_7A(void)
|
||||
* - N/A
|
||||
*/
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
static const char kGua1Prefix[] = "2001:db8:1::/64";
|
||||
Ip6::Prefix gua1Prefix;
|
||||
SuccessOrQuit(gua1Prefix.FromString(kGua1Prefix));
|
||||
@@ -203,7 +202,6 @@ void Test_1_3_DBR_TC_7A(void)
|
||||
br2.Get<NetworkData::Notifier>().HandleServerDataUpdated();
|
||||
|
||||
br2.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
br2.mInfraIf.Init(br2);
|
||||
Ip6::Prefix pre1Prefix;
|
||||
SuccessOrQuit(pre1Prefix.FromString(kPre1Prefix));
|
||||
br2.mInfraIf.StartRouterAdvertisement(pre1Prefix);
|
||||
|
||||
@@ -134,7 +134,6 @@ void Test_1_3_DBR_TC_7B(void)
|
||||
* - N/A
|
||||
*/
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
static const char kGua1Prefix[] = "2001:db8:1::/64";
|
||||
Ip6::Prefix gua1Prefix;
|
||||
SuccessOrQuit(gua1Prefix.FromString(kGua1Prefix));
|
||||
@@ -203,7 +202,6 @@ void Test_1_3_DBR_TC_7B(void)
|
||||
br2.Get<NetworkData::Notifier>().HandleServerDataUpdated();
|
||||
|
||||
br2.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
br2.mInfraIf.Init(br2);
|
||||
Ip6::Prefix pre1Prefix;
|
||||
SuccessOrQuit(pre1Prefix.FromString(kPre1Prefix));
|
||||
br2.mInfraIf.StartRouterAdvertisement(pre1Prefix);
|
||||
|
||||
@@ -144,7 +144,6 @@ void Test_1_3_DBR_TC_7C(void)
|
||||
* - N/A
|
||||
*/
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
Ip6::Prefix gua1Prefix;
|
||||
SuccessOrQuit(gua1Prefix.FromString(kGua1Prefix));
|
||||
|
||||
@@ -211,7 +210,6 @@ void Test_1_3_DBR_TC_7C(void)
|
||||
br2.Get<NetworkData::Notifier>().HandleServerDataUpdated();
|
||||
|
||||
br2.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
br2.mInfraIf.Init(br2);
|
||||
Ip6::Prefix pre1Prefix;
|
||||
SuccessOrQuit(pre1Prefix.FromString(kPre1Prefix));
|
||||
br2.mInfraIf.StartRouterAdvertisement(pre1Prefix);
|
||||
|
||||
@@ -250,7 +250,6 @@ void Test_1_3_DBR_TC_8(void)
|
||||
*/
|
||||
Log("Step 0: Eth_1 configured with GUA_1.");
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
Ip6::Address eth1Gua;
|
||||
SuccessOrQuit(eth1Gua.FromString(kEth1GuaAddrStr));
|
||||
eth1.mInfraIf.AddAddress(eth1Gua);
|
||||
|
||||
@@ -185,8 +185,6 @@ void Test_1_3_DPR_TC_1(const char *aJsonFileName)
|
||||
* - Pass Criteria: N/A
|
||||
*/
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
|
||||
ed1.Join(br1, Node::kAsFed);
|
||||
nexus.AdvanceTime(kJoinNetworkTime);
|
||||
VerifyOrQuit(ed1.Get<Mle::Mle>().IsAttached());
|
||||
|
||||
@@ -168,7 +168,6 @@ void Test_1_3_SRPC_TC_4(const char *aJsonFileName)
|
||||
* - N/A
|
||||
*/
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
br1.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
br1.Get<BorderRouter::RoutingManager>().Init();
|
||||
SuccessOrQuit(br1.Get<BorderRouter::RoutingManager>().SetEnabled(true));
|
||||
|
||||
@@ -326,8 +326,6 @@ void Test_1_3_SRPC_TC_5(const char *aJsonFileName)
|
||||
ed2.Join(br1, Node::kAsFed);
|
||||
nexus.AdvanceTime(kJoinNetworkTime);
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
|
||||
Log("---------------------------------------------------------------------------------------");
|
||||
Log("Step 2: Device: BR 1 Description (SRPC-3.5): Automatically adds its SRP Server information");
|
||||
|
||||
|
||||
@@ -120,7 +120,6 @@ void Test_1_4_TREL_TC_6(void)
|
||||
*/
|
||||
Log("Step 1: Form the topology");
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
Ip6::Prefix guaPrefix;
|
||||
SuccessOrQuit(guaPrefix.FromString(kGuaPrefixStr));
|
||||
eth1.mInfraIf.StartRouterAdvertisement(guaPrefix);
|
||||
@@ -128,7 +127,6 @@ void Test_1_4_TREL_TC_6(void)
|
||||
br.Form();
|
||||
nexus.AdvanceTime(kFormNetworkTime);
|
||||
|
||||
br.mInfraIf.Init(br);
|
||||
br.Get<BorderRouter::InfraIf>().Init(kInfraIfIndex, true);
|
||||
br.Get<BorderRouter::RoutingManager>().Init();
|
||||
SuccessOrQuit(br.Get<BorderRouter::RoutingManager>().SetEnabled(true));
|
||||
@@ -149,7 +147,6 @@ void Test_1_4_TREL_TC_6(void)
|
||||
*/
|
||||
Log("Step 2: Eth_1 sends mDNS query PTR for _trel._udp.local");
|
||||
|
||||
eth1.mInfraIf.Init(eth1);
|
||||
SuccessOrQuit(eth1.Get<Dns::Multicast::Core>().SetEnabled(true, kInfraIfIndex));
|
||||
{
|
||||
Dns::Multicast::Core::Browser browser;
|
||||
|
||||
Reference in New Issue
Block a user