21 #include "ns3/string.h" 23 #include "ns3/simulator.h" 24 #include "ns3/wifi-mac-queue.h" 25 #include "ns3/wifi-psdu.h" 26 #include "ns3/sta-wifi-mac.h" 27 #include "ns3/yans-wifi-phy.h" 28 #include "ns3/mac-tx-middle.h" 29 #include "ns3/mac-low.h" 30 #include "ns3/msdu-aggregator.h" 31 #include "ns3/mpdu-aggregator.h" 32 #include "ns3/wifi-net-device.h" 33 #include "ns3/ht-configuration.h" 34 #include "ns3/vht-configuration.h" 35 #include "ns3/he-configuration.h" 51 virtual void DoRun (
void);
60 :
TestCase (
"Check the correctness of MPDU aggregation operations")
70 m_device = CreateObject<WifiNetDevice> ();
77 m_phy = CreateObject<YansWifiPhy> ();
95 m_mac = CreateObject<StaWifiMac> ();
116 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
122 uint16_t sequence =
m_mac->
m_txMiddle->GetNextSequenceNumberFor (&hdr);
123 hdr.SetSequenceNumber (sequence);
124 hdr.SetFragmentNumber (0);
125 hdr.SetNoMoreFragments ();
147 auto mpduList =
m_mac->
GetBEQueue ()->
GetLow ()->GetMpduAggregator ()->GetNextAmpdu (Create<WifiMacQueueItem> (pkt, hdr),
173 mpduList =
m_mac->
GetBEQueue ()->
GetLow ()->GetMpduAggregator ()->GetNextAmpdu (Create<WifiMacQueueItem> (pkt, hdr),
184 for (uint32_t i = 0; i < psdu->
GetNMpdus (); i++)
196 pkt1 = Create<Packet> (1500);
197 pkt2 = Create<Packet> (1500);
202 hdr1.SetSequenceNumber (3);
218 mpduList =
m_mac->
GetBEQueue ()->
GetLow ()->GetMpduAggregator ()->GetNextAmpdu (Create<WifiMacQueueItem> (pkt1, hdr1),
220 NS_TEST_EXPECT_MSG_EQ (mpduList.empty (),
true,
"a single packet for this destination should not result in an A-MPDU");
222 mpduList =
m_mac->
GetBEQueue ()->
GetLow ()->GetMpduAggregator ()->GetNextAmpdu (Create<WifiMacQueueItem> (pkt2, hdr2),
224 NS_TEST_EXPECT_MSG_EQ (mpduList.empty (),
true,
"no MPDU aggregation should be performed if there is no agreement");
234 Simulator::Destroy ();
257 virtual void DoRun (
void);
266 :
TestCase (
"Check the correctness of two-level aggregation operations")
276 m_device = CreateObject<WifiNetDevice> ();
283 m_phy = CreateObject<YansWifiPhy> ();
301 m_mac = CreateObject<StaWifiMac> ();
323 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
345 item =
m_mac->
GetBEQueue ()->
GetLow ()->GetMsduAggregator ()->GetNextAmsdu (hdr.GetAddr1 (), 0, txVector,
346 currentAggregatedPacket->GetSize ());
347 bool result = (item != 0);
364 item =
m_mac->
GetBEQueue ()->
GetLow ()->GetMsduAggregator ()->GetNextAmsdu (hdr.GetAddr1 (), 0, txVector,
365 currentAggregatedPacket->GetSize ());
366 result = (item != 0);
381 item =
m_mac->
GetBEQueue ()->
GetLow ()->GetMsduAggregator ()->GetNextAmsdu (hdr.GetAddr1 (), 0, txVector,
382 currentAggregatedPacket->GetSize ());
384 result = (item != 0);
409 pkt = Create<Packet> (1400);
413 for (uint8_t i = 0; i < 10; i++)
418 txVector =
m_mac->
GetVIQueue ()->
GetLow ()->GetDataTxVector (Create<const WifiMacQueueItem> (pkt, hdr));
424 txVector, 0, txopLimit);
427 auto mpduList =
m_mac->
GetVIQueue ()->
GetLow ()->GetMpduAggregator ()->GetNextAmpdu (mpdu, txVector, txopLimit);
444 "Unexpected number of MSDUs left in the EDCA queue");
449 Simulator::Destroy ();
478 :
TestCase (
"Check the correctness of 802.11ax aggregation operations")
488 m_device = CreateObject<WifiNetDevice> ();
499 m_phy = CreateObject<YansWifiPhy> ();
517 m_mac = CreateObject<StaWifiMac> ();
535 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
541 uint16_t sequence =
m_mac->
m_txMiddle->GetNextSequenceNumberFor (&hdr);
542 hdr.SetSequenceNumber (sequence);
543 hdr.SetFragmentNumber (0);
544 hdr.SetNoMoreFragments ();
562 for (uint16_t i = 0; i < 300; i++)
577 auto mpduList =
m_mac->
GetBEQueue ()->
GetLow ()->GetMpduAggregator ()-> GetNextAmpdu (Create<WifiMacQueueItem> (pkt, hdr),
580 NS_TEST_EXPECT_MSG_EQ (mpduList.size (), bufferSize,
"A-MPDU should countain " << bufferSize <<
" MPDUs");
581 uint16_t expectedRemainingPacketsInQueue = 300 - bufferSize + 1;
584 Simulator::Destroy ();
593 vhtConfiguration = 0;
void Dispose(void)
Dispose of this Object.
Ptr< StaWifiMac > m_mac
Mac.
void SetWifiPhy(const Ptr< WifiPhy > phy)
ObjectFactory m_factory
factory
void MissedAck(void)
Event handler when an ACK is missed.
Wifi Aggregation Test Suite.
Simulation virtual time values and global simulation resolution.
virtual void DoRun(void)
Implementation to actually run this TestCase.
HT PHY for the 5 GHz band (clause 20)
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Hold variables of type string.
ObjectFactory m_factory
factory
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
The HT Capabilities Information ElementThis class knows how to serialise and deserialise the HT Capab...
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
void ConfigureStandard(WifiPhyStandard standard)
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Ptr< StaWifiMac > m_mac
Mac.
ObjectFactory m_factory
factory
Ptr< YansWifiPhy > m_phy
Phy.
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager)
Set up WifiRemoteStationManager associated with this StaWifiMac.
uint32_t GetSize(void) const
Return the size of the PSDU.
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
HE PHY for the 5 GHz band (clause 26)
Ptr< WifiRemoteStationManager > m_manager
remote station manager
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetMac(const Ptr< WifiMac > mac)
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ptr< WifiNetDevice > m_device
WifiNetDevice.
void SetMaxAmpduLength(uint32_t maxampdulength)
Set the maximum AMPDU length.
Hold an unsigned integer type.
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htcapabilities)
Records HT capabilities of the remote station.
Ptr< BlockAckManager > m_baManager
the Block ACK manager
void SetAddress(Mac48Address address)
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
TwoLevelAggregationTest()
Ptr< StaWifiMac > m_mac
Mac.
Ptr< WifiNetDevice > m_device
WifiNetDevice.
void AddStationHeCapabilities(Mac48Address from, HeCapabilities hecapabilities)
Records HE capabilities of the remote station.
void SetMaxAmsduLength(uint16_t maxamsdulength)
Set the maximum AMSDU length.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
hold a list of per-remote-station state.
WifiAggregationTestSuite()
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
void DoRunSubTest(uint16_t bufferSize)
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
Ptr< MacLow > GetLow(void) const
Return the MacLow associated with this Txop.
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static WifiAggregationTestSuite g_wifiAggregationTestSuite
the test suite
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Ptr< const Packet > m_currentPacket
the current packet
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
Two Level Aggregation Test.
Instantiate subclasses of ns3::Object.
void SetPhy(const Ptr< WifiPhy > phy)
Ptr< QosTxop > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
void DoRun(void)
Implementation to actually run this TestCase.
virtual void DoRun(void)
Implementation to actually run this TestCase.
802.11ax aggregation test which permits 64 or 256 MPDUs in A-MPDU according to the negociated buffer ...
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Ptr< YansWifiPhy > m_phy
Phy.
virtual void ConfigureStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
WifiMacHeader m_currentHdr
the current header
Ptr< YansWifiPhy > m_phy
Phy.
The IEEE 802.11ax HE Capabilities.
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Time GetTxopLimit(void) const
Return the TXOP limit.