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 = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
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;
195  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
196 
197  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
198 
199  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet should not result in an A-MPDU");
200 
201  // the packet has not been "transmitted", release its sequence number
202  m_mac->m_txMiddle->SetSequenceNumberFor (&item->GetHeader ());
203 
204  //-----------------------------------------------------------------------------------------------------
205 
206  /*
207  * Test behavior when 2 more packets are in the queue
208  */
209  Ptr<const Packet> pkt1 = Create<Packet> (1500);
210  Ptr<const Packet> pkt2 = Create<Packet> (1500);
211  WifiMacHeader hdr1, hdr2;
212 
213  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
214  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
215  hdr1.SetType (WIFI_MAC_QOSDATA);
216  hdr1.SetQosTid (0);
217 
218  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
219  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
220  hdr2.SetType (WIFI_MAC_QOSDATA);
221  hdr2.SetQosTid (0);
222 
223  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
224  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
225 
226  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
227  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
228 
229  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
230 
231  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
232  htFem->DequeuePsdu (psdu);
233 
234  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 4606, "A-MPDU size is not correct");
235  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "A-MPDU should contain 3 MPDUs");
236  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
237 
238  for (uint32_t i = 0; i < psdu->GetNMpdus (); i++)
239  {
240  NS_TEST_EXPECT_MSG_EQ (psdu->GetHeader (i).GetSequenceNumber (), i, "wrong sequence number");
241  }
242 
243  //-----------------------------------------------------------------------------------------------------
244 
245  /*
246  * Test behavior when the 802.11n station and another non-QoS station are associated to the AP.
247  * 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.
248  * This is used to reproduce bug 2224.
249  */
250  pkt1 = Create<Packet> (1500);
251  pkt2 = Create<Packet> (1500);
252  hdr1.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
253  hdr1.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
254  hdr1.SetType (WIFI_MAC_QOSDATA);
255  hdr1.SetQosTid (0);
256  hdr1.SetSequenceNumber (3);
257  hdr2.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
258  hdr2.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
259  hdr2.SetType (WIFI_MAC_QOSDATA);
260  hdr2.SetQosTid (0);
261 
262  Ptr<const Packet> pkt3 = Create<Packet> (1500);
263  WifiMacHeader hdr3;
264  hdr3.SetSequenceNumber (0);
265  hdr3.SetAddr1 (Mac48Address ("00:00:00:00:00:03"));
266  hdr3.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
267  hdr3.SetType (WIFI_MAC_QOSDATA);
268  hdr3.SetQosTid (0);
269 
270  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt1, hdr1));
271  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt2, hdr2));
272  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt3, hdr3));
273 
274  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
275  txParams.Clear ();
277  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
278 
279  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
280 
281  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "a single packet for this destination should not result in an A-MPDU");
282  // dequeue the MPDU
283  htFem->DequeueMpdu (item);
284 
285  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
286  txParams.Clear ();
288  item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
289 
290  mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
291 
292  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), true, "no MPDU aggregation should be performed if there is no agreement");
293 
294  m_manager->SetMaxSsrc (0); //set to 0 in order to fake that the maximum number of retries has been reached
296  htFem->m_dcf = m_mac->GetBEQueue ();
297  htFem->NormalAckTimeout (item, txParams.m_txVector);
298 
299  NS_TEST_EXPECT_MSG_EQ (m_discarded, true, "packet should be discarded");
300  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Flush ();
301 
302  Simulator::Destroy ();
303 
304  m_manager->Dispose ();
305  m_manager = 0;
306 
307  m_device->Dispose ();
308  m_device = 0;
309 
310  htConfiguration = 0;
311 }
312 
320 {
321 public:
323 
324 private:
325  void DoRun (void) override;
331 };
332 
334  : TestCase ("Check the correctness of two-level aggregation operations")
335 {
336 }
337 
338 void
340 {
341  /*
342  * Create device and attach HT configuration.
343  */
344  m_device = CreateObject<WifiNetDevice> ();
345  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
346  m_device->SetHtConfiguration (htConfiguration);
347 
348  /*
349  * Create and configure phy layer.
350  */
351  m_phy = CreateObject<YansWifiPhy> ();
354  m_device->SetPhy (m_phy);
355 
356  /*
357  * Create and configure manager.
358  */
360  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
361  m_factory.Set ("DataMode", StringValue ("HtMcs7"));
365 
366  /*
367  * Create and configure mac layer.
368  */
369  m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
372  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
375  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
376  protectionManager->SetWifiMac (m_mac);
377  fem->SetProtectionManager (protectionManager);
378  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
379  ackManager->SetWifiMac (m_mac);
380  fem->SetAckManager (ackManager);
382  m_device->SetMac (m_mac);
383 
384  /*
385  * Configure aggregation.
386  */
387  m_mac->SetAttribute ("BE_MaxAmsduSize", UintegerValue (4095));
388  m_mac->SetAttribute ("BE_MaxAmpduSize", UintegerValue (65535));
389  HtCapabilities htCapabilities;
390  htCapabilities.SetMaxAmsduLength (7935);
391  htCapabilities.SetMaxAmpduLength (65535);
392  m_manager->AddStationHtCapabilities (Mac48Address ("00:00:00:00:00:02"), htCapabilities);
393 
394  /*
395  * Create dummy packets of 1500 bytes and fill mac header fields that will be used for the tests.
396  */
397  Ptr<const Packet> pkt = Create<Packet> (1500);
398  WifiMacHeader hdr;
399  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
400  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
402  hdr.SetQosTid (0);
403 
404  //-----------------------------------------------------------------------------------------------------
405 
406  /*
407  * Test MSDU and MPDU aggregation. Three MSDUs are in the queue and the maximum A-MSDU size
408  * is such that only two MSDUs can be aggregated. Therefore, the first MPDU we get contains
409  * an A-MSDU of 2 MSDUs.
410  */
411  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
412  Ptr<MsduAggregator> msduAggregator = htFem->GetMsduAggregator ();
413  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
414 
415  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
416  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
417  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1500), hdr));
418 
420  WifiTxParameters txParams;
422  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
423  Ptr<WifiMacQueueItem> item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min ());
424 
425  bool result = (item != 0);
426  NS_TEST_EXPECT_MSG_EQ (result, true, "aggregation failed");
427  NS_TEST_EXPECT_MSG_EQ (item->GetPacketSize (), 3030, "wrong packet size");
428 
429  // dequeue the MSDUs
430  htFem->DequeueMpdu (item);
431 
432  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 1,
433  "Unexpected number of MSDUs left in the EDCA queue");
434 
435  //-----------------------------------------------------------------------------------------------------
436 
437  /*
438  * A-MSDU aggregation fails when there is just one MSDU in the queue.
439  */
440 
441  peeked = m_mac->GetBEQueue ()->PeekNextMpdu ();
442  txParams.Clear ();
444  htFem->TryAddMpdu (peeked, txParams, Time::Min ());
445  item = msduAggregator->GetNextAmsdu (peeked, txParams, Time::Min ());
446 
447  NS_TEST_EXPECT_MSG_EQ ((item == 0), true, "A-MSDU aggregation did not fail");
448 
449  htFem->DequeueMpdu (peeked);
450 
451  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), 0, "queue should be empty");
452 
453  //-----------------------------------------------------------------------------------------------------
454 
455  /*
456  * Aggregation of MPDUs is stopped to prevent that the PPDU duration exceeds the TXOP limit.
457  * In this test, the VI AC is used, which has a default TXOP limit of 3008 microseconds.
458  */
459 
460  // Establish agreement.
461  uint8_t tid = 5;
462  MgtAddBaRequestHeader reqHdr;
463  reqHdr.SetImmediateBlockAck ();
464  reqHdr.SetTid (tid);
465  reqHdr.SetBufferSize (64);
466  reqHdr.SetTimeout (0);
467  reqHdr.SetStartingSequence (0);
468  m_mac->GetVIQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
469 
470  MgtAddBaResponseHeader respHdr;
471  StatusCode code;
472  code.SetSuccess ();
473  respHdr.SetStatusCode (code);
474  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
475  respHdr.SetImmediateBlockAck ();
476  respHdr.SetTid (reqHdr.GetTid ());
477  respHdr.SetBufferSize (63);
478  respHdr.SetTimeout (reqHdr.GetTimeout ());
479  m_mac->GetVIQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
480 
481  m_mac->SetAttribute ("VI_MaxAmsduSize", UintegerValue (3050)); // max 2 MSDUs per A-MSDU
482  m_mac->SetAttribute ("VI_MaxAmpduSize", UintegerValue (65535));
483  m_manager->SetAttribute ("DataMode", StringValue ("HtMcs2")); // 19.5Mbps
484 
485  hdr.SetQosTid (tid);
486 
487  // Add 10 MSDUs to the EDCA queue
488  for (uint8_t i = 0; i < 10; i++)
489  {
490  m_mac->GetVIQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (Create<Packet> (1300), hdr));
491  }
492 
493  peeked = m_mac->GetVIQueue ()->PeekNextMpdu ();
494  txParams.Clear ();
496  Time txopLimit = m_mac->GetVIQueue ()->GetTxopLimit (); // 3.008 ms
497 
498  // Compute the first MPDU to be aggregated in an A-MPDU. It must contain an A-MSDU
499  // aggregating two MSDUs
500  item = m_mac->GetVIQueue ()->GetNextMpdu (peeked, txParams, txopLimit, true);
501 
502  NS_TEST_EXPECT_MSG_EQ (std::distance (item->begin (), item->end ()), 2, "There must be 2 MSDUs in the A-MSDU");
503 
504  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, txopLimit);
505 
506  // The maximum number of bytes that can be transmitted in a TXOP is (approximately, as we
507  // do not consider that the preamble is transmitted at a different rate):
508  // 19.5 Mbps * 3.008 ms = 7332 bytes
509  // Given that the max A-MSDU size is set to 3050, an A-MSDU will contain two MSDUs and have
510  // a size of 2 * 1300 (MSDU size) + 2 * 14 (A-MSDU subframe header size) + 2 (one padding field) = 2630 bytes
511  // Hence, we expect that the A-MPDU will consist of:
512  // - 2 MPDUs containing each an A-MSDU. The size of each MPDU is 2630 (A-MSDU) + 30 (header+trailer) = 2660
513  // - 1 MPDU containing a single MSDU. The size of such MPDU is 1300 (MSDU) + 30 (header+trailer) = 1330
514  // The size of the A-MPDU is 4 + 2660 + 4 + 2660 + 4 + 1330 = 6662
515  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "aggregation failed");
516  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), 3, "Unexpected number of MPDUs in the A-MPDU");
517  NS_TEST_EXPECT_MSG_EQ (mpduList.at (0)->GetSize (), 2660, "Unexpected size of the first MPDU");
518  NS_TEST_EXPECT_MSG_EQ (mpduList.at (1)->GetSize (), 2660, "Unexpected size of the second MPDU");
519  NS_TEST_EXPECT_MSG_EQ (mpduList.at (2)->GetSize (), 1330, "Unexpected size of the first MPDU");
520 
521  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
522  htFem->DequeuePsdu (psdu);
523 
524  NS_TEST_EXPECT_MSG_EQ (m_mac->GetVIQueue ()->GetWifiMacQueue ()->GetNPackets (), 5,
525  "Unexpected number of MSDUs left in the EDCA queue");
526 
527  NS_TEST_EXPECT_MSG_EQ (psdu->GetSize (), 6662, "Unexpected size of the A-MPDU");
528 
529  Simulator::Destroy ();
530 
531  m_device->Dispose ();
532  m_device = 0;
533  htConfiguration = 0;
534 }
535 
543 {
544 public:
546 
547 private:
548  void DoRun (void) override;
554  void DoRunSubTest (uint16_t bufferSize);
560 };
561 
563  : TestCase ("Check the correctness of 802.11ax aggregation operations")
564 {
565 }
566 
567 void
568 HeAggregationTest::DoRunSubTest (uint16_t bufferSize)
569 {
570  /*
571  * Create device and attach configurations.
572  */
573  m_device = CreateObject<WifiNetDevice> ();
574  Ptr<HtConfiguration> htConfiguration = CreateObject<HtConfiguration> ();
575  m_device->SetHtConfiguration (htConfiguration);
576  Ptr<VhtConfiguration> vhtConfiguration = CreateObject<VhtConfiguration> ();
577  m_device->SetVhtConfiguration (vhtConfiguration);
578  Ptr<HeConfiguration> heConfiguration = CreateObject<HeConfiguration> ();
579  m_device->SetHeConfiguration (heConfiguration);
580 
581  /*
582  * Create and configure phy layer.
583  */
584  m_phy = CreateObject<YansWifiPhy> ();
587  m_device->SetPhy (m_phy);
588 
589  /*
590  * Create and configure manager.
591  */
593  m_factory.SetTypeId ("ns3::ConstantRateWifiManager");
594  m_factory.Set ("DataMode", StringValue ("HeMcs11"));
598 
599  /*
600  * Create and configure mac layer.
601  */
602  m_mac = CreateObjectWithAttributes<StaWifiMac> ("QosSupported", BooleanValue (true));
605  m_mac->SetAddress (Mac48Address ("00:00:00:00:00:01"));
608  Ptr<WifiProtectionManager> protectionManager = CreateObject<WifiDefaultProtectionManager> ();
609  protectionManager->SetWifiMac (m_mac);
610  fem->SetProtectionManager (protectionManager);
611  Ptr<WifiAckManager> ackManager = CreateObject<WifiDefaultAckManager> ();
612  ackManager->SetWifiMac (m_mac);
613  fem->SetAckManager (ackManager);
615  m_device->SetMac (m_mac);
616 
617  /*
618  * Configure aggregation.
619  */
620  HeCapabilities heCapabilities;
621  m_manager->AddStationHeCapabilities (Mac48Address ("00:00:00:00:00:02"), heCapabilities);
622 
623  /*
624  * Fill mac header fields.
625  */
626  WifiMacHeader hdr;
627  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
628  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
630  hdr.SetQosTid (0);
631  uint16_t sequence = m_mac->m_txMiddle->PeekNextSequenceNumberFor (&hdr);
632  hdr.SetSequenceNumber (sequence);
633  hdr.SetFragmentNumber (0);
634  hdr.SetNoMoreFragments ();
635  hdr.SetNoRetry ();
636 
637  /*
638  * Establish agreement.
639  */
640  MgtAddBaRequestHeader reqHdr;
641  reqHdr.SetImmediateBlockAck ();
642  reqHdr.SetTid (0);
643  reqHdr.SetBufferSize (bufferSize);
644  reqHdr.SetTimeout (0);
645  reqHdr.SetStartingSequence (0);
646  m_mac->GetBEQueue ()->GetBaManager ()->CreateAgreement (&reqHdr, hdr.GetAddr1 ());
647 
648  MgtAddBaResponseHeader respHdr;
649  StatusCode code;
650  code.SetSuccess ();
651  respHdr.SetStatusCode (code);
652  respHdr.SetAmsduSupport (reqHdr.IsAmsduSupported ());
653  respHdr.SetImmediateBlockAck ();
654  respHdr.SetTid (reqHdr.GetTid ());
655  respHdr.SetBufferSize (bufferSize - 1);
656  respHdr.SetTimeout (reqHdr.GetTimeout ());
657  m_mac->GetBEQueue ()->GetBaManager ()->UpdateAgreement (&respHdr, hdr.GetAddr1 (), 0);
658 
659  /*
660  * Test behavior when 300 packets are ready for transmission but negociated buffer size is 64
661  */
662  Ptr<HtFrameExchangeManager> htFem = DynamicCast<HtFrameExchangeManager> (fem);
663  Ptr<MpduAggregator> mpduAggregator = htFem->GetMpduAggregator ();
664 
665  for (uint16_t i = 0; i < 300; i++)
666  {
667  Ptr<const Packet> pkt = Create<Packet> (100);
668  WifiMacHeader hdr;
669 
670  hdr.SetAddr1 (Mac48Address ("00:00:00:00:00:02"));
671  hdr.SetAddr2 (Mac48Address ("00:00:00:00:00:01"));
673  hdr.SetQosTid (0);
674 
675  m_mac->GetBEQueue ()->GetWifiMacQueue ()->Enqueue (Create<WifiMacQueueItem> (pkt, hdr));
676  }
677 
679  WifiTxParameters txParams;
681  Ptr<WifiMacQueueItem> item = m_mac->GetBEQueue ()->GetNextMpdu (peeked, txParams, Time::Min (), true);
682 
683  auto mpduList = mpduAggregator->GetNextAmpdu (item, txParams, Time::Min ());
684  Ptr<WifiPsdu> psdu = Create<WifiPsdu> (mpduList);
685  htFem->DequeuePsdu (psdu);
686 
687  NS_TEST_EXPECT_MSG_EQ (mpduList.empty (), false, "MPDU aggregation failed");
688  NS_TEST_EXPECT_MSG_EQ (mpduList.size (), bufferSize, "A-MPDU should countain " << bufferSize << " MPDUs");
689  uint16_t expectedRemainingPacketsInQueue = 300 - bufferSize;
690  NS_TEST_EXPECT_MSG_EQ (m_mac->GetBEQueue ()->GetWifiMacQueue ()->GetNPackets (), expectedRemainingPacketsInQueue, "queue should contain 300 - "<< bufferSize << " = "<< expectedRemainingPacketsInQueue << " packets");
691 
692  Simulator::Destroy ();
693 
694  m_manager->Dispose ();
695  m_manager = 0;
696 
697  m_device->Dispose ();
698  m_device = 0;
699 
700  htConfiguration = 0;
701  vhtConfiguration = 0;
702  heConfiguration = 0;
703 }
704 
705 void
707 {
708  DoRunSubTest (64);
709  DoRunSubTest (256);
710 }
711 
732 {
733 public:
735  virtual ~PreservePacketsInAmpdus ();
736 
737  void DoRun (void) override;
738 
739 
740 private:
741  std::list<Ptr<const Packet>> m_packetList;
742  std::vector<std::size_t> m_nMpdus;
743  std::vector<std::size_t> m_nMsdus;
744 
749  void NotifyMacTransmit (Ptr<const Packet> packet);
756  void NotifyPsduForwardedDown (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW);
762 };
763 
765  : TestCase ("Test case to check that the Wifi Mac forwards up the same packets received at sender side.")
766 {
767 }
768 
770 {
771 }
772 
773 void
775 {
776  m_packetList.push_back (packet);
777 }
778 
779 void
781 {
782  NS_TEST_EXPECT_MSG_EQ ((psduMap.size () == 1 && psduMap.begin ()->first == SU_STA_ID),
783  true, "No DL MU PPDU expected");
784 
785  if (!psduMap[SU_STA_ID]->GetHeader (0).IsQosData ())
786  {
787  return;
788  }
789 
790  m_nMpdus.push_back (psduMap[SU_STA_ID]->GetNMpdus ());
791 
792  for (auto& mpdu : *PeekPointer (psduMap[SU_STA_ID]))
793  {
794  std::size_t dist = std::distance (mpdu->begin (), mpdu->end ());
795  // the list of aggregated MSDUs is empty if the MPDU includes a non-aggregated MSDU
796  m_nMsdus.push_back (dist > 0 ? dist : 1);
797  }
798 }
799 
800 void
802 {
803  auto it = std::find (m_packetList.begin (), m_packetList.end (), p);
804  NS_TEST_EXPECT_MSG_EQ ((it != m_packetList.end ()), true, "Packet being forwarded up not found");
805  m_packetList.erase (it);
806 }
807 
808 void
810 {
811  NodeContainer wifiStaNode;
812  wifiStaNode.Create (1);
813 
815  wifiApNode.Create (1);
816 
817  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
819  phy.SetChannel (channel.Create ());
820 
822  wifi.SetStandard (WIFI_STANDARD_80211n_5GHZ);
823  wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
824 
826  Ssid ssid = Ssid ("ns-3-ssid");
827  mac.SetType ("ns3::StaWifiMac",
828  "BE_MaxAmsduSize", UintegerValue (4500),
829  "BE_MaxAmpduSize", UintegerValue (7500),
830  "Ssid", SsidValue (ssid),
831  /* setting blockack threshold for sta's BE queue */
832  "BE_BlockAckThreshold", UintegerValue (2),
833  "ActiveProbing", BooleanValue (false));
834 
836  staDevices = wifi.Install (phy, mac, wifiStaNode);
837 
838  mac.SetType ("ns3::ApWifiMac",
839  "Ssid", SsidValue (ssid),
840  "BeaconGeneration", BooleanValue (true));
841 
843  apDevices = wifi.Install (phy, mac, wifiApNode);
844 
846  Ptr<ListPositionAllocator> positionAlloc = CreateObject<ListPositionAllocator> ();
847 
848  positionAlloc->Add (Vector (0.0, 0.0, 0.0));
849  positionAlloc->Add (Vector (1.0, 0.0, 0.0));
850  mobility.SetPositionAllocator (positionAlloc);
851 
852  mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel");
853  mobility.Install (wifiApNode);
854  mobility.Install (wifiStaNode);
855 
856  Ptr<WifiNetDevice> ap_device = DynamicCast<WifiNetDevice> (apDevices.Get (0));
857  Ptr<WifiNetDevice> sta_device = DynamicCast<WifiNetDevice> (staDevices.Get (0));
858 
859  PacketSocketAddress socket;
860  socket.SetSingleDevice (sta_device->GetIfIndex ());
861  socket.SetPhysicalAddress (ap_device->GetAddress ());
862  socket.SetProtocol (1);
863 
864  // install packet sockets on nodes.
865  PacketSocketHelper packetSocket;
866  packetSocket.Install (wifiStaNode);
867  packetSocket.Install (wifiApNode);
868 
869  Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
870  client->SetAttribute ("PacketSize", UintegerValue (1000));
871  client->SetAttribute ("MaxPackets", UintegerValue (8));
872  client->SetAttribute ("Interval", TimeValue (Seconds (1)));
873  client->SetRemote (socket);
874  wifiStaNode.Get (0)->AddApplication (client);
875  client->SetStartTime (Seconds (1));
876  client->SetStopTime (Seconds (3.0));
877  Simulator::Schedule (Seconds (1.5), &PacketSocketClient::SetAttribute, client,
878  "Interval", TimeValue (MicroSeconds (0)));
879 
880  Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
881  server->SetLocal (socket);
882  wifiApNode.Get (0)->AddApplication (server);
883  server->SetStartTime (Seconds (0.0));
884  server->SetStopTime (Seconds (4.0));
885 
886  sta_device->GetMac ()->TraceConnectWithoutContext ("MacTx",
888  sta_device->GetPhy ()->TraceConnectWithoutContext ("PhyTxPsduBegin",
890  ap_device->GetMac ()->TraceConnectWithoutContext ("MacRx",
892 
893  Simulator::Stop (Seconds (5));
894  Simulator::Run ();
895 
896  Simulator::Destroy ();
897 
898  // Two packets are transmitted. The first one is an MPDU containing a single MSDU.
899  // The second one is an A-MPDU containing two MPDUs: the first MPDU contains 4 MSDUs
900  // and the second MPDU contains 3 MSDUs
901  NS_TEST_EXPECT_MSG_EQ (m_nMpdus.size (), 2, "Unexpected number of transmitted packets");
902  NS_TEST_EXPECT_MSG_EQ (m_nMsdus.size (), 3, "Unexpected number of transmitted MPDUs");
903  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[0], 1, "Unexpected number of MPDUs in the first A-MPDU");
904  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[0], 1, "Unexpected number of MSDUs in the first MPDU");
905  NS_TEST_EXPECT_MSG_EQ (m_nMpdus[1], 2, "Unexpected number of MPDUs in the second A-MPDU");
906  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[1], 4, "Unexpected number of MSDUs in the second MPDU");
907  NS_TEST_EXPECT_MSG_EQ (m_nMsdus[2], 3, "Unexpected number of MSDUs in the third MPDU");
908  // All the packets must have been forwarded up at the receiver
909  NS_TEST_EXPECT_MSG_EQ (m_packetList.empty (), true, "Some packets have not been forwarded up");
910 }
911 
919 {
920 public:
922 };
923 
925  : TestSuite ("wifi-aggregation", UNIT)
926 {
927  AddTestCase (new AmpduAggregationTest, TestCase::QUICK);
928  AddTestCase (new TwoLevelAggregationTest, TestCase::QUICK);
929  AddTestCase (new HeAggregationTest, TestCase::QUICK);
930  AddTestCase (new PreservePacketsInAmpdus, TestCase::QUICK);
931 }
932 
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:168
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:556
ns3::YansWifiPhyHelper
Make it easy to create and manage PHY objects for the YANS model.
Definition: yans-wifi-helper.h:161
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:809
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:1339
PreservePacketsInAmpdus
Test for A-MSDU and A-MPDU aggregation.
Definition: wifi-aggregation-test.cc:732
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:557
ns3::WifiMacDropReason
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:55
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:558
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:323
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:742
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:339
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:933
TwoLevelAggregationTest::m_mac
Ptr< StaWifiMac > m_mac
Mac.
Definition: wifi-aggregation-test.cc:327
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:741
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::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:96
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:72
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:559
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:764
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:333
ns3::WIFI_PHY_STANDARD_80211ax
@ WIFI_PHY_STANDARD_80211ax
HE PHY (clause 26)
Definition: wifi-standards.h:49
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:326
ns3::WifiMac::SetDevice
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-mac.cc:85
PreservePacketsInAmpdus::~PreservePacketsInAmpdus
virtual ~PreservePacketsInAmpdus()
Definition: wifi-aggregation-test.cc:769
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:801
TwoLevelAggregationTest::m_factory
ObjectFactory m_factory
factory
Definition: wifi-aggregation-test.cc:330
ns3::RegularWifiMac::SetAddress
void SetAddress(Mac48Address address) override
Definition: regular-wifi-mac.cc:711
ns3::HtCapabilities
The HT Capabilities Information Element.
Definition: ht-capabilities.h:42
WifiAggregationTestSuite::WifiAggregationTestSuite
WifiAggregationTestSuite()
Definition: wifi-aggregation-test.cc:924
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:543
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:919
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::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:174
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:1279
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:447
TwoLevelAggregationTest
Two Level Aggregation Test.
Definition: wifi-aggregation-test.cc:320
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:514
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
test-ns3.result
result
Definition: test-ns3.py:576
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:1142
ns3::WifiTxParameters::m_txVector
WifiTxVector m_txVector
TXVECTOR of the frame being prepared.
Definition: wifi-tx-parameters.h:62
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:1070
HeAggregationTest::DoRunSubTest
void DoRunSubTest(uint16_t bufferSize)
Run test for a given buffer size.
Definition: wifi-aggregation-test.cc:568
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
ns3::QosTxop::GetNextMpdu
Ptr< WifiMacQueueItem > GetNextMpdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime, bool initialFrame)
Prepare the frame to transmit starting from the MPDU that has been previously peeked by calling PeekN...
Definition: qos-txop.cc:437
PreservePacketsInAmpdus::NotifyMacTransmit
void NotifyMacTransmit(Ptr< const Packet > packet)
Callback invoked when an MSDU is passed to the MAC.
Definition: wifi-aggregation-test.cc:774
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:309
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:706
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:181
ns3::QosTxop::PeekNextMpdu
Ptr< const WifiMacQueueItem > PeekNextMpdu(uint8_t tid=8, Mac48Address recipient=Mac48Address::GetBroadcast(), Ptr< const WifiMacQueueItem > item=nullptr)
Peek the next frame to transmit to the given receiver and of the given TID from the EDCA queue.
Definition: qos-txop.cc:357
HeAggregationTest::m_device
Ptr< WifiNetDevice > m_device
WifiNetDevice.
Definition: wifi-aggregation-test.cc:555
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:537
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:562
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:911
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
ns3::MsduAggregator::GetNextAmsdu
Ptr< WifiMacQueueItem > GetNextAmsdu(Ptr< const WifiMacQueueItem > peekedItem, WifiTxParameters &txParams, Time availableTime) const
Attempt to aggregate other MSDUs to the given A-MSDU while meeting the following constraints:
Definition: msdu-aggregator.cc:86
ns3::WifiPhy::SetDevice
void SetDevice(const Ptr< WifiNetDevice > device)
Sets the device this PHY is associated with.
Definition: wifi-phy.cc:778
PreservePacketsInAmpdus::m_nMsdus
std::vector< std::size_t > m_nMsdus
Number of MSDUs in MPDUs passed to the PHY.
Definition: wifi-aggregation-test.cc:743
ns3::MpduAggregator::GetNextAmpdu
std::vector< Ptr< WifiMacQueueItem > > GetNextAmpdu(Ptr< WifiMacQueueItem > mpdu, WifiTxParameters &txParams, Time availableTime) 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:531
TwoLevelAggregationTest::m_phy
Ptr< YansWifiPhy > m_phy
Phy.
Definition: wifi-aggregation-test.cc:328
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:329
ns3::FrameExchangeManager::NormalAckTimeout
void NormalAckTimeout(Ptr< WifiMacQueueItem > mpdu, const WifiTxVector &txVector)
Called when the Ack timeout expires.
Definition: frame-exchange-manager.cc:767
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:780
ns3::MgtAddBaResponseHeader::SetAmsduSupport
void SetAmsduSupport(bool supported)
Enable or disable A-MSDU support.
Definition: mgt-headers.cc:1744