wifi: Make EMLSR link switch test more robust

Wait for one additional TimeStep before checking which link the main
PHY is switching to. We were waiting for a PHY slot to account for
backoff slot alignment, but this is not sufficient when channel access
is delayed by a whole PHY slot because the check is performed before
channel access is granted and the main PHY starts switching.
This commit is contained in:
Stefano Avallone
2025-07-24 15:00:36 +02:00
parent ff32f672b4
commit 08236466c5

View File

@@ -1677,7 +1677,9 @@ EmlsrSwitchMainPhyBackTest::MainPhySwitchInfoCallback(std::size_t index,
m_staMacs[0]->GetDevice()->GetNode()->AddApplication(
GetApplication(UPLINK, 0, 1, 500, 4));
// channel access can be obtained within a slot due to slot alignment
Simulator::Schedule(m_apMac->GetWifiPhy(m_linkIdForTid4)->GetSlot(), [=, this]() {
Simulator::Schedule(
m_apMac->GetWifiPhy(m_linkIdForTid4)->GetSlot() + TimeStep(1),
[=, this]() {
auto advEmlsrMgr =
DynamicCast<AdvancedEmlsrManager>(m_staMacs[0]->GetEmlsrManager());
@@ -1687,7 +1689,7 @@ EmlsrSwitchMainPhyBackTest::MainPhySwitchInfoCallback(std::size_t index,
NS_TEST_EXPECT_MSG_EQ(
+advEmlsrMgr->m_mainPhySwitchInfo.to,
+(advEmlsrMgr->m_interruptSwitching ? m_linkIdForTid4 : m_mainPhyId),
"Main PHY is switching to wrong link");
"Test index " << +m_testIndex << ": Main PHY is switching to wrong link");
});
});
InsertEventsForQosTid4();