21 #include "ns3/string.h"
23 #include "ns3/simulator.h"
24 #include "ns3/wifi-mac-queue.h"
25 #include "ns3/mac-low.h"
26 #include "ns3/edca-txop-n.h"
27 #include "ns3/yans-wifi-phy.h"
28 #include "ns3/mac-tx-middle.h"
29 #include "ns3/dcf-manager.h"
30 #include "ns3/msdu-aggregator.h"
31 #include "ns3/mpdu-aggregator.h"
47 virtual void DoRun (
void);
59 :
TestCase (
"Check the correctness of MPDU aggregation operations")
69 m_phy = CreateObject<YansWifiPhy> ();
85 m_low = CreateObject<MacLow> ();
95 m_edca = CreateObject<EdcaTxopN> ();
118 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
125 hdr.SetSequenceNumber (sequence);
126 hdr.SetFragmentNumber (0);
127 hdr.SetNoMoreFragments ();
173 m_edca->
GetQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
174 m_edca->
GetQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
186 for (; aggregationQueueSize > 0; aggregationQueueSize--, i++)
189 dequeuedHdr = dequeuedItem->GetHeader ();
201 pkt1 = Create<Packet> (1500);
202 pkt2 = Create<Packet> (1500);
207 hdr1.SetSequenceNumber (3);
221 m_edca->
GetQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt3, hdr3));
224 NS_TEST_EXPECT_MSG_EQ (isAmpdu,
false,
"a single packet for this destination should not result in an A-MPDU");
230 NS_TEST_EXPECT_MSG_EQ (isAmpdu,
false,
"no MPDU aggregation should be performed if there is no agreement");
239 Simulator::Destroy ();
265 virtual void DoRun (
void);
276 :
TestCase (
"Check the correctness of two-level aggregation operations")
286 m_phy = CreateObject<YansWifiPhy> ();
301 m_low = CreateObject<MacLow> ();
305 m_edca = CreateObject<EdcaTxopN> ();
318 m_mpduAggregator->SetMaxAmpduSize (65535);
327 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
344 m_edca->
GetQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
345 m_edca->
GetQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
358 bool result = (packet != 0);
371 m_factory.SetTypeId (
"ns3::MpduAggregator");
376 m_edca->
GetQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
379 result = (packet != 0);
389 m_mpduAggregator->SetMaxAmpduSize (4095);
395 result = (packet != 0);
398 Simulator::Destroy ();
Aggregator used to construct A-MPDUs.
void Dispose(void)
Dispose of this Object.
Ptr< const Packet > GetPacket(void) const
Get the packet stored in this item.
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)
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Hold variables of type string.
Ptr< MacLow > m_low
MacLow.
ObjectFactory m_factory
factory
void SetPhy(const Ptr< WifiPhy > phy)
Set up WifiPhy associated with this MacLow.
void SetAccessCategory(AcIndex ac)
Set the access category of this EDCAF.
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.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
void SetManager(const Ptr< DcfManager > manager)
Set DcfManager this DcaTxop is associated to.
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this EdcaTxopN is associated to.
Time GetTimeStamp(void) const
Get the timestamp included in this item.
ObjectFactory m_factory
factory
Ptr< YansWifiPhy > m_phy
Phy.
Ptr< MsduAggregator > m_msduAggregator
A-MSDU aggregator.
Ptr< Packet > PerformMsduAggregation(Ptr< const Packet > packet, WifiMacHeader *hdr, Time *tstamp, Ptr< Packet > currentAmpduPacket, uint16_t blockAckSize)
Perform MSDU aggregation for a given MPDU in an A-MPDU.
Ptr< MacTxMiddle > m_txMiddle
MacTxMiddle.
void MissedAck(void)
Event handler when an ACK is missed.
WifiTxVector m_currentTxVector
TXVECTOR used for the current packet transmission.
uint16_t GetNextSequenceNumberFor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
void SetupPhyListener(Ptr< WifiPhy > phy)
Set up listener for Phy events.
void SetMsduAggregator(const Ptr< MsduAggregator > aggr)
Set the aggregator used to construct A-MSDU subframes.
TwoLevelAggregationTest()
void SetupLow(Ptr< MacLow > low)
Set up listener for MacLow events.
Ptr< WifiMacQueue > m_aggregateQueue[8]
Queues per TID used for MPDU aggregation.
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()
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregrator.
virtual void SetHtSupported(bool enable)
Enable or disable HT capability support.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static WifiAggregationTestSuite g_wifiAggregationTestSuite
the test suite
WifiMacHeader m_currentHdr
the current header
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
void Set(std::string name, const AttributeValue &value)
Set an attribute to be set during construction.
Ptr< const Packet > m_currentPacket
the current packet
Two Level Aggregation Test.
void SetLow(const Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
void SetTxMiddle(const Ptr< MacTxMiddle > txMiddle)
Set MacTxMiddle this DcaTxop is associated to.
void SetMaxAmpduSize(uint16_t maxSize)
Sets the maximum A-MPDU size in bytes.
void SetSlot(Time slotTime)
virtual WifiTxVector GetDataTxVector(Ptr< const Packet > packet, const WifiMacHeader *hdr) const
Return a TXVECTOR for the DATA frame given the destination.
Instantiate subclasses of ns3::Object.
void SetMaxSlrc(uint32_t maxSlrc)
Sets the maximum STA long retry count (SLRC).
virtual void DoRun(void)
Implementation to actually run this TestCase.
Ptr< EdcaTxopN > m_edca
EDCA.
void CompleteConfig(void)
Complete block ACK configuration.
Ptr< Packet > m_currentPacket
Current packet transmitted/to be transmitted.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiMacHeader m_currentHdr
Header of the current transmitted packet.
void SetAddress(Mac48Address ad)
Set MAC address of this MacLow.
virtual void ConfigureStandard(WifiPhyStandard standard)
Configure the PHY-level parameters for different Wi-Fi standard.
Ptr< BlockAckManager > m_baManager
the Block ACK manager
bool IsAmpdu(Ptr< const Packet > packet, const WifiMacHeader hdr)
Checks if the given packet will be aggregated to an A-MPDU or not.
Ptr< YansWifiPhy > m_phy
Phy.
Ptr< MacLow > m_low
MacLow.
void SetMpduAggregator(const Ptr< MpduAggregator > aggr)
Set the aggregator used to construct A-MPDU subframes.
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Set up WifiRemoteStationManager associated with this MacLow.
Ptr< DcfManager > m_dcfManager
DCF manager.
void SetMaxAmsduSize(uint16_t maxSize)
Sets the maximum A-MSDU size in bytes.
Ptr< MpduAggregator > m_mpduAggregator
A-MPDU aggregator.
Ptr< EdcaTxopN > m_edca
EDCA.
Ptr< WifiRemoteStationManager > m_manager
remote station manager