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