A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-mac-ofdma-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#include "ns3/config.h"
10#include "ns3/he-configuration.h"
11#include "ns3/he-frame-exchange-manager.h"
12#include "ns3/he-phy.h"
13#include "ns3/mobility-helper.h"
14#include "ns3/multi-model-spectrum-channel.h"
15#include "ns3/multi-user-scheduler.h"
16#include "ns3/packet-socket-client.h"
17#include "ns3/packet-socket-helper.h"
18#include "ns3/packet-socket-server.h"
19#include "ns3/packet.h"
20#include "ns3/qos-utils.h"
21#include "ns3/rng-seed-manager.h"
22#include "ns3/spectrum-wifi-helper.h"
23#include "ns3/string.h"
24#include "ns3/test.h"
25#include "ns3/wifi-acknowledgment.h"
26#include "ns3/wifi-mac-header.h"
27#include "ns3/wifi-mac-queue.h"
28#include "ns3/wifi-net-device.h"
29#include "ns3/wifi-protection.h"
30#include "ns3/wifi-psdu.h"
31
32#include <iomanip>
33#include <utility>
34
35using namespace ns3;
36
37NS_LOG_COMPONENT_DEFINE("WifiMacOfdmaTestSuite");
38
39/**
40 * @ingroup wifi-test
41 * @ingroup tests
42 *
43 * @brief Dummy Multi User Scheduler used to test OFDMA ack sequences
44 *
45 * This Multi User Scheduler returns SU_TX until the simulation time reaches 1.5 seconds
46 * (when all BA agreements have been established). Afterwards, it cycles through UL_MU_TX
47 * (with a BSRP Trigger Frame), UL_MU_TX (with a Basic Trigger Frame) and DL_MU_TX.
48 * This scheduler requires that 4 stations are associated with the AP.
49 *
50 */
52{
53 public:
54 /**
55 * @brief Get the type ID.
56 * @return the object TypeId
57 */
58 static TypeId GetTypeId();
60 ~TestMultiUserScheduler() override;
61
62 private:
63 // Implementation of pure virtual methods of MultiUserScheduler class
64 TxFormat SelectTxFormat() override;
65 DlMuInfo ComputeDlMuInfo() override;
66 UlMuInfo ComputeUlMuInfo() override;
67
68 /**
69 * Compute the TX vector to use for MU PPDUs.
70 */
72
73 TxFormat m_txFormat; //!< the format of next transmission
74 TriggerFrameType m_ulTriggerType; //!< Trigger Frame type for UL MU
75 CtrlTriggerHeader m_trigger; //!< Trigger Frame to send
76 WifiMacHeader m_triggerHdr; //!< MAC header for Trigger Frame
77 WifiTxVector m_txVector; //!< the TX vector for MU PPDUs
78 WifiTxParameters m_txParams; //!< TX parameters
79 WifiPsduMap m_psduMap; //!< the DL MU PPDU to transmit
80 WifiModulationClass m_modClass; //!< modulation class for DL MU PPDUs and TB PPDUs
81};
82
84
87{
88 static TypeId tid =
89 TypeId("ns3::TestMultiUserScheduler")
91 .SetGroupName("Wifi")
92 .AddConstructor<TestMultiUserScheduler>()
93 .AddAttribute(
94 "ModulationClass",
95 "Modulation class for DL MU PPDUs and TB PPDUs.",
99 return tid;
100}
101
108
113
116{
117 NS_LOG_FUNCTION(this);
118
119 // Do not use OFDMA if a BA agreement has not been established with all the stations
120 if (Simulator::Now() < Seconds(1.5))
121 {
122 NS_LOG_DEBUG("Return SU_TX");
123 return SU_TX;
124 }
125
127
128 if (m_txFormat == SU_TX || m_txFormat == DL_MU_TX ||
130 {
131 // try to send a Trigger Frame
132 TriggerFrameType ulTriggerType =
135
136 WifiTxVector txVector = m_txVector;
139 m_trigger = CtrlTriggerHeader(ulTriggerType, txVector);
140
141 txVector.SetGuardInterval(m_trigger.GetGuardInterval());
142
143 uint32_t ampduSize = (ulTriggerType == TriggerFrameType::BSRP_TRIGGER)
145 : 3500; // allows aggregation of 2 MPDUs in TB PPDUs
146
147 auto staList = m_apMac->GetStaList(SINGLE_LINK_OP_ID);
148 // ignore non-HE stations
149 for (auto it = staList.begin(); it != staList.end();)
150 {
151 it = m_apMac->GetHeSupported(it->second) ? std::next(it) : staList.erase(it);
152 }
153
154 Time duration = WifiPhy::CalculateTxDuration(ampduSize,
155 txVector,
156 m_apMac->GetWifiPhy()->GetPhyBand(),
157 staList.begin()->first);
158
159 uint16_t length;
160 std::tie(length, duration) = HePhy::ConvertHeTbPpduDurationToLSigLength(
161 duration,
162 m_trigger.GetHeTbTxVector(m_trigger.begin()->GetAid12()),
163 m_apMac->GetWifiPhy()->GetPhyBand());
164 m_trigger.SetUlLength(length);
165
166 Ptr<Packet> packet = Create<Packet>();
167 packet->AddHeader(m_trigger);
168
171 m_triggerHdr.SetAddr2(m_apMac->GetAddress());
172 m_triggerHdr.SetDsNotTo();
173 m_triggerHdr.SetDsNotFrom();
174
175 auto item = Create<WifiMpdu>(packet, m_triggerHdr);
176
177 m_txParams.Clear();
178 // set the TXVECTOR used to send the Trigger Frame
179 m_txParams.m_txVector =
180 m_apMac->GetWifiRemoteStationManager()->GetRtsTxVector(m_triggerHdr.GetAddr1(),
182
183 if (!GetHeFem(SINGLE_LINK_OP_ID)->TryAddMpdu(item, m_txParams, m_availableTime) ||
184 (m_availableTime && *m_txParams.m_protection->protectionTime +
185 *m_txParams.m_txDuration // TF tx time
186 + m_apMac->GetWifiPhy()->GetSifs() + duration +
187 *m_txParams.m_acknowledgment->acknowledgmentTime >
189 {
190 NS_LOG_DEBUG("Remaining TXOP duration is not enough for BSRP TF exchange");
191 return SU_TX;
192 }
193
195 m_ulTriggerType = ulTriggerType;
196 }
197 else if (m_txFormat == UL_MU_TX)
198 {
199 // try to send a DL MU PPDU
200 m_psduMap.clear();
201 auto staList = m_apMac->GetStaList(SINGLE_LINK_OP_ID);
202 // ignore non-HE stations
203 for (auto it = staList.cbegin(); it != staList.cend();)
204 {
205 it = m_apMac->GetHeSupported(it->second) ? std::next(it) : staList.erase(it);
206 }
207 NS_ABORT_MSG_IF(staList.size() != 4, "There must be 4 associated stations");
208
209 /* Initialize TX params */
210 m_txParams.Clear();
211 m_txParams.m_txVector = m_txVector;
212
213 for (auto& sta : staList)
214 {
215 Ptr<WifiMpdu> peeked;
216 uint8_t tid;
217
218 for (tid = 0; tid < 8; tid++)
219 {
220 peeked = m_apMac->GetQosTxop(tid)->PeekNextMpdu(SINGLE_LINK_OP_ID, tid, sta.second);
221 if (peeked)
222 {
223 break;
224 }
225 }
226
227 if (!peeked)
228 {
229 NS_LOG_DEBUG("No frame to send to " << sta.second);
230 continue;
231 }
232
233 auto mpdu = m_apMac->GetQosTxop(tid)->GetNextMpdu(SINGLE_LINK_OP_ID,
234 peeked,
237 if (!mpdu)
238 {
239 NS_LOG_DEBUG("Not enough time to send frames to all the stations");
240 return SU_TX;
241 }
242
243 std::vector<Ptr<WifiMpdu>> mpduList;
244 mpduList = GetHeFem(SINGLE_LINK_OP_ID)
245 ->GetMpduAggregator()
246 ->GetNextAmpdu(mpdu, m_txParams, m_availableTime);
247
248 if (mpduList.size() > 1)
249 {
250 m_psduMap[sta.first] = Create<WifiPsdu>(std::move(mpduList));
251 }
252 else
253 {
254 m_psduMap[sta.first] = Create<WifiPsdu>(mpdu, true);
255 }
256 }
257
258 if (m_psduMap.empty())
259 {
260 NS_LOG_DEBUG("No frame to send");
261 return SU_TX;
262 }
263
265 }
266 else
267 {
268 NS_ABORT_MSG("Cannot get here.");
269 }
270
271 NS_LOG_DEBUG("Return " << m_txFormat);
272 return m_txFormat;
273}
274
275void
277{
278 if (m_txVector.IsDlMu())
279 {
280 // the TX vector has been already computed
281 return;
282 }
283
284 const auto bw = m_apMac->GetWifiPhy()->GetChannelWidth();
285
288 if (IsEht(m_txVector.GetPreambleType()))
289 {
290 m_txVector.SetEhtPpduType(0);
291 }
292 m_txVector.SetChannelWidth(bw);
293 m_txVector.SetGuardInterval(m_apMac->GetHeConfiguration()->GetGuardInterval());
294 m_txVector.SetTxPowerLevel(
295 GetWifiRemoteStationManager(SINGLE_LINK_OP_ID)->GetDefaultTxPowerLevel());
296
297 auto staList = m_apMac->GetStaList(SINGLE_LINK_OP_ID);
298 // ignore non-HE stations
299 for (auto it = staList.cbegin(); it != staList.cend();)
300 {
301 it = m_apMac->GetHeSupported(it->second) ? std::next(it) : staList.erase(it);
302 }
303 NS_ABORT_MSG_IF(staList.size() != 4, "There must be 4 associated stations");
304
305 RuType ruType;
306 switch (static_cast<uint16_t>(bw))
307 {
308 case 20: {
309 ruType = RuType::RU_52_TONE;
310 const uint16_t ruAllocPer20 = IsEht(m_txVector.GetPreambleType()) ? 24 : 112;
311 m_txVector.SetRuAllocation({ruAllocPer20}, 0);
312 break;
313 }
314 case 40: {
315 ruType = RuType::RU_106_TONE;
316 const uint16_t ruAllocPer20 = IsEht(m_txVector.GetPreambleType()) ? 48 : 96;
317 m_txVector.SetRuAllocation({ruAllocPer20, ruAllocPer20}, 0);
318 break;
319 }
320 case 80: {
321 ruType = RuType::RU_242_TONE;
322 const uint16_t ruAllocPer20 = IsEht(m_txVector.GetPreambleType()) ? 64 : 112;
323 m_txVector.SetRuAllocation({ruAllocPer20, ruAllocPer20, ruAllocPer20, ruAllocPer20}, 0);
324 break;
325 }
326 case 160: {
327 ruType = RuType::RU_484_TONE;
328 const uint16_t ruAllocPer20 = IsEht(m_txVector.GetPreambleType()) ? 72 : 200;
329 m_txVector.SetRuAllocation({ruAllocPer20,
330 ruAllocPer20,
331 ruAllocPer20,
332 ruAllocPer20,
333 ruAllocPer20,
334 ruAllocPer20,
335 ruAllocPer20,
336 ruAllocPer20},
337 0);
338 break;
339 }
340 case 320: {
341 ruType = RuType::RU_996_TONE;
342 NS_ASSERT(IsEht(m_txVector.GetPreambleType()));
343 m_txVector.SetRuAllocation({80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80},
344 0);
345 break;
346 }
347 default:
348 NS_ABORT_MSG("Unsupported channel width: " << bw);
349 }
350
351 auto primary80OrLow80{true};
352 auto primary160{true};
353 std::size_t ruIndex{1};
354 for (auto& sta : staList)
355 {
356 auto index{ruIndex};
357 if (bw > MHz_u{80})
358 {
359 if (!IsEht(m_txVector.GetPreambleType()))
360 {
361 index = HeRu::GetIndexIn80MHzSegment(bw, ruType, ruIndex);
362 primary80OrLow80 = HeRu::GetPrimary80MHzFlag(bw, ruType, ruIndex, 0);
363 }
364 else
365 {
366 index = EhtRu::GetIndexIn80MHzSegment(bw, ruType, ruIndex);
367 const auto& [p160, p80OrLow80] = EhtRu::GetPrimaryFlags(bw, ruType, ruIndex, 0);
368 primary160 = p160;
369 primary80OrLow80 = p80OrLow80;
370 }
371 }
372 const auto ru =
373 IsEht(m_txVector.GetPreambleType())
374 ? WifiRu::RuSpec(EhtRu::RuSpec{ruType, index, primary160, primary80OrLow80})
375 : WifiRu::RuSpec(HeRu::RuSpec{ruType, index, primary80OrLow80});
376 m_txVector.SetHeMuUserInfo(sta.first, {ru, 11, 1});
377 ruIndex++;
378 }
379 m_txVector.SetSigBMode(VhtPhy::GetVhtMcs5());
380}
381
388
395
396/**
397 * @ingroup wifi-test
398 * The scenarios
399 */
400enum class WifiOfdmaScenario : uint8_t
401{
402 HE = 0, // HE AP and HE non-AP STAs
403 HE_EHT, // EHT AP, some EHT non-AP STAs and some non-EHT HE non-AP STAs
404 EHT // EHT AP and EHT non-AP STAs
405};
406
407/**
408 * @ingroup wifi-test
409 * @ingroup tests
410 *
411 * @brief Test OFDMA acknowledgment sequences
412 *
413 * Run this test with:
414 *
415 * NS_LOG="WifiMacOfdmaTestSuite=info|prefix_time|prefix_node" ./ns3 run "test-runner
416 * --suite=wifi-mac-ofdma"
417 *
418 * to print the list of transmitted frames only, along with the TX time and the
419 * node prefix. Replace 'info' with 'debug' if you want to print the debug messages
420 * from the test multi-user scheduler only. Replace 'info' with 'level_debug' if
421 * you want to print both the transmitted frames and the debug messages.
422 */
424{
425 public:
426 /**
427 * MU EDCA Parameter Set
428 */
430 {
431 uint8_t muAifsn; //!< MU AIFS (0 to disable EDCA)
432 uint16_t muCwMin; //!< MU CW min
433 uint16_t muCwMax; //!< MU CW max
434 uint8_t muTimer; //!< MU EDCA Timer in units of 8192 microseconds (0 not to use MU EDCA)
435 };
436
437 /**
438 * Parameters for the OFDMA acknowledgment sequences test
439 */
440 struct Params
441 {
442 MHz_u channelWidth; ///< PHY channel bandwidth
443 WifiAcknowledgment::Method dlMuAckType; ///< DL MU ack sequence type
444 uint32_t maxAmpduSize; ///< maximum A-MPDU size in bytes
445 uint16_t txopLimit; ///< TXOP limit in microseconds
446 bool continueTxopAfterBsrp; ///< whether to continue TXOP after BSRP TF when TXOP limit is 0
447 bool skipMuRtsBeforeBsrp; ///< whether to skip MU-RTS before BSRP TF
448 bool protectedIfResponded; ///< A STA is considered protected if responded to previous frame
449 uint16_t nPktsPerSta; ///< number of packets to send to each station
450 MuEdcaParameterSet muEdcaParameterSet; ///< MU EDCA Parameter Set
451 WifiOfdmaScenario scenario; ///< OFDMA scenario to test
452 };
453
454 /**
455 * Constructor
456 *
457 * @param params parameters for the OFDMA acknowledgment sequences test
458 */
459 OfdmaAckSequenceTest(const Params& params);
460 ~OfdmaAckSequenceTest() override;
461
462 /**
463 * Function to trace packets received by the server application
464 * @param context the context
465 * @param p the packet
466 * @param addr the address
467 */
468 void L7Receive(std::string context, Ptr<const Packet> p, const Address& addr);
469 /**
470 * Function to trace CW value used by the given station after the MU exchange
471 * @param staIndex the index of the given station
472 * @param cw the current Contention Window value
473 */
474 void TraceCw(uint32_t staIndex, uint32_t cw, uint8_t /* linkId */);
475 /**
476 * Callback invoked when FrameExchangeManager passes PSDUs to the PHY
477 * @param context the context
478 * @param psduMap the PSDU map
479 * @param txVector the TX vector
480 * @param txPowerW the tx power in Watts
481 */
482 void Transmit(std::string context,
483 WifiConstPsduMap psduMap,
484 WifiTxVector txVector,
485 double txPowerW);
486 /**
487 * Check correctness of transmitted frames
488 * @param sifs the SIFS duration
489 * @param slotTime a slot duration
490 * @param aifsn the AIFSN
491 */
492 void CheckResults(Time sifs, Time slotTime, uint8_t aifsn);
493
494 private:
495 void DoRun() override;
496
497 static constexpr uint16_t m_muTimerRes = 8192; ///< MU timer resolution in usec
498
499 /// Information about transmitted frames
501 {
502 Time startTx; ///< start TX time
503 Time endTx; ///< end TX time
504 WifiConstPsduMap psduMap; ///< transmitted PSDU map
505 WifiTxVector txVector; ///< TXVECTOR
506 };
507
508 uint16_t m_nStations; ///< number of stations
509 NetDeviceContainer m_staDevices; ///< stations' devices
511 std::vector<PacketSocketAddress> m_sockets; ///< packet socket addresses for STAs
512 MHz_u m_channelWidth; ///< PHY channel bandwidth
513 uint8_t m_muRtsRuAllocation; ///< B7-B1 of RU Allocation subfield of MU-RTS
514 std::vector<FrameInfo> m_txPsdus; ///< transmitted PSDUs
515 WifiAcknowledgment::Method m_dlMuAckType; ///< DL MU ack sequence type
516 uint32_t m_maxAmpduSize; ///< maximum A-MPDU size in bytes
517 uint16_t m_txopLimit; ///< TXOP limit in microseconds
518 bool
519 m_continueTxopAfterBsrp; ///< whether to continue TXOP after BSRP TF when TXOP limit is zero
520 bool m_skipMuRtsBeforeBsrp; ///< whether to skip MU-RTS before BSRP TF
521 bool m_protectedIfResponded; ///< A STA is considered protected if responded to previous frame
522 uint16_t m_nPktsPerSta; ///< number of packets to send to each station
523 MuEdcaParameterSet m_muEdcaParameterSet; ///< MU EDCA Parameter Set
524 WifiOfdmaScenario m_scenario; ///< OFDMA scenario to test
525 WifiPreamble m_dlMuPreamble; ///< expected preamble type for DL MU PPDUs
526 WifiPreamble m_tbPreamble; ///< expected preamble type for TB PPDUs
527 bool m_ulPktsGenerated; ///< whether UL packets for HE TB PPDUs have been generated
528 uint16_t m_received; ///< number of packets received by the stations
529 uint16_t m_flushed; ///< number of DL packets flushed after DL MU PPDU
530 Time m_edcaDisabledStartTime; ///< time when disabling EDCA started
531 std::vector<uint32_t> m_cwValues; ///< CW used by stations after MU exchange
532 const Time m_defaultTbPpduDuration; ///< default TB PPDU duration
533};
534
536 : TestCase("Check correct operation of DL OFDMA acknowledgment sequences"),
537 m_nStations(4),
539 m_channelWidth(params.channelWidth),
540 m_dlMuAckType(params.dlMuAckType),
541 m_maxAmpduSize(params.maxAmpduSize),
542 m_txopLimit(params.txopLimit),
543 m_continueTxopAfterBsrp(params.continueTxopAfterBsrp),
544 m_skipMuRtsBeforeBsrp(params.skipMuRtsBeforeBsrp),
545 m_protectedIfResponded(params.protectedIfResponded),
546 m_nPktsPerSta(params.nPktsPerSta),
547 m_muEdcaParameterSet(params.muEdcaParameterSet),
548 m_scenario(params.scenario),
549 m_ulPktsGenerated(false),
550 m_received(0),
551 m_flushed(0),
553 m_cwValues(std::vector<uint32_t>(m_nStations, 2)), // 2 is an invalid CW value
555{
556 switch (m_scenario)
557 {
562 break;
566 break;
567 }
568
569 switch (static_cast<uint16_t>(m_channelWidth))
570 {
571 case 20:
572 m_muRtsRuAllocation = 61; // p20 index is 0
573 break;
574 case 40:
575 m_muRtsRuAllocation = 65; // p20 index is 0
576 break;
577 case 80:
579 break;
580 case 160:
582 break;
583 case 320:
585 break;
586 default:
587 NS_ABORT_MSG("Unhandled channel width (" << m_channelWidth << " MHz)");
588 }
589
590 m_txPsdus.reserve(35);
591}
592
596
597void
599{
600 if (p->GetSize() >= 1400 && Simulator::Now() > Seconds(1.5))
601 {
602 m_received++;
603 }
604}
605
606void
607OfdmaAckSequenceTest::TraceCw(uint32_t staIndex, uint32_t cw, uint8_t /* linkId */)
608{
609 if (m_cwValues.at(staIndex) == 2)
610 {
611 // store the first CW used after MU exchange (the last one may be used after
612 // the MU EDCA timer expired)
613 m_cwValues[staIndex] = cw;
614 }
615}
616
617void
619 WifiConstPsduMap psduMap,
620 WifiTxVector txVector,
621 double txPowerW)
622{
623 // skip beacon frames and frames transmitted before 1.5s (association
624 // request/response, ADDBA request, ...)
625 if (!psduMap.begin()->second->GetHeader(0).IsBeacon() && Simulator::Now() >= Seconds(1.5))
626 {
628 psduMap,
629 txVector,
631 m_txPsdus.push_back({Simulator::Now(), Simulator::Now() + txDuration, psduMap, txVector});
632
633 for (const auto& [staId, psdu] : psduMap)
634 {
635 NS_LOG_INFO("Sending "
636 << psdu->GetHeader(0).GetTypeString() << " #MPDUs " << psdu->GetNMpdus()
637 << (psdu->GetHeader(0).IsQosData()
638 ? " TID " + std::to_string(*psdu->GetTids().begin())
639 : "")
640 << std::setprecision(10) << " txDuration " << txDuration << " duration/ID "
641 << psdu->GetHeader(0).GetDuration() << " #TX PSDUs = " << m_txPsdus.size()
642 << " size=" << (*psdu->begin())->GetSize() << "\n"
643 << "TXVECTOR: " << txVector << "\n");
644 }
645 }
646
647 // Flush the MAC queue of the AP after sending a DL MU PPDU (no need for
648 // further transmissions)
649 if (txVector.GetPreambleType() == m_dlMuPreamble)
650 {
651 m_flushed = 0;
652 for (uint32_t i = 0; i < m_staDevices.GetN(); i++)
653 {
654 auto queue =
655 m_apDevice->GetMac()->GetQosTxop(static_cast<AcIndex>(i))->GetWifiMacQueue();
656 auto staDev = DynamicCast<WifiNetDevice>(m_staDevices.Get(i));
657 Ptr<const WifiMpdu> lastInFlight = nullptr;
659
660 while ((mpdu = queue->PeekByTidAndAddress(i * 2,
661 staDev->GetMac()->GetAddress(),
662 std::nullopt,
663 lastInFlight)) != nullptr)
664 {
665 if (mpdu->IsInFlight())
666 {
667 lastInFlight = mpdu;
668 }
669 else
670 {
671 queue->Remove(mpdu);
672 m_flushed++;
673 }
674 }
675 }
676 }
677 else if (txVector.GetPreambleType() == m_tbPreamble &&
678 psduMap.begin()->second->GetHeader(0).HasData())
679 {
680 Mac48Address sender = psduMap.begin()->second->GetAddr2();
681
682 for (uint32_t i = 0; i < m_staDevices.GetN(); i++)
683 {
684 auto dev = DynamicCast<WifiNetDevice>(m_staDevices.Get(i));
685
686 if (dev->GetAddress() == sender)
687 {
688 Ptr<QosTxop> qosTxop = dev->GetMac()->GetQosTxop(static_cast<AcIndex>(i));
689
690 if (m_muEdcaParameterSet.muTimer > 0 && m_muEdcaParameterSet.muAifsn > 0)
691 {
692 // stations use worse access parameters, trace CW. MU AIFSN must be large
693 // enough to avoid collisions between stations trying to transmit using EDCA
694 // right after the UL MU transmission and the AP trying to send a DL MU PPDU
695 qosTxop->TraceConnectWithoutContext(
696 "CwTrace",
698 }
699 else
700 {
701 // there is no "protection" against collisions from stations, hence flush
702 // their MAC queues after sending an HE TB PPDU containing QoS data frames,
703 // so that the AP can send a DL MU PPDU
704 qosTxop->GetWifiMacQueue()->Flush();
705 }
706 break;
707 }
708 }
709 }
710 else if (!txVector.IsMu() && psduMap.begin()->second->GetHeader(0).IsBlockAck() &&
711 psduMap.begin()->second->GetHeader(0).GetAddr2() == m_apDevice->GetAddress() &&
712 m_muEdcaParameterSet.muTimer > 0 && m_muEdcaParameterSet.muAifsn == 0)
713 {
714 CtrlBAckResponseHeader blockAck;
715 psduMap.begin()->second->GetPayload(0)->PeekHeader(blockAck);
716
717 if (blockAck.IsMultiSta())
718 {
719 // AP is transmitting a multi-STA BlockAck and stations have to disable EDCA,
720 // record the starting time
722 Simulator::Now() + m_txPsdus.back().endTx - m_txPsdus.back().startTx;
723 }
724 }
725 else if (!txVector.IsMu() && psduMap.begin()->second->GetHeader(0).IsTrigger() &&
727 {
728 CtrlTriggerHeader trigger;
729 psduMap.begin()->second->GetPayload(0)->PeekHeader(trigger);
730 if (trigger.IsBasic())
731 {
732 // the AP is starting the transmission of the Basic Trigger frame, so generate
733 // the configured number of packets at STAs, which are sent in HE TB PPDUs
735 psduMap,
736 txVector,
738 for (uint16_t i = 0; i < m_nStations; i++)
739 {
741 client->SetAttribute("PacketSize", UintegerValue(1400 + i * 100));
742 client->SetAttribute("MaxPackets", UintegerValue(m_nPktsPerSta));
743 client->SetAttribute("Interval", TimeValue(MicroSeconds(0)));
744 client->SetAttribute("Priority", UintegerValue(i * 2)); // 0, 2, 4 and 6
745 client->SetRemote(m_sockets[i]);
746 m_staDevices.Get(i)->GetNode()->AddApplication(client);
747 client->SetStartTime(txDuration); // start when TX ends
748 client->SetStopTime(Seconds(1)); // stop in a second
749 client->Initialize();
750 }
751 m_ulPktsGenerated = true;
752 }
753 }
754}
755
756void
757OfdmaAckSequenceTest::CheckResults(Time sifs, Time slotTime, uint8_t aifsn)
758{
759 CtrlTriggerHeader trigger;
760 CtrlBAckResponseHeader blockAck;
761 Time tEnd; // TX end for a frame
762 Time tStart; // TX start for the next frame
763 Time tolerance = NanoSeconds(500); // due to propagation delay
764 Time ifs = (m_txopLimit > 0 ? sifs : sifs + aifsn * slotTime);
765 Time navEnd;
766
767 /*
768 * |-------------NAV----------->| |-----------------NAV------------------->|
769 * |---------NAV------>| |--------------NAV------------->|
770 * |---NAV-->| |--------NAV-------->|
771 * ┌───┐ ┌───┐ ┌────┐ ┌────┐ ┌───┐ ┌───┐ ┌─────┐ ┌────┐ ┌─────┐
772 * │ │ │ │ │ │ │QoS │ │ │ │ │ │ │ │QoS │ │ │
773 * │ │ │ │ │ │ │Null│ │ │ │ │ │ │ │Data│ │ │
774 * │ │ │ │ │ │ ├────┤ │ │ │ │ │ │ ├────┤ │ │
775 * │ │ │ │ │ │ │QoS │ │ │ │ │ │ │ │QoS │ │Multi│
776 * │MU-│ │CTS│ │BSRP│ │Null│ │MU-│ │CTS│ │Basic│ │Data│ │-STA │
777 * │RTS│SIFS│ │SIFS│ TF │SIFS├────┤<IFS>│RTS│SIFS│ │SIFS│ TF │SIFS├────┤SIFS│Block│
778 * │TF │ │x4 │ │ │ │QoS │ │TF │ │x4 │ │ │ │QoS │ │ Ack │
779 * │ │ │ │ │ │ │Null│ │ │ │ │ │ │ │Data│ │ │
780 * │ │ │ │ │ │ ├────┤ │ │ │ │ │ │ ├────┤ │ │
781 * │ │ │ │ │ │ │QoS │ │ │ │ │ │ │ │QoS │ │ │
782 * │ │ │ │ │ │ │Null│ │ │ │ │ │ │ │Data│ │ │
783 * ───┴───┴────┴───┴────┴────┴────┴────┴─────┴───┴────┴───┴────┴─────┴────┴────┴────┴─────┴──
784 * From: AP all AP all AP all AP all AP
785 * To: all AP all AP all AP all AP all
786 *
787 * NOTE 1:The first MU-RTS is not transmitted if SkipMuRtsBeforeBsrp is true
788 * NOTE 2: The second MU-RTS is transmitted if the Trigger Frames are transmitted in separate
789 * TXOPs, or it is a single TXOP and an MU-RTS has not been sent earlier (to protect
790 * the BSRP TF) and STAs are not considered protected if they responded
791 */
792
793 tEnd = m_txPsdus[0].endTx;
794 navEnd = tEnd + m_txPsdus[0].psduMap[SU_STA_ID]->GetDuration();
795 Time ctsNavEnd{0};
796
798 {
799 // the first packet sent after 1.5s is an MU-RTS Trigger Frame
800 NS_TEST_ASSERT_MSG_GT_OR_EQ(m_txPsdus.size(), 5, "Expected at least 5 transmitted packet");
802 (m_txPsdus[0].psduMap.size() == 1 &&
803 m_txPsdus[0].psduMap[SU_STA_ID]->GetHeader(0).IsTrigger() &&
804 m_txPsdus[0].psduMap[SU_STA_ID]->GetHeader(0).GetAddr1().IsBroadcast()),
805 true,
806 "Expected a Trigger Frame");
807 m_txPsdus[0].psduMap[SU_STA_ID]->GetPayload(0)->PeekHeader(trigger);
808 NS_TEST_EXPECT_MSG_EQ(trigger.IsMuRts(), true, "Expected an MU-RTS Trigger Frame");
810 4,
811 "Expected one User Info field per station");
812 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[0].txVector.GetChannelWidth(),
814 "Expected the MU-RTS to occupy the entire channel width");
815 for (const auto& userInfo : trigger)
816 {
817 NS_TEST_EXPECT_MSG_EQ(+userInfo.GetMuRtsRuAllocation(),
819 "Unexpected RU Allocation value in MU-RTS");
820 }
821
822 // A first STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
824 (m_txPsdus[1].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
825 m_txPsdus[1].psduMap.size() == 1 &&
826 m_txPsdus[1].psduMap.begin()->second->GetNMpdus() == 1 &&
827 m_txPsdus[1].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
828 true,
829 "Expected a CTS frame");
830 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[1].txVector.GetChannelWidth(),
832 "Expected the CTS to occupy the entire channel width");
833
834 tStart = m_txPsdus[1].startTx;
835 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
836 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
837 ctsNavEnd = m_txPsdus[1].endTx + m_txPsdus[1].psduMap[SU_STA_ID]->GetDuration();
838 // navEnd <= ctsNavEnd < navEnd + tolerance
839 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
840 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
841 navEnd + tolerance,
842 "Duration/ID in CTS frame is too long");
843
844 // A second STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
846 (m_txPsdus[2].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
847 m_txPsdus[2].psduMap.size() == 1 &&
848 m_txPsdus[2].psduMap.begin()->second->GetNMpdus() == 1 &&
849 m_txPsdus[2].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
850 true,
851 "Expected a CTS frame");
852 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[2].txVector.GetChannelWidth(),
854 "Expected the CTS to occupy the entire channel width");
855
856 tStart = m_txPsdus[2].startTx;
857 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
858 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
859 ctsNavEnd = m_txPsdus[2].endTx + m_txPsdus[2].psduMap[SU_STA_ID]->GetDuration();
860 // navEnd <= ctsNavEnd < navEnd + tolerance
861 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
862 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
863 navEnd + tolerance,
864 "Duration/ID in CTS frame is too long");
865
866 // A third STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
868 (m_txPsdus[3].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
869 m_txPsdus[3].psduMap.size() == 1 &&
870 m_txPsdus[3].psduMap.begin()->second->GetNMpdus() == 1 &&
871 m_txPsdus[3].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
872 true,
873 "Expected a CTS frame");
874 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[3].txVector.GetChannelWidth(),
876 "Expected the CTS to occupy the entire channel width");
877
878 tStart = m_txPsdus[3].startTx;
879 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
880 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
881 ctsNavEnd = m_txPsdus[3].endTx + m_txPsdus[3].psduMap[SU_STA_ID]->GetDuration();
882 // navEnd <= ctsNavEnd < navEnd + tolerance
883 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
884 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
885 navEnd + tolerance,
886 "Duration/ID in CTS frame is too long");
887
888 // A fourth STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
890 (m_txPsdus[4].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
891 m_txPsdus[4].psduMap.size() == 1 &&
892 m_txPsdus[4].psduMap.begin()->second->GetNMpdus() == 1 &&
893 m_txPsdus[4].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
894 true,
895 "Expected a CTS frame");
896 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[4].txVector.GetChannelWidth(),
898 "Expected the CTS to occupy the entire channel width");
899
900 tStart = m_txPsdus[4].startTx;
901 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
902 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
903 ctsNavEnd = m_txPsdus[4].endTx + m_txPsdus[4].psduMap[SU_STA_ID]->GetDuration();
904 // navEnd <= ctsNavEnd < navEnd + tolerance
905 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
906 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
907 navEnd + tolerance,
908 "Duration/ID in CTS frame is too long");
909 }
910 else
911 {
912 // insert 5 elements in m_txPsdus to align the index of the following frames in the
913 // two cases (m_skipMuRtsBeforeBsrp true and false)
914 m_txPsdus.insert(m_txPsdus.begin(), 5, {});
915 }
916
917 // the AP sends a BSRP Trigger Frame
918 NS_TEST_ASSERT_MSG_GT_OR_EQ(m_txPsdus.size(), 10, "Expected at least 10 transmitted packet");
919 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[5].psduMap.size() == 1 &&
920 m_txPsdus[5].psduMap[SU_STA_ID]->GetHeader(0).IsTrigger() &&
921 m_txPsdus[5].psduMap[SU_STA_ID]->GetHeader(0).GetAddr1().IsBroadcast()),
922 true,
923 "Expected a Trigger Frame");
924 m_txPsdus[5].psduMap[SU_STA_ID]->GetPayload(0)->PeekHeader(trigger);
925 NS_TEST_EXPECT_MSG_EQ(trigger.IsBsrp(), true, "Expected a BSRP Trigger Frame");
927 4,
928 "Expected one User Info field per station");
930 {
931 tEnd = m_txPsdus[4].endTx;
932 tStart = m_txPsdus[5].startTx;
933 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "BSRP Trigger Frame sent too early");
934 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "BSRP Trigger Frame sent too late");
935 }
936 Time bsrpNavEnd = m_txPsdus[5].endTx + m_txPsdus[5].psduMap[SU_STA_ID]->GetDuration();
938 {
939 // BSRP TF extends the NAV beyond the responses
940 navEnd += m_defaultTbPpduDuration;
941 }
942 // navEnd <= bsrpNavEnd < navEnd + tolerance
943 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, bsrpNavEnd, "Duration/ID in BSRP TF is too short");
944 NS_TEST_EXPECT_MSG_LT(bsrpNavEnd, navEnd + tolerance, "Duration/ID in BSRP TF is too long");
945
946 // A first STA sends a QoS Null frame in a TB PPDU a SIFS after the reception of the BSRP TF
947 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[6].txVector.GetPreambleType() == m_tbPreamble &&
948 m_txPsdus[6].psduMap.size() == 1 &&
949 m_txPsdus[6].psduMap.begin()->second->GetNMpdus() == 1),
950 true,
951 "Expected a QoS Null frame in a TB PPDU");
952 {
953 const WifiMacHeader& hdr = m_txPsdus[6].psduMap.begin()->second->GetHeader(0);
954 NS_TEST_EXPECT_MSG_EQ(hdr.GetType(), WIFI_MAC_QOSDATA_NULL, "Expected a QoS Null frame");
955 uint16_t staId;
956 for (staId = 0; staId < m_nStations; staId++)
957 {
958 if (DynamicCast<WifiNetDevice>(m_staDevices.Get(staId))->GetAddress() == hdr.GetAddr2())
959 {
960 break;
961 }
962 }
963 NS_TEST_EXPECT_MSG_NE(+staId, m_nStations, "Sender not found among stations");
964 uint8_t tid = staId * 2;
965 NS_TEST_EXPECT_MSG_EQ(+hdr.GetQosTid(), +tid, "Expected a TID equal to " << +tid);
966 }
967 tEnd = m_txPsdus[5].endTx;
968 tStart = m_txPsdus[6].startTx;
969 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS Null frame in HE TB PPDU sent too early");
971 tEnd + sifs + tolerance,
972 "QoS Null frame in HE TB PPDU sent too late");
973 Time qosNullNavEnd = m_txPsdus[6].endTx + m_txPsdus[6].psduMap.begin()->second->GetDuration();
974 if (m_txopLimit == 0)
975 {
976 NS_TEST_EXPECT_MSG_EQ(qosNullNavEnd,
977 m_txPsdus[6].endTx +
979 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
980 }
981 // navEnd <= qosNullNavEnd < navEnd + tolerance
982 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosNullNavEnd, "Duration/ID in QoS Null is too short");
983 NS_TEST_EXPECT_MSG_LT(qosNullNavEnd, navEnd + tolerance, "Duration/ID in QoS Null is too long");
984
985 // A second STA sends a QoS Null frame in a TB PPDU a SIFS after the reception of the BSRP TF
986 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[7].txVector.GetPreambleType() == m_tbPreamble &&
987 m_txPsdus[7].psduMap.size() == 1 &&
988 m_txPsdus[7].psduMap.begin()->second->GetNMpdus() == 1),
989 true,
990 "Expected a QoS Null frame in a TB PPDU");
991 {
992 const WifiMacHeader& hdr = m_txPsdus[7].psduMap.begin()->second->GetHeader(0);
993 NS_TEST_EXPECT_MSG_EQ(hdr.GetType(), WIFI_MAC_QOSDATA_NULL, "Expected a QoS Null frame");
994 uint16_t staId;
995 for (staId = 0; staId < m_nStations; staId++)
996 {
997 if (DynamicCast<WifiNetDevice>(m_staDevices.Get(staId))->GetAddress() == hdr.GetAddr2())
998 {
999 break;
1000 }
1001 }
1002 NS_TEST_EXPECT_MSG_NE(+staId, m_nStations, "Sender not found among stations");
1003 uint8_t tid = staId * 2;
1004 NS_TEST_EXPECT_MSG_EQ(+hdr.GetQosTid(), +tid, "Expected a TID equal to " << +tid);
1005 }
1006 tStart = m_txPsdus[7].startTx;
1007 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS Null frame in HE TB PPDU sent too early");
1008 NS_TEST_EXPECT_MSG_LT(tStart,
1009 tEnd + sifs + tolerance,
1010 "QoS Null frame in HE TB PPDU sent too late");
1011 qosNullNavEnd = m_txPsdus[7].endTx + m_txPsdus[7].psduMap.begin()->second->GetDuration();
1012 if (m_txopLimit == 0)
1013 {
1014 NS_TEST_EXPECT_MSG_EQ(qosNullNavEnd,
1015 m_txPsdus[7].endTx +
1017 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
1018 }
1019 // navEnd <= qosNullNavEnd < navEnd + tolerance
1020 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosNullNavEnd, "Duration/ID in QoS Null is too short");
1021 NS_TEST_EXPECT_MSG_LT(qosNullNavEnd, navEnd + tolerance, "Duration/ID in QoS Null is too long");
1022
1023 // A third STA sends a QoS Null frame in a TB PPDU a SIFS after the reception of the BSRP TF
1024 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[8].txVector.GetPreambleType() == m_tbPreamble &&
1025 m_txPsdus[8].psduMap.size() == 1 &&
1026 m_txPsdus[8].psduMap.begin()->second->GetNMpdus() == 1),
1027 true,
1028 "Expected a QoS Null frame in an HE TB PPDU");
1029 {
1030 const WifiMacHeader& hdr = m_txPsdus[8].psduMap.begin()->second->GetHeader(0);
1031 NS_TEST_EXPECT_MSG_EQ(hdr.GetType(), WIFI_MAC_QOSDATA_NULL, "Expected a QoS Null frame");
1032 uint16_t staId;
1033 for (staId = 0; staId < m_nStations; staId++)
1034 {
1035 if (DynamicCast<WifiNetDevice>(m_staDevices.Get(staId))->GetAddress() == hdr.GetAddr2())
1036 {
1037 break;
1038 }
1039 }
1040 NS_TEST_EXPECT_MSG_NE(+staId, m_nStations, "Sender not found among stations");
1041 uint8_t tid = staId * 2;
1042 NS_TEST_EXPECT_MSG_EQ(+hdr.GetQosTid(), +tid, "Expected a TID equal to " << +tid);
1043 }
1044 tStart = m_txPsdus[8].startTx;
1045 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS Null frame in HE TB PPDU sent too early");
1046 NS_TEST_EXPECT_MSG_LT(tStart,
1047 tEnd + sifs + tolerance,
1048 "QoS Null frame in HE TB PPDU sent too late");
1049 qosNullNavEnd = m_txPsdus[8].endTx + m_txPsdus[8].psduMap.begin()->second->GetDuration();
1050 if (m_txopLimit == 0)
1051 {
1052 NS_TEST_EXPECT_MSG_EQ(qosNullNavEnd,
1053 m_txPsdus[8].endTx +
1055 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
1056 }
1057 // navEnd <= qosNullNavEnd < navEnd + tolerance
1058 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosNullNavEnd, "Duration/ID in QoS Null is too short");
1059 NS_TEST_EXPECT_MSG_LT(qosNullNavEnd, navEnd + tolerance, "Duration/ID in QoS Null is too long");
1060
1061 // A fourth STA sends a QoS Null frame in a TB PPDU a SIFS after the reception of the BSRP TF
1062 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[9].txVector.GetPreambleType() == m_tbPreamble &&
1063 m_txPsdus[9].psduMap.size() == 1 &&
1064 m_txPsdus[9].psduMap.begin()->second->GetNMpdus() == 1),
1065 true,
1066 "Expected a QoS Null frame in an HE TB PPDU");
1067 {
1068 const WifiMacHeader& hdr = m_txPsdus[9].psduMap.begin()->second->GetHeader(0);
1069 NS_TEST_EXPECT_MSG_EQ(hdr.GetType(), WIFI_MAC_QOSDATA_NULL, "Expected a QoS Null frame");
1070 uint16_t staId;
1071 for (staId = 0; staId < m_nStations; staId++)
1072 {
1073 if (DynamicCast<WifiNetDevice>(m_staDevices.Get(staId))->GetAddress() == hdr.GetAddr2())
1074 {
1075 break;
1076 }
1077 }
1078 NS_TEST_EXPECT_MSG_NE(+staId, m_nStations, "Sender not found among stations");
1079 uint8_t tid = staId * 2;
1080 NS_TEST_EXPECT_MSG_EQ(+hdr.GetQosTid(), +tid, "Expected a TID equal to " << +tid);
1081 }
1082 tStart = m_txPsdus[9].startTx;
1083 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS Null frame in HE TB PPDU sent too early");
1084 NS_TEST_EXPECT_MSG_LT(tStart,
1085 tEnd + sifs + tolerance,
1086 "QoS Null frame in HE TB PPDU sent too late");
1087 qosNullNavEnd = m_txPsdus[9].endTx + m_txPsdus[9].psduMap.begin()->second->GetDuration();
1088 if (m_txopLimit == 0)
1089 {
1090 NS_TEST_EXPECT_MSG_EQ(qosNullNavEnd,
1091 m_txPsdus[9].endTx +
1093 "Expected null Duration/ID for QoS Null frame in HE TB PPDU");
1094 }
1095 // navEnd <= qosNullNavEnd < navEnd + tolerance
1096 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosNullNavEnd, "Duration/ID in QoS Null is too short");
1097 NS_TEST_EXPECT_MSG_LT(qosNullNavEnd, navEnd + tolerance, "Duration/ID in QoS Null is too long");
1098
1099 // if the Basic TF is sent in a separate TXOP than the BSRP TF, MU-RTS protection is used for
1100 // the Basic TF. Otherwise, MU-RTS is sent if an MU-RTS has not been sent earlier (to protect
1101 // the BSRP TF) and STAs are not considered protected if they responded
1102 const auto twoTxops = m_txopLimit == 0 && !m_continueTxopAfterBsrp;
1103 const auto secondMuRts = twoTxops || (m_skipMuRtsBeforeBsrp && !m_protectedIfResponded);
1104
1105 tEnd = m_txPsdus[9].endTx;
1106 tStart = m_txPsdus[10].startTx;
1107 NS_TEST_EXPECT_MSG_LT(tEnd + (twoTxops ? ifs : sifs),
1108 tStart,
1109 (secondMuRts ? "MU-RTS" : "Basic Trigger Frame") << " sent too early");
1110
1111 if (!twoTxops)
1112 {
1113 NS_TEST_EXPECT_MSG_LT(tStart,
1114 tEnd + sifs + tolerance,
1115 (secondMuRts ? "MU-RTS" : "Basic Trigger Frame") << " sent too late");
1116 }
1117
1118 if (m_txopLimit > 0)
1119 {
1120 // Duration/ID of Basic TF still protects until the end of the TXOP
1121 auto basicTfNavEnd = m_txPsdus[10].endTx + m_txPsdus[10].psduMap[SU_STA_ID]->GetDuration();
1122 // navEnd <= basicTfNavEnd < navEnd + tolerance
1123 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, basicTfNavEnd, "Duration/ID in MU-RTS is too short");
1124 NS_TEST_EXPECT_MSG_LT(basicTfNavEnd,
1125 navEnd + tolerance,
1126 "Duration/ID in MU-RTS is too long");
1127 }
1128 else if (m_continueTxopAfterBsrp)
1129 {
1130 // the Basic TF sets a new NAV
1131 navEnd = m_txPsdus[10].endTx + m_txPsdus[10].psduMap[SU_STA_ID]->GetDuration();
1132 }
1133
1134 if (secondMuRts)
1135 {
1136 // the AP sends another MU-RTS Trigger Frame to protect the Basic TF
1138 15,
1139 "Expected at least 15 transmitted packet");
1141 (m_txPsdus[10].psduMap.size() == 1 &&
1142 m_txPsdus[10].psduMap[SU_STA_ID]->GetHeader(0).IsTrigger() &&
1143 m_txPsdus[10].psduMap[SU_STA_ID]->GetHeader(0).GetAddr1().IsBroadcast()),
1144 true,
1145 "Expected a Trigger Frame");
1146 m_txPsdus[10].psduMap[SU_STA_ID]->GetPayload(0)->PeekHeader(trigger);
1147 NS_TEST_EXPECT_MSG_EQ(trigger.IsMuRts(), true, "Expected an MU-RTS Trigger Frame");
1149 4,
1150 "Expected one User Info field per station");
1151 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[10].txVector.GetChannelWidth(),
1153 "Expected the MU-RTS to occupy the entire channel width");
1154 for (const auto& userInfo : trigger)
1155 {
1156 NS_TEST_EXPECT_MSG_EQ(+userInfo.GetMuRtsRuAllocation(),
1158 "Unexpected RU Allocation value in MU-RTS");
1159 }
1160
1161 // NAV end is now set by the Duration/ID of the second MU-RTS TF
1162 tEnd = m_txPsdus[10].endTx;
1163 navEnd = tEnd + m_txPsdus[10].psduMap[SU_STA_ID]->GetDuration();
1164
1165 // A first STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1167 (m_txPsdus[11].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1168 m_txPsdus[11].psduMap.size() == 1 &&
1169 m_txPsdus[11].psduMap.begin()->second->GetNMpdus() == 1 &&
1170 m_txPsdus[11].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1171 true,
1172 "Expected a CTS frame");
1173 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[11].txVector.GetChannelWidth(),
1175 "Expected the CTS to occupy the entire channel width");
1176
1177 tStart = m_txPsdus[11].startTx;
1178 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1179 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1180 ctsNavEnd = m_txPsdus[11].endTx + m_txPsdus[11].psduMap[SU_STA_ID]->GetDuration();
1181 // navEnd <= ctsNavEnd < navEnd + tolerance
1182 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1183 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1184 navEnd + tolerance,
1185 "Duration/ID in CTS frame is too long");
1186
1187 // A second STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1189 (m_txPsdus[12].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1190 m_txPsdus[12].psduMap.size() == 1 &&
1191 m_txPsdus[12].psduMap.begin()->second->GetNMpdus() == 1 &&
1192 m_txPsdus[12].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1193 true,
1194 "Expected a CTS frame");
1195 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[12].txVector.GetChannelWidth(),
1197 "Expected the CTS to occupy the entire channel width");
1198
1199 tStart = m_txPsdus[12].startTx;
1200 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1201 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1202 ctsNavEnd = m_txPsdus[12].endTx + m_txPsdus[12].psduMap[SU_STA_ID]->GetDuration();
1203 // navEnd <= ctsNavEnd < navEnd + tolerance
1204 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1205 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1206 navEnd + tolerance,
1207 "Duration/ID in CTS frame is too long");
1208
1209 // A third STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1211 (m_txPsdus[13].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1212 m_txPsdus[13].psduMap.size() == 1 &&
1213 m_txPsdus[13].psduMap.begin()->second->GetNMpdus() == 1 &&
1214 m_txPsdus[13].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1215 true,
1216 "Expected a CTS frame");
1217 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[13].txVector.GetChannelWidth(),
1219 "Expected the CTS to occupy the entire channel width");
1220
1221 tStart = m_txPsdus[13].startTx;
1222 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1223 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1224 ctsNavEnd = m_txPsdus[13].endTx + m_txPsdus[13].psduMap[SU_STA_ID]->GetDuration();
1225 // navEnd <= ctsNavEnd < navEnd + tolerance
1226 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1227 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1228 navEnd + tolerance,
1229 "Duration/ID in CTS frame is too long");
1230
1231 // A fourth STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1233 (m_txPsdus[14].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1234 m_txPsdus[14].psduMap.size() == 1 &&
1235 m_txPsdus[14].psduMap.begin()->second->GetNMpdus() == 1 &&
1236 m_txPsdus[14].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1237 true,
1238 "Expected a CTS frame");
1239 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[14].txVector.GetChannelWidth(),
1241 "Expected the CTS to occupy the entire channel width");
1242
1243 tStart = m_txPsdus[14].startTx;
1244 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1245 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1246 ctsNavEnd = m_txPsdus[14].endTx + m_txPsdus[14].psduMap[SU_STA_ID]->GetDuration();
1247 // navEnd <= ctsNavEnd < navEnd + tolerance
1248 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1249 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1250 navEnd + tolerance,
1251 "Duration/ID in CTS frame is too long");
1252
1253 tEnd = m_txPsdus[14].endTx;
1254 }
1255 else
1256 {
1257 // insert 5 elements in m_txPsdus to align the index of the following frames in the
1258 // two cases (TXOP limit null and not null)
1259 m_txPsdus.insert(std::next(m_txPsdus.begin(), 10), 5, {});
1260 tEnd = m_txPsdus[9].endTx;
1261 }
1262
1263 // the AP sends a Basic Trigger Frame to solicit QoS data frames
1264 NS_TEST_ASSERT_MSG_GT_OR_EQ(m_txPsdus.size(), 21, "Expected at least 21 transmitted packets");
1265 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[15].psduMap.size() == 1 &&
1266 m_txPsdus[15].psduMap[SU_STA_ID]->GetHeader(0).IsTrigger() &&
1267 m_txPsdus[15].psduMap[SU_STA_ID]->GetHeader(0).GetAddr1().IsBroadcast()),
1268 true,
1269 "Expected a Trigger Frame");
1270 m_txPsdus[15].psduMap[SU_STA_ID]->GetPayload(0)->PeekHeader(trigger);
1271 NS_TEST_EXPECT_MSG_EQ(trigger.IsBasic(), true, "Expected a Basic Trigger Frame");
1273 4,
1274 "Expected one User Info field per station");
1275 tStart = m_txPsdus[15].startTx;
1276 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Basic Trigger Frame sent too early");
1277 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "Basic Trigger Frame sent too late");
1278 Time basicNavEnd = m_txPsdus[15].endTx + m_txPsdus[15].psduMap[SU_STA_ID]->GetDuration();
1279 // navEnd <= basicNavEnd < navEnd + tolerance
1280 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, basicNavEnd, "Duration/ID in Basic TF is too short");
1281 NS_TEST_EXPECT_MSG_LT(basicNavEnd, navEnd + tolerance, "Duration/ID in Basic TF is too long");
1282
1283 // A first STA sends QoS data frames in a TB PPDU a SIFS after the reception of the Basic TF
1284 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[16].txVector.GetPreambleType() == m_tbPreamble &&
1285 m_txPsdus[16].psduMap.size() == 1 &&
1286 m_txPsdus[16].psduMap.begin()->second->GetNMpdus() == 2 &&
1287 m_txPsdus[16].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1288 m_txPsdus[16].psduMap.begin()->second->GetHeader(1).IsQosData()),
1289 true,
1290 "Expected 2 QoS data frames in an HE TB PPDU");
1291 tEnd = m_txPsdus[15].endTx;
1292 tStart = m_txPsdus[16].startTx;
1293 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS data frames in HE TB PPDU sent too early");
1294 NS_TEST_EXPECT_MSG_LT(tStart,
1295 tEnd + sifs + tolerance,
1296 "QoS data frames in HE TB PPDU sent too late");
1297 Time qosDataNavEnd = m_txPsdus[16].endTx + m_txPsdus[16].psduMap.begin()->second->GetDuration();
1298 // navEnd <= qosDataNavEnd < navEnd + tolerance
1299 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosDataNavEnd, "Duration/ID in QoS Data is too short");
1300 NS_TEST_EXPECT_MSG_LT(qosDataNavEnd, navEnd + tolerance, "Duration/ID in QoS Data is too long");
1301
1302 // A second STA sends QoS data frames in a TB PPDU a SIFS after the reception of the Basic TF
1303 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[17].txVector.GetPreambleType() == m_tbPreamble &&
1304 m_txPsdus[17].psduMap.size() == 1 &&
1305 m_txPsdus[17].psduMap.begin()->second->GetNMpdus() == 2 &&
1306 m_txPsdus[17].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1307 m_txPsdus[17].psduMap.begin()->second->GetHeader(1).IsQosData()),
1308 true,
1309 "Expected 2 QoS data frames in an HE TB PPDU");
1310 tStart = m_txPsdus[17].startTx;
1311 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS data frames in HE TB PPDU sent too early");
1312 NS_TEST_EXPECT_MSG_LT(tStart,
1313 tEnd + sifs + tolerance,
1314 "QoS data frames in HE TB PPDU sent too late");
1315 qosDataNavEnd = m_txPsdus[17].endTx + m_txPsdus[17].psduMap.begin()->second->GetDuration();
1316 // navEnd <= qosDataNavEnd < navEnd + tolerance
1317 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosDataNavEnd, "Duration/ID in QoS Data is too short");
1318 NS_TEST_EXPECT_MSG_LT(qosDataNavEnd, navEnd + tolerance, "Duration/ID in QoS Data is too long");
1319
1320 // A third STA sends QoS data frames in a TB PPDU a SIFS after the reception of the Basic TF
1321 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[18].txVector.GetPreambleType() == m_tbPreamble &&
1322 m_txPsdus[18].psduMap.size() == 1 &&
1323 m_txPsdus[18].psduMap.begin()->second->GetNMpdus() == 2 &&
1324 m_txPsdus[18].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1325 m_txPsdus[18].psduMap.begin()->second->GetHeader(1).IsQosData()),
1326 true,
1327 "Expected 2 QoS data frames in an HE TB PPDU");
1328 tStart = m_txPsdus[18].startTx;
1329 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS data frames in HE TB PPDU sent too early");
1330 NS_TEST_EXPECT_MSG_LT(tStart,
1331 tEnd + sifs + tolerance,
1332 "QoS data frames in HE TB PPDU sent too late");
1333 qosDataNavEnd = m_txPsdus[18].endTx + m_txPsdus[18].psduMap.begin()->second->GetDuration();
1334 // navEnd <= qosDataNavEnd < navEnd + tolerance
1335 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosDataNavEnd, "Duration/ID in QoS Data is too short");
1336 NS_TEST_EXPECT_MSG_LT(qosDataNavEnd, navEnd + tolerance, "Duration/ID in QoS Data is too long");
1337
1338 // A fourth STA sends QoS data frames in a TB PPDU a SIFS after the reception of the Basic TF
1339 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[19].txVector.GetPreambleType() == m_tbPreamble &&
1340 m_txPsdus[19].psduMap.size() == 1 &&
1341 m_txPsdus[19].psduMap.begin()->second->GetNMpdus() == 2 &&
1342 m_txPsdus[19].psduMap.begin()->second->GetHeader(0).IsQosData() &&
1343 m_txPsdus[19].psduMap.begin()->second->GetHeader(1).IsQosData()),
1344 true,
1345 "Expected 2 QoS data frames in an HE TB PPDU");
1346 tStart = m_txPsdus[19].startTx;
1347 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "QoS data frames in HE TB PPDU sent too early");
1348 NS_TEST_EXPECT_MSG_LT(tStart,
1349 tEnd + sifs + tolerance,
1350 "QoS data frames in HE TB PPDU sent too late");
1351 qosDataNavEnd = m_txPsdus[19].endTx + m_txPsdus[19].psduMap.begin()->second->GetDuration();
1352 // navEnd <= qosDataNavEnd < navEnd + tolerance
1353 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, qosDataNavEnd, "Duration/ID in QoS Data is too short");
1354 NS_TEST_EXPECT_MSG_LT(qosDataNavEnd, navEnd + tolerance, "Duration/ID in QoS Data is too long");
1355
1356 // the AP sends a Multi-STA Block Ack
1357 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[20].psduMap.size() == 1 &&
1358 m_txPsdus[20].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAck() &&
1359 m_txPsdus[20].psduMap[SU_STA_ID]->GetHeader(0).GetAddr1().IsBroadcast()),
1360 true,
1361 "Expected a Block Ack");
1362 m_txPsdus[20].psduMap[SU_STA_ID]->GetPayload(0)->PeekHeader(blockAck);
1363 NS_TEST_EXPECT_MSG_EQ(blockAck.IsMultiSta(), true, "Expected a Multi-STA Block Ack");
1365 4,
1366 "Expected one Per AID TID Info subfield per station");
1367 for (uint8_t i = 0; i < 4; i++)
1368 {
1369 NS_TEST_EXPECT_MSG_EQ(blockAck.GetAckType(i), true, "Expected All-ack context");
1370 NS_TEST_EXPECT_MSG_EQ(+blockAck.GetTidInfo(i), 14, "Expected All-ack context");
1371 }
1372 tEnd = m_txPsdus[19].endTx;
1373 tStart = m_txPsdus[20].startTx;
1374 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Multi-STA Block Ack sent too early");
1375 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "Multi-STA Block Ack sent too late");
1376 auto multiStaBaNavEnd = m_txPsdus[20].endTx + m_txPsdus[20].psduMap[SU_STA_ID]->GetDuration();
1377 // navEnd <= multiStaBaNavEnd < navEnd + tolerance
1379 multiStaBaNavEnd,
1380 "Duration/ID in Multi-STA BlockAck is too short");
1381 NS_TEST_EXPECT_MSG_LT(multiStaBaNavEnd,
1382 navEnd + tolerance,
1383 "Duration/ID in Multi-STA BlockAck is too long");
1384
1385 // if the TXOP limit is not null, MU-RTS protection is not used because the next transmission
1386 // is protected by the previous MU-RTS Trigger Frame
1387 if (m_txopLimit == 0)
1388 {
1389 // the AP sends an MU-RTS Trigger Frame to protect the DL MU PPDU
1391 26,
1392 "Expected at least 26 transmitted packet");
1394 (m_txPsdus[21].psduMap.size() == 1 &&
1395 m_txPsdus[21].psduMap[SU_STA_ID]->GetHeader(0).IsTrigger() &&
1396 m_txPsdus[21].psduMap[SU_STA_ID]->GetHeader(0).GetAddr1().IsBroadcast()),
1397 true,
1398 "Expected a Trigger Frame");
1399 m_txPsdus[21].psduMap[SU_STA_ID]->GetPayload(0)->PeekHeader(trigger);
1400 NS_TEST_EXPECT_MSG_EQ(trigger.IsMuRts(), true, "Expected an MU-RTS Trigger Frame");
1402 4,
1403 "Expected one User Info field per station");
1404 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[21].txVector.GetChannelWidth(),
1406 "Expected the MU-RTS to occupy the entire channel width");
1407 for (const auto& userInfo : trigger)
1408 {
1409 NS_TEST_EXPECT_MSG_EQ(+userInfo.GetMuRtsRuAllocation(),
1411 "Unexpected RU Allocation value in MU-RTS");
1412 }
1413 tEnd = m_txPsdus[20].endTx;
1414 tStart = m_txPsdus[21].startTx;
1415 NS_TEST_EXPECT_MSG_LT_OR_EQ(tEnd + ifs, tStart, "MU-RTS Trigger Frame sent too early");
1416 tEnd = m_txPsdus[21].endTx;
1417 navEnd = tEnd + m_txPsdus[21].psduMap[SU_STA_ID]->GetDuration();
1418
1419 // A first STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1421 (m_txPsdus[22].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1422 m_txPsdus[22].psduMap.size() == 1 &&
1423 m_txPsdus[22].psduMap.begin()->second->GetNMpdus() == 1 &&
1424 m_txPsdus[22].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1425 true,
1426 "Expected a CTS frame");
1427 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[22].txVector.GetChannelWidth(),
1429 "Expected the CTS to occupy the entire channel width");
1430
1431 tStart = m_txPsdus[22].startTx;
1432 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1433 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1434 ctsNavEnd = m_txPsdus[22].endTx + m_txPsdus[22].psduMap[SU_STA_ID]->GetDuration();
1435 // navEnd <= ctsNavEnd < navEnd + tolerance
1436 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1437 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1438 navEnd + tolerance,
1439 "Duration/ID in CTS frame is too long");
1440
1441 // A second STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1443 (m_txPsdus[23].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1444 m_txPsdus[23].psduMap.size() == 1 &&
1445 m_txPsdus[23].psduMap.begin()->second->GetNMpdus() == 1 &&
1446 m_txPsdus[23].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1447 true,
1448 "Expected a CTS frame");
1449 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[23].txVector.GetChannelWidth(),
1451 "Expected the CTS to occupy the entire channel width");
1452
1453 tStart = m_txPsdus[23].startTx;
1454 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1455 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1456 ctsNavEnd = m_txPsdus[23].endTx + m_txPsdus[23].psduMap[SU_STA_ID]->GetDuration();
1457 // navEnd <= ctsNavEnd < navEnd + tolerance
1458 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1459 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1460 navEnd + tolerance,
1461 "Duration/ID in CTS frame is too long");
1462
1463 // A third STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1465 (m_txPsdus[24].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1466 m_txPsdus[24].psduMap.size() == 1 &&
1467 m_txPsdus[24].psduMap.begin()->second->GetNMpdus() == 1 &&
1468 m_txPsdus[24].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1469 true,
1470 "Expected a CTS frame");
1471 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[24].txVector.GetChannelWidth(),
1473 "Expected the CTS to occupy the entire channel width");
1474
1475 tStart = m_txPsdus[24].startTx;
1476 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1477 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1478 ctsNavEnd = m_txPsdus[24].endTx + m_txPsdus[24].psduMap[SU_STA_ID]->GetDuration();
1479 // navEnd <= ctsNavEnd < navEnd + tolerance
1480 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1481 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1482 navEnd + tolerance,
1483 "Duration/ID in CTS frame is too long");
1484
1485 // A fourth STA sends a CTS frame a SIFS after the reception of the MU-RTS TF
1487 (m_txPsdus[25].txVector.GetPreambleType() != WIFI_PREAMBLE_HE_TB &&
1488 m_txPsdus[25].psduMap.size() == 1 &&
1489 m_txPsdus[25].psduMap.begin()->second->GetNMpdus() == 1 &&
1490 m_txPsdus[25].psduMap.begin()->second->GetHeader(0).GetType() == WIFI_MAC_CTL_CTS),
1491 true,
1492 "Expected a CTS frame");
1493 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[25].txVector.GetChannelWidth(),
1495 "Expected the CTS to occupy the entire channel width");
1496
1497 tStart = m_txPsdus[25].startTx;
1498 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "CTS frame sent too early");
1499 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "CTS frame sent too late");
1500 ctsNavEnd = m_txPsdus[25].endTx + m_txPsdus[25].psduMap[SU_STA_ID]->GetDuration();
1501 // navEnd <= ctsNavEnd < navEnd + tolerance
1502 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, ctsNavEnd, "Duration/ID in CTS frame is too short");
1503 NS_TEST_EXPECT_MSG_LT(ctsNavEnd,
1504 navEnd + tolerance,
1505 "Duration/ID in CTS frame is too long");
1506
1507 tEnd = m_txPsdus[25].endTx;
1508 }
1509 else
1510 {
1511 // insert 5 elements in m_txPsdus to align the index of the following frames in the
1512 // two cases (TXOP limit null and not null)
1513 m_txPsdus.insert(std::next(m_txPsdus.begin(), 21), 5, {});
1514 tEnd = m_txPsdus[20].endTx;
1515 }
1516
1517 // the AP sends a DL MU PPDU
1518 NS_TEST_ASSERT_MSG_GT_OR_EQ(m_txPsdus.size(), 27, "Expected at least 27 transmitted packet");
1519 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[26].txVector.GetPreambleType(),
1521 "Expected a DL MU PPDU");
1522 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[26].psduMap.size(),
1523 4,
1524 "Expected 4 PSDUs within the DL MU PPDU");
1525 // the TX duration cannot exceed the maximum PPDU duration
1526 NS_TEST_EXPECT_MSG_LT_OR_EQ(m_txPsdus[26].endTx - m_txPsdus[26].startTx,
1527 GetPpduMaxTime(m_txPsdus[26].txVector.GetPreambleType()),
1528 "TX duration cannot exceed max PPDU duration");
1529 for (auto& psdu : m_txPsdus[26].psduMap)
1530 {
1531 NS_TEST_EXPECT_MSG_LT_OR_EQ(psdu.second->GetSize(),
1533 "Max A-MPDU size exceeded");
1534 }
1535 tStart = m_txPsdus[26].startTx;
1536 NS_TEST_EXPECT_MSG_LT_OR_EQ(tEnd + sifs, tStart, "DL MU PPDU sent too early");
1537 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "DL MU PPDU sent too late");
1538
1539 // The Duration/ID field is the same for all the PSDUs
1540 auto dlMuNavEnd = m_txPsdus[26].endTx;
1541 for (auto& psdu : m_txPsdus[26].psduMap)
1542 {
1543 if (dlMuNavEnd == m_txPsdus[26].endTx)
1544 {
1545 dlMuNavEnd += psdu.second->GetDuration();
1546 }
1547 else
1548 {
1549 NS_TEST_EXPECT_MSG_EQ(m_txPsdus[26].endTx + psdu.second->GetDuration(),
1550 dlMuNavEnd,
1551 "Duration/ID must be the same for all PSDUs");
1552 }
1553 }
1554 // navEnd <= dlMuNavEnd < navEnd + tolerance
1555 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, dlMuNavEnd, "Duration/ID in DL MU PPDU is too short");
1556 NS_TEST_EXPECT_MSG_LT(dlMuNavEnd, navEnd + tolerance, "Duration/ID in DL MU PPDU is too long");
1557
1558 std::size_t nTxPsdus = 0;
1559
1561 {
1562 /*
1563 * |-----------------------------------------NAV-------------------------------->|
1564 * |----------------------------------NAV------------------------------>|
1565 * |-----------------------------NAV------------------------->|
1566 * |-------------------------NAV--------------------->|
1567 * |--NAV->| |--NAV->| |--NAV->|
1568 * ┌───┐ ┌───┐ ┌────┐ ┌──┐ ┌───┐ ┌──┐ ┌───┐ ┌──┐ ┌───┐ ┌──┐
1569 * │ │ │ │ │PSDU│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1570 * │ │ │ │ │ 1 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1571 * │ │ │ │ ├────┤ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1572 * │ │ │ │ │PSDU│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1573 * │MU-│ │CTS│ │ 2 │ │BA│ │BAR│ │BA│ │BAR│ │BA│ │BAR│ │BA│
1574 * │RTS│SIFS│ │SIFS├────┤SIFS│ │SIFS│ │SIFS│ │SIFS│ │SIFS│ │SIFS│ │SIFS│ │
1575 * │TF │ │x4 │ │PSDU│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1576 * │ │ │ │ │ 3 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1577 * │ │ │ │ ├────┤ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1578 * │ │ │ │ │PSDU│ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1579 * │ │ │ │ │ 4 │ │ │ │ │ │ │ │ │ │ │ │ │ │ │
1580 * ───┴───┴────┴───┴────┴────┴────┴──┴────┴───┴────┴──┴────┴───┴────┴──┴────┴───┴────┴──┴──
1581 * From: AP all AP STA 1 AP STA 2 AP STA 3 AP STA 4
1582 * To: all AP all AP STA 2 AP STA 3 AP STA 4 AP
1583 */
1584 NS_TEST_EXPECT_MSG_GT_OR_EQ(m_txPsdus.size(), 34, "Expected at least 34 packets");
1585
1586 // A first STA sends a Block Ack a SIFS after the reception of the DL MU PPDU
1587 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[27].psduMap.size() == 1 &&
1588 m_txPsdus[27].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAck()),
1589 true,
1590 "Expected a Block Ack");
1591 tEnd = m_txPsdus[26].endTx;
1592 tStart = m_txPsdus[27].startTx;
1593 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "First Block Ack sent too early");
1594 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "First Block Ack sent too late");
1595 Time baNavEnd = m_txPsdus[27].endTx + m_txPsdus[27].psduMap[SU_STA_ID]->GetDuration();
1596 // The NAV of the first BlockAck, being a response to a QoS Data frame, matches the NAV
1597 // set by the MU-RTS TF.
1598 // navEnd <= baNavEnd < navEnd + tolerance
1600 baNavEnd,
1601 "Duration/ID in 1st BlockAck frame is too short");
1602 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1603 navEnd + tolerance,
1604 "Duration/ID in 1st BlockAck is too long");
1605
1606 // the AP transmits a Block Ack Request an IFS after the reception of the Block Ack
1607 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[28].psduMap.size() == 1 &&
1608 m_txPsdus[28].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAckReq()),
1609 true,
1610 "Expected a Block Ack Request");
1611 tEnd = m_txPsdus[27].endTx;
1612 tStart = m_txPsdus[28].startTx;
1613 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "First Block Ack Request sent too early");
1614 NS_TEST_EXPECT_MSG_LT(tStart,
1615 tEnd + sifs + tolerance,
1616 "First Block Ack Request sent too late");
1617 // under single protection setting (TXOP limit equal to zero), the NAV of the BlockAckReq
1618 // only covers the following BlockAck response; under multiple protection setting, the
1619 // NAV of the BlockAckReq matches the NAV set by the MU-RTS TF
1620 Time barNavEnd = m_txPsdus[28].endTx + m_txPsdus[28].psduMap[SU_STA_ID]->GetDuration();
1621 if (m_txopLimit > 0)
1622 {
1623 // navEnd <= barNavEnd < navEnd + tolerance
1625 barNavEnd,
1626 "Duration/ID in BlockAckReq is too short");
1627 NS_TEST_EXPECT_MSG_LT(barNavEnd,
1628 navEnd + tolerance,
1629 "Duration/ID in BlockAckReq is too long");
1630 }
1631
1632 // A second STA sends a Block Ack a SIFS after the reception of the Block Ack Request
1633 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[29].psduMap.size() == 1 &&
1634 m_txPsdus[29].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAck()),
1635 true,
1636 "Expected a Block Ack");
1637 tEnd = m_txPsdus[28].endTx;
1638 tStart = m_txPsdus[29].startTx;
1639 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Second Block Ack sent too early");
1640 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "Second Block Ack sent too late");
1641 baNavEnd = m_txPsdus[29].endTx + m_txPsdus[29].psduMap[SU_STA_ID]->GetDuration();
1642 if (m_txopLimit > 0)
1643 {
1644 // navEnd <= baNavEnd < navEnd + tolerance
1645 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck is too short");
1646 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1647 navEnd + tolerance,
1648 "Duration/ID in BlockAck is too long");
1649 }
1650 else
1651 {
1652 // barNavEnd <= baNavEnd < barNavEnd + tolerance
1654 baNavEnd,
1655 "Duration/ID in BlockAck is too short");
1656 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1657 barNavEnd + tolerance,
1658 "Duration/ID in BlockAck is too long");
1659 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1660 m_txPsdus[29].endTx,
1661 "Expected null Duration/ID for BlockAck");
1662 }
1663
1664 // the AP transmits a Block Ack Request an IFS after the reception of the Block Ack
1665 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[30].psduMap.size() == 1 &&
1666 m_txPsdus[30].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAckReq()),
1667 true,
1668 "Expected a Block Ack Request");
1669 tEnd = m_txPsdus[29].endTx;
1670 tStart = m_txPsdus[30].startTx;
1671 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Second Block Ack Request sent too early");
1672 NS_TEST_EXPECT_MSG_LT(tStart,
1673 tEnd + sifs + tolerance,
1674 "Second Block Ack Request sent too late");
1675 // under single protection setting (TXOP limit equal to zero), the NAV of the BlockAckReq
1676 // only covers the following BlockAck response; under multiple protection setting, the
1677 // NAV of the BlockAckReq matches the NAV set by the MU-RTS TF
1678 barNavEnd = m_txPsdus[30].endTx + m_txPsdus[30].psduMap[SU_STA_ID]->GetDuration();
1679 if (m_txopLimit > 0)
1680 {
1681 // navEnd <= barNavEnd < navEnd + tolerance
1683 barNavEnd,
1684 "Duration/ID in BlockAckReq is too short");
1685 NS_TEST_EXPECT_MSG_LT(barNavEnd,
1686 navEnd + tolerance,
1687 "Duration/ID in BlockAckReq is too long");
1688 }
1689
1690 // A third STA sends a Block Ack a SIFS after the reception of the Block Ack Request
1691 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[31].psduMap.size() == 1 &&
1692 m_txPsdus[31].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAck()),
1693 true,
1694 "Expected a Block Ack");
1695 tEnd = m_txPsdus[30].endTx;
1696 tStart = m_txPsdus[31].startTx;
1697 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Third Block Ack sent too early");
1698 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "Third Block Ack sent too late");
1699 baNavEnd = m_txPsdus[31].endTx + m_txPsdus[31].psduMap[SU_STA_ID]->GetDuration();
1700 if (m_txopLimit > 0)
1701 {
1702 // navEnd <= baNavEnd < navEnd + tolerance
1703 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck is too short");
1704 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1705 navEnd + tolerance,
1706 "Duration/ID in BlockAck is too long");
1707 }
1708 else
1709 {
1710 // barNavEnd <= baNavEnd < barNavEnd + tolerance
1712 baNavEnd,
1713 "Duration/ID in BlockAck is too short");
1714 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1715 barNavEnd + tolerance,
1716 "Duration/ID in BlockAck is too long");
1717 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1718 m_txPsdus[31].endTx,
1719 "Expected null Duration/ID for BlockAck");
1720 }
1721
1722 // the AP transmits a Block Ack Request an IFS after the reception of the Block Ack
1723 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[32].psduMap.size() == 1 &&
1724 m_txPsdus[32].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAckReq()),
1725 true,
1726 "Expected a Block Ack Request");
1727 tEnd = m_txPsdus[31].endTx;
1728 tStart = m_txPsdus[32].startTx;
1729 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Third Block Ack Request sent too early");
1730 NS_TEST_EXPECT_MSG_LT(tStart,
1731 tEnd + sifs + tolerance,
1732 "Third Block Ack Request sent too late");
1733 // under single protection setting (TXOP limit equal to zero), the NAV of the BlockAckReq
1734 // only covers the following BlockAck response; under multiple protection setting, the
1735 // NAV of the BlockAckReq matches the NAV set by the MU-RTS TF
1736 barNavEnd = m_txPsdus[32].endTx + m_txPsdus[32].psduMap[SU_STA_ID]->GetDuration();
1737 if (m_txopLimit > 0)
1738 {
1739 // navEnd <= barNavEnd < navEnd + tolerance
1741 barNavEnd,
1742 "Duration/ID in BlockAckReq is too short");
1743 NS_TEST_EXPECT_MSG_LT(barNavEnd,
1744 navEnd + tolerance,
1745 "Duration/ID in BlockAckReq is too long");
1746 }
1747
1748 // A fourth STA sends a Block Ack a SIFS after the reception of the Block Ack Request
1749 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[33].psduMap.size() == 1 &&
1750 m_txPsdus[33].psduMap[SU_STA_ID]->GetHeader(0).IsBlockAck()),
1751 true,
1752 "Expected a Block Ack");
1753 tEnd = m_txPsdus[32].endTx;
1754 tStart = m_txPsdus[33].startTx;
1755 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Fourth Block Ack sent too early");
1756 NS_TEST_EXPECT_MSG_LT(tStart, tEnd + sifs + tolerance, "Fourth Block Ack sent too late");
1757 baNavEnd = m_txPsdus[33].endTx + m_txPsdus[33].psduMap[SU_STA_ID]->GetDuration();
1758 if (m_txopLimit > 0)
1759 {
1760 // navEnd <= baNavEnd < navEnd + tolerance
1761 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck is too short");
1762 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1763 navEnd + tolerance,
1764 "Duration/ID in BlockAck is too long");
1765 }
1766 else
1767 {
1768 // barNavEnd <= baNavEnd < barNavEnd + tolerance
1770 baNavEnd,
1771 "Duration/ID in BlockAck is too short");
1772 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1773 barNavEnd + tolerance,
1774 "Duration/ID in BlockAck is too long");
1775 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1776 m_txPsdus[33].endTx,
1777 "Expected null Duration/ID for BlockAck");
1778 }
1779
1780 if (m_txopLimit == 0)
1781 {
1782 // the duration/ID of the DL MU PPDU covers the entire acknowledgment sequence
1783 // dlMuNavEnd <= ackSequenceEnd < dlMuNavEnd + tolerance
1784 NS_TEST_EXPECT_MSG_LT_OR_EQ(dlMuNavEnd,
1785 m_txPsdus[33].endTx,
1786 "Duration/ID in DL MU PPDU is too long");
1788 dlMuNavEnd + tolerance,
1789 "Duration/ID in DL MU PPDU does not cover the ack sequence");
1790 }
1791
1792 nTxPsdus = 34;
1793 }
1795 {
1796 /*
1797 * |---------------------NAV------------------------>|
1798 * |-------------------NAV----------------->|
1799 * |---------------NAV--------->|
1800 * |------NAV----->|
1801 * ┌───┐ ┌───┐ ┌──────┐ ┌───────┐ ┌──────────┐
1802 * │ │ │ │ │PSDU 1│ │ │ │BlockAck 1│
1803 * │ │ │ │ ├──────┤ │MU-BAR │ ├──────────┤
1804 * │MU-│ │CTS│ │PSDU 2│ │Trigger│ │BlockAck 2│
1805 * │RTS│SIFS│ │SIFS├──────┤SIFS│ Frame │SIFS├──────────┤
1806 * │TF │ │x4 │ │PSDU 3│ │ │ │BlockAck 3│
1807 * │ │ │ │ ├──────┤ │ │ ├──────────┤
1808 * │ │ │ │ │PSDU 4│ │ │ │BlockAck 4│
1809 * -----┴───┴────┴───┴────┴──────┴────┴───────┴────┴──────────┴───
1810 * From: AP all AP AP all
1811 * To: all AP all all AP
1812 */
1813 NS_TEST_EXPECT_MSG_GT_OR_EQ(m_txPsdus.size(), 32, "Expected at least 32 packets");
1814
1815 // the AP transmits a MU-BAR Trigger Frame a SIFS after the transmission of the DL MU PPDU
1816 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[27].psduMap.size() == 1 &&
1817 m_txPsdus[27].psduMap[SU_STA_ID]->GetHeader(0).IsTrigger()),
1818 true,
1819 "Expected a MU-BAR Trigger Frame");
1820 tEnd = m_txPsdus[26].endTx;
1821 tStart = m_txPsdus[27].startTx;
1822 NS_TEST_EXPECT_MSG_EQ(tStart, tEnd + sifs, "MU-BAR Trigger Frame sent at wrong time");
1823 auto muBarNavEnd = m_txPsdus[27].endTx + m_txPsdus[27].psduMap[SU_STA_ID]->GetDuration();
1824 // navEnd <= muBarNavEnd < navEnd + tolerance
1826 muBarNavEnd,
1827 "Duration/ID in MU-BAR Trigger Frame is too short");
1828 NS_TEST_EXPECT_MSG_LT(muBarNavEnd,
1829 navEnd + tolerance,
1830 "Duration/ID in MU-BAR Trigger Frame is too long");
1831
1832 // A first STA sends a Block Ack in a TB PPDU a SIFS after the reception of the MU-BAR
1833 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[28].txVector.GetPreambleType() == m_tbPreamble &&
1834 m_txPsdus[28].psduMap.size() == 1 &&
1835 m_txPsdus[28].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1836 true,
1837 "Expected a Block Ack");
1838 tEnd = m_txPsdus[27].endTx;
1839 tStart = m_txPsdus[28].startTx;
1840 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
1841 NS_TEST_EXPECT_MSG_LT(tStart,
1842 tEnd + sifs + tolerance,
1843 "Block Ack in HE TB PPDU sent too late");
1844 Time baNavEnd = m_txPsdus[28].endTx + m_txPsdus[28].psduMap.begin()->second->GetDuration();
1845 // navEnd <= baNavEnd < navEnd + tolerance
1846 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
1847 NS_TEST_EXPECT_MSG_LT(baNavEnd, navEnd + tolerance, "Duration/ID in BlockAck is too long");
1848 if (m_txopLimit == 0)
1849 {
1850 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1851 m_txPsdus[28].endTx,
1852 "Expected null Duration/ID for BlockAck");
1853 }
1854
1855 // A second STA sends a Block Ack in a TB PPDU a SIFS after the reception of the MU-BAR
1856 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[29].txVector.GetPreambleType() == m_tbPreamble &&
1857 m_txPsdus[29].psduMap.size() == 1 &&
1858 m_txPsdus[29].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1859 true,
1860 "Expected a Block Ack");
1861 tStart = m_txPsdus[29].startTx;
1862 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
1863 NS_TEST_EXPECT_MSG_LT(tStart,
1864 tEnd + sifs + tolerance,
1865 "Block Ack in HE TB PPDU sent too late");
1866 baNavEnd = m_txPsdus[29].endTx + m_txPsdus[29].psduMap.begin()->second->GetDuration();
1867 // navEnd <= baNavEnd < navEnd + tolerance
1868 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
1869 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1870 navEnd + tolerance,
1871 "Duration/ID in 1st BlockAck is too long");
1872 if (m_txopLimit == 0)
1873 {
1874 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1875 m_txPsdus[29].endTx,
1876 "Expected null Duration/ID for BlockAck");
1877 }
1878
1879 // A third STA sends a Block Ack in a TB PPDU a SIFS after the reception of the MU-BAR
1880 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[30].txVector.GetPreambleType() == m_tbPreamble &&
1881 m_txPsdus[30].psduMap.size() == 1 &&
1882 m_txPsdus[30].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1883 true,
1884 "Expected a Block Ack");
1885 tStart = m_txPsdus[30].startTx;
1886 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
1887 NS_TEST_EXPECT_MSG_LT(tStart,
1888 tEnd + sifs + tolerance,
1889 "Block Ack in HE TB PPDU sent too late");
1890 baNavEnd = m_txPsdus[30].endTx + m_txPsdus[30].psduMap.begin()->second->GetDuration();
1891 // navEnd <= baNavEnd < navEnd + tolerance
1892 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
1893 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1894 navEnd + tolerance,
1895 "Duration/ID in 1st BlockAck is too long");
1896 if (m_txopLimit == 0)
1897 {
1898 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1899 m_txPsdus[30].endTx,
1900 "Expected null Duration/ID for BlockAck");
1901 }
1902
1903 // A fourth STA sends a Block Ack in a TB PPDU a SIFS after the reception of the MU-BAR
1904 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[31].txVector.GetPreambleType() == m_tbPreamble &&
1905 m_txPsdus[31].psduMap.size() == 1 &&
1906 m_txPsdus[31].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1907 true,
1908 "Expected a Block Ack");
1909 tStart = m_txPsdus[31].startTx;
1910 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
1911 NS_TEST_EXPECT_MSG_LT(tStart,
1912 tEnd + sifs + tolerance,
1913 "Block Ack in HE TB PPDU sent too late");
1914 baNavEnd = m_txPsdus[31].endTx + m_txPsdus[31].psduMap.begin()->second->GetDuration();
1915 // navEnd <= baNavEnd < navEnd + tolerance
1916 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
1917 NS_TEST_EXPECT_MSG_LT(baNavEnd,
1918 navEnd + tolerance,
1919 "Duration/ID in 1st BlockAck is too long");
1920 if (m_txopLimit == 0)
1921 {
1922 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1923 m_txPsdus[31].endTx,
1924 "Expected null Duration/ID for BlockAck");
1925 }
1926
1927 nTxPsdus = 32;
1928 }
1930 {
1931 /*
1932 * |---------------------NAV----------------------->|
1933 * |-------------------NAV---------------->|
1934 * |------NAV----->|
1935 * ┌───┐ ┌───┐ ┌──────┬───────────┐ ┌──────────┐
1936 * │ │ │ │ │PSDU 1│MU-BAR TF 1│ │BlockAck 1│
1937 * │ │ │ │ ├──────┼───────────┤ ├──────────┤
1938 * │MU-│ │CTS│ │PSDU 2│MU-BAR TF 2│ │BlockAck 2│
1939 * │RTS│SIFS│ │SIFS├──────┼───────────┤SIFS├──────────┤
1940 * │TF │ │x4 │ │PSDU 3│MU-BAR TF 3│ │BlockAck 3│
1941 * │ │ │ │ ├──────┼───────────┤ ├──────────┤
1942 * │ │ │ │ │PSDU 4│MU-BAR TF 4│ │BlockAck 4│
1943 * -----┴───┴────┴───┴────┴──────┴───────────┴────┴──────────┴───
1944 * From: AP all AP all
1945 * To: all AP all AP
1946 */
1947 NS_TEST_ASSERT_MSG_GT_OR_EQ(m_txPsdus.size(), 31, "Expected at least 31 packets");
1948
1949 // The last MPDU in each PSDU is a MU-BAR Trigger Frame
1950 for (auto& psdu : m_txPsdus[26].psduMap)
1951 {
1952 NS_TEST_EXPECT_MSG_EQ((*std::prev(psdu.second->end()))->GetHeader().IsTrigger(),
1953 true,
1954 "Expected an aggregated MU-BAR Trigger Frame");
1955 }
1956
1957 // A first STA sends a Block Ack in a TB PPDU a SIFS after the reception of the DL MU PPDU
1958 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[27].txVector.GetPreambleType() == m_tbPreamble &&
1959 m_txPsdus[27].psduMap.size() == 1 &&
1960 m_txPsdus[27].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1961 true,
1962 "Expected a Block Ack");
1963 tEnd = m_txPsdus[26].endTx;
1964 tStart = m_txPsdus[27].startTx;
1965 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
1966 NS_TEST_EXPECT_MSG_LT(tStart,
1967 tEnd + sifs + tolerance,
1968 "Block Ack in HE TB PPDU sent too late");
1969 Time baNavEnd = m_txPsdus[27].endTx + m_txPsdus[27].psduMap.begin()->second->GetDuration();
1970 // navEnd <= baNavEnd < navEnd + tolerance
1971 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
1972 NS_TEST_EXPECT_MSG_LT(baNavEnd, navEnd + tolerance, "Duration/ID in BlockAck is too long");
1973 if (m_txopLimit == 0)
1974 {
1975 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1976 m_txPsdus[27].endTx,
1977 "Expected null Duration/ID for BlockAck");
1978 }
1979
1980 // A second STA sends a Block Ack in a TB PPDU a SIFS after the reception of the DL MU PPDU
1981 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[28].txVector.GetPreambleType() == m_tbPreamble &&
1982 m_txPsdus[28].psduMap.size() == 1 &&
1983 m_txPsdus[28].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
1984 true,
1985 "Expected a Block Ack");
1986 tStart = m_txPsdus[28].startTx;
1987 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
1988 NS_TEST_EXPECT_MSG_LT(tStart,
1989 tEnd + sifs + tolerance,
1990 "Block Ack in HE TB PPDU sent too late");
1991 baNavEnd = m_txPsdus[28].endTx + m_txPsdus[28].psduMap.begin()->second->GetDuration();
1992 // navEnd <= baNavEnd < navEnd + tolerance
1993 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
1994 NS_TEST_EXPECT_MSG_LT(baNavEnd, navEnd + tolerance, "Duration/ID in BlockAck is too long");
1995 if (m_txopLimit == 0)
1996 {
1997 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
1998 m_txPsdus[28].endTx,
1999 "Expected null Duration/ID for BlockAck");
2000 }
2001
2002 // A third STA sends a Block Ack in a TB PPDU a SIFS after the reception of the DL MU PPDU
2003 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[29].txVector.GetPreambleType() == m_tbPreamble &&
2004 m_txPsdus[29].psduMap.size() == 1 &&
2005 m_txPsdus[29].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
2006 true,
2007 "Expected a Block Ack");
2008 tStart = m_txPsdus[29].startTx;
2009 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
2010 NS_TEST_EXPECT_MSG_LT(tStart,
2011 tEnd + sifs + tolerance,
2012 "Block Ack in HE TB PPDU sent too late");
2013 baNavEnd = m_txPsdus[29].endTx + m_txPsdus[29].psduMap.begin()->second->GetDuration();
2014 // navEnd <= baNavEnd < navEnd + tolerance
2015 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
2016 NS_TEST_EXPECT_MSG_LT(baNavEnd, navEnd + tolerance, "Duration/ID in BlockAck is too long");
2017 if (m_txopLimit == 0)
2018 {
2019 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
2020 m_txPsdus[29].endTx,
2021 "Expected null Duration/ID for BlockAck");
2022 }
2023
2024 // A fourth STA sends a Block Ack in a TB PPDU a SIFS after the reception of the DL MU PPDU
2025 NS_TEST_EXPECT_MSG_EQ((m_txPsdus[30].txVector.GetPreambleType() == m_tbPreamble &&
2026 m_txPsdus[30].psduMap.size() == 1 &&
2027 m_txPsdus[30].psduMap.begin()->second->GetHeader(0).IsBlockAck()),
2028 true,
2029 "Expected a Block Ack");
2030 tStart = m_txPsdus[30].startTx;
2031 NS_TEST_EXPECT_MSG_LT(tEnd + sifs, tStart, "Block Ack in HE TB PPDU sent too early");
2032 NS_TEST_EXPECT_MSG_LT(tStart,
2033 tEnd + sifs + tolerance,
2034 "Block Ack in HE TB PPDU sent too late");
2035 baNavEnd = m_txPsdus[30].endTx + m_txPsdus[30].psduMap.begin()->second->GetDuration();
2036 // navEnd <= baNavEnd < navEnd + tolerance
2037 NS_TEST_EXPECT_MSG_LT_OR_EQ(navEnd, baNavEnd, "Duration/ID in BlockAck frame is too short");
2038 NS_TEST_EXPECT_MSG_LT(baNavEnd, navEnd + tolerance, "Duration/ID in BlockAck is too long");
2039 if (m_txopLimit == 0)
2040 {
2041 NS_TEST_EXPECT_MSG_EQ(baNavEnd,
2042 m_txPsdus[30].endTx,
2043 "Expected null Duration/ID for BlockAck");
2044 }
2045
2046 nTxPsdus = 31;
2047 }
2048
2051 "Not all DL packets have been received");
2052
2053 if (m_muEdcaParameterSet.muTimer > 0 && m_muEdcaParameterSet.muAifsn == 0)
2054 {
2055 // EDCA disabled, find the first PSDU transmitted by a station not in an
2056 // HE TB PPDU and check that it was not transmitted before the MU EDCA
2057 // timer expired
2058 for (std::size_t i = nTxPsdus; i < m_txPsdus.size(); ++i)
2059 {
2060 if (m_txPsdus[i].psduMap.size() == 1 &&
2061 !m_txPsdus[i].psduMap.begin()->second->GetHeader(0).IsCts() &&
2062 m_txPsdus[i].psduMap.begin()->second->GetHeader(0).GetAddr2() !=
2063 m_apDevice->GetAddress() &&
2064 !m_txPsdus[i].txVector.IsUlMu())
2065 {
2067 m_txPsdus[i].startTx.GetMicroSeconds(),
2068 m_edcaDisabledStartTime.GetMicroSeconds() +
2070 "A station transmitted before the MU EDCA timer expired");
2071 break;
2072 }
2073 }
2074 }
2075 else if (m_muEdcaParameterSet.muTimer > 0 && m_muEdcaParameterSet.muAifsn > 0)
2076 {
2077 // stations used worse access parameters after successful UL MU transmission
2078 for (const auto& cwValue : m_cwValues)
2079 {
2080 NS_TEST_EXPECT_MSG_EQ((cwValue == 2 || cwValue >= m_muEdcaParameterSet.muCwMin),
2081 true,
2082 "A station did not set the correct MU CW min");
2083 }
2084 }
2085
2086 m_txPsdus.clear();
2087}
2088
2089void
2091{
2092 uint32_t previousSeed = RngSeedManager::GetSeed();
2093 uint64_t previousRun = RngSeedManager::GetRun();
2094 Config::SetGlobal("RngSeed", UintegerValue(2));
2095 Config::SetGlobal("RngRun", UintegerValue(2));
2096 int64_t streamNumber = 10;
2097
2098 NodeContainer wifiApNode;
2099 wifiApNode.Create(1);
2100
2101 NodeContainer wifiOldStaNodes;
2102 NodeContainer wifiNewStaNodes;
2103 wifiOldStaNodes.Create(m_nStations / 2);
2104 wifiNewStaNodes.Create(m_nStations - m_nStations / 2);
2105 NodeContainer wifiStaNodes(wifiOldStaNodes, wifiNewStaNodes);
2106
2109 spectrumChannel->AddPropagationLossModel(lossModel);
2112 spectrumChannel->SetPropagationDelayModel(delayModel);
2113
2115 phy.SetPcapDataLinkType(WifiPhyHelper::DLT_IEEE802_11_RADIO);
2116 phy.SetErrorRateModel("ns3::NistErrorRateModel");
2117 phy.SetChannel(spectrumChannel);
2118 switch (static_cast<uint16_t>(m_channelWidth))
2119 {
2120 case 20:
2121 phy.Set("ChannelSettings", StringValue("{36, 20, BAND_5GHZ, 0}"));
2122 break;
2123 case 40:
2124 phy.Set("ChannelSettings", StringValue("{38, 40, BAND_5GHZ, 0}"));
2125 break;
2126 case 80:
2127 phy.Set("ChannelSettings", StringValue("{42, 80, BAND_5GHZ, 0}"));
2128 break;
2129 case 160:
2130 phy.Set("ChannelSettings", StringValue("{50, 160, BAND_5GHZ, 0}"));
2131 break;
2132 case 320:
2133 phy.Set("ChannelSettings", StringValue("{31, 320, BAND_6GHZ, 0}"));
2134 break;
2135 default:
2136 NS_ABORT_MSG("Invalid channel bandwidth: " << m_channelWidth);
2137 }
2138
2139 Config::SetDefault("ns3::HeConfiguration::MuBeAifsn",
2141 Config::SetDefault("ns3::HeConfiguration::MuBeCwMin",
2143 Config::SetDefault("ns3::HeConfiguration::MuBeCwMax",
2145 Config::SetDefault("ns3::HeConfiguration::BeMuEdcaTimer",
2147
2148 Config::SetDefault("ns3::HeConfiguration::MuBkAifsn",
2150 Config::SetDefault("ns3::HeConfiguration::MuBkCwMin",
2152 Config::SetDefault("ns3::HeConfiguration::MuBkCwMax",
2154 Config::SetDefault("ns3::HeConfiguration::BkMuEdcaTimer",
2156
2157 Config::SetDefault("ns3::HeConfiguration::MuViAifsn",
2159 Config::SetDefault("ns3::HeConfiguration::MuViCwMin",
2161 Config::SetDefault("ns3::HeConfiguration::MuViCwMax",
2163 Config::SetDefault("ns3::HeConfiguration::ViMuEdcaTimer",
2165
2166 Config::SetDefault("ns3::HeConfiguration::MuVoAifsn",
2168 Config::SetDefault("ns3::HeConfiguration::MuVoCwMin",
2170 Config::SetDefault("ns3::HeConfiguration::MuVoCwMax",
2172 Config::SetDefault("ns3::HeConfiguration::VoMuEdcaTimer",
2174
2175 // increase MSDU lifetime so that it does not expire before the MU EDCA timer ends
2176 Config::SetDefault("ns3::WifiMacQueue::MaxDelay", TimeValue(Seconds(2)));
2177
2178 WifiHelper wifi;
2181 wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager",
2182 "DataMode",
2183 StringValue("HeMcs11"));
2184 wifi.ConfigHeOptions("MuBeAifsn",
2186 "MuBeCwMin",
2188 "MuBeCwMax",
2190 "BeMuEdcaTimer",
2192 // MU EDCA timers must be either all null or all non-null
2193 "BkMuEdcaTimer",
2195 "ViMuEdcaTimer",
2197 "VoMuEdcaTimer",
2199
2200 WifiMacHelper mac;
2201 Ssid ssid = Ssid("ns-3-ssid");
2202 mac.SetType("ns3::StaWifiMac",
2203 "Ssid",
2204 SsidValue(ssid),
2205 "BE_MaxAmsduSize",
2206 UintegerValue(0),
2207 "BE_MaxAmpduSize",
2209 /* setting blockack threshold for sta's BE queue */
2210 "BE_BlockAckThreshold",
2211 UintegerValue(2),
2212 "BK_MaxAmsduSize",
2213 UintegerValue(0),
2214 "BK_MaxAmpduSize",
2216 /* setting blockack threshold for sta's BK queue */
2217 "BK_BlockAckThreshold",
2218 UintegerValue(2),
2219 "VI_MaxAmsduSize",
2220 UintegerValue(0),
2221 "VI_MaxAmpduSize",
2223 /* setting blockack threshold for sta's VI queue */
2224 "VI_BlockAckThreshold",
2225 UintegerValue(2),
2226 "VO_MaxAmsduSize",
2227 UintegerValue(0),
2228 "VO_MaxAmpduSize",
2230 /* setting blockack threshold for sta's VO queue */
2231 "VO_BlockAckThreshold",
2232 UintegerValue(2),
2233 "ActiveProbing",
2234 BooleanValue(false));
2235
2236 m_staDevices = wifi.Install(phy, mac, wifiOldStaNodes);
2237
2240 m_staDevices = NetDeviceContainer(m_staDevices, wifi.Install(phy, mac, wifiNewStaNodes));
2241
2242 if (m_channelWidth < MHz_u{320})
2243 {
2244 // create a listening VHT station
2245 wifi.SetStandard(WIFI_STANDARD_80211ac);
2246 wifi.Install(phy, mac, CreateObject<Node>());
2247 }
2248
2251
2252 mac.SetType("ns3::ApWifiMac", "BeaconGeneration", BooleanValue(true));
2253 mac.SetMultiUserScheduler(
2254 "ns3::TestMultiUserScheduler",
2255 "ModulationClass",
2257 // request channel access at 1.5s
2258 "AccessReqInterval",
2259 TimeValue(Seconds(1.5)),
2260 "DelayAccessReqUponAccess",
2261 BooleanValue(false),
2262 "DefaultTbPpduDuration",
2264 mac.SetProtectionManager("ns3::WifiDefaultProtectionManager",
2265 "EnableMuRts",
2266 BooleanValue(true),
2267 "SkipMuRtsBeforeBsrp",
2269 mac.SetAckManager("ns3::WifiDefaultAckManager",
2270 "DlMuAckSequenceType",
2272 mac.SetFrameExchangeManager("ProtectedIfResponded",
2274 "ContinueTxopAfterBsrp",
2276
2277 m_apDevice = DynamicCast<WifiNetDevice>(wifi.Install(phy, mac, wifiApNode).Get(0));
2278
2279 // Assign fixed streams to random variables in use
2280 streamNumber += WifiHelper::AssignStreams(NetDeviceContainer(m_apDevice), streamNumber);
2281 streamNumber += WifiHelper::AssignStreams(m_staDevices, streamNumber);
2282
2283 MobilityHelper mobility;
2285
2286 positionAlloc->Add(Vector(0.0, 0.0, 0.0));
2287 positionAlloc->Add(Vector(1.0, 0.0, 0.0));
2288 positionAlloc->Add(Vector(0.0, 1.0, 0.0));
2289 positionAlloc->Add(Vector(-1.0, 0.0, 0.0));
2290 positionAlloc->Add(Vector(-1.0, -1.0, 0.0));
2291 mobility.SetPositionAllocator(positionAlloc);
2292
2293 mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel");
2294 mobility.Install(wifiApNode);
2295 mobility.Install(wifiStaNodes);
2296
2298 for (uint32_t i = 0; i < allDevices.GetN(); i++)
2299 {
2300 auto dev = DynamicCast<WifiNetDevice>(allDevices.Get(i));
2301 // set the same TXOP limit on all ACs
2302 dev->GetMac()->GetQosTxop(AC_BE)->SetTxopLimit(MicroSeconds(m_txopLimit));
2303 dev->GetMac()->GetQosTxop(AC_BK)->SetTxopLimit(MicroSeconds(m_txopLimit));
2304 dev->GetMac()->GetQosTxop(AC_VI)->SetTxopLimit(MicroSeconds(m_txopLimit));
2305 dev->GetMac()->GetQosTxop(AC_VO)->SetTxopLimit(MicroSeconds(m_txopLimit));
2306 // set the same AIFSN on all ACs (just to be able to check inter-frame spaces)
2307 dev->GetMac()->GetQosTxop(AC_BE)->SetAifsn(3);
2308 dev->GetMac()->GetQosTxop(AC_BK)->SetAifsn(3);
2309 dev->GetMac()->GetQosTxop(AC_VI)->SetAifsn(3);
2310 dev->GetMac()->GetQosTxop(AC_VO)->SetAifsn(3);
2311 }
2312
2313 PacketSocketHelper packetSocket;
2314 packetSocket.Install(wifiApNode);
2315 packetSocket.Install(wifiStaNodes);
2316
2317 // DL Traffic
2318 for (uint16_t i = 0; i < m_nStations; i++)
2319 {
2320 PacketSocketAddress socket;
2321 socket.SetSingleDevice(m_apDevice->GetIfIndex());
2322 socket.SetPhysicalAddress(m_staDevices.Get(i)->GetAddress());
2323 socket.SetProtocol(1);
2324
2325 // the first client application generates two packets in order
2326 // to trigger the establishment of a Block Ack agreement
2328 client1->SetAttribute("PacketSize", UintegerValue(1400));
2329 client1->SetAttribute("MaxPackets", UintegerValue(2));
2330 client1->SetAttribute("Interval", TimeValue(MicroSeconds(0)));
2331 client1->SetAttribute("Priority", UintegerValue(i * 2)); // 0, 2, 4 and 6
2332 client1->SetRemote(socket);
2333 wifiApNode.Get(0)->AddApplication(client1);
2334 client1->SetStartTime(Seconds(1) + i * MilliSeconds(1));
2335 client1->SetStopTime(Seconds(2));
2336
2337 // the second client application generates the selected number of packets,
2338 // which are sent in DL MU PPDUs.
2340 client2->SetAttribute("PacketSize", UintegerValue(1400 + i * 100));
2341 client2->SetAttribute("MaxPackets", UintegerValue(m_nPktsPerSta));
2342 client2->SetAttribute("Interval", TimeValue(MicroSeconds(0)));
2343 client2->SetAttribute("Priority", UintegerValue(i * 2)); // 0, 2, 4 and 6
2344 client2->SetRemote(socket);
2345 wifiApNode.Get(0)->AddApplication(client2);
2346 client2->SetStartTime(Seconds(1.5003));
2347 client2->SetStopTime(Seconds(2.5));
2348
2350 server->SetLocal(socket);
2351 wifiStaNodes.Get(i)->AddApplication(server);
2352 server->SetStartTime(Seconds(0));
2353 server->SetStopTime(Seconds(3));
2354 }
2355
2356 // UL Traffic
2357 for (uint16_t i = 0; i < m_nStations; i++)
2358 {
2359 m_sockets[i].SetSingleDevice(m_staDevices.Get(i)->GetIfIndex());
2360 m_sockets[i].SetPhysicalAddress(m_apDevice->GetAddress());
2361 m_sockets[i].SetProtocol(1);
2362
2363 // the first client application generates two packets in order
2364 // to trigger the establishment of a Block Ack agreement
2366 client1->SetAttribute("PacketSize", UintegerValue(1400));
2367 client1->SetAttribute("MaxPackets", UintegerValue(2));
2368 client1->SetAttribute("Interval", TimeValue(MicroSeconds(0)));
2369 client1->SetAttribute("Priority", UintegerValue(i * 2)); // 0, 2, 4 and 6
2370 client1->SetRemote(m_sockets[i]);
2371 wifiStaNodes.Get(i)->AddApplication(client1);
2372 client1->SetStartTime(Seconds(1.005) + i * MilliSeconds(1));
2373 client1->SetStopTime(Seconds(2));
2374
2375 // packets to be included in HE TB PPDUs are generated (by Transmit()) when
2376 // the first Basic Trigger Frame is sent by the AP
2377
2379 server->SetLocal(m_sockets[i]);
2380 wifiApNode.Get(0)->AddApplication(server);
2381 server->SetStartTime(Seconds(0));
2382 server->SetStopTime(Seconds(3));
2383 }
2384
2385 Config::Connect("/NodeList/*/ApplicationList/0/$ns3::PacketSocketServer/Rx",
2387 // Trace PSDUs passed to the PHY on all devices
2388 Config::Connect("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/PhyTxPsduBegin",
2390
2393
2394 CheckResults(m_apDevice->GetMac()->GetWifiPhy()->GetSifs(),
2395 m_apDevice->GetMac()->GetWifiPhy()->GetSlot(),
2396 m_apDevice->GetMac()->GetQosTxop(AC_BE)->Txop::GetAifsn());
2397
2399
2400 // Restore the seed and run number that were in effect before this test
2401 Config::SetGlobal("RngSeed", UintegerValue(previousSeed));
2402 Config::SetGlobal("RngRun", UintegerValue(previousRun));
2403}
2404
2405/**
2406 * @ingroup wifi-test
2407 * @ingroup tests
2408 *
2409 * @brief wifi MAC OFDMA Test Suite
2410 */
2412{
2413 public:
2415};
2416
2418 : TestSuite("wifi-mac-ofdma", Type::UNIT)
2419{
2420 using MuEdcaParams = std::initializer_list<OfdmaAckSequenceTest::MuEdcaParameterSet>;
2421 using ChannelWidths = std::initializer_list<std::pair<MHz_u, MHz_u>>;
2422
2423 for (auto& muEdcaParameterSet : MuEdcaParams{{0, 0, 0, 0}, /* no MU EDCA */
2424 {0, 127, 2047, 100}, /* EDCA disabled */
2425 {10, 127, 2047, 100} /* worse parameters */})
2426 {
2427 for (const auto scenario :
2429 {
2430 // limit test to 2 channel widths per TXOP limit combination
2431 for (const auto& [chWidth1, chWidth2] : ChannelWidths{{MHz_u{20}, MHz_u{40}},
2432 {MHz_u{80}, MHz_u{160}},
2433 {MHz_u{320}, MHz_u{320}}})
2434 {
2435 if ((chWidth1 > MHz_u{160}) && (scenario < WifiOfdmaScenario::EHT))
2436 {
2437 continue;
2438 }
2441 {.channelWidth = chWidth1,
2443 .maxAmpduSize = 10000,
2444 .txopLimit = 5632,
2445 .continueTxopAfterBsrp = false, // unused because non-zero TXOP limit
2446 .skipMuRtsBeforeBsrp = true,
2447 .protectedIfResponded = false,
2448 .nPktsPerSta = 15,
2449 .muEdcaParameterSet = muEdcaParameterSet,
2450 .scenario = scenario}),
2454 {.channelWidth = chWidth1,
2456 .maxAmpduSize = 10000,
2457 .txopLimit = 5632,
2458 .continueTxopAfterBsrp = false, // unused because non-zero TXOP limit
2459 .skipMuRtsBeforeBsrp = false,
2460 .protectedIfResponded = false,
2461 .nPktsPerSta = 15,
2462 .muEdcaParameterSet = muEdcaParameterSet,
2463 .scenario = scenario}),
2467 {.channelWidth = chWidth1,
2469 .maxAmpduSize = 10000,
2470 .txopLimit = 5632,
2471 .continueTxopAfterBsrp = false, // unused because non-zero TXOP limit
2472 .skipMuRtsBeforeBsrp = true,
2473 .protectedIfResponded = true,
2474 .nPktsPerSta = 15,
2475 .muEdcaParameterSet = muEdcaParameterSet,
2476 .scenario = scenario}),
2479 {.channelWidth = chWidth2,
2481 .maxAmpduSize = 10000,
2482 .txopLimit = 0,
2483 .continueTxopAfterBsrp = true,
2484 .skipMuRtsBeforeBsrp = false,
2485 .protectedIfResponded = false,
2486 .nPktsPerSta = 15,
2487 .muEdcaParameterSet = muEdcaParameterSet,
2488 .scenario = scenario}),
2491 new OfdmaAckSequenceTest({.channelWidth = chWidth2,
2493 .maxAmpduSize = 10000,
2494 .txopLimit = 0,
2495 .continueTxopAfterBsrp = false,
2496 .skipMuRtsBeforeBsrp = true,
2497 .protectedIfResponded = false,
2498 .nPktsPerSta = 15,
2499 .muEdcaParameterSet = muEdcaParameterSet,
2500 .scenario = scenario}),
2503 new OfdmaAckSequenceTest({.channelWidth = chWidth2,
2505 .maxAmpduSize = 10000,
2506 .txopLimit = 0,
2507 .continueTxopAfterBsrp = true,
2508 .skipMuRtsBeforeBsrp = false,
2509 .protectedIfResponded = true,
2510 .nPktsPerSta = 15,
2511 .muEdcaParameterSet = muEdcaParameterSet,
2512 .scenario = scenario}),
2514 }
2515 }
2516 }
2517}
2518
Test OFDMA acknowledgment sequences.
OfdmaAckSequenceTest(const Params &params)
Constructor.
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
bool m_protectedIfResponded
A STA is considered protected if responded to previous frame.
Time m_edcaDisabledStartTime
time when disabling EDCA started
uint16_t m_flushed
number of DL packets flushed after DL MU PPDU
uint8_t m_muRtsRuAllocation
B7-B1 of RU Allocation subfield of MU-RTS.
void Transmit(std::string context, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when FrameExchangeManager passes PSDUs to the PHY.
static constexpr uint16_t m_muTimerRes
MU timer resolution in usec.
uint16_t m_received
number of packets received by the stations
void CheckResults(Time sifs, Time slotTime, uint8_t aifsn)
Check correctness of transmitted frames.
MHz_u m_channelWidth
PHY channel bandwidth.
WifiAcknowledgment::Method m_dlMuAckType
DL MU ack sequence type.
bool m_ulPktsGenerated
whether UL packets for HE TB PPDUs have been generated
uint16_t m_nPktsPerSta
number of packets to send to each station
NetDeviceContainer m_staDevices
stations' devices
std::vector< PacketSocketAddress > m_sockets
packet socket addresses for STAs
uint16_t m_txopLimit
TXOP limit in microseconds.
void DoRun() override
Implementation to actually run this TestCase.
void L7Receive(std::string context, Ptr< const Packet > p, const Address &addr)
Function to trace packets received by the server application.
WifiOfdmaScenario m_scenario
OFDMA scenario to test.
uint32_t m_maxAmpduSize
maximum A-MPDU size in bytes
Ptr< WifiNetDevice > m_apDevice
AP's device.
std::vector< uint32_t > m_cwValues
CW used by stations after MU exchange.
void TraceCw(uint32_t staIndex, uint32_t cw, uint8_t)
Function to trace CW value used by the given station after the MU exchange.
WifiPreamble m_tbPreamble
expected preamble type for TB PPDUs
uint16_t m_nStations
number of stations
bool m_skipMuRtsBeforeBsrp
whether to skip MU-RTS before BSRP TF
MuEdcaParameterSet m_muEdcaParameterSet
MU EDCA Parameter Set.
bool m_continueTxopAfterBsrp
whether to continue TXOP after BSRP TF when TXOP limit is zero
const Time m_defaultTbPpduDuration
default TB PPDU duration
WifiPreamble m_dlMuPreamble
expected preamble type for DL MU PPDUs
Dummy Multi User Scheduler used to test OFDMA ack sequences.
WifiPsduMap m_psduMap
the DL MU PPDU to transmit
TxFormat m_txFormat
the format of next transmission
WifiModulationClass m_modClass
modulation class for DL MU PPDUs and TB PPDUs
WifiTxVector m_txVector
the TX vector for MU PPDUs
UlMuInfo ComputeUlMuInfo() override
Prepare the information required to solicit an UL MU transmission.
TriggerFrameType m_ulTriggerType
Trigger Frame type for UL MU.
WifiTxParameters m_txParams
TX parameters.
TxFormat SelectTxFormat() override
Select the format of the next transmission.
void ComputeWifiTxVector()
Compute the TX vector to use for MU PPDUs.
static TypeId GetTypeId()
Get the type ID.
WifiMacHeader m_triggerHdr
MAC header for Trigger Frame.
CtrlTriggerHeader m_trigger
Trigger Frame to send.
DlMuInfo ComputeDlMuInfo() override
Compute the information required to perform a DL MU transmission.
wifi MAC OFDMA Test Suite
a polymophic address class
Definition address.h:114
Headers for BlockAck response.
std::size_t GetNPerAidTidInfoSubfields() const
For Multi-STA Block Acks, get the number of Per AID TID Info subfields included in this Block Ack.
uint8_t GetTidInfo(std::size_t index=0) const
For Block Ack variants other than Multi-STA Block Ack, get the TID_INFO subfield of the BA Control fi...
bool GetAckType(std::size_t index) const
For Multi-STA Block Acks, get the Ack Type subfield of the Per AID TID Info subfield identified by th...
Headers for Trigger frames.
bool IsBasic() const
Check if this is a Basic Trigger frame.
bool IsMuRts() const
Check if this is a MU-RTS Trigger frame.
bool IsBsrp() const
Check if this is a Buffer Status Report Poll Trigger frame.
std::size_t GetNUserInfoFields() const
Get the number of User Info fields in this Trigger Frame.
RU Specification.
Definition eht-ru.h:35
static std::pair< bool, bool > GetPrimaryFlags(MHz_u bw, RuType ruType, std::size_t phyIndex, uint8_t p20Index)
Get the primary flags of a given RU transmitted in a PPDU.
Definition eht-ru.cc:912
static std::size_t GetIndexIn80MHzSegment(MHz_u bw, RuType ruType, std::size_t phyIndex)
Get the index of a given RU transmitted in a PPDU within its 80 MHz segment.
Definition eht-ru.cc:945
Hold variables of type enum.
Definition enum.h:52
static std::pair< uint16_t, Time > ConvertHeTbPpduDurationToLSigLength(Time ppduDuration, const WifiTxVector &txVector, WifiPhyBand band)
Compute the L-SIG length value corresponding to the given HE TB PPDU duration.
Definition he-phy.cc:263
RU Specification.
Definition he-ru.h:38
static std::size_t GetIndexIn80MHzSegment(MHz_u bw, RuType ruType, std::size_t phyIndex)
Get the index of a given RU transmitted in a PPDU within its 80 MHz segment.
Definition he-ru.cc:475
static bool GetPrimary80MHzFlag(MHz_u bw, RuType ruType, std::size_t phyIndex, uint8_t p20Index)
Get the primary 80 MHz flag of a given RU transmitted in a PPDU.
Definition he-ru.cc:462
an EUI-48 address
static Mac48Address GetBroadcast()
Helper class used to assign positions and mobility models to nodes.
Ptr< ApWifiMac > m_apMac
the AP wifi MAC
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager(uint8_t linkId) const
Get the station manager attached to the AP on the given link.
uint32_t GetMaxSizeOfQosNullAmpdu(const CtrlTriggerHeader &trigger) const
Get the maximum size in bytes among the A-MPDUs containing QoS Null frames and solicited by the given...
MHz_u m_allowedWidth
the allowed width for the current transmission
Ptr< HeFrameExchangeManager > GetHeFem(uint8_t linkId) const
Get the HE Frame Exchange Manager attached to the AP on the given link.
TxFormat
Enumeration of the possible transmission formats.
std::optional< Time > m_availableTime
the limit on the time available for frame exchange
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
an address for a packet socket
void SetProtocol(uint16_t protocol)
Set the protocol.
void SetPhysicalAddress(const Address address)
Set the destination address.
void SetSingleDevice(uint32_t device)
Set the address to match only a specified NetDevice.
Give ns3::PacketSocket powers to ns3::Node.
void Install(Ptr< Node > node) const
Aggregate an instance of a ns3::PacketSocketFactory onto the provided node.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
static uint64_t GetRun()
Get the current run number.
static uint32_t GetSeed()
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:125
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
static void Run()
Run the simulation.
Definition simulator.cc:161
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:169
Make it easy to create and manage PHY objects for the spectrum model.
The IEEE 802.11 SSID Information Element.
Definition ssid.h:27
AttributeValue implementation for Ssid.
Definition ssid.h:98
Hold variables of type string.
Definition string.h:45
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:296
@ QUICK
Fast test.
Definition test.h:1057
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
Type
Type of test.
Definition test.h:1271
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Definition test.cc:494
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
a unique identifier for an interface.
Definition type-id.h:50
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1003
Hold an unsigned integer type.
Definition uinteger.h:34
static WifiMode GetVhtMcs5()
helps to create WifiNetDevice objects
static int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by the PHY and MAC aspects ...
Implements the IEEE 802.11 MAC header.
uint8_t GetQosTid() const
Return the Traffic ID of a QoS header.
virtual WifiMacType GetType() const
Return the type (WifiMacType).
Mac48Address GetAddr2() const
Return the address in the Address 2 field.
create MAC layers for a ns3::WifiNetDevice.
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition wifi-phy.cc:1574
std::variant< HeRu::RuSpec, EhtRu::RuSpec > RuSpec
variant of the RU specification
Definition wifi-ru.h:28
This class stores the TX parameters (TX vector, protection mechanism, acknowledgment mechanism,...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetGuardInterval(Time guardInterval)
Sets the guard interval duration.
WifiPreamble GetPreambleType() const
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
STL class.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition callback.h:690
void SetGlobal(std::string name, const AttributeValue &value)
Definition config.cc:928
void SetDefault(std::string name, const AttributeValue &value)
Definition config.cc:886
void Connect(std::string path, const CallbackBase &cb)
Definition config.cc:966
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition abort.h:38
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition abort.h:99
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:201
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:267
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:274
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:627
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:492
#define NS_TEST_EXPECT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to limit and report if not.
Definition test.h:985
#define NS_TEST_EXPECT_MSG_LT_OR_EQ(actual, limit, msg)
Test that an actual value is less than or equal to a limit and report if not.
Definition test.h:819
#define NS_TEST_EXPECT_MSG_LT(actual, limit, msg)
Test that an actual value is less than a limit and report if not.
Definition test.h:779
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
Definition test.h:655
#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:240
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort if not.
Definition test.h:904
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1347
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1364
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1313
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1330
WifiOfdmaScenario
The scenarios.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:64
TriggerFrameType
The different Trigger frame types.
@ WIFI_STANDARD_80211be
@ WIFI_STANDARD_80211ax
@ WIFI_STANDARD_80211ac
@ WIFI_PREAMBLE_EHT_TB
@ WIFI_PREAMBLE_HE_TB
@ WIFI_PREAMBLE_EHT_MU
@ WIFI_PREAMBLE_HE_MU
@ WIFI_PHY_BAND_6GHZ
The 6 GHz band.
@ WIFI_PHY_BAND_5GHZ
The 5 GHz band.
@ WIFI_MOD_CLASS_EHT
EHT (Clause 36).
@ WIFI_MOD_CLASS_HE
HE (Clause 27).
@ AC_BE
Best Effort.
Definition qos-utils.h:66
@ AC_VO
Voice.
Definition qos-utils.h:72
@ AC_VI
Video.
Definition qos-utils.h:70
@ AC_BK
Background.
Definition qos-utils.h:68
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetPpduMaxTime(WifiPreamble preamble)
Get the maximum PPDU duration (see Section 10.14 of 802.11-2016) for the PHY layers defining the aPPD...
RuType
The different Resource Unit (RU) types.
Definition wifi-types.h:286
double MHz_u
MHz weak type.
Definition wifi-units.h:31
Ptr< const AttributeChecker > MakeEnumChecker(T v, std::string n, Ts... args)
Make an EnumChecker pre-configured with a set of allowed values by name.
Definition enum.h:181
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Definition ptr.h:643
std::unordered_map< uint16_t, Ptr< WifiPsdu > > WifiPsduMap
Map of PSDUs indexed by STA-ID.
Definition wifi-mac.h:105
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
Definition wifi-utils.h:307
@ WIFI_MAC_CTL_TRIGGER
@ WIFI_MAC_CTL_CTS
@ WIFI_MAC_QOSDATA_NULL
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:39
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU).
Ptr< const AttributeAccessor > MakeEnumAccessor(T1 a1)
Definition enum.h:223
bool IsEht(WifiPreamble preamble)
Return true if a preamble corresponds to an EHT transmission.
STL namespace.
Information about transmitted frames.
WifiConstPsduMap psduMap
transmitted PSDU map
uint8_t muAifsn
MU AIFS (0 to disable EDCA).
uint8_t muTimer
MU EDCA Timer in units of 8192 microseconds (0 not to use MU EDCA).
Parameters for the OFDMA acknowledgment sequences test.
bool protectedIfResponded
A STA is considered protected if responded to previous frame.
bool continueTxopAfterBsrp
whether to continue TXOP after BSRP TF when TXOP limit is 0
uint16_t txopLimit
TXOP limit in microseconds.
uint16_t nPktsPerSta
number of packets to send to each station
WifiAcknowledgment::Method dlMuAckType
DL MU ack sequence type.
MuEdcaParameterSet muEdcaParameterSet
MU EDCA Parameter Set.
MHz_u channelWidth
PHY channel bandwidth.
uint32_t maxAmpduSize
maximum A-MPDU size in bytes
bool skipMuRtsBeforeBsrp
whether to skip MU-RTS before BSRP TF
WifiOfdmaScenario scenario
OFDMA scenario to test.
Information to be provided in case of DL MU transmission.
Information to be provided in case of UL MU transmission.
Method
Available acknowledgment methods.
static WifiMacOfdmaTestSuite g_wifiMacOfdmaTestSuite
the test suite