A Discrete-Event Network Simulator
API
wifi-aggregation-test.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2015
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: S├ębastien Deronne <sebastien.deronne@gmail.com>
19  */
20 
21 #include "ns3/string.h"
22 #include "ns3/test.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/ht-frame-exchange-manager.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"
36 #include "ns3/node-container.h"
37 #include "ns3/yans-wifi-helper.h"
38 #include "ns3/mobility-helper.h"
39 #include "ns3/pointer.h"
40 #include "ns3/packet-socket-server.h"
41 #include "ns3/packet-socket-client.h"
42 #include "ns3/packet-socket-helper.h"
43 #include "ns3/wifi-default-protection-manager.h"
44 #include "ns3/wifi-default-ack-manager.h"
45 #include <iterator>
46 #include <algorithm>
47 
48 using namespace ns3;
49 
57 {
58 public:
60 
61 private:
68  void MpduDiscarded (WifiMacDropReason reason, Ptr<const WifiMacQueueItem> mpdu);
69 
70  void DoRun (void) override;
76  bool m_discarded;
77 };
78 
80  : TestCase ("Check the correctness of MPDU aggregation operations"),
81  m_discarded (false)
82 {
83 }
84 
85 void
87 {
88  m_discarded = true;
89 }
90 
91 void
93 {
94  /*
95  * Create device and attach HT configuration.
96  */
97  m_device = CreateObject<WifiNetDevice> ();
98  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
99  m_device->SetHtConfiguration (htConfiguration);
100 
101  /*
102  * Create and configure phy layer.
103  */
104  m_phy = CreateObject<YansWifiPhy> ();
107  m_device->SetPhy (m_phy);
108 
109  /*
110  * Create and configure manager.
111  */
113  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
114  m_factory.Set ("DataMode", StringValue ("HtMcs7"));
118 
119  /*
120  * Create and configure mac layer.
121  */
122  m_mac = CreateObject<StaWifiMac> ();
125  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
128  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
129  protectionManager->SetWifiMac (m_mac);
130  fem->SetProtectionManager (protectionManager);
131  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
132  ackManager->SetWifiMac (m_mac);
133  fem->SetAckManager (ackManager);
135  m_device->SetMac (m_mac);
136 
137  /*
138  * Configure MPDU aggregation.
139  */
140  m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535));
141  HtCapabilities htCapabilities;
142  htCapabilities.SetMaxAmpduLength (65535);
143  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities);
144  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:03"), htCapabilities);
145 
146  /*
147  * Create a dummy packet of 1500 bytes and fill mac header fields.
148  */
149  Ptr<const Packet> pkt = Create<Packet> (1500);
150  Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
151  WifiMacHeader hdr;
152  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
153  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
155  hdr.SetQosTid (0);
156  hdr.SetFragmentNumber (0);
157  hdr.SetNoMoreFragments ();
158  hdr.SetNoRetry ();
159 
160  /*
161  * Establish agreement.
162  */
163  MgtAddBaRequestHeader reqHdr;
164  reqHdr.SetImmediateBlockAck ();
165  reqHdr.SetTid (0);
166  reqHdr.SetBufferSize (64);
167  reqHdr.SetTimeout (0);
168  reqHdr.SetStartingSequence (0);
169  m_mac->GetBEQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
170 
171  MgtAddBaResponseHeader respHdr;
172  StatusCode code;
173  code.SetSuccess ();
174  respHdr.SetStatusCode (code);
175  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
176  respHdr.SetImmediateBlockAck ();
177  respHdr.SetTid (reqHdr.GetTid ());
178  respHdr.SetBufferSize (63);
179  respHdr.SetTimeout (reqHdr.GetTimeout ());
180  m_mac->GetBEQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
181 
182  //-----------------------------------------------------------------------------------------------------
183 
184  /*
185  * Test behavior when no other packets are in the queue
186  */
187  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
188  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
189 
190  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
191 
193  WifiTxParameters txParams;
196  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (),
197  true, queueIt);
198 
199  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
200 
201  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet should not result in an A-MPDU");
202 
203  // the packet has not been "transmitted", release its sequence number
204  m_mac->m_txMiddle->SetSequenceNumberFor (&item->GetHeader ());
205 
206  //-----------------------------------------------------------------------------------------------------
207 
208  /*
209  * Test behavior when 2 more packets are in the queue
210  */
211  Ptr<const Packet> pkt1 = Create<Packet> (1500);
212  Ptr<const Packet> pkt2 = Create<Packet> (1500);
213  WifiMacHeader hdr1, hdr2;
214 
215  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
216  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
217  hdr1.SetType (WIFI_MAC_QOSDATA);
218  hdr1.SetQosTid (0);
219 
220  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
221  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
222  hdr2.SetType (WIFI_MAC_QOSDATA);
223  hdr2.SetQosTid (0);
224 
225  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
226  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
227 
228  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
229  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
230 
231  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
232 
233  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
234  htFem->DequeuePsdu (psdu);
235 
236  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 4606, "A-MPDU size is not correct");
237  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "A-MPDU should contain 3 MPDUs");
238  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
239 
240  for (uint32_t i = 0; i < psdu->GetNMpdus (); i++)
241  {
242  NS_TEST_EXPECT_MSG_EQ (psdu->GetHeader (i).GetSequenceNumber (), i, "wrong sequence number");
243  }
244 
245  //-----------------------------------------------------------------------------------------------------
246 
247  /*
248  * Test behavior when the 802.11n station and another non-QoS station are associated to the AP.
249  * The AP sends an A-MPDU to the 802.11n station followed by the last retransmission of a non-QoS data frame to the non-QoS station.
250  * This is used to reproduce bug 2224.
251  */
252  pkt1 = Create<Packet> (1500);
253  pkt2 = Create<Packet> (1500);
254  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
255  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
256  hdr1.SetType (WIFI_MAC_QOSDATA);
257  hdr1.SetQosTid (0);
258  hdr1.SetSequenceNumber (3);
259  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
260  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
261  hdr2.SetType (WIFI_MAC_QOSDATA);
262  hdr2.SetQosTid (0);
263 
264  Ptr<const Packet> pkt3 = Create<Packet> (1500);
265  WifiMacHeader hdr3;
266  hdr3.SetSequenceNumber (0);
267  hdr3.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
268  hdr3.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
269  hdr3.SetType (WIFI_MAC_QOSDATA);
270  hdr3.SetQosTid (0);
271 
272  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
273  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
274  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt3, hdr3));
275 
276  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
277  txParams.Clear ();
279  queueIt = WifiMacQueue::EMPTY; // reset queueIt
280  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
281 
282  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
283 
284  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet for this destination should not result in an A-MPDU");
285  // dequeue the MPDU
286  htFem->DequeueMpdu (item);
287 
288  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
289  txParams.Clear ();
291  queueIt = WifiMacQueue::EMPTY; // reset queueIt
292  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true, queueIt);
293 
294  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
295 
296  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "no MPDU aggregation should be performed if there is no agreement");
297 
298  m_manager->SetMaxSsrc (0); //set to 0 in order to fake that the maximum number of retries has been reached
300  htFem->m_dcf = m_mac->GetBEQueue ();
301  htFem->NormalAckTimeout (item, txParams.m_txVector);
302 
303  NS_TEST_EXPECT_MSG_EQ (m_discarded, true, "packet should be discarded");
304  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Flush ();
305 
306  Simulator::Destroy ();
307 
308  m_manager->Dispose ();
309  m_manager = 0;
310 
311  m_device->Dispose ();
312  m_device = 0;
313 
314  htConfiguration = 0;
315 }
316 
324 {
325 public:
327 
328 private:
329  void DoRun (void) override;
335 };
336 
338  : TestCase ("Check the correctness of two-level aggregation operations")
339 {
340 }
341 
342 void
344 {
345  /*
346  * Create device and attach HT configuration.
347  */
348  m_device = CreateObject<WifiNetDevice> ();
349  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
350  m_device->SetHtConfiguration (htConfiguration);
351 
352  /*
353  * Create and configure phy layer.
354  */
355  m_phy = CreateObject<YansWifiPhy> ();
358  m_device->SetPhy (m_phy);
359 
360  /*
361  * Create and configure manager.
362  */
364  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
365  m_factory.Set ("DataMode", StringValue ("HtMcs7"));
369 
370  /*
371  * Create and configure mac layer.
372  */
373  m_mac = CreateObject<StaWifiMac> ();
376  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
379  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
380  protectionManager->SetWifiMac (m_mac);
381  fem->SetProtectionManager (protectionManager);
382  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
383  ackManager->SetWifiMac (m_mac);
384  fem->SetAckManager (ackManager);
386  m_device->SetMac (m_mac);
387 
388  /*
389  * Configure aggregation.
390  */
391  m_mac->SetAttribute ("BE_MaxAmsduSize", UintegerValue (4095));
392  m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535));
393  HtCapabilities htCapabilities;
394  htCapabilities.SetMaxAmsduLength (7935);
395  htCapabilities.SetMaxAmpduLength (65535);
396  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities);
397 
398  /*
399  * Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
400  */
401  Ptr<const Packet> pkt = Create<Packet> (1500);
402  WifiMacHeader hdr;
403  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
404  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
406  hdr.SetQosTid (0);
407 
408  //-----------------------------------------------------------------------------------------------------
409 
410  /*
411  * Test MSDU and MPDU aggregation. Three MSDUs are in the queue and the maximum A-MSDU size
412  * is such that only two MSDUs can be aggregated. Therefore, the first MPDU we get contains
413  * an A-MSDU of 2 MSDUs.
414  */
415  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
416  Ptr<MsduAggregator> msduAggregator = htFem->GetMsduAggregator ();
417  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
418 
419  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
420  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
421  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
422 
424  WifiTxParameters txParams;
426  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
428  Ptr<WifiMacQueueItem> item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min (), queueIt);
429 
430  bool result = (item != 0);
431  NS_TEST_EXPECT_MSG_EQ (result, true, "aggregation failed");
432  NS_TEST_EXPECT_MSG_EQ (item->GetPacketSize (), 3030, "wrong packet size");
433 
434  // dequeue the MSDUs
435  htFem->DequeueMpdu (item);
436 
437  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 1,
438  "Unexpected number of MSDUs left in the EDCA queue");
439 
440  //-----------------------------------------------------------------------------------------------------
441 
442  /*
443  * A-MSDU aggregation fails when there is just one MSDU in the queue.
444  */
445 
446  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
447  txParams.Clear ();
449  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
450  item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min (), queueIt);
451 
452  NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "A-MSDU aggregation did not fail");
453 
454  htFem->DequeueMpdu (*peeked->GetQueueIterator ());
455 
456  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
457 
458  //-----------------------------------------------------------------------------------------------------
459 
460  /*
461  * Aggregation of MPDUs is stopped to prevent that the PPDU duration exceeds the TXOP limit.
462  * In this test, the VI AC is used, which has a default TXOP limit of 3008 microseconds.
463  */
464 
465  // Establish agreement.
466  uint8_t tid = 5;
467  MgtAddBaRequestHeader reqHdr;
468  reqHdr.SetImmediateBlockAck ();
469  reqHdr.SetTid (tid);
470  reqHdr.SetBufferSize (64);
471  reqHdr.SetTimeout (0);
472  reqHdr.SetStartingSequence (0);
473  m_mac->GetVIQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
474 
475  MgtAddBaResponseHeader respHdr;
476  StatusCode code;
477  code.SetSuccess ();
478  respHdr.SetStatusCode (code);
479  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
480  respHdr.SetImmediateBlockAck ();
481  respHdr.SetTid (reqHdr.GetTid ());
482  respHdr.SetBufferSize (63);
483  respHdr.SetTimeout (reqHdr.GetTimeout ());
484  m_mac->GetVIQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
485 
486  m_mac->SetAttribute ("VI_MaxAmsduSize", UintegerValue (3050)); // max 2 MSDUs per A-MSDU
487  m_mac->SetAttribute ("VI_MaxAmpduSize", UintegerValue (65535));
488  m_manager->SetAttribute ("DataMode", StringValue ("HtMcs2")); // 19.5Mbps
489 
490  hdr.SetQosTid (tid);
491 
492  // Add 10 MSDUs to the EDCA queue
493  for (uint8_t i = 0; i < 10; i++)
494  {
495  m_mac->GetVIQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1300), hdr));
496  }
497 
498  peeked = m_mac->GetVIQueue ()->PeekNextMpdu ();
499  txParams.Clear ();
501  Time txopLimit = m_mac->GetVIQueue ()->GetTxopLimit (); // 3.008 ms
502 
503  // Compute the first MPDU to be aggregated in an A-MPDU. It must contain an A-MSDU
504  // aggregating two MSDUs
505  queueIt = WifiMacQueue::EMPTY; // reset queueIt
506  item = m_mac->GetVIQueue ()->GetNextMpdu (peeked, txParams, txopLimit, true, queueIt);
507 
508  NS_TEST_EXPECT_MSG_EQ (std::distance (item->begin (), item->end ()), 2, "There must be 2 MSDUs in the A-MSDU");
509 
510  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, txopLimit, queueIt);
511 
512  // The maximum number of bytes that can be transmitted in a TXOP is (approximately, as we
513  // do not consider that the preamble is transmitted at a different rate):
514  // 19.5 Mbps * 3.008 ms = 7332 bytes
515  // Given that the max A-MSDU size is set to 3050, an A-MSDU will contain two MSDUs and have
516  // a size of 2 * 1300 (MSDU size) + 2 * 14 (A-MSDU subframe header size) + 2 (one padding field) = 2630 bytes
517  // Hence, we expect that the A-MPDU will consist of:
518  // - 2 MPDUs containing each an A-MSDU. The size of each MPDU is 2630 (A-MSDU) + 30 (header+trailer) = 2660
519  // - 1 MPDU containing a single MSDU. The size of such MPDU is 1300 (MSDU) + 30 (header+trailer) = 1330
520  // The size of the A-MPDU is 4 + 2660 + 4 + 2660 + 4 + 1330 = 6662
521  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "aggregation failed");
522  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "Unexpected number of MPDUs in the A-MPDU");
523  NS_TEST_EXPECT_MSG_EQ (mpduList.at (0)->GetSize (), 2660, "Unexpected size of the first MPDU");
524  NS_TEST_EXPECT_MSG_EQ (mpduList.at (1)->GetSize (), 2660, "Unexpected size of the second MPDU");
525  NS_TEST_EXPECT_MSG_EQ (mpduList.at (2)->GetSize (), 1330, "Unexpected size of the first MPDU");
526 
527  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
528  htFem->DequeuePsdu (psdu);
529 
530  NS_TEST_EXPECT_MSG_EQ (m_mac->GetVIQueue ()->GetWifiMacQueue ()->GetNPackets (), 5,
531  "Unexpected number of MSDUs left in the EDCA queue");
532 
533  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 6662, "Unexpected size of the A-MPDU");
534 
535  Simulator::Destroy ();
536 
537  m_device->Dispose ();
538  m_device = 0;
539  htConfiguration = 0;
540 }
541 
549 {
550 public:
552 
553 private:
554  void DoRun (void) override;
560  void DoRunSubTest (uint16_t bufferSize);
566 };
567 
569  : TestCase ("Check the correctness of 802.11ax aggregation operations")
570 {
571 }
572 
573 void
574 HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
575 {
576  /*
577  * Create device and attach configurations.
578  */
579  m_device = CreateObject<WifiNetDevice> ();
580  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
581  m_device->SetHtConfiguration (htConfiguration);
582  Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
583  m_device->SetVhtConfiguration (vhtConfiguration);
584  Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
585  m_device->SetHeConfiguration (heConfiguration);
586 
587  /*
588  * Create and configure phy layer.
589  */
590  m_phy = CreateObject<YansWifiPhy> ();
593  m_device->SetPhy (m_phy);
594 
595  /*
596  * Create and configure manager.
597  */
599  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
600  m_factory.Set ("DataMode", StringValue ("HeMcs11"));
604 
605  /*
606  * Create and configure mac layer.
607  */
608  m_mac = CreateObject<StaWifiMac> ();
611  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
614  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
615  protectionManager->SetWifiMac (m_mac);
616  fem->SetProtectionManager (protectionManager);
617  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
618  ackManager->SetWifiMac (m_mac);
619  fem->SetAckManager (ackManager);
621  m_device->SetMac (m_mac);
622 
623  /*
624  * Configure aggregation.
625  */
626  HeCapabilities heCapabilities;
627  m_manager->AddStationHeCapabilities (Mac48Address ("00:00:00:00:00:02"), heCapabilities);
628 
629  /*
630  * Fill mac header fields.
631  */
632  WifiMacHeader hdr;
633  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
634  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
636  hdr.SetQosTid (0);
637  uint16_t sequence = m_mac->m_txMiddle->PeekNextSequenceNumberFor (&hdr);
638  hdr.SetSequenceNumber (sequence);
639  hdr.SetFragmentNumber (0);
640  hdr.SetNoMoreFragments ();
641  hdr.SetNoRetry ();
642 
643  /*
644  * Establish agreement.
645  */
646  MgtAddBaRequestHeader reqHdr;
647  reqHdr.SetImmediateBlockAck ();
648  reqHdr.SetTid (0);
649  reqHdr.SetBufferSize (bufferSize);
650  reqHdr.SetTimeout (0);
651  reqHdr.SetStartingSequence (0);
652  m_mac->GetBEQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
653 
654  MgtAddBaResponseHeader respHdr;
655  StatusCode code;
656  code.SetSuccess ();
657  respHdr.SetStatusCode (code);
658  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
659  respHdr.SetImmediateBlockAck ();
660  respHdr.SetTid (reqHdr.GetTid ());
661  respHdr.SetBufferSize (bufferSize - 1);
662  respHdr.SetTimeout (reqHdr.GetTimeout ());
663  m_mac->GetBEQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
664 
665  /*
666  * Test behavior when 300 packets are ready for transmission but negociated buffer size is 64
667  */
668  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
669  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
670 
671  for (uint16_t i = 0; i < 300; i++)
672  {
673  Ptr<const Packet> pkt = Create<Packet> (100);
674  WifiMacHeader hdr;
675 
676  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
677  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
679  hdr.SetQosTid (0);
680 
681  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
682  }
683 
685  WifiTxParameters txParams;
688  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (),
689  true, queueIt);
690 
691  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min (), queueIt);
692  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
693  htFem->DequeuePsdu (psdu);
694 
695  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
696  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), bufferSize, "A-MPDU should countain " << bufferSize << " MPDUs");
697  uint16_t expectedRemainingPacketsInQueue = 300 - bufferSize;
698  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), expectedRemainingPacketsInQueue, "queue should contain 300 - "<< bufferSize << " = "<< expectedRemainingPacketsInQueue << " packets");
699 
700  Simulator::Destroy ();
701 
702  m_manager->Dispose ();
703  m_manager = 0;
704 
705  m_device->Dispose ();
706  m_device = 0;
707 
708  htConfiguration = 0;
709  vhtConfiguration = 0;
710  heConfiguration = 0;
711 }
712 
713 void
715 {
716  DoRunSubTest (64);
717  DoRunSubTest (256);
718 }
719 
740 {
741 public:
743  virtual ~PreservePacketsInAmpdus ();
744 
745  void DoRun (void) override;
746 
747 
748 private:
749  std::list<Ptr<const Packet>> m_packetList;
750  std::vector<std::size_t> m_nMpdus;
751  std::vector<std::size_t> m_nMsdus;
752 
757  void NotifyMacTransmit (Ptr<const Packet> packet);
764  void NotifyPsduForwardedDown (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
770 };
771 
773  : TestCase ("Test case to check that the Wifi Mac forwards up the same packets received at sender side.")
774 {
775 }
776 
778 {
779 }
780 
781 void
783 {
784  m_packetList.push_back (packet);
785 }
786 
787 void
789 {
790  NS_TEST_EXPECT_MSG_EQ ((psduMap.size () == 1 && psduMap.begin ()->first == SU_STA_ID),
791  true, "No DL MU PPDU expected");
792 
793  if (!psduMap[SU_STA_ID]->GetHeader (0).IsQosData ())
794  {
795  return;
796  }
797 
798  m_nMpdus.push_back (psduMap[SU_STA_ID]->GetNMpdus ());
799 
800  for (auto& mpdu : *PeekPointer (psduMap[SU_STA_ID]))
801  {
802  std::size_t dist = std::distance (mpdu->begin (), mpdu->end ());
803  // the list of aggregated MSDUs is empty if the MPDU includes a non-aggregated MSDU
804  m_nMsdus.push_back (dist > 0 ? dist : 1);
805  }
806 }
807 
808 void
810 {
811  auto it = std::find (m_packetList.begin (), m_packetList.end (), p);
812  NS_TEST_EXPECT_MSG_EQ ((it != m_packetList.end ()), true, "Packet being forwarded up not found");
813  m_packetList.erase (it);
814 }
815 
816 void
818 {
819  NodeContainer wifiStaNode;
820  wifiStaNode.Create (1);
821 
823  wifiApNode.Create (1);
824 
825  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
827  phy.SetChannel (channel.Create ());
828 
830  wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
831  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
832 
834  Ssid ssid = Ssid ("ns-3-ssid");
835  mac.SetType ("ns3::StaWifiMac",
836  "BE_MaxAmsduSize", UintegerValue (4500),
837  "BE_MaxAmpduSize", UintegerValue (7500),
838  "Ssid", SsidValue (ssid),
839  /* setting blockack threshold for sta's BE queue */
840  "BE_BlockAckThreshold", UintegerValue (2),
841  "ActiveProbing", BooleanValue (false));
842 
844  staDevices = wifi.Install (phy, mac, wifiStaNode);
845 
846  mac.SetType ("ns3::ApWifiMac",
847  "Ssid", SsidValue (ssid),
848  "BeaconGeneration", BooleanValue (true));
849 
851  apDevices = wifi.Install (phy, mac, wifiApNode);
852 
854  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
855 
856  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
857  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
858  mobility.SetPositionAllocator (positionAlloc);
859 
860  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
861  mobility.Install (wifiApNode);
862  mobility.Install (wifiStaNode);
863 
864  Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice> (apDevices.Get (0));
865  Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice> (staDevices.Get (0));
866 
867  PacketSocketAddress socket;
868  socket.SetSingleDevice (sta_device->GetIfIndex ());
869  socket.SetPhysicalAddress (ap_device->GetAddress ());
870  socket.SetProtocol (1);
871 
872  // install packet sockets on nodes.
873  PacketSocketHelper packetSocket;
874  packetSocket.Install (wifiStaNode);
875  packetSocket.Install (wifiApNode);
876 
877  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
878  client->SetAttribute ("PacketSize", UintegerValue (1000));
879  client->SetAttribute ("MaxPackets", UintegerValue (8));
880  client->SetAttribute ("Interval", TimeValue (Seconds (1)));
881  client->SetRemote (socket);
882  wifiStaNode.Get (0)->AddApplication (client);
883  client->SetStartTime (Seconds (1));
884  client->SetStopTime (Seconds (3.0));
885  Simulator::Schedule (Seconds (1.5), &PacketSocketClient::SetAttribute, client,
886  "Interval", TimeValue (MicroSeconds (0)));
887 
888  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
889  server->SetLocal (socket);
890  wifiApNode.Get (0)->AddApplication (server);
891  server->SetStartTime (Seconds (0.0));
892  server->SetStopTime (Seconds (4.0));
893 
894  sta_device->GetMac ()->TraceConnectWithoutContext ("MacTx",
896  sta_device->GetPhy ()->TraceConnectWithoutContext ("PhyTxPsduBegin",
898  ap_device->GetMac ()->TraceConnectWithoutContext ("MacRx",
900 
901  Simulator::Stop (Seconds (5));
902  Simulator::Run ();
903 
904  Simulator::Destroy ();
905 
906  // Two packets are transmitted. The first one is an MPDU containing a single MSDU.
907  // The second one is an A-MPDU containing two MPDUs: the first MPDU contains 4 MSDUs
908  // and the second MPDU contains 3 MSDUs
909  NS_TEST_EXPECT_MSG_EQ (m_nMpdus.size (), 2, "Unexpected number of transmitted packets");
910  NS_TEST_EXPECT_MSG_EQ (m_nMsdus.size (), 3, "Unexpected number of transmitted MPDUs");
911  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[0], 1, "Unexpected number of MPDUs in the first A-MPDU");
912  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[0], 1, "Unexpected number of MSDUs in the first MPDU");
913  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[1], 2, "Unexpected number of MPDUs in the second A-MPDU");
914  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[1], 4, "Unexpected number of MSDUs in the second MPDU");
915  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[2], 3, "Unexpected number of MSDUs in the third MPDU");
916  // All the packets must have been forwarded up at the receiver
917  NS_TEST_EXPECT_MSG_EQ (m_packetList.empty (), true, "Some packets have not been forwarded up");
918 }
919 
927 {
928 public:
930 };
931 
933  : TestSuite ("wifi-aggregation", UNIT)
934 {
935  AddTestCase (new AmpduAggregationTest, TestCase::QUICK);
936  AddTestCase (new TwoLevelAggregationTest, TestCase::QUICK);
937  AddTestCase (new HeAggregationTest, TestCase::QUICK);
938  AddTestCase (new PreservePacketsInAmpdus, TestCase::QUICK);
939 }
940 
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition: net-device-container.h:42
ns3::WIFI_STANDARD_80211n_5GHZ
@ WIFI_STANDARD_80211n_5GHZ
Definition: wifi-standards.h:132
ns3::RegularWifiMac::GetFrameExchangeManager
Ptr< FrameExchangeManager > GetFrameExchangeManager(void) const
Get the Frame Exchange Manager.
Definition: regular-wifi-mac.cc:177
ns3::WifiMacQueueItem::begin
DeaggregatedMsdusCI begin(void)
Get a constant iterator pointing to the first MSDU in the list of aggregated MSDUs.
Definition: wifi-mac-queue-item.cc:243
HeAggregationTest::m_mac
Ptr< StaWifiMac > m_mac
Mac.
Definition: wifi-aggregation-test.cc:562
ns3::YansWifiPhyHelper
Make it easy to create and manage PHY objects for the YANS model.
Definition: yans-wifi-helper.h:161
ns3::WifiMac::SetDevice
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:85
ns3::TestCase::AddTestCase
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:299
AmpduAggregationTest::m_manager
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Definition: wifi-aggregation-test.cc:74
ns3::ListPositionAllocator::Add
void Add(Vector v)
Add a position to the list of positions.
Definition: position-allocator.cc:70
ns3::Object::Dispose
void Dispose(void)
Dispose of this Object.
Definition: object.cc:214
third.staDevices
staDevices
Definition: third.py:103
ns3::WifiMacHeader::SetNoMoreFragments
void SetNoMoreFragments(void)
Un-set the More Fragment bit in the Frame Control Field.
Definition: wifi-mac-header.cc:322
PreservePacketsInAmpdus::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: wifi-aggregation-test.cc:817
ns3::WifiRemoteStationManager::SetMaxSsrc
void SetMaxSsrc(uint32_t maxSsrc)
Sets the maximum STA short retry count (SSRC).
Definition: wifi-remote-station-manager.cc:178
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
AmpduAggregationTest::MpduDiscarded
void MpduDiscarded(WifiMacDropReason reason, Ptr< const WifiMacQueueItem > mpdu)
Fired when the MAC discards an MPDU.
Definition: wifi-aggregation-test.cc:86
ns3::WifiRemoteStationManager::AddStationHeCapabilities
void AddStationHeCapabilities(Mac48Address from, HeCapabilities heCapabilities)
Records HE capabilities of the remote station.
Definition: wifi-remote-station-manager.cc:1361
PreservePacketsInAmpdus
Test for A-MSDU and A-MPDU aggregation.
Definition: wifi-aggregation-test.cc:740
ns3::MgtAddBaRequestHeader::SetImmediateBlockAck
void SetImmediateBlockAck()
Enable immediate BlockAck.
Definition: mgt-headers.cc:1533
HeAggregationTest::m_phy
Ptr< YansWifiPhy > m_phy
Phy.
Definition: wifi-aggregation-test.cc:563
ns3::WifiMacDropReason
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:55
ns3::WifiPhy::SetDevice
void SetDevice(const Ptr< NetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:777
ns3::WifiNetDevice::GetPhy
Ptr< WifiPhy > GetPhy(void) const
Definition: wifi-net-device.cc:207
ns3::WifiMacHeader::SetFragmentNumber
void SetFragmentNumber(uint8_t frag)
Set the fragment number of the header.
Definition: wifi-mac-header.cc:317
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
HeAggregationTest::m_manager
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Definition: wifi-aggregation-test.cc:564
ns3::WifiNetDevice::SetMac
void SetMac(const Ptr< WifiMac > mac)
Definition: wifi-net-device.cc:180
ns3::WifiHelper
helps to create WifiNetDevice objects
Definition: wifi-helper.h:327
ns3::WifiMacHeader::SetSequenceNumber
void SetSequenceNumber(uint16_t seq)
Set the sequence number of the header.
Definition: wifi-mac-header.cc:312
PreservePacketsInAmpdus::m_nMpdus
std::vector< std::size_t > m_nMpdus
Number of MPDUs in PSDUs passed to the PHY.
Definition: wifi-aggregation-test.cc:750
ns3::FrameExchangeManager::SetAckManager
virtual void SetAckManager(Ptr< WifiAckManager > ackManager)
Set the Acknowledgment Manager to use.
Definition: frame-exchange-manager.cc:117
AmpduAggregationTest::AmpduAggregationTest
AmpduAggregationTest()
Definition: wifi-aggregation-test.cc:79
ns3::MgtAddBaRequestHeader::SetBufferSize
void SetBufferSize(uint16_t size)
Set buffer size.
Definition: mgt-headers.cc:1552
TwoLevelAggregationTest::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: wifi-aggregation-test.cc:343
ns3::MicroSeconds
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
ns3::WifiNetDevice::SetHeConfiguration
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
Definition: wifi-net-device.cc:474
g_wifiAggregationTestSuite
static WifiAggregationTestSuite g_wifiAggregationTestSuite
the test suite
Definition: wifi-aggregation-test.cc:941
TwoLevelAggregationTest::m_mac
Ptr< StaWifiMac > m_mac
Mac.
Definition: wifi-aggregation-test.cc:331
AmpduAggregationTest::m_device
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Definition: wifi-aggregation-test.cc:71
ns3::WIFI_PHY_BAND_5GHZ
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
Definition: wifi-phy-band.h:37
ns3::HtCapabilities::SetMaxAmpduLength
void SetMaxAmpduLength(uint32_t maxAmpduLength)
Set the maximum AMPDU length.
Definition: ht-capabilities.cc:146
ns3::WIFI_STANDARD_80211ax_5GHZ
@ WIFI_STANDARD_80211ax_5GHZ
Definition: wifi-standards.h:135
ns3::WifiMacQueueItem::end
DeaggregatedMsdusCI end(void)
Get a constant iterator indicating past-the-last MSDU in the list of aggregated MSDUs.
Definition: wifi-mac-queue-item.cc:249
third.channel
channel
Definition: third.py:92
AmpduAggregationTest
Ampdu Aggregation Test.
Definition: wifi-aggregation-test.cc:57
ns3::WifiNetDevice::SetVhtConfiguration
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
Definition: wifi-net-device.cc:462
ns3::QosTxop::GetBaManager
Ptr< BlockAckManager > GetBaManager(void)
Get the Block Ack Manager associated with this QosTxop.
Definition: qos-txop.cc:243
ns3::HeCapabilities
The IEEE 802.11ax HE Capabilities.
Definition: he-capabilities.h:34
ns3::MgtAddBaRequestHeader
Implement the header for management frames of type Add Block Ack request.
Definition: mgt-headers.h:1018
ns3::WifiProtectionManager::SetWifiMac
void SetWifiMac(Ptr< RegularWifiMac > mac)
Set the MAC which is using this Protection Manager.
Definition: wifi-protection-manager.cc:56
PreservePacketsInAmpdus::m_packetList
std::list< Ptr< const Packet > > m_packetList
List of packets passed to the MAC.
Definition: wifi-aggregation-test.cc:749
ns3::WifiRemoteStationManager
hold a list of per-remote-station state.
Definition: wifi-remote-station-manager.h:121
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
Min
#define Min(a, b)
Definition: aarf-wifi-manager.cc:25
ns3::PacketSocketAddress
an address for a packet socket
Definition: packet-socket-address.h:39
ns3::QosTxop::PeekNextMpdu
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast())
Peek the next frame to transmit to the given receiver and of the given TID from the block ack manager...
Definition: qos-txop.cc:357
ns3::WifiMacHeader::SetNoRetry
void SetNoRetry(void)
Un-set the Retry bit in the Frame Control field.
Definition: wifi-mac-header.cc:347
ns3::ObjectBase::SetAttribute
void SetAttribute(std::string name, const AttributeValue &value)
Set a single attribute, raising fatal errors if unsuccessful.
Definition: object-base.cc:185
ns3::FrameExchangeManager::SetProtectionManager
virtual void SetProtectionManager(Ptr< WifiProtectionManager > protectionManager)
Set the Protection Manager to use.
Definition: frame-exchange-manager.cc:104
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::WifiNetDevice::GetAddress
Address GetAddress(void) const override
Definition: wifi-net-device.cc:243
ns3::WifiMacQueueItem::GetPacketSize
uint32_t GetPacketSize(void) const
Return the size in bytes of the packet or control header or management header stored by this item.
Definition: wifi-mac-queue-item.cc:89
ns3::WifiMacHeader::GetAddr1
Mac48Address GetAddr1(void) const
Return the address in the Address 1 field.
Definition: wifi-mac-header.cc:424
third.mac
mac
Definition: third.py:99
ns3::WifiConstPsduMap
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition: he-frame-exchange-manager.h:43
ns3::WifiTxParameters
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
Definition: wifi-tx-parameters.h:45
ns3::PacketSocketClient::SetRemote
void SetRemote(PacketSocketAddress addr)
set the remote address and protocol to be used
Definition: packet-socket-client.cc:91
ns3::WifiMacQueueItem::GetHeader
const WifiMacHeader & GetHeader(void) const
Get the header stored in this item.
Definition: wifi-mac-queue-item.cc:65
ns3::Txop::GetTxopLimit
Time GetTxopLimit(void) const
Return the TXOP limit.
Definition: txop.cc:280
ns3::PeekPointer
U * PeekPointer(const Ptr< U > &p)
Definition: ptr.h:415
AmpduAggregationTest::m_factory
ObjectFactory m_factory
factory
Definition: wifi-aggregation-test.cc:75
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition: node-container.cc:98
ns3::SsidValue
AttributeValue implementation for Ssid.
Definition: ssid.h:105
ns3::Ssid
The IEEE 802.11 SSID Information Element.
Definition: ssid.h:36
ns3::WifiNetDevice::SetHtConfiguration
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Definition: wifi-net-device.cc:450
HeAggregationTest::m_factory
ObjectFactory m_factory
factory
Definition: wifi-aggregation-test.cc:565
ns3::MgtAddBaResponseHeader::SetTid
void SetTid(uint8_t tid)
Set Traffic ID (TID).
Definition: mgt-headers.cc:1719
ns3::TestCase
encapsulates test code
Definition: test.h:1154
third.apDevices
apDevices
Definition: third.py:106
ns3::WifiMacHeader::SetAddr1
void SetAddr1(Mac48Address address)
Fill the Address 1 field with the given address.
Definition: wifi-mac-header.cc:108
PreservePacketsInAmpdus::PreservePacketsInAmpdus
PreservePacketsInAmpdus()
Definition: wifi-aggregation-test.cc:772
ns3::MgtAddBaRequestHeader::IsAmsduSupported
bool IsAmsduSupported(void) const
Return whether A-MSDU capability is supported.
Definition: mgt-headers.cc:1600
ns3::MgtAddBaResponseHeader::SetTimeout
void SetTimeout(uint16_t timeout)
Set timeout.
Definition: mgt-headers.cc:1726
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::Application::SetStopTime
void SetStopTime(Time stop)
Specify application stop time.
Definition: application.cc:75
ns3::PacketSocketHelper::Install
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Definition: packet-socket-helper.cc:37
third.wifi
wifi
Definition: third.py:96
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
TwoLevelAggregationTest::TwoLevelAggregationTest
TwoLevelAggregationTest()
Definition: wifi-aggregation-test.cc:337
ns3::WIFI_PHY_STANDARD_80211ax
@ WIFI_PHY_STANDARD_80211ax
HE PHY (clause 26)
Definition: wifi-standards.h:49
ns3::WifiMacQueueItem::ConstIterator
std::list< Ptr< WifiMacQueueItem > >::const_iterator ConstIterator
Const iterator typedef.
Definition: wifi-mac-queue-item.h:144
ns3::Application::SetStartTime
void SetStartTime(Time start)
Specify application start time.
Definition: application.cc:69
AmpduAggregationTest::m_mac
Ptr< StaWifiMac > m_mac
Mac.
Definition: wifi-aggregation-test.cc:72
ns3::MgtAddBaResponseHeader::SetStatusCode
void SetStatusCode(StatusCode code)
Set the status code.
Definition: mgt-headers.cc:1738
TwoLevelAggregationTest::m_device
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Definition: wifi-aggregation-test.cc:330
PreservePacketsInAmpdus::~PreservePacketsInAmpdus
virtual ~PreservePacketsInAmpdus()
Definition: wifi-aggregation-test.cc:777
PreservePacketsInAmpdus::NotifyMacForwardUp
void NotifyMacForwardUp(Ptr< const Packet > p)
Callback invoked when the receiver MAC forwards a packet up to the upper layer.
Definition: wifi-aggregation-test.cc:809
TwoLevelAggregationTest::m_factory
ObjectFactory m_factory
factory
Definition: wifi-aggregation-test.cc:334
ns3::RegularWifiMac::SetAddress
void SetAddress(Mac48Address address) override
Definition: regular-wifi-mac.cc:676
ns3::HtCapabilities
The HT Capabilities Information Element.
Definition: ht-capabilities.h:42
WifiAggregationTestSuite::WifiAggregationTestSuite
WifiAggregationTestSuite()
Definition: wifi-aggregation-test.cc:932
ns3::WifiPsdu::GetHeader
const WifiMacHeader & GetHeader(std::size_t i) const
Get the header of the i-th MPDU.
Definition: wifi-psdu.cc:266
ns3::Node::AddApplication
uint32_t AddApplication(Ptr< Application > application)
Associate an Application to this Node.
Definition: node.cc:159
ns3::WifiAckManager::SetWifiMac
void SetWifiMac(Ptr< RegularWifiMac > mac)
Set the MAC which is using this Acknowledgment Manager.
Definition: wifi-ack-manager.cc:57
ns3::StatusCode::SetSuccess
void SetSuccess(void)
Set success bit to 0 (success).
Definition: status-code.cc:30
ns3::StaWifiMac::SetWifiPhy
void SetWifiPhy(const Ptr< WifiPhy > phy) override
Definition: sta-wifi-mac.cc:141
ns3::Txop::GetWifiMacQueue
Ptr< WifiMacQueue > GetWifiMacQueue() const
Return the packet queue associated with this Txop.
Definition: txop.cc:154
ns3::MgtAddBaRequestHeader::SetTid
void SetTid(uint8_t tid)
Set Traffic ID (TID).
Definition: mgt-headers.cc:1539
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition: object-factory.h:48
HeAggregationTest
802.11ax aggregation test which permits 64 or 256 MPDUs in A-MPDU according to the negociated buffer ...
Definition: wifi-aggregation-test.cc:549
ns3::WifiPsdu::GetSize
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
Definition: wifi-psdu.cc:260
SU_STA_ID
#define SU_STA_ID
Definition: wifi-mode.h:32
ns3::WifiTxParameters::Clear
void Clear(void)
Reset the TX parameters.
Definition: wifi-tx-parameters.cc:67
AmpduAggregationTest::m_discarded
bool m_discarded
whether the packet should be discarded
Definition: wifi-aggregation-test.cc:76
ns3::HtCapabilities::SetMaxAmsduLength
void SetMaxAmsduLength(uint16_t maxAmsduLength)
Set the maximum AMSDU length.
Definition: ht-capabilities.cc:132
ns3::NodeContainer::Get
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
Definition: node-container.cc:93
ns3::MgtAddBaRequestHeader::SetStartingSequence
void SetStartingSequence(uint16_t seq)
Set the starting sequence number.
Definition: mgt-headers.cc:1558
ns3::WifiPsdu::GetNMpdus
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
Definition: wifi-psdu.cc:319
NS_TEST_EXPECT_MSG_EQ
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition: test.h:283
ns3::MgtAddBaRequestHeader::GetTid
uint8_t GetTid(void) const
Return the Traffic ID (TID).
Definition: mgt-headers.cc:1576
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::WifiMacHeader::GetSequenceNumber
uint16_t GetSequenceNumber(void) const
Return the sequence number of the header.
Definition: wifi-mac-header.cc:777
third.wifiApNode
wifiApNode
Definition: third.py:90
WifiAggregationTestSuite
Wifi Aggregation Test Suite.
Definition: wifi-aggregation-test.cc:927
ns3::WifiRemoteStationManager::SetupPhy
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...
Definition: wifi-remote-station-manager.cc:142
ns3::PacketSocketAddress::SetSingleDevice
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Definition: packet-socket-address.cc:46
ns3::MsduAggregator::GetNextAmsdu
Ptr< WifiMacQueueItem > GetNextAmsdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, WifiMacQueueItem::ConstIterator &queueIt) const
Attempt to aggregate other MSDUs to the given A-MSDU while meeting the following constraints:
Definition: msdu-aggregator.cc:86
ns3::MgtAddBaRequestHeader::SetTimeout
void SetTimeout(uint16_t timeout)
Set timeout.
Definition: mgt-headers.cc:1546
ns3::RegularWifiMac::SetWifiRemoteStationManager
void SetWifiRemoteStationManager(const Ptr< WifiRemoteStationManager > stationManager) override
Definition: regular-wifi-mac.cc:183
ns3::MgtAddBaRequestHeader::GetTimeout
uint16_t GetTimeout(void) const
Return the timeout.
Definition: mgt-headers.cc:1588
ns3::PacketSocketHelper
Give ns3::PacketSocket powers to ns3::Node.
Definition: packet-socket-helper.h:32
ns3::StatusCode
Status code for association response.
Definition: status-code.h:32
ns3::WifiRemoteStationManager::AddStationHtCapabilities
void AddStationHtCapabilities(Mac48Address from, HtCapabilities htCapabilities)
Records HT capabilities of the remote station.
Definition: wifi-remote-station-manager.cc:1301
ns3::FrameExchangeManager::DequeueMpdu
virtual void DequeueMpdu(Ptr< const WifiMacQueueItem > mpdu)
Dequeue the given MPDU from the queue in which it is stored.
Definition: frame-exchange-manager.cc:450
TwoLevelAggregationTest
Two Level Aggregation Test.
Definition: wifi-aggregation-test.cc:324
ns3::MgtAddBaResponseHeader
Implement the header for management frames of type Add Block Ack response.
Definition: mgt-headers.h:1150
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
ns3::WifiNetDevice::GetIfIndex
uint32_t GetIfIndex(void) const override
Definition: wifi-net-device.cc:225
ns3::WifiRemoteStationManager::GetDataTxVector
WifiTxVector GetDataTxVector(const WifiMacHeader &header)
Definition: wifi-remote-station-manager.cc:535
ns3::WIFI_PHY_STANDARD_80211n
@ WIFI_PHY_STANDARD_80211n
HT PHY (clause 20)
Definition: wifi-standards.h:45
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
ns3::HtFrameExchangeManager::GetMpduAggregator
Ptr< MpduAggregator > GetMpduAggregator(void) const
Returns the aggregator used to construct A-MPDU subframes.
Definition: ht-frame-exchange-manager.cc:92
ns3::WifiMacHeader::SetAddr2
void SetAddr2(Mac48Address address)
Fill the Address 2 field with the given address.
Definition: wifi-mac-header.cc:114
ns3::TestSuite
A suite of tests to run.
Definition: test.h:1344
AmpduAggregationTest::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: wifi-aggregation-test.cc:92
ns3::RegularWifiMac::ConfigureStandard
void ConfigureStandard(WifiStandard standard) override
Definition: regular-wifi-mac.cc:1106
ns3::WifiTxParameters::m_txVector
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
Definition: wifi-tx-parameters.h:62
ns3::QosTxop::GetNextMpdu
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame, WifiMacQueueItem::ConstIterator &queueIt)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:443
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::WifiNetDevice::SetRemoteStationManager
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Definition: wifi-net-device.cc:194
ns3::WifiPhy::ConfigureStandardAndBand
virtual void ConfigureStandardAndBand(WifiPhyStandard standard, WifiPhyBand band)
Configure the PHY-level parameters for different Wi-Fi standard.
Definition: wifi-phy.cc:1069
HeAggregationTest::DoRunSubTest
void DoRunSubTest(uint16_t bufferSize)
Run test for a given buffer size.
Definition: wifi-aggregation-test.cc:574
ns3::ObjectFactory::Set
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Definition: object-factory.h:223
ns3::WIFI_MAC_QOSDATA
@ WIFI_MAC_QOSDATA
Definition: wifi-mac-header.h:70
ns3::PacketSocketAddress::SetPhysicalAddress
void SetPhysicalAddress(const Address address)
Set the destination address.
Definition: packet-socket-address.cc:53
third.ssid
ssid
Definition: third.py:100
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
ns3::RegularWifiMac::m_txMiddle
Ptr< MacTxMiddle > m_txMiddle
TX middle (aggregation etc.)
Definition: regular-wifi-mac.h:218
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
PreservePacketsInAmpdus::NotifyMacTransmit
void NotifyMacTransmit(Ptr< const Packet > packet)
Callback invoked when an MSDU is passed to the MAC.
Definition: wifi-aggregation-test.cc:782
ns3::QosFrameExchangeManager::TryAddMpdu
bool TryAddMpdu(Ptr< const WifiMacQueueItem > mpdu, WifiTxParameters &txParams, Time availableTime) const
Recompute the protection and acknowledgment methods to use if the given MPDU is added to the frame be...
Definition: qos-frame-exchange-manager.cc:310
ns3::WifiMacHeader::SetType
void SetType(WifiMacType type, bool resetToDsFromDs=true)
Set Type/Subtype values with the correct values depending on the given type.
Definition: wifi-mac-header.cc:132
ns3::PacketSocketAddress::SetProtocol
void SetProtocol(uint16_t protocol)
Set the protocol.
Definition: packet-socket-address.cc:33
HeAggregationTest::DoRun
void DoRun(void) override
Implementation to actually run this TestCase.
Definition: wifi-aggregation-test.cc:714
ns3::ObjectFactory::SetTypeId
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
Definition: object-factory.cc:40
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::RegularWifiMac::GetWifiRemoteStationManager
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(void) const override
Definition: regular-wifi-mac.cc:190
HeAggregationTest::m_device
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Definition: wifi-aggregation-test.cc:561
ns3::YansWifiChannelHelper
manage and create wifi channel objects for the YANS model.
Definition: yans-wifi-helper.h:37
ns3::ObjectFactory::Create
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
Definition: object-factory.cc:98
ns3::WifiMacHelper
create MAC layers for a ns3::WifiNetDevice.
Definition: wifi-mac-helper.h:48
ns3::RegularWifiMac::GetBEQueue
Ptr< QosTxop > GetBEQueue(void) const
Accessor for the AC_BE channel access function.
Definition: regular-wifi-mac.cc:525
ns3::HtFrameExchangeManager::GetMsduAggregator
Ptr< MsduAggregator > GetMsduAggregator(void) const
Returns the aggregator used to construct A-MSDU subframes.
Definition: ht-frame-exchange-manager.cc:86
HeAggregationTest::HeAggregationTest
HeAggregationTest()
Definition: wifi-aggregation-test.cc:568
ns3::ObjectBase::TraceConnectWithoutContext
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
Definition: object-base.cc:293
ns3::HtFrameExchangeManager::DequeuePsdu
void DequeuePsdu(Ptr< const WifiPsdu > psdu)
Dequeue the MPDUs of the given PSDU from the queue in which they are stored.
Definition: ht-frame-exchange-manager.cc:912
ns3::WifiMacQueueItem::GetQueueIterator
ConstIterator GetQueueIterator(void) const
Get a const iterator pointing to the position of the MPDU in the queue.
Definition: wifi-mac-queue-item.cc:218
ns3::PacketSocketServer::SetLocal
void SetLocal(PacketSocketAddress addr)
set the local address and protocol to be used
Definition: packet-socket-server.cc:102
ns3::WifiMacHeader::SetQosTid
void SetQosTid(uint8_t tid)
Set the TID for the QoS header.
Definition: wifi-mac-header.cc:352
PreservePacketsInAmpdus::m_nMsdus
std::vector< std::size_t > m_nMsdus
Number of MSDUs in MPDUs passed to the PHY.
Definition: wifi-aggregation-test.cc:751
ns3::MpduAggregator::GetNextAmpdu
std::vector< Ptr< WifiMacQueueItem > > GetNextAmpdu(Ptr< WifiMacQueueItem > mpdu, WifiTxParameters &txParams, Time availableTime, WifiMacQueueItem::ConstIterator queueIt) const
Attempt to aggregate other MPDUs to the given MPDU, while meeting the following constraints:
Definition: mpdu-aggregator.cc:194
ns3::RegularWifiMac::GetVIQueue
Ptr< QosTxop > GetVIQueue(void) const
Accessor for the AC_VI channel access function.
Definition: regular-wifi-mac.cc:519
TwoLevelAggregationTest::m_phy
Ptr< YansWifiPhy > m_phy
Phy.
Definition: wifi-aggregation-test.cc:332
ns3::MobilityHelper
Helper class used to assign positions and mobility models to nodes.
Definition: mobility-helper.h:43
ns3::MgtAddBaResponseHeader::SetBufferSize
void SetBufferSize(uint16_t size)
Set buffer size.
Definition: mgt-headers.cc:1732
AmpduAggregationTest::m_phy
Ptr< YansWifiPhy > m_phy
Phy.
Definition: wifi-aggregation-test.cc:73
third.mobility
mobility
Definition: third.py:108
ns3::WifiNetDevice::SetPhy
void SetPhy(const Ptr< WifiPhy > phy)
Definition: wifi-net-device.cc:187
third.phy
phy
Definition: third.py:93
TwoLevelAggregationTest::m_manager
Ptr< WifiRemoteStationManager > m_manager
remote station manager
Definition: wifi-aggregation-test.cc:333
ns3::FrameExchangeManager::NormalAckTimeout
void NormalAckTimeout(Ptr< WifiMacQueueItem > mpdu, const WifiTxVector &txVector)
Called when the Ack timeout expires.
Definition: frame-exchange-manager.cc:770
ns3::WifiNetDevice::GetMac
Ptr< WifiMac > GetMac(void) const
Definition: wifi-net-device.cc:201
ns3::FrameExchangeManager::m_dcf
Ptr< Txop > m_dcf
the DCF/EDCAF that gained channel access
Definition: frame-exchange-manager.h:378
ns3::MgtAddBaResponseHeader::SetImmediateBlockAck
void SetImmediateBlockAck()
Enable immediate BlockAck.
Definition: mgt-headers.cc:1713
PreservePacketsInAmpdus::NotifyPsduForwardedDown
void NotifyPsduForwardedDown(WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when the sender MAC passes a PSDU(s) to the PHY.
Definition: wifi-aggregation-test.cc:788
ns3::MgtAddBaResponseHeader::SetAmsduSupport
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:1744