10#define WIFI_MLO_TEST_H
12#include "ns3/ap-wifi-mac.h"
13#include "ns3/frame-exchange-manager.h"
14#include "ns3/mgt-action-headers.h"
15#include "ns3/mgt-headers.h"
16#include "ns3/multi-model-spectrum-channel.h"
17#include "ns3/packet-socket-client.h"
18#include "ns3/packet-socket-server.h"
19#include "ns3/qos-utils.h"
20#include "ns3/spectrum-wifi-helper.h"
21#include "ns3/sta-wifi-mac.h"
23#include "ns3/wifi-psdu.h"
48 void DoRun()
override;
106 void DoRun()
override;
119 void RunOne(std::string text,
121 const std::map<uint8_t, uint8_t>& links,
122 const std::map<uint8_t, uint8_t>& expected);
143 void DoRun()
override;
177 std::vector<std::string>
179 std::vector<std::string>
245 uint8_t priority = 0)
const;
250 using ChannelMap = std::map<FrequencyRange, Ptr<MultiModelSpectrumChannel>>;
268 std::optional<Direction> direction = std::nullopt);
302 const std::vector<std::string>& channels,
370 const std::vector<uint8_t>& setupLinks,
372 const std::string& dlTidToLinkMapping,
373 const std::string& ulTidToLinkMapping,
374 bool support160MHzOp =
true);
379 void DoRun()
override;
457 std::vector<std::size_t>
459 std::vector<std::size_t>
539 uint8_t nMaxInflight);
557 double txPowerW)
override;
559 void DoRun()
override;
631 uint8_t nMaxInflight);
649 double txPowerW)
override;
651 void DoRun()
override;
707 void DoRun()
override;
712 double txPowerW)
override;
751 void DoRun()
override;
756 double txPowerW)
override;
Test that the AIDs that an AP MLD assigns to SLDs and MLDs are all unique.
AidAssignmentTest(const std::vector< std::set< uint8_t > > &linkIds)
Constructor.
const std::vector< std::set< uint8_t > > m_linkIds
link IDs for all non-AP STAs/MLDs
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void SetSsid(Ptr< StaWifiMac > staMac, Mac48Address)
Set the SSID on the next station that needs to start the association procedure.
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_expectedAid
expected AID for current non-AP STA/MLD
const std::vector< std::string > m_linkChannels
channels for all AP links
NetDeviceContainer m_staDevices
non-AP STAs/MLDs devices
Test the implementation of WifiAssocManager::GetNextAffiliatedAp(), which searches a given RNR elemen...
GetRnrLinkInfoTest()
Constructor.
~GetRnrLinkInfoTest() override=default
void DoRun() override
Implementation to actually run this TestCase.
Test FrameExchangeManager subclass to access m_linkId.
uint8_t GetLinkId() const
Test WifiMac subclass used to access the SwapLinks method.
static TypeId GetTypeId()
void DoCompleteConfig() override
Allow subclasses to complete the configuration of the MAC layer components.
~TestWifiMac() override=default
bool CanForwardPacketsTo(Mac48Address to) const override
Return true if packets can be forwarded to the given destination, false otherwise.
void Enqueue(Ptr< WifiMpdu > mpdu, Mac48Address to, Mac48Address from) override
Test the WifiMac::SwapLinks() method.
void DoRun() override
Implementation to actually run this TestCase.
void RunOne(std::string text, std::size_t nLinks, const std::map< uint8_t, uint8_t > &links, const std::map< uint8_t, uint8_t > &expected)
Run a single test case.
~MldSwapLinksTest() override=default
Test data transmission between MLDs using OFDMA MU transmissions.
std::optional< Mac48Address > m_dataCorruptedSta
MAC address of the station that received MPDU with SeqNo=2 corrupted.
std::pair< Mac48Address, uint16_t > AddrSeqNoPair
A pair of a MAC address (the address of the receiver for DL frames and the address of the sender for ...
~MultiLinkMuTxTest() override=default
void CheckBlockAck(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint8_t linkId)
Check the content of a received BlockAck frame when the max number of links on which an MPDU can be i...
std::vector< PacketSocketAddress > m_sockets
packet socket addresses for STAs
void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
std::size_t m_nPackets
number of application packets to generate
void DoRun() override
Implementation to actually run this TestCase.
MultiLinkMuTxTest(const BaseParams &baseParams, WifiMuTrafficPattern muTrafficPattern, WifiUseBarAfterMissedBa useBarAfterMissedBa, uint8_t nMaxInflight)
Constructor.
std::list< uint64_t > m_uidList
list of UIDs of packets to corrupt
std::unordered_map< Mac48Address, Ptr< ListErrorModel >, WifiAddressHash > RxErrorModelMap
Receiver address-indexed map of list error models.
std::size_t m_blockAckCount
transmitted BlockAck counter
void DoSetup() override
Implementation to do any local setup required for this TestCase.
RxErrorModelMap m_errorModels
error rate models to corrupt packets
std::map< AddrSeqNoPair, std::size_t > m_inflightCount
max number of simultaneous transmissions of each data frame
Ptr< WifiMac > m_sourceMac
MAC of the node sending application packets.
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
bool m_useBarAfterMissedBa
whether to send BAR after missed BlockAck
bool m_waitFirstTf
whether we are waiting for the first Basic Trigger Frame
WifiMuTrafficPattern m_muTrafficPattern
the pattern of traffic to generate
std::size_t m_tfCount
transmitted Trigger Frame counter
std::size_t m_nMaxInflight
max number of links on which an MPDU can be inflight
Base class for Multi-Link Operations tests.
virtual void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when a FEM passes PSDUs to the PHY.
void SetSsid(uint16_t aid, Mac48Address)
Set the SSID on the next station that needs to start the association procedure.
virtual void StartTraffic()
Start the generation of traffic (needs to be overridden)
std::vector< Ptr< StaWifiMac > > m_staMacs
STA wifi MACs.
const std::vector< std::string > m_staChannels
strings specifying channels for STA
~MultiLinkOperationsTestBase() override=default
void CheckAddresses(Ptr< const WifiPsdu > psdu, std::optional< Direction > direction=std::nullopt)
Check that the Address 1 and Address 2 fields of the given PSDU contain device MAC addresses.
virtual void L7Receive(uint8_t nodeId, Ptr< const Packet > p, const Address &addr)
Function to trace packets received by the server application.
Ptr< PacketSocketClient > GetApplication(const PacketSocketAddress &sockAddr, std::size_t count, std::size_t pktSize, Time delay=Seconds(0), uint8_t priority=0) const
void CheckCapabilities(Ptr< WifiMpdu > mpdu, Ptr< WifiMac > mac, uint8_t phyId)
Check that the expected Capabilities information elements are present in the given management frame b...
void SetChannels(SpectrumWifiPhyHelper &helper, const std::vector< std::string > &channels, const ChannelMap &channelMap)
Reset the given PHY helper, use the given strings to set the ChannelSettings attribute of the PHY obj...
const std::vector< std::string > m_apChannels
strings specifying channels for AP
uint16_t m_lastAid
AID of last associated station.
std::map< FrequencyRange, Ptr< MultiModelSpectrumChannel > > ChannelMap
PHY band-indexed map of spectrum channels.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
std::vector< std::size_t > m_rxPkts
number of packets received at application layer by each node (index is node ID)
uint8_t m_nStations
number of stations to create
Time m_duration
simulation duration
const std::vector< uint8_t > m_fixedPhyBands
links on non-AP MLD with fixed PHY band
Direction
Uplink or Downlink direction.
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
Ptr< ApWifiMac > m_apMac
AP wifi MAC.
MultiLinkOperationsTestBase(const std::string &name, uint8_t nStations, const BaseParams &baseParams)
Constructor.
Multi-Link Discovery & Setup test.
MultiLinkSetupTest(const BaseParams &baseParams, WifiScanType scanType, const std::vector< uint8_t > &setupLinks, WifiTidToLinkMappingNegSupport apNegSupport, const std::string &dlTidToLinkMapping, const std::string &ulTidToLinkMapping, bool support160MHzOp=true)
Constructor.
uint8_t m_dlTid1
the TID of the first set of DL QoS data frames
void CheckAssocRequest(Ptr< WifiMpdu > mpdu, uint8_t linkId)
Check correctness of the given Association Request frame.
~MultiLinkSetupTest() override=default
void CheckProbeResponse(Ptr< WifiMpdu > mpdu, uint8_t linkId)
Check correctness of the given Probe Response frame.
std::optional< uint8_t > m_ulTid2
the TID of the optional set of UL QoS data frames
WifiScanType m_scanType
the scan type (active or passive)
void CheckMlSetup()
Check correctness of Multi-Link Setup procedure.
std::vector< std::size_t > m_qosFrames1
indices of QoS frames of the first set in the vector of TX PSDUs
void CheckDisabledLinks()
Check that links that are not setup on the non-AP MLD are disabled.
std::size_t m_nProbeResp
number of Probe Responses received by the non-AP MLD
std::string m_dlTidLinkMappingStr
DL TID-to-Link Mapping for non-AP MLD EHT configuration.
bool m_support160MHzOp
whether non-AP MLDs support 160 MHz operations
uint8_t m_ulTid1
the TID of the first set of UL QoS data frames
WifiTidLinkMapping m_ulTidLinkMapping
expected UL TID-to-Link Mapping requested by non-AP MLD and accepted by AP MLD
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
void DoRun() override
Implementation to actually run this TestCase.
WifiTidToLinkMappingNegSupport m_apNegSupport
TID-to-Link Mapping negotiation supported by the AP MLD.
std::optional< uint8_t > m_dlTid2
the TID of the optional set of DL QoS data frames
WifiTidLinkMapping m_dlTidLinkMapping
expected DL TID-to-Link Mapping requested by non-AP MLD and accepted by AP MLD
void CheckAssocResponse(Ptr< WifiMpdu > mpdu, uint8_t linkId)
Check correctness of the given Association Response frame.
void CheckQosData(Ptr< WifiMpdu > mpdu, const WifiTxVector &txvector, uint8_t linkId, std::size_t index)
Check that QoS data frames are sent on links their TID is mapped to and with the correct TX width.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
std::string m_ulTidLinkMappingStr
UL TID-to-Link Mapping for non-AP MLD EHT configuration.
void CheckBeacon(Ptr< WifiMpdu > mpdu, uint8_t linkId)
Check correctness of the given Beacon frame.
std::vector< std::size_t > m_qosFrames2
indices of QoS frames of the optional set in the vector of TX PSDUs
const std::vector< uint8_t > m_setupLinks
IDs of the expected links to setup.
Test data transmission between two MLDs.
~MultiLinkTxTest() override=default
std::unordered_map< Mac48Address, Ptr< ListErrorModel >, WifiAddressHash > RxErrorModelMap
Receiver address-indexed map of list error models.
bool m_dataCorrupted
whether second data frame has been already corrupted
RxErrorModelMap m_errorModels
error rate models to corrupt packets
void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
std::list< uint64_t > m_uidList
list of UIDs of packets to corrupt
void DoRun() override
Implementation to actually run this TestCase.
std::size_t m_nPackets
number of application packets to generate
std::size_t m_nMaxInflight
max number of links on which an MPDU can be inflight
bool m_baEnabled
whether BA agreement is enabled or disabled
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
bool m_useBarAfterMissedBa
whether to send BAR after missed BlockAck
std::size_t m_blockAckCount
transmitted BlockAck counter
WifiTrafficPattern m_trafficPattern
the pattern of traffic to generate
std::size_t m_blockAckReqCount
transmitted BlockAckReq counter
std::map< uint16_t, std::size_t > m_inflightCount
seqNo-indexed max number of simultaneous transmissions of a data frame
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Ptr< WifiMac > m_sourceMac
MAC of the node sending application packets.
MultiLinkTxTest(const BaseParams &baseParams, WifiTrafficPattern trafficPattern, WifiBaEnabled baEnabled, WifiUseBarAfterMissedBa useBarAfterMissedBa, uint8_t nMaxInflight)
Constructor.
void CheckBlockAck(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint8_t linkId)
Check the content of a received BlockAck frame when the max number of links on which an MPDU can be i...
Test release of sequence numbers upon CTS timeout in multi-link operations.
ReleaseSeqNoAfterCtsTimeoutTest()
PacketSocketAddress m_sockAddr
packet socket address
Ptr< ListErrorModel > m_errorModel
error rate model to corrupt first RTS frame
std::size_t m_nQosDataFrames
counter for transmitted QoS data frames
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
bool m_rtsCorrupted
whether the first RTS frame has been corrupted
void DoSetup() override
Implementation to do any local setup required for this TestCase.
~ReleaseSeqNoAfterCtsTimeoutTest() override=default
void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
void DoRun() override
Implementation to actually run this TestCase.
Test update of BA starting sequence number after ADDBA Response timeout in multi-link operations.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoRun() override
Implementation to actually run this TestCase.
PacketSocketAddress m_sockAddr
packet socket address
std::size_t m_nQosDataCount
counter for transmitted QoS data frames
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
StartSeqNoUpdateAfterAddBaTimeoutTest()
void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
Ptr< ListErrorModel > m_staErrorModel
error rate model to corrupt frames at the non-AP MLD
WifiMultiLinkOperationsTestSuite()
a polymophic address class
FrameExchangeManager is a base class handling the basic frame exchange sequences for non-QoS stations...
uint8_t m_linkId
the ID of the link this object is associated with
holds a vector of ns3::NetDevice pointers
an address for a packet socket
Smart pointer class similar to boost::intrusive_ptr.
Make it easy to create and manage PHY objects for the spectrum model.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
base class for all MAC-level wifi objects.
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiScanType
Scan type (active or passive)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
WifiTidToLinkMappingNegSupport
TID-to-Link Mapping Negotiation Support.
std::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
Configuration parameters common to all subclasses.
std::vector< std::string > staChannels
the strings specifying the operating channels for the non-AP MLD
std::vector< uint8_t > fixedPhyBands
list of IDs of non-AP MLD PHYs that cannot switch band
std::vector< std::string > apChannels
the strings specifying the operating channels for the AP MLD
Information about transmitted frames.
uint8_t phyId
ID of the transmitting PHY.
WifiConstPsduMap psduMap
transmitted PSDU map
WifiTxVector txVector
TXVECTOR.
Time startTx
TX start time.
Function object to compute the hash of a MAC address.
uint32_t pktSize
packet size used for the simulation (in bytes)
WifiMuTrafficPattern
Tested MU traffic patterns.
WifiTrafficPattern
Tested traffic patterns.
WifiUseBarAfterMissedBa
Whether to send a BlockAckReq after a missed BlockAck.
WifiBaEnabled
Block Ack agreement enabled/disabled.