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