20 #include "ns3/header-serialization-test.h"
22 #include "ns3/mgt-headers.h"
23 #include "ns3/multi-link-element.h"
24 #include "ns3/reduced-neighbor-report.h"
25 #include "ns3/tid-to-link-mapping-element.h"
26 #include "ns3/wifi-phy-operating-channel.h"
60 std::vector<MultiLinkElement::PerStaProfileSubelement> subelements);
63 void DoRun()
override;
70 "Check serialization and deserialization of Basic variant Multi-Link elements"),
82 std::vector<MultiLinkElement::PerStaProfileSubelement> subelements)
103 for (std::size_t i = 0; i < subelements.size(); ++i)
133 .mediumSyncOfdmEdThreshold = 4,
134 .mediumSyncMaxNTxops = 5};
201 void DoRun()
override;
206 "Check serialization and deserialization of Reduced Neighbor Report elements")
221 std::stringstream info;
223 if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
227 info <<
"{Ch=" << +
channel.GetNumber() <<
", Bw=" <<
channel.GetWidth() <<
", 2.4 GHz} ";
240 if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
244 info <<
"{Ch=" << +
channel.GetNumber() <<
", Bw=" <<
channel.GetWidth() <<
", 5 GHz} ";
264 if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
268 info <<
"{Ch=" << +
channel.GetNumber() <<
", Bw=" <<
channel.GetWidth() <<
", 6 GHz} ";
291 channel2_4It = channel5It = channel6It = WifiPhyOperatingChannel::m_frequencyChannels.cbegin();
294 while (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend() ||
295 channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend() ||
296 channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
298 if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
300 channel2_4It = WifiPhyOperatingChannel::FindFirst(0,
307 if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
309 channel5It = WifiPhyOperatingChannel::FindFirst(0,
316 if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
318 channel6It = WifiPhyOperatingChannel::FindFirst(0,
329 if (channel2_4It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
333 if (channel5It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
337 if (channel6It != WifiPhyOperatingChannel::m_frequencyChannels.cend())
377 uint32_t maxAmpduSize,
378 uint8_t maxSupportedMcs)
const;
422 void DoRun()
override;
430 m_is2_4Ghz{is2_4Ghz},
431 m_channelWidth{channelWidth}
439 uint8_t channelWidthSet = 0;
442 channelWidthSet |= 0x01;
446 channelWidthSet |= 0x02;
450 channelWidthSet |= 0x04;
458 uint32_t maxAmpduSize,
459 uint8_t maxSupportedMcs)
const
468 maxAmpduSize = (1UL <<
static_cast<uint32_t
>(std::ceil(std::log2(maxAmpduSize + 1)))) - 1;
473 (maxSupportedMcs >= 12) ? 1 : 0;
475 (maxSupportedMcs >= 12) ? 1 : 0;
478 for (
auto maxMcs : {7, 9, 11, 13})
482 maxMcs <= maxSupportedMcs ? 1 : 0);
485 maxMcs <= maxSupportedMcs ? 2 : 0);
490 for (
auto maxMcs : {9, 11, 13})
493 EhtMcsAndNssSet::EHT_MCS_MAP_TYPE_NOT_LARGER_THAN_80_MHZ,
495 maxMcs <= maxSupportedMcs ? 3 : 0);
497 EhtMcsAndNssSet::EHT_MCS_MAP_TYPE_NOT_LARGER_THAN_80_MHZ,
499 maxMcs <= maxSupportedMcs ? 4 : 0);
504 for (
auto maxMcs : {9, 11, 13})
508 maxMcs <= maxSupportedMcs ? 2 : 0);
511 maxMcs <= maxSupportedMcs ? 1 : 0);
517 for (
auto maxMcs : {9, 11, 13})
521 maxMcs <= maxSupportedMcs ? 4 : 0);
524 maxMcs <= maxSupportedMcs ? 3 : 0);
551 uint8_t
byte = it.
ReadU8();
557 uint8_t expectedValueFirstByte)
565 uint8_t expectedValueSixthByte)
580 uint8_t maxSupportedMcs)
588 maxSupportedMcs >= 8 ? 0x21 : 0x00);
592 maxSupportedMcs >= 10 ? 0x21 : 0x00);
596 maxSupportedMcs >= 12 ? 0x21 : 0x00);
604 maxSupportedMcs >= 10 ? 0x43 : 0x00);
608 maxSupportedMcs >= 12 ? 0x43 : 0x00);
616 maxSupportedMcs >= 10 ? 0x12 : 0x00);
620 maxSupportedMcs >= 12 ? 0x12 : 0x00);
628 maxSupportedMcs >= 10 ? 0x34 : 0x00);
632 maxSupportedMcs >= 12 ? 0x34 : 0x00);
640 uint16_t expectedEhtMcsAndNssSetSize = 0;
644 expectedEhtMcsAndNssSetSize = 4;
648 expectedEhtMcsAndNssSetSize = 3;
651 expectedEhtMcsAndNssSetSize = (2 * 3);
654 expectedEhtMcsAndNssSetSize = (3 * 3);
660 uint16_t expectedSize = 1 +
665 expectedEhtMcsAndNssSetSize;
667 auto mapType =
m_channelWidth == 20 ? EhtMcsAndNssSet::EHT_MCS_MAP_TYPE_20_MHZ_ONLY
668 : EhtMcsAndNssSet::EHT_MCS_MAP_TYPE_NOT_LARGER_THAN_80_MHZ;
680 "Unexpected header size");
703 "Unexpected header size");
726 "Unexpected header size");
747 std::vector<std::pair<uint8_t, uint8_t>> ppeThresholds;
748 ppeThresholds.emplace_back(1, 2);
749 ppeThresholds.emplace_back(2, 3);
750 ppeThresholds.emplace_back(3, 4);
751 ppeThresholds.emplace_back(4, 3);
752 ppeThresholds.emplace_back(3, 2);
753 ppeThresholds.emplace_back(2, 1);
760 "Unexpected header size");
790 template <
typename... Args>
804 template <
typename... Args>
814 void DoRun()
override;
819 template <
typename... Args>
822 "Check serialization and deserialization of TID-To-Link Mapping elements")
829 template <
typename... Args>
832 const std::list<uint8_t>& linkIds,
874 uint8_t rxMaxNss10_11,
875 uint8_t txMaxNss10_11,
876 uint8_t rxMaxNss12_13,
877 uint8_t txMaxNss12_13,
878 std::optional<EhtOperation::EhtOpInfo> opInfo);
883 void DoRun()
override;
893 uint8_t rxMaxNss10_11,
894 uint8_t txMaxNss10_11,
895 uint8_t rxMaxNss12_13,
896 uint8_t txMaxNss12_13,
897 std::optional<EhtOperation::EhtOpInfo> opInfo)
899 "Check serialization and deserialization of EHT Operation elements")
949 std::list<uint8_t>{0, 4, 6},
951 std::list<uint8_t>{3, 7, 11, 14}),
955 std::list<uint8_t>{0, 1, 2},
957 std::list<uint8_t>{3, 4, 5},
959 std::list<uint8_t>{6, 7},
961 std::list<uint8_t>{8, 9, 10},
963 std::list<uint8_t>{11, 12, 13},
965 std::list<uint8_t>{14},
967 std::list<uint8_t>{1, 3, 6},
969 std::list<uint8_t>{11, 14}),
971 AddTestCase(
new EhtOperationElementTest({0, 0, 0, 0, 0}, 1, 2, 3, 4, 5, 6, 7, 8, std::nullopt),
Test Multi-Link Element (Basic variant) serialization and deserialization.
WifiMacType m_frameType
the type of frame possibly included in the MLE
~BasicMultiLinkElementTest() override
BasicMultiLinkElementTest()
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
MultiLinkElement GetMultiLinkElement(const CommonInfoBasicMle &commonInfo, std::vector< MultiLinkElement::PerStaProfileSubelement > subelements)
Get a Multi-Link Element including the given Common Info field and the given Per-STA Profile Subeleme...
Test EHT Operation information element serialization and deserialization.
void DoRun() override
Implementation to actually run this TestCase.
EhtOperationElementTest(const EhtOperation::EhtOpParams ¶ms, uint8_t rxMaxNss0_7, uint8_t txMaxNss0_7, uint8_t rxMaxNss8_9, uint8_t txMaxNss8_9, uint8_t rxMaxNss10_11, uint8_t txMaxNss10_11, uint8_t rxMaxNss12_13, uint8_t txMaxNss12_13, std::optional< EhtOperation::EhtOpInfo > opInfo)
Constructor.
EhtOperation m_ehtOperation
EHT Operation element.
~EhtOperationElementTest() override=default
Test Reduced Neighbor Report serialization and deserialization.
ReducedNeighborReport GetReducedNeighborReport(PhyOpChannelIt channel2_4It, PhyOpChannelIt channel5It, PhyOpChannelIt channel6It)
Get a Reduced Neighbor Report element including the given operating channels.
ReducedNeighborReportTest()
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
~ReducedNeighborReportTest() override
WifiPhyOperatingChannel::ConstIterator PhyOpChannelIt
typedef for const iterator on the set of available channels
Test TID-To-Link Mapping information element serialization and deserialization.
TidToLinkMapping m_tidToLinkMapping
TID-To-Link Mapping element.
TidToLinkMappingElementTest(TidLinkMapDir direction, Args &&... args)
Constructor.
void SetLinkMapping()
Base case to stop the recursion performed by the templated version of this method.
~TidToLinkMappingElementTest() override=default
void DoRun() override
Implementation to actually run this TestCase.
Test serialization and deserialization of EHT capabilities IE.
void CheckSerializedByte(const Buffer &buffer, uint32_t position, uint8_t value)
Check that the given buffer contains the given value at the given position.
void DoRun() override
Implementation to actually run this TestCase.
HeCapabilities GetHeCapabilities() const
Generate the HE capabilities IE.
bool m_is2_4Ghz
whether the PHY is operating in 2.4 GHz
void CheckSupportedEhtMcsAndNssSet(const Buffer &buffer, uint8_t maxSupportedMcs)
Check the content of the Supported EHT-MCS And NSS Set subfield.
~WifiEhtCapabilitiesIeTest() override=default
Buffer SerializeIntoBuffer(const EhtCapabilities &ehtCapabilities)
Serialize the EHT capabilities in a buffer.
WifiEhtCapabilitiesIeTest(bool is2_4Ghz, uint16_t channelWidth)
Constructor.
uint16_t m_channelWidth
Supported channel width by the PHY (in MHz)
EhtCapabilities GetEhtCapabilities(uint16_t maxMpduLength, uint32_t maxAmpduSize, uint8_t maxSupportedMcs) const
Generate the EHT capabilities IE.
void CheckEhtMacCapabilitiesInformation(const Buffer &buffer, uint8_t expectedValueFirstByte)
Check the content of the EHT MAC Capabilities Information subfield.
void CheckEhtPhyCapabilitiesInformation(const Buffer &buffer, uint8_t expectedValueSixthByte)
Check the content of the EHT PHY Capabilities Information subfield.
wifi EHT Information Elements Test Suite
WifiEhtInfoElemsTestSuite()
iterator in a Buffer instance
void Next()
go forward by one byte
automatically resized byte buffer
void AddAtStart(uint32_t start)
Buffer::Iterator Begin() const
The IEEE 802.11be EHT Capabilities.
void SetMaxMpduLength(uint16_t length)
Set the maximum MPDU length.
void SetSupportedTxEhtMcsAndNss(EhtMcsAndNssSet::EhtMcsMapType mapType, uint8_t upperMcs, uint8_t maxNss)
Set a subfield of the Supported EHT-MCS And NSS Set.
void SetPpeThresholds(uint8_t nssPe, uint8_t ruIndexBitmask, const std::vector< std::pair< uint8_t, uint8_t >> &ppeThresholds)
Set the EHT PPE threshold info subfield.
EhtPhyCapabilities m_phyCapabilities
EHT PHY Capabilities Info subfield.
uint8_t GetHighestSupportedTxMcs(EhtMcsAndNssSet::EhtMcsMapType mapType)
Get the highest supported TX MCS for a given EHT-MCS map type.
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum A-MPDU length.
void SetSupportedRxEhtMcsAndNss(EhtMcsAndNssSet::EhtMcsMapType mapType, uint8_t upperMcs, uint8_t maxNss)
Set a subfield of the Supported EHT-MCS And NSS Set.
uint8_t GetHighestSupportedRxMcs(EhtMcsAndNssSet::EhtMcsMapType mapType)
Get the highest supported RX MCS for a given EHT-MCS map type.
EHT Operation Information Element.
void SetMaxTxNss(uint8_t maxNss, uint8_t mcsStart, uint8_t mcsEnd)
Set the max Tx NSS for input MCS index range.
void SetMaxRxNss(uint8_t maxNss, uint8_t mcsStart, uint8_t mcsEnd)
Set the max Rx NSS for input MCS index range.
EhtOpParams m_params
EHT Operation Parameters.
std::optional< EhtOpInfo > m_opInfo
EHT Operation Information.
The IEEE 802.11ax HE Capabilities.
void SetChannelWidthSet(uint8_t channelWidthSet)
Set channel width set.
Per-STA Profile Subelement of Multi-Link element.
void SetStaMacAddress(Mac48Address address)
Set the STA MAC Address subfield in the STA Info field.
void SetCompleteProfile()
Set the Complete Profile flag in the STA Control field.
void SetAssocRequest(const std::variant< MgtAssocRequestHeader, MgtReassocRequestHeader > &assoc)
Include the given (Re)Association Request frame body in the STA Profile field of this Per-STA Profile...
void SetLinkId(uint8_t linkId)
Set the Link ID subfield in the STA Control field.
void AddPerStaProfileSubelement()
Add a Per-STA Profile Subelement in the Link Info field.
void SetMediumSyncMaxNTxops(uint8_t nTxops)
Set the Medium Synchronization Maximum Number of TXOPs subfield of the Medium Synchronization Delay i...
void SetBssParamsChangeCount(uint8_t count)
Set the BSS Parameters Change Count subfield in the Common Info field.
void SetLinkIdInfo(uint8_t linkIdInfo)
Set the Link ID Info subfield in the Common Info field.
void SetMediumSyncDelayTimer(Time delay)
Set the Medium Synchronization Duration subfield of the Medium Synchronization Delay information in t...
PerStaProfileSubelement & GetPerStaProfile(std::size_t i)
Get a reference to the i-th Per-STA Profile Subelement in the Link Info field.
void SetMediumSyncOfdmEdThreshold(int8_t threshold)
Set the Medium Synchronization OFDM ED Threshold subfield of the Medium Synchronization Delay informa...
void SetMldMacAddress(Mac48Address address)
Set the MLD MAC Address subfield in the Common Info field.
The Reduced Neighbor Report element.
std::size_t GetNNbrApInfoFields() const
Get the number of Neighbor AP Information fields.
void SetMldParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t mldId, uint8_t linkId, uint8_t changeSequence)
Set the MLD Parameters subfield of the i-th TBTT Information field of the given Neighbor AP Informati...
void SetShortSsid(std::size_t nbrApInfoId, std::size_t index, uint32_t shortSsid)
Set the Short SSID field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
void SetBssid(std::size_t nbrApInfoId, std::size_t index, Mac48Address bssid)
Set the BSSID field of the i-th TBTT Information field of the given Neighbor AP Information field.
void SetPsd20MHz(std::size_t nbrApInfoId, std::size_t index, uint8_t psd20MHz)
Set the 20 MHz PSD field of the i-th TBTT Information field of the given Neighbor AP Information fiel...
void AddNbrApInfoField()
Add a Neighbor AP Information field.
void SetBssParameters(std::size_t nbrApInfoId, std::size_t index, uint8_t bssParameters)
Set the BSS Parameters field of the i-th TBTT Information field of the given Neighbor AP Information ...
void AddTbttInformationField(std::size_t nbrApInfoId)
Add a TBTT Information fields to the TBTT Information Set field of the given Neighbor AP Information ...
void SetOperatingChannel(std::size_t nbrApInfoId, const WifiPhyOperatingChannel &channel)
Set the Operating Class and the Channel Number fields of the given Neighbor AP Information field base...
The IEEE 802.11 SSID Information Element.
The Supported Rates Information Element.
void AddSupportedRate(uint64_t bs)
Add the given rate to the supported rates.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
TID-to-Link Mapping Information Element.
void SetLinkMappingOfTid(uint8_t tid, std::list< uint8_t > linkIds)
Set the Link Mapping field of the given TID such that the given TID is mapped to the links associated...
TidToLinkMapping::Control m_control
TID-to-link Mapping Control.
Class that keeps track of all information about the current PHY operating channel.
std::set< FrequencyChannelInfo >::const_iterator ConstIterator
Typedef for a const iterator pointing to a channel in the set of available channels.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_2_4GHZ
The 2.4 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TidLinkMapDir
TID-to-Link Mapping Control Direction IEEE 802.11be D2.0 Figure 9-1002an.
WifiMacType
Combination of valid MAC header type/subtype.
@ WIFI_MAC_MGT_ASSOCIATION_REQUEST
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
Medium Synchronization Delay Information subfield.
uint8_t mediumSyncDuration
Medium Synchronization Duration.
Common Info field of the Basic Multi-Link element.
std::optional< MediumSyncDelayInfo > m_mediumSyncDelayInfo
Medium Synchronization Delay Information.
Mac48Address m_mldMacAddress
Subfields.
std::optional< uint8_t > m_bssParamsChangeCount
BSS Parameters Change Count.
std::optional< uint8_t > m_linkIdInfo
Link ID Info.
EHT Operation Information subfield IEEE 802.11be D2.0 Figure 9-1002c.
EHT Operation Parameters subfield IEEE 802.11be D2.0 Figure 9-1002b.
uint8_t support320MhzIn6Ghz
Support For 320 MHz In 6 GHz.
uint8_t supportTx1024And4096QamForRuSmallerThan242Tones
Tx 1024-QAM And 4096-QAM < 242-tone RU Support.
uint8_t supportRx1024And4096QamForRuSmallerThan242Tones
Rx 1024-QAM And 4096-QAM < 242-tone RU Support.
bool defaultMapping
Default link mapping.
TidLinkMapDir direction
Direction.
static WifiEhtInfoElemsTestSuite g_wifiEhtInfoElemsTestSuite
the test suite