From e2f65b36266d1da7ed7482f89433578fa4cf1ac5 Mon Sep 17 00:00:00 2001 From: Stefano Avallone Date: Wed, 26 Oct 2022 12:56:22 +0200 Subject: [PATCH] wifi: MLO test uses multiple spectrum channels --- src/wifi/test/wifi-mlo-test.cc | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/wifi/test/wifi-mlo-test.cc b/src/wifi/test/wifi-mlo-test.cc index c28b064e9..4dfe981b6 100644 --- a/src/wifi/test/wifi-mlo-test.cc +++ b/src/wifi/test/wifi-mlo-test.cc @@ -235,6 +235,9 @@ class MultiLinkOperationsTestBase : public TestCase void DoSetup() override; + /// PHY band-indexed map of spectrum channels + using ChannelMap = std::map>; + /** * Uplink or Downlink direction */ @@ -279,11 +282,11 @@ class MultiLinkOperationsTestBase : public TestCase * * \param helper the given PHY helper * \param channels the strings specifying the operating channels to configure - * \param channel the created spectrum channel + * \param channelMap the created spectrum channels */ void SetChannels(SpectrumWifiPhyHelper& helper, const std::vector& channels, - Ptr channel); + const ChannelMap& channelMap); /** * Set the SSID on the next station that needs to start the association procedure. @@ -425,7 +428,7 @@ MultiLinkOperationsTestBase::Transmit(uint8_t linkId, void MultiLinkOperationsTestBase::SetChannels(SpectrumWifiPhyHelper& helper, const std::vector& channels, - Ptr channel) + const ChannelMap& channelMap) { helper = SpectrumWifiPhyHelper(channels.size()); helper.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO); @@ -436,7 +439,12 @@ MultiLinkOperationsTestBase::SetChannels(SpectrumWifiPhyHelper& helper, helper.Set(linkId++, "ChannelSettings", StringValue(str)); } - helper.SetChannel(channel); + // NOTE replace this for loop with the line below to use a single spectrum channel + // helper.SetChannel(channelMap.begin()->second); + for (const auto& [band, channel] : channelMap) + { + helper.AddChannel(channel, band); + } } void @@ -461,12 +469,14 @@ MultiLinkOperationsTestBase::DoSetup() "ControlMode", StringValue("HtMcs0")); - auto channel = CreateObject(); + ChannelMap channelMap{{WIFI_SPECTRUM_2_4_GHZ, CreateObject()}, + {WIFI_SPECTRUM_5_GHZ, CreateObject()}, + {WIFI_SPECTRUM_6_GHZ, CreateObject()}}; SpectrumWifiPhyHelper staPhyHelper; SpectrumWifiPhyHelper apPhyHelper; - SetChannels(staPhyHelper, m_staChannels, channel); - SetChannels(apPhyHelper, m_apChannels, channel); + SetChannels(staPhyHelper, m_staChannels, channelMap); + SetChannels(apPhyHelper, m_apChannels, channelMap); for (const auto& linkId : m_fixedPhyBands) {