From 983cd5dc071d795f039e9b226ffe150bd3db5770 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Mon, 13 Feb 2023 18:28:16 +0100 Subject: [PATCH] wifi: Extend multiple spectrum PHY interfaces tests to verify CCA indication when channel width is changed --- src/wifi/test/spectrum-wifi-phy-test.cc | 82 +++++++++++++++---------- 1 file changed, 48 insertions(+), 34 deletions(-) diff --git a/src/wifi/test/spectrum-wifi-phy-test.cc b/src/wifi/test/spectrum-wifi-phy-test.cc index ae2cca193..f9c3672ea 100644 --- a/src/wifi/test/spectrum-wifi-phy-test.cc +++ b/src/wifi/test/spectrum-wifi-phy-test.cc @@ -1401,43 +1401,57 @@ SpectrumWifiPhyMultipleInterfacesTest::DoRun() { for (std::size_t j = 0; j < 4; ++j) { - if (i == j) - { - continue; - } - delay += Seconds(1); auto txPpduPhy = m_txPhys.at(i); - Simulator::Schedule(delay, - &SpectrumWifiPhyMultipleInterfacesTest::SendPpdu, - this, - txPpduPhy, - txPowerDbm); - Simulator::Schedule(delay + txOngoingAfterTxStartedDelay, - &SpectrumWifiPhyMultipleInterfacesTest::SwitchChannel, - this, - j, - txPpduPhy->GetPhyBand(), - txPpduPhy->GetChannelNumber(), - txPpduPhy->GetChannelWidth()); - for (std::size_t k = 0; k < 4; ++k) + const auto startChannel = + WifiPhyOperatingChannel::FindFirst(txPpduPhy->GetPrimaryChannelNumber(20), + 0, + 20, + WIFI_STANDARD_80211ax, + txPpduPhy->GetPhyBand()); + for (uint16_t bw = txPpduPhy->GetChannelWidth(); bw >= 20; bw /= 2) { - Simulator::Schedule(delay + flushResultsDelay, - &SpectrumWifiPhyMultipleInterfacesTest::Reset, - this); - if (k == i) - { - continue; - } - const auto expectCcaBusyIndication = - m_trackSignalsInactiveInterfaces - ? (txPowerDbm >= ccaEdThresholdDbm ? (j == k) : false) - : false; - Simulator::Schedule(delay + checkResultsDelay, - &SpectrumWifiPhyMultipleInterfacesTest::CheckCcaIndication, + [[maybe_unused]] const auto [channel, frequency, channelWidth, type, band] = + (*WifiPhyOperatingChannel::FindFirst(0, + 0, + bw, + WIFI_STANDARD_80211ax, + txPpduPhy->GetPhyBand(), + startChannel)); + delay += Seconds(1); + Simulator::Schedule(delay, + &SpectrumWifiPhyMultipleInterfacesTest::SendPpdu, this, - k, - expectCcaBusyIndication, - txOngoingAfterTxStartedDelay); + txPpduPhy, + txPowerDbm); + Simulator::Schedule(delay + txOngoingAfterTxStartedDelay, + &SpectrumWifiPhyMultipleInterfacesTest::SwitchChannel, + this, + j, + band, + channel, + channelWidth); + for (std::size_t k = 0; k < 4; ++k) + { + Simulator::Schedule(delay + flushResultsDelay, + &SpectrumWifiPhyMultipleInterfacesTest::Reset, + this); + if ((i != j) && (k == i)) + { + continue; + } + const auto expectCcaBusyIndication = + (k == i) ? (txPowerDbm >= ccaEdThresholdDbm) + : (m_trackSignalsInactiveInterfaces + ? ((txPowerDbm >= ccaEdThresholdDbm) ? (j == k) : false) + : false); + Simulator::Schedule( + delay + checkResultsDelay, + &SpectrumWifiPhyMultipleInterfacesTest::CheckCcaIndication, + this, + k, + expectCcaBusyIndication, + txOngoingAfterTxStartedDelay); + } } } }