10#define WIFI_GCR_TEST_H
12#include "ns3/ap-wifi-mac.h"
13#include "ns3/error-model.h"
14#include "ns3/ht-phy.h"
15#include "ns3/packet-socket-client.h"
16#include "ns3/sta-wifi-mac.h"
18#include "ns3/wifi-default-gcr-manager.h"
19#include "ns3/wifi-mac-helper.h"
78 std::vector<StaInfo>
stas{};
88 GroupcastProtectionMode::RTS_CTS};
89 std::map<uint8_t, std::map<uint8_t, std::set<uint8_t>>>
114 GcrTestBase(
const std::string& testName,
const GcrParameters& params);
119 void DoRun()
override;
150 virtual void Transmit(std::string context,
164 virtual void PhyRx(std::string context,
203 std::vector<Ptr<ListErrorModel>>
208 std::vector<uint16_t>
214 std::vector<std::vector<uint16_t>>
264 std::optional<uint16_t>
269 std::optional<uint16_t>
284 const GcrParameters& commonParams,
285 const GcrUrParameters& gcrUrParams);
295 double txPowerW)
override;
353 const GcrParameters& commonParams,
354 const GcrBaParameters& gcrBaParams);
364 double txPowerW)
override;
Test the implementation of GCR Block Ack.
void Receive(std::string context, Ptr< const Packet > p, const Address &adr) override
Callback invoked when packet is received by the packet socket server.
void Transmit(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
void NotifyTxopTerminated(Time startTime, Time duration, uint8_t linkId) override
Callback invoked when a TXOP is terminated.
void ConfigureGcrManager(WifiMacHelper &macHelper) override
Configure the GCR manager for the test.
int m_lastTxSeq
sequence number of the last in-flight groupcast MPDU
uint8_t m_nTxGcrBarsInCurrentTxop
number of GCR BAR frames transmitted by the AP in the current TXOP
GcrBaTest(const std::string &testName, const GcrParameters &commonParams, const GcrBaParameters &gcrBaParams)
Constructor.
uint8_t m_nTxGcrBlockAck
number of GCR Block Ack Response frames sent to the AP
void PacketGenerated(std::string context, Ptr< const Packet > p, const Address &adr) override
Callback invoked when a packet is generated by the packet socket client.
~GcrBaTest() override=default
std::vector< uint8_t > m_nTxGcrBarsPerTxop
number of GCR BAR frames transmitted by the AP per TXOP (only takes into account TXOPs with BARs tran...
uint8_t m_nTxBlockAck
number of Block Ack Response frames sent to the AP
uint16_t m_firstTxSeq
sequence number of the first in-flight groupcast MPDU
GcrBaParameters m_gcrBaParams
GCR-BA parameters for the test to run.
void CheckResults() override
Check results at the end of the test run.
uint8_t m_nTxGcrBar
number of GCR Block Ack Request frames sent by the AP
Base class for GCR tests.
std::vector< std::vector< uint16_t > > m_rxGroupcastPerSta
count groupcast packets received by the packet socket server of each STA and store TX attempt number ...
uint8_t m_nTxDelba
number of transmitted DELBA frames
uint8_t m_nTxGcrAddbaResp
number of transmitted GCR ADDBA Response frames
uint8_t m_nTxGroupcastInCurrentTxop
number of groupcast frames transmitted by the AP (including retries) in the current TXOP
std::vector< Ptr< ListErrorModel > > m_errorModels
error rate models to corrupt packets (per STA)
GcrParameters m_params
parameters for the test to run
GcrTestBase(const std::string &testName, const GcrParameters ¶ms)
Constructor.
virtual void Transmit(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when a FEM passes PSDUs to the PHY.
uint8_t m_nTxApRts
number of RTS frames sent by the AP
Ptr< PacketSocketClient > m_groupcastClient
the packet socket client
bool m_expectGcrUsed
flag whether GCR is expected to be used during the test
std::vector< Ptr< StaWifiMac > > m_stasWifiMac
STAs wifi MAC.
uint16_t m_expectedMaxNumMpdusInPsdu
expected maximum number of MPDUs in PSDUs
~GcrTestBase() override=default
std::string m_testName
name of the test
virtual void PhyRx(std::string context, Ptr< const Packet > p, double snr, WifiMode mode, WifiPreamble preamble)
Callback invoked when a packet is successfully received by the PHY.
virtual void NotifyTxopTerminated(Time startTime, Time duration, uint8_t linkId)
Callback invoked when a TXOP is terminated.
uint8_t m_nTxCtsInCurrentTxop
number of CTS-to-self frames transmitted by the AP in the current TXOP
uint8_t m_nTxAddbaReq
number of transmitted ADDBA Request frames
uint8_t m_nTxGcrAddbaReq
number of transmitted GCR ADDBA Request frames
uint16_t m_packets
Number of generated groupcast packets by the application.
virtual void ConfigureGcrManager(WifiMacHelper &macHelper)=0
Configure the GCR manager for the test.
uint8_t m_nTxApCts
number of CTS-to-self frames sent by the AP
std::vector< uint16_t > m_rxUnicastPerSta
count unicast packets received by the packet socket server of each STA
virtual void CheckResults()
Check results at the end of the test run.
Ptr< ListErrorModel > m_apErrorModel
error rate model to corrupt frames sent to the AP
uint8_t m_nTxGcrDelba
number of transmitted GCR DELBA frames
void DoSetup() override
Implementation to do any local setup required for this TestCase.
virtual void PacketGenerated(std::string context, Ptr< const Packet > p, const Address &adr)
Callback invoked when a packet is generated by the packet socket client.
virtual bool IsUsingAmpduOrSmpdu() const
Function to indicate whether A-MPDU or S-MPDU is currently being used.
Ptr< ApWifiMac > m_apWifiMac
AP wifi MAC.
uint8_t m_nTxRtsInCurrentTxop
number of RTS frames transmitted by the AP in the current TXOP
virtual void Receive(std::string context, Ptr< const Packet > p, const Address &adr)=0
Callback invoked when packet is received by the packet socket server.
std::vector< uint16_t > m_phyRxPerSta
count number of PSDUs successfully received by PHY of each STA
uint8_t m_nTxAddbaResp
number of transmitted ADDBA Response frames
void DoRun() override
Implementation to actually run this TestCase.
uint8_t m_totalTx
total number of groupcast frames transmitted by the AP
std::vector< uint8_t > m_txCtsPerSta
count number of CTS responses frames sent by each STA
Test the implementation of GCR-UR.
std::vector< uint8_t > m_totalTxGroupcasts
total number of groupcast frames transmitted by the AP (including retries) per original groupcast fra...
void PacketGenerated(std::string context, Ptr< const Packet > p, const Address &adr) override
Callback invoked when a packet is generated by the packet socket client.
void ConfigureGcrManager(WifiMacHelper &macHelper) override
Configure the GCR manager for the test.
GcrUrTest(const std::string &testName, const GcrParameters &commonParams, const GcrUrParameters &gcrUrParams)
Constructor.
Ptr< WifiMpdu > m_currentMpdu
current MPDU
void CheckResults() override
Check results at the end of the test run.
uint64_t m_currentUid
current UID
GcrUrParameters m_gcrUrParams
GCR-UR parameters for the test to run.
~GcrUrTest() override=default
bool IsUsingAmpduOrSmpdu() const override
Function to indicate whether A-MPDU or S-MPDU is currently being used.
void Transmit(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
void Receive(std::string context, Ptr< const Packet > p, const Address &adr) override
Callback invoked when packet is received by the packet socket server.
a polymophic address class
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
create MAC layers for a ns3::WifiNetDevice.
represent a single transmission mode
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
@ WIFI_STANDARD_UNSPECIFIED
Every class exported by the ns3 library is enclosed in the ns3 namespace.
GroupcastProtectionMode
Groupcast protection mode enumeration.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Parameters for GCR-BA tests.
std::set< uint8_t > blockAcksToCorrupt
list of GCR Block ACKs (starting from 1) to corrupt
std::set< uint8_t > barsToCorrupt
list of GCR BARs (starting from 1) to corrupt
std::vector< uint8_t > expectedNTxBarsPerTxop
the expected number of BAR frames transmitted by the AP per TXOP (only takes into account TXOPs with ...
Common parameters for GCR tests.
uint16_t maxNumMpdusInPsdu
maximum number of MPDUs in PSDUs
std::set< uint8_t > addbaRespsToCorrupt
list of GCR ADDBA responses (starting from 1) to corrupt
std::set< uint8_t > rtsFramesToCorrupt
list of RTS frames (starting from 1) to corrupt
Time duration
the duration of the simulation for the test run (2 seconds by default)
std::vector< StaInfo > stas
information about STAs
uint16_t numUnicastPackets
number of unicast packets to generate
std::set< uint8_t > expectedDroppedGroupcastMpdus
list of groupcast MPDUs that are expected to be dropped because of lifetime expiry (starting from 1)
Time txopLimit
the TXOP limit duration
uint16_t baInactivityTimeout
max time (blocks of 1024 microseconds) allowed for block ack inactivity
std::set< uint8_t > ctsFramesToCorrupt
list of CTS frames (starting from 1) to corrupt
uint16_t numGroupcastPackets
number of groupcast packets to generate
uint32_t rtsThreshold
the RTS threshold in bytes
std::set< uint8_t > addbaReqsToCorrupt
list of GCR ADDBA requests (starting from 1) to corrupt
uint32_t packetSize
the size in bytes of the packets to generate
Time startGroupcast
time to start groupcast packets generation
Time startUnicast
time to start unicast packets generation
Time maxLifetime
the maximum MSDU lifetime
GroupcastProtectionMode gcrProtectionMode
the protection mode to use
std::map< uint8_t, std::map< uint8_t, std::set< uint8_t > > > mpdusToCorruptPerPsdu
list of MPDUs (starting from 1) to corrupt per PSDU (starting from 1)
Information about GCR STAs.
bool gcrCapable
flag whether the STA is GCR capable
MHz_u maxChannelWidth
maximum channel width supported by the STA
WifiStandard standard
standard configured for the STA
uint8_t maxNumStreams
maximum number of spatial streams supported by the STA
Time minGi
minimum guard interval duration supported by the STA
Parameters for GCR-UR tests.
uint8_t expectedSkippedRetries
the number of skipped retries because of lifetime expiry
std::optional< uint16_t > packetsResumeAggregation
the amount of generated packets after which MPDU aggregation should be used again by refilling the qu...
uint8_t nGcrRetries
number of solicited retries to use for GCR-UR
std::optional< uint16_t > packetsPauzeAggregation
the amount of generated packets after which MPDU aggregation should not be used by limiting the queue...