A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-mlo-test.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 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#ifndef WIFI_MLO_TEST_H
10#define WIFI_MLO_TEST_H
11
12#include "ns3/ap-wifi-mac.h"
13#include "ns3/frame-exchange-manager.h"
14#include "ns3/mgt-action-headers.h"
15#include "ns3/mgt-headers.h"
16#include "ns3/multi-model-spectrum-channel.h"
17#include "ns3/packet-socket-client.h"
18#include "ns3/packet-socket-server.h"
19#include "ns3/qos-utils.h"
20#include "ns3/spectrum-wifi-helper.h"
21#include "ns3/sta-wifi-mac.h"
22#include "ns3/test.h"
23#include "ns3/wifi-psdu.h"
24
25#include <optional>
26#include <vector>
27
28using namespace ns3;
29
30/**
31 * \ingroup wifi-test
32 * \ingroup tests
33 *
34 * \brief Test the implementation of WifiAssocManager::GetNextAffiliatedAp(), which
35 * searches a given RNR element for APs affiliated to the same AP MLD as the
36 * reporting AP that sent the frame containing the element.
37 */
39{
40 public:
41 /**
42 * Constructor
43 */
45 ~GetRnrLinkInfoTest() override = default;
46
47 private:
48 void DoRun() override;
49};
50
51/**
52 * \ingroup wifi-test
53 * \ingroup tests
54 *
55 * Test the WifiMac::SwapLinks() method.
56 */
58{
59 /**
60 * Test WifiMac subclass used to access the SwapLinks method.
61 */
62 class TestWifiMac : public WifiMac
63 {
64 public:
65 ~TestWifiMac() override = default;
66
67 /// \return the object TypeId
68 static TypeId GetTypeId();
69
72
73 bool CanForwardPacketsTo(Mac48Address to) const override
74 {
75 return true;
76 }
77
78 private:
79 void DoCompleteConfig() override
80 {
81 }
82
83 void Enqueue(Ptr<WifiMpdu> mpdu, Mac48Address to, Mac48Address from) override
84 {
85 }
86 };
87
88 /**
89 * Test FrameExchangeManager subclass to access m_linkId
90 */
92 {
93 public:
94 /// \return the link ID stored by this object
95 uint8_t GetLinkId() const
96 {
97 return m_linkId;
98 }
99 };
100
101 public:
103 ~MldSwapLinksTest() override = default;
104
105 protected:
106 void DoRun() override;
107
108 private:
109 /**
110 * Run a single test case.
111 *
112 * \param text string identifying the test case
113 * \param nLinks the number of links of the MLD
114 * \param links a set of pairs (from, to) each mapping a current link ID to the
115 * link ID it has to become (i.e., link 'from' becomes link 'to')
116 * \param expected maps each link ID to the id of the PHY that is expected
117 * to operate on that link after the swap
118 */
119 void RunOne(std::string text,
120 std::size_t nLinks,
121 const std::map<uint8_t, uint8_t>& links,
122 const std::map<uint8_t, uint8_t>& expected);
123};
124
125/**
126 * \ingroup wifi-test
127 * \ingroup tests
128 *
129 * Test that the AIDs that an AP MLD assigns to SLDs and MLDs are all unique.
130 */
132{
133 public:
134 /**
135 * Constructor.
136 *
137 * \param linkIds A vector specifying the set of link IDs each STA will setup
138 */
139 AidAssignmentTest(const std::vector<std::set<uint8_t>>& linkIds);
140
141 private:
142 void DoSetup() override;
143 void DoRun() override;
144
145 /**
146 * Set the SSID on the next station that needs to start the association procedure.
147 * This method is triggered every time a STA completes its association.
148 *
149 * \param staMac the MAC of the STA that completed association
150 */
151 void SetSsid(Ptr<StaWifiMac> staMac, Mac48Address /* apAddr */);
152
153 const std::vector<std::string> m_linkChannels; //!< channels for all AP links
154 const std::vector<std::set<uint8_t>> m_linkIds; //!< link IDs for all non-AP STAs/MLDs
155 NetDeviceContainer m_staDevices; //!< non-AP STAs/MLDs devices
156 uint16_t m_expectedAid; //!< expected AID for current non-AP STA/MLD
157};
158
159/**
160 * \ingroup wifi-test
161 * \ingroup tests
162 *
163 * \brief Base class for Multi-Link Operations tests
164 *
165 * Three spectrum channels are created, one for each band (2.4 GHz, 5 GHz and 6 GHz).
166 * Each PHY object is attached to the spectrum channel corresponding to the PHY band
167 * in which it is operating.
168 */
170{
171 public:
172 /**
173 * Configuration parameters common to all subclasses
174 */
176 {
177 std::vector<std::string>
178 staChannels; //!< the strings specifying the operating channels for the non-AP MLD
179 std::vector<std::string>
180 apChannels; //!< the strings specifying the operating channels for the AP MLD
181 std::vector<uint8_t>
182 fixedPhyBands; //!< list of IDs of non-AP MLD PHYs that cannot switch band
183 };
184
185 /**
186 * Constructor
187 *
188 * \param name The name of the new TestCase created
189 * \param nStations the number of stations to create
190 * \param baseParams common configuration parameters
191 */
192 MultiLinkOperationsTestBase(const std::string& name,
193 uint8_t nStations,
194 const BaseParams& baseParams);
195 ~MultiLinkOperationsTestBase() override = default;
196
197 protected:
198 /**
199 * Callback invoked when a FEM passes PSDUs to the PHY.
200 *
201 * \param mac the MAC transmitting the PSDUs
202 * \param phyId the ID of the PHY transmitting the PSDUs
203 * \param psduMap the PSDU map
204 * \param txVector the TX vector
205 * \param txPowerW the tx power in Watts
206 */
207 virtual void Transmit(Ptr<WifiMac> mac,
208 uint8_t phyId,
209 WifiConstPsduMap psduMap,
210 WifiTxVector txVector,
211 double txPowerW);
212
213 /**
214 * Check that the expected Capabilities information elements are present in the given
215 * management frame based on the band in which the given link is operating.
216 *
217 * \param mpdu the given management frame
218 * \param mac the MAC transmitting the management frame
219 * \param phyId the ID of the PHY transmitting the management frame
220 */
221 void CheckCapabilities(Ptr<WifiMpdu> mpdu, Ptr<WifiMac> mac, uint8_t phyId);
222
223 /**
224 * Function to trace packets received by the server application
225 * \param nodeId the ID of the node that received the packet
226 * \param p the packet
227 * \param addr the address
228 */
229 virtual void L7Receive(uint8_t nodeId, Ptr<const Packet> p, const Address& addr);
230
231 /**
232 * \param sockAddr the packet socket address identifying local outgoing interface
233 * and remote address
234 * \param count the number of packets to generate
235 * \param pktSize the size of the packets to generate
236 * \param delay the delay with which traffic generation starts
237 * \param priority user priority for generated packets
238 * \return an application generating the given number packets of the given size destined
239 * to the given packet socket address
240 */
242 std::size_t count,
243 std::size_t pktSize,
244 Time delay = Seconds(0),
245 uint8_t priority = 0) const;
246
247 void DoSetup() override;
248
249 /// PHY band-indexed map of spectrum channels
250 using ChannelMap = std::map<FrequencyRange, Ptr<MultiModelSpectrumChannel>>;
251
252 /**
253 * Uplink or Downlink direction
254 */
256 {
257 DL = 0,
258 UL
259 };
260
261 /**
262 * Check that the Address 1 and Address 2 fields of the given PSDU contain device MAC addresses.
263 *
264 * \param psdu the given PSDU
265 * \param direction indicates direction for management frames (DL or UL)
266 */
268 std::optional<Direction> direction = std::nullopt);
269
270 /// Information about transmitted frames
272 {
273 Time startTx; ///< TX start time
274 WifiConstPsduMap psduMap; ///< transmitted PSDU map
275 WifiTxVector txVector; ///< TXVECTOR
276 uint8_t linkId; ///< link ID
277 uint8_t phyId; ///< ID of the transmitting PHY
278 };
279
280 std::vector<FrameInfo> m_txPsdus; ///< transmitted PSDUs
281 const std::vector<std::string> m_staChannels; ///< strings specifying channels for STA
282 const std::vector<std::string> m_apChannels; ///< strings specifying channels for AP
283 const std::vector<uint8_t> m_fixedPhyBands; ///< links on non-AP MLD with fixed PHY band
284 Ptr<ApWifiMac> m_apMac; ///< AP wifi MAC
285 std::vector<Ptr<StaWifiMac>> m_staMacs; ///< STA wifi MACs
286 uint8_t m_nStations; ///< number of stations to create
287 uint16_t m_lastAid; ///< AID of last associated station
288 Time m_duration{Seconds(1)}; ///< simulation duration
289 std::vector<std::size_t> m_rxPkts; ///< number of packets received at application layer
290 ///< by each node (index is node ID)
291
292 /**
293 * Reset the given PHY helper, use the given strings to set the ChannelSettings
294 * attribute of the PHY objects to create, and attach them to the given spectrum
295 * channels appropriately.
296 *
297 * \param helper the given PHY helper
298 * \param channels the strings specifying the operating channels to configure
299 * \param channelMap the created spectrum channels
300 */
302 const std::vector<std::string>& channels,
303 const ChannelMap& channelMap);
304
305 /**
306 * Set the SSID on the next station that needs to start the association procedure.
307 * This method is connected to the ApWifiMac's AssociatedSta trace source.
308 * Start generating traffic (if needed) when all stations are associated.
309 *
310 * \param aid the AID assigned to the previous associated STA
311 */
312 void SetSsid(uint16_t aid, Mac48Address /* addr */);
313
314 private:
315 /**
316 * Start the generation of traffic (needs to be overridden)
317 */
318 virtual void StartTraffic()
319 {
320 }
321};
322
323/**
324 * \ingroup wifi-test
325 * \ingroup tests
326 *
327 * \brief Multi-Link Discovery & Setup test.
328 *
329 * This test sets up an AP MLD and a non-AP MLD having a variable number of links.
330 * The RF channels to set each link to are provided as input parameters through the test
331 * case constructor, along with the identifiers (starting at 0) of the links that cannot
332 * switch PHY band (if any). The links that are expected to be setup are also provided as input
333 * parameters. This test verifies that the management frames exchanged during ML discovery
334 * and ML setup contain the expected values and that the two MLDs setup the expected links.
335 *
336 * The negotiated TID-to-link mapping is tested by verifying that generated QoS data frames of
337 * a given TID are transmitted on links which the TID is mapped to. Specifically, the following
338 * operations are performed separately for each direction (downlink and uplink). A first TID
339 * is searched such that it is not mapped on all the setup links. If no such TID is found, only
340 * QoS frames of TID 0 are generated. Otherwise, we also search for a second TID that is mapped
341 * to a link set that is disjoint with the link set to which the first TID is mapped. If such a
342 * TID is found, QoS frames of both the first TID and the second TID are generated; otherwise,
343 * only QoS frames of the first TID are generated. For each TID, a number of QoS frames equal
344 * to the number of setup links is generated. For each TID, we check that the first N QoS frames,
345 * where N is the size of the link set to which the TID is mapped, are transmitted concurrently,
346 * while the following QoS frames are sent after the first QoS frame sent on the same link. We
347 * also check that all the QoS frames are sent on a link belonging to the link set to which the
348 * TID is mapped. If QoS frames of two TIDs are generated, we also check that the first N QoS
349 * frames of a TID, where N is the size of the link set to which that TID is mapped, are sent
350 * concurrently with the first M QoS frames of the other TID, where M is the size of the link
351 * set to which the other TID is mapped.
352 */
354{
355 public:
356 /**
357 * Constructor
358 *
359 * \param baseParams common configuration parameters
360 * \param scanType the scan type (active or passive)
361 * \param setupLinks a list of links that are expected to be setup. In case one of the two
362 * devices has a single link, the ID of the link on the MLD is indicated
363 * \param apNegSupport TID-to-Link Mapping negotiation supported by the AP MLD (0, 1, or 3)
364 * \param dlTidToLinkMapping DL TID-to-Link Mapping for EHT configuration of non-AP MLD
365 * \param ulTidToLinkMapping UL TID-to-Link Mapping for EHT configuration of non-AP MLD
366 * \param support160MHzOp whether non-AP MLDs support 160 MHz operations
367 */
368 MultiLinkSetupTest(const BaseParams& baseParams,
369 WifiScanType scanType,
370 const std::vector<uint8_t>& setupLinks,
372 const std::string& dlTidToLinkMapping,
373 const std::string& ulTidToLinkMapping,
374 bool support160MHzOp = true);
375 ~MultiLinkSetupTest() override = default;
376
377 protected:
378 void DoSetup() override;
379 void DoRun() override;
380
381 private:
382 void StartTraffic() override;
383
384 /**
385 * Check correctness of Multi-Link Setup procedure.
386 */
387 void CheckMlSetup();
388
389 /**
390 * Check that links that are not setup on the non-AP MLD are disabled. Also, on the AP side,
391 * check that the queue storing QoS data frames destined to the non-AP MLD has a mask for a
392 * link if and only if the link has been setup by the non-AO MLD.
393 */
394 void CheckDisabledLinks();
395
396 /**
397 * Check correctness of the given Beacon frame.
398 *
399 * \param mpdu the given Beacon frame
400 * \param linkId the ID of the link on which the Beacon frame was transmitted
401 */
402 void CheckBeacon(Ptr<WifiMpdu> mpdu, uint8_t linkId);
403
404 /**
405 * Check correctness of the given Probe Response frame.
406 *
407 * \param mpdu the given Probe Response frame
408 * \param linkId the ID of the link on which the Probe Response frame was transmitted
409 */
410 void CheckProbeResponse(Ptr<WifiMpdu> mpdu, uint8_t linkId);
411
412 /**
413 * Check correctness of the given Association Request frame.
414 *
415 * \param mpdu the given Association Request frame
416 * \param linkId the ID of the link on which the Association Request frame was transmitted
417 */
418 void CheckAssocRequest(Ptr<WifiMpdu> mpdu, uint8_t linkId);
419
420 /**
421 * Check correctness of the given Association Response frame.
422 *
423 * \param mpdu the given Association Response frame
424 * \param linkId the ID of the link on which the Association Response frame was transmitted
425 */
426 void CheckAssocResponse(Ptr<WifiMpdu> mpdu, uint8_t linkId);
427
428 /**
429 * Check that QoS data frames are sent on links their TID is mapped to and with the
430 * correct TX width.
431 *
432 * \param mpdu the given QoS data frame
433 * \param txvector the TXVECTOR used to send the QoS data frame
434 * \param linkId the ID of the link on which the QoS data frame was transmitted
435 * \param index index of the QoS data frame in the vector of transmitted PSDUs
436 */
437 void CheckQosData(Ptr<WifiMpdu> mpdu,
438 const WifiTxVector& txvector,
439 uint8_t linkId,
440 std::size_t index);
441
442 const std::vector<uint8_t> m_setupLinks; //!< IDs of the expected links to setup
443 WifiScanType m_scanType; //!< the scan type (active or passive)
444 std::size_t m_nProbeResp; //!< number of Probe Responses received by the non-AP MLD
446 m_apNegSupport; //!< TID-to-Link Mapping negotiation supported by the AP MLD
447 std::string m_dlTidLinkMappingStr; //!< DL TID-to-Link Mapping for non-AP MLD EHT configuration
448 std::string m_ulTidLinkMappingStr; //!< UL TID-to-Link Mapping for non-AP MLD EHT configuration
449 WifiTidLinkMapping m_dlTidLinkMapping; //!< expected DL TID-to-Link Mapping requested by non-AP
450 //!< MLD and accepted by AP MLD
451 WifiTidLinkMapping m_ulTidLinkMapping; //!< expected UL TID-to-Link Mapping requested by non-AP
452 //!< MLD and accepted by AP MLD
453 uint8_t m_dlTid1; //!< the TID of the first set of DL QoS data frames
454 uint8_t m_ulTid1; //!< the TID of the first set of UL QoS data frames
455 std::optional<uint8_t> m_dlTid2; //!< the TID of the optional set of DL QoS data frames
456 std::optional<uint8_t> m_ulTid2; //!< the TID of the optional set of UL QoS data frames
457 std::vector<std::size_t>
458 m_qosFrames1; //!< indices of QoS frames of the first set in the vector of TX PSDUs
459 std::vector<std::size_t>
460 m_qosFrames2; //!< indices of QoS frames of the optional set in the vector of TX PSDUs
461 bool m_support160MHzOp; //!< whether non-AP MLDs support 160 MHz operations
462};
463
464/**
465 * Tested traffic patterns.
466 */
467enum class WifiTrafficPattern : uint8_t
468{
469 STA_TO_STA = 0,
470 STA_TO_AP,
471 AP_TO_STA,
474};
475
476/**
477 * Block Ack agreement enabled/disabled
478 */
479enum class WifiBaEnabled : uint8_t
480{
481 NO = 0,
482 YES
483};
484
485/**
486 * Whether to send a BlockAckReq after a missed BlockAck
487 */
488enum class WifiUseBarAfterMissedBa : uint8_t
489{
490 NO = 0,
491 YES
492};
493
494/**
495 * \ingroup wifi-test
496 * \ingroup tests
497 *
498 * \brief Test data transmission between two MLDs.
499 *
500 * This test sets up an AP MLD and two non-AP MLDs having a variable number of links.
501 * The RF channels to set each link to are provided as input parameters through the test
502 * case constructor, along with the identifiers (starting at 0) of the links that cannot
503 * switch PHY band (if any). This test aims at veryfing the successful transmission of both
504 * unicast QoS data frames (from one station to another, from one station to the AP, from
505 * the AP to the station) and broadcast QoS data frames (from the AP or from one station).
506 * In the scenarios in which the AP forwards frames (i.e., from one station to another and
507 * from one station to broadcast) the client application generates only 4 packets, in order
508 * to limit the probability of collisions. In the other scenarios, 8 packets are generated.
509 * When BlockAck agreements are enabled, the maximum A-MSDU size is set such that two
510 * packets can be aggregated in an A-MSDU. The MPDU with sequence number equal to 1 is
511 * corrupted (once, by using a post reception error model) to test its successful
512 * re-transmission, unless the traffic scenario is from the AP to broadcast (broadcast frames
513 * are not retransmitted) or is a scenario where the AP forwards frame (to limit the
514 * probability of collisions).
515 *
516 * When BlockAck agreements are enabled, we also corrupt a BlockAck frame, so as to simulate
517 * the case of BlockAck timeout. Both the case where a BlockAckReq is sent and the case where
518 * data frame are retransmitted are tested. Finally, when BlockAck agreements are enabled, we
519 * also enable the concurrent transmission of data frames over two links and check that at
520 * least one MPDU is concurrently transmitted over two links.
521 */
523{
524 public:
525 /**
526 * Constructor
527 *
528 * \param baseParams common configuration parameters
529 * \param trafficPattern the pattern of traffic to generate
530 * \param baEnabled whether BA agreement is enabled or disabled
531 * \param useBarAfterMissedBa whether a BAR or Data frames are sent after missed BlockAck
532 * \param nMaxInflight the max number of links on which an MPDU can be simultaneously inflight
533 * (unused if Block Ack agreements are not established)
534 */
535 MultiLinkTxTest(const BaseParams& baseParams,
536 WifiTrafficPattern trafficPattern,
537 WifiBaEnabled baEnabled,
538 WifiUseBarAfterMissedBa useBarAfterMissedBa,
539 uint8_t nMaxInflight);
540 ~MultiLinkTxTest() override = default;
541
542 protected:
543 /**
544 * Check the content of a received BlockAck frame when the max number of links on which
545 * an MPDU can be inflight is one.
546 *
547 * \param psdu the PSDU containing the BlockAck
548 * \param txVector the TXVECTOR used to transmit the BlockAck
549 * \param linkId the ID of the link on which the BlockAck was transmitted
550 */
551 void CheckBlockAck(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, uint8_t linkId);
552
553 void Transmit(Ptr<WifiMac> mac,
554 uint8_t phyId,
555 WifiConstPsduMap psduMap,
556 WifiTxVector txVector,
557 double txPowerW) override;
558 void DoSetup() override;
559 void DoRun() override;
560
561 private:
562 void StartTraffic() override;
563
564 /// Receiver address-indexed map of list error models
565 using RxErrorModelMap = std::unordered_map<Mac48Address, Ptr<ListErrorModel>, WifiAddressHash>;
566
567 RxErrorModelMap m_errorModels; ///< error rate models to corrupt packets
568 std::list<uint64_t> m_uidList; ///< list of UIDs of packets to corrupt
569 bool m_dataCorrupted{false}; ///< whether second data frame has been already corrupted
570 WifiTrafficPattern m_trafficPattern; ///< the pattern of traffic to generate
571 bool m_baEnabled; ///< whether BA agreement is enabled or disabled
572 bool m_useBarAfterMissedBa; ///< whether to send BAR after missed BlockAck
573 std::size_t m_nMaxInflight; ///< max number of links on which an MPDU can be inflight
574 std::size_t m_nPackets; ///< number of application packets to generate
575 std::size_t m_blockAckCount{0}; ///< transmitted BlockAck counter
576 std::size_t m_blockAckReqCount{0}; ///< transmitted BlockAckReq counter
577 std::map<uint16_t, std::size_t> m_inflightCount; ///< seqNo-indexed max number of simultaneous
578 ///< transmissions of a data frame
579 Ptr<WifiMac> m_sourceMac; ///< MAC of the node sending application packets
580};
581
582/**
583 * Tested MU traffic patterns.
584 */
585enum class WifiMuTrafficPattern : uint8_t
586{
590 UL_MU
591};
592
593/**
594 * \ingroup wifi-test
595 * \ingroup tests
596 *
597 * \brief Test data transmission between MLDs using OFDMA MU transmissions
598 *
599 * This test sets up an AP MLD and two non-AP MLDs having a variable number of links.
600 * The RF channels to set each link to are provided as input parameters through the test
601 * case constructor, along with the identifiers (starting at 0) of the links that cannot
602 * switch PHY band (if any). This test aims at veryfing the successful transmission of both
603 * DL MU and UL MU frames. In the DL MU scenarios, the client applications installed on the
604 * AP generate 8 packets addressed to each of the stations (plus 3 packets to trigger the
605 * establishment of BlockAck agreements). In the UL MU scenario, client applications
606 * installed on the stations generate 4 packets each (plus 3 packets to trigger the
607 * establishment of BlockAck agreements).
608 *
609 * The maximum A-MSDU size is set such that two packets can be aggregated in an A-MSDU.
610 * The MPDU with sequence number equal to 3 is corrupted (by using a post reception error
611 * model) once and for a single station, to test its successful re-transmission.
612 *
613 * Also, we enable the concurrent transmission of data frames over two links and check that at
614 * least one MPDU is concurrently transmitted over two links.
615 */
617{
618 public:
619 /**
620 * Constructor
621 *
622 * \param baseParams common configuration parameters
623 * \param muTrafficPattern the pattern of traffic to generate
624 * \param useBarAfterMissedBa whether a BAR or Data frames are sent after missed BlockAck
625 * \param nMaxInflight the max number of links on which an MPDU can be simultaneously inflight
626 * (unused if Block Ack agreements are not established)
627 */
628 MultiLinkMuTxTest(const BaseParams& baseParams,
629 WifiMuTrafficPattern muTrafficPattern,
630 WifiUseBarAfterMissedBa useBarAfterMissedBa,
631 uint8_t nMaxInflight);
632 ~MultiLinkMuTxTest() override = default;
633
634 protected:
635 /**
636 * Check the content of a received BlockAck frame when the max number of links on which
637 * an MPDU can be inflight is one.
638 *
639 * \param psdu the PSDU containing the BlockAck
640 * \param txVector the TXVECTOR used to transmit the BlockAck
641 * \param linkId the ID of the link on which the BlockAck was transmitted
642 */
643 void CheckBlockAck(Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, uint8_t linkId);
644
645 void Transmit(Ptr<WifiMac> mac,
646 uint8_t phyId,
647 WifiConstPsduMap psduMap,
648 WifiTxVector txVector,
649 double txPowerW) override;
650 void DoSetup() override;
651 void DoRun() override;
652
653 private:
654 void StartTraffic() override;
655
656 /// Receiver address-indexed map of list error models
657 using RxErrorModelMap = std::unordered_map<Mac48Address, Ptr<ListErrorModel>, WifiAddressHash>;
658
659 /// A pair of a MAC address (the address of the receiver for DL frames and the address of
660 /// the sender for UL frames) and a sequence number identifying a transmitted QoS data frame
661 using AddrSeqNoPair = std::pair<Mac48Address, uint16_t>;
662
663 RxErrorModelMap m_errorModels; ///< error rate models to corrupt packets
664 std::list<uint64_t> m_uidList; ///< list of UIDs of packets to corrupt
665 std::optional<Mac48Address> m_dataCorruptedSta; ///< MAC address of the station that received
666 ///< MPDU with SeqNo=2 corrupted
667 bool m_waitFirstTf{true}; ///< whether we are waiting for the first Basic Trigger Frame
668 WifiMuTrafficPattern m_muTrafficPattern; ///< the pattern of traffic to generate
669 bool m_useBarAfterMissedBa; ///< whether to send BAR after missed BlockAck
670 std::size_t m_nMaxInflight; ///< max number of links on which an MPDU can be inflight
671 std::vector<PacketSocketAddress> m_sockets; ///< packet socket addresses for STAs
672 std::size_t m_nPackets; ///< number of application packets to generate
673 std::size_t m_blockAckCount{0}; ///< transmitted BlockAck counter
674 std::size_t m_tfCount{0}; ///< transmitted Trigger Frame counter
675 // std::size_t m_blockAckReqCount{0}; ///< transmitted BlockAckReq counter
676 std::map<AddrSeqNoPair, std::size_t> m_inflightCount; ///< max number of simultaneous
677 ///< transmissions of each data frame
678 Ptr<WifiMac> m_sourceMac; ///< MAC of the node sending application packets
679};
680
681/**
682 * \ingroup wifi-test
683 * \ingroup tests
684 *
685 * \brief Test release of sequence numbers upon CTS timeout in multi-link operations
686 *
687 * In this test, an AP MLD and a non-AP MLD setup 3 links. Usage of RTS/CTS protection is
688 * enabled for frames whose length is at least 1000 bytes. The AP MLD receives a first set
689 * of 4 packets from the upper layer and sends an RTS frame, which is corrupted at the
690 * receiver, on a first link. When the RTS frame is transmitted, the AP MLD receives another
691 * set of 4 packets, which are transmitted after a successful RTS/CTS exchange on a second
692 * link. In the meantime, a new RTS/CTS exchange is successfully carried out (on the first
693 * link or on the third link) to transmit the first set of 4 packets. When the transmission
694 * of the first set of 4 packets starts, the AP MLD receives the third set of 4 packets from
695 * the upper layer, which are transmitted after a successful RTS/CTS exchange.
696 *
697 * This test checks that sequence numbers are correctly assigned to all the MPDUs carrying data.
698 */
700{
701 public:
704
705 protected:
706 void DoSetup() override;
707 void DoRun() override;
708 void Transmit(Ptr<WifiMac> mac,
709 uint8_t phyId,
710 WifiConstPsduMap psduMap,
711 WifiTxVector txVector,
712 double txPowerW) override;
713
714 private:
715 void StartTraffic() override;
716
717 PacketSocketAddress m_sockAddr; //!< packet socket address
718 std::size_t m_nQosDataFrames; //!< counter for transmitted QoS data frames
719 Ptr<ListErrorModel> m_errorModel; //!< error rate model to corrupt first RTS frame
720 bool m_rtsCorrupted; //!< whether the first RTS frame has been corrupted
721};
722
723/**
724 * \ingroup wifi-test
725 * \ingroup tests
726 *
727 * \brief Test update of BA starting sequence number after ADDBA Response timeout in
728 * multi-link operations
729 *
730 * In this test, an AP MLD and a non-AP MLD setup 2 links. The AP MLD has a QoS data frame to
731 * transmit to the non-AP MLD, which triggers the establishment of a BA agreement. When the ADDBA
732 * Request frame is received by the non-AP MLD, transmissions of the non-AP MLD are blocked to put
733 * the transmission of the ADDBA Response on hold. The goal is to mimic a delay in getting channel
734 * access due to, e.g., other devices grabbing the medium. When the ADDBA Response timer at the AP
735 * MLD expires, transmissions of the non-AP MLD are unblocked, so that the AP MLD sends the QoS data
736 * frame (protected by RTS, but the test works without RTS as well, and using Normal acknowledgment)
737 * on one link and the non-AP MLD sends the ADDBA Response on the other link. The transmission of
738 * the QoS data frame is then corrupted. We verify that:
739 *
740 * - when the AP MLD receives the ADDBA Response, the BA starting sequence number is set to the
741 * sequence number of the QoS data frame which is inflight
742 * - the QoS data frame is retransmitted and received by the non-AP MLD
743 */
745{
746 public:
748
749 private:
750 void DoSetup() override;
751 void DoRun() override;
752 void Transmit(Ptr<WifiMac> mac,
753 uint8_t phyId,
754 WifiConstPsduMap psduMap,
755 WifiTxVector txVector,
756 double txPowerW) override;
757 void StartTraffic() override;
758
759 PacketSocketAddress m_sockAddr; //!< packet socket address
760 std::size_t m_nQosDataCount; //!< counter for transmitted QoS data frames
761 Ptr<ListErrorModel> m_staErrorModel; //!< error rate model to corrupt frames at the non-AP MLD
762};
763
764/**
765 * \ingroup wifi-test
766 * \ingroup tests
767 *
768 * \brief wifi 11be MLD Test Suite
769 */
775
776#endif /* WIFI_MLO_TEST_H */
Test that the AIDs that an AP MLD assigns to SLDs and MLDs are all unique.
AidAssignmentTest(const std::vector< std::set< uint8_t > > &linkIds)
Constructor.
const std::vector< std::set< uint8_t > > m_linkIds
link IDs for all non-AP STAs/MLDs
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void SetSsid(Ptr< StaWifiMac > staMac, Mac48Address)
Set the SSID on the next station that needs to start the association procedure.
void DoRun() override
Implementation to actually run this TestCase.
uint16_t m_expectedAid
expected AID for current non-AP STA/MLD
const std::vector< std::string > m_linkChannels
channels for all AP links
NetDeviceContainer m_staDevices
non-AP STAs/MLDs devices
Test release of sequence numbers upon CTS timeout in multi-link operations.
PacketSocketAddress m_sockAddr
packet socket address
Ptr< ListErrorModel > m_errorModel
error rate model to corrupt first RTS frame
std::size_t m_nQosDataFrames
counter for transmitted QoS data frames
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
bool m_rtsCorrupted
whether the first RTS frame has been corrupted
void DoSetup() override
Implementation to do any local setup required for this TestCase.
~ReleaseSeqNoAfterCtsTimeoutTest() override=default
void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
void DoRun() override
Implementation to actually run this TestCase.
Test update of BA starting sequence number after ADDBA Response timeout in multi-link operations.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void DoRun() override
Implementation to actually run this TestCase.
PacketSocketAddress m_sockAddr
packet socket address
std::size_t m_nQosDataCount
counter for transmitted QoS data frames
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) override
Callback invoked when a FEM passes PSDUs to the PHY.
Ptr< ListErrorModel > m_staErrorModel
error rate model to corrupt frames at the non-AP MLD
a polymophic address class
Definition address.h:90
FrameExchangeManager is a base class handling the basic frame exchange sequences for non-QoS stations...
uint8_t m_linkId
the ID of the link this object is associated with
an EUI-48 address
holds a vector of ns3::NetDevice pointers
an address for a packet socket
Smart pointer class similar to boost::intrusive_ptr.
Make it easy to create and manage PHY objects for the spectrum model.
encapsulates test code
Definition test.h:1050
A suite of tests to run.
Definition test.h:1267
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
base class for all MAC-level wifi objects.
Definition wifi-mac.h:89
const std::map< uint8_t, std::unique_ptr< LinkEntity > > & GetLinks() const
Definition wifi-mac.cc:1072
void SwapLinks(std::map< uint8_t, uint8_t > links)
Swap the links based on the information included in the given map.
Definition wifi-mac.cc:1149
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
WifiScanType
Scan type (active or passive)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
WifiTidToLinkMappingNegSupport
TID-to-Link Mapping Negotiation Support.
std::map< uint8_t, std::set< uint8_t > > WifiTidLinkMapping
TID-indexed map of the link set to which the TID is mapped.
Definition wifi-utils.h:65
Function object to compute the hash of a MAC address.
Definition qos-utils.h:45
uint32_t pktSize
packet size used for the simulation (in bytes)
WifiMuTrafficPattern
Tested MU traffic patterns.
WifiTrafficPattern
Tested traffic patterns.
WifiUseBarAfterMissedBa
Whether to send a BlockAckReq after a missed BlockAck.
WifiBaEnabled
Block Ack agreement enabled/disabled.