A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-emlsr-test.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023 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_EMLSR_TEST_H
10#define WIFI_EMLSR_TEST_H
11
12#include "ns3/ap-wifi-mac.h"
13#include "ns3/error-model.h"
14#include "ns3/header-serialization-test.h"
15#include "ns3/packet-socket-address.h"
16#include "ns3/packet-socket-client.h"
17#include "ns3/sta-wifi-mac.h"
18#include "ns3/test.h"
19#include "ns3/wifi-mac-queue-scheduler.h"
20#include "ns3/wifi-mac.h"
21#include "ns3/wifi-ppdu.h"
22#include "ns3/wifi-psdu.h"
23
24#include <array>
25#include <list>
26#include <map>
27#include <memory>
28#include <optional>
29#include <set>
30#include <vector>
31
32using namespace ns3;
33using namespace std::string_literals;
34
35// forward declaration
36namespace ns3
37{
39}
40
41/**
42 * @ingroup wifi-test
43 * @ingroup tests
44 *
45 * @brief Test EML Operating Mode Notification frame serialization and deserialization
46 */
48{
49 public:
50 /**
51 * Constructor
52 */
55
56 private:
57 void DoRun() override;
58};
59
60/**
61 * @ingroup wifi-test
62 * @ingroup tests
63 *
64 * @brief Base class for EMLSR Operations tests
65 *
66 * This base class setups and configures one AP MLD, a variable number of non-AP MLDs with
67 * EMLSR activated and a variable number of non-AP MLD with EMLSR deactivated. Every MLD has
68 * three links, each operating on a distinct PHY band (2.4 GHz, 5 GHz and 6 GHz). Therefore,
69 * it is expected that three links are setup by the non-AP MLD(s). The values for the Padding
70 * Delay, the Transition Delay and the Transition Timeout are provided as argument to the
71 * constructor of this class, along with the IDs of the links on which EMLSR mode must be
72 * enabled for the non-AP MLDs (this information is used to set the EmlsrLinkSet attribute
73 * of the DefaultEmlsrManager installed on the non-AP MLDs).
74 */
76{
77 public:
78 /**
79 * Constructor
80 *
81 * @param name The name of the new TestCase created
82 */
83 EmlsrOperationsTestBase(const std::string& name);
84 ~EmlsrOperationsTestBase() override = default;
85
86 /// Enumeration for traffic directions
87 enum TrafficDirection : uint8_t
88 {
90 UPLINK
91 };
92
93 protected:
94 /**
95 * Callback invoked when a FEM passes PSDUs to the PHY.
96 *
97 * @param mac the MAC transmitting the PSDUs
98 * @param phyId the ID of the PHY transmitting the PSDUs
99 * @param psduMap the PSDU map
100 * @param txVector the TX vector
101 * @param txPowerW the tx power in Watts
102 */
103 virtual void Transmit(Ptr<WifiMac> mac,
104 uint8_t phyId,
105 WifiConstPsduMap psduMap,
106 WifiTxVector txVector,
107 double txPowerW);
108
109 /**
110 * @param dir the traffic direction (downlink/uplink)
111 * @param staId the index (starting at 0) of the non-AP MLD generating/receiving packets
112 * @param count the number of packets to generate
113 * @param pktSize the size of the packets to generate
114 * @param priority user priority for generated packets
115 * @return an application generating the given number packets of the given size from/to the
116 * AP MLD to/from the given non-AP MLD
117 */
119 std::size_t staId,
120 std::size_t count,
121 std::size_t pktSize,
122 uint8_t priority = 0) const;
123
124 /**
125 * Check whether QoS data unicast transmissions addressed to the given destination on the
126 * given link are blocked or unblocked for the given reason on the given device.
127 *
128 * @param mac the MAC of the given device
129 * @param dest the MAC address of the given destination
130 * @param linkId the ID of the given link
131 * @param reason the reason for blocking transmissions to test
132 * @param blocked whether transmissions are blocked for the given reason
133 * @param description text indicating when this check is performed
134 * @param testUnblockedForOtherReasons whether to test if transmissions are unblocked for
135 * all the reasons other than the one provided
136 */
138 Mac48Address dest,
139 uint8_t linkId,
141 bool blocked,
142 std::string description,
143 bool testUnblockedForOtherReasons = true);
144
145 /**
146 * Check whether the MediumSyncDelay timer is running on the given link of the given device.
147 *
148 * @param staMac the MAC of the given device
149 * @param linkId the ID of the given link
150 * @param isRunning whether the MediumSyncDelay timer is running
151 * @param msg message to print in case the check failed
152 */
154 uint8_t linkId,
155 bool isRunning,
156 const std::string& msg);
157
158 /**
159 * Check whether aux PHYs of the given device are in sleep mode/awake.
160 *
161 * @param staMac the MAC of the given device
162 * @param sleep whether aux PHYs should be in sleep mode
163 */
164 void CheckAuxPhysSleepMode(Ptr<StaWifiMac> staMac, bool sleep);
165
166 /**
167 * Callback connected to the EMLSR Manager MainPhySwitch trace source.
168 *
169 * @param index the index of the EMLSR client whose main PHY switch event is logged
170 * @param info the information associated with the main PHY switch event
171 */
172 void MainPhySwitchInfoCallback(std::size_t index, const EmlsrMainPhySwitchTrace& info);
173
174 /**
175 * Check information provided by the EMLSR Manager MainPhySwitch trace.
176 *
177 * @param index the ID of the EMLSR client this check refers to
178 * @param reason the reason for main PHY to switch
179 * @param fromLinkId the ID of the link the main PHY is moving from (if any)
180 * @param toLinkId the ID of the link the main PHY is moving to
181 * @param checkFromLinkId whether to check the given fromLinkId value
182 * @param checkToLinkId whether to check the given toLinkId value
183 */
184 void CheckMainPhyTraceInfo(std::size_t index,
185 std::string_view reason,
186 const std::optional<uint8_t>& fromLinkId,
187 uint8_t toLinkId,
188 bool checkFromLinkId = true,
189 bool checkToLinkId = true);
190
191 void DoSetup() override;
192
193 /// Information about transmitted frames
195 {
196 Time startTx; ///< TX start time
197 WifiConstPsduMap psduMap; ///< transmitted PSDU map
198 WifiTxVector txVector; ///< TXVECTOR
199 uint8_t linkId; ///< link ID
200 uint8_t phyId; ///< ID of the transmitting PHY
201 };
202
203 /// array of strings defining the channels for the MLD links
204 const std::array<std::string, 3> m_channelsStr{"{2, 0, BAND_2_4GHZ, 0}"s,
205 "{36, 0, BAND_5GHZ, 0}"s,
206 "{1, 0, BAND_6GHZ, 0}"s};
207
208 /// array of frequency ranges for MLD links
209 const std::array<FrequencyRange, 3> m_freqRanges{WIFI_SPECTRUM_2_4_GHZ,
212
213 uint8_t m_mainPhyId{0}; //!< ID of the main PHY
214 std::set<uint8_t> m_linksToEnableEmlsrOn; /**< IDs of the links on which EMLSR mode has to
215 be enabled */
216 std::size_t m_nPhysPerEmlsrDevice{3}; //!< number of PHYs per EMLSR client
217 std::size_t m_nEmlsrStations{1}; ///< number of stations to create that activate EMLSR
218 std::size_t m_nNonEmlsrStations{0}; /**< number of stations to create that do not
219 activate EMLSR */
220 Time m_transitionTimeout{MicroSeconds(128)}; ///< Transition Timeout advertised by the AP MLD
221 std::vector<Time> m_paddingDelay{
222 {MicroSeconds(32)}}; ///< Padding Delay advertised by the non-AP MLD
223 std::vector<Time> m_transitionDelay{
224 {MicroSeconds(16)}}; ///< Transition Delay advertised by the non-AP MLD
225 std::vector<uint8_t> m_establishBaDl{}; /**< the TIDs for which BA needs to be established
226 with the AP as originator */
227 std::vector<uint8_t> m_establishBaUl{}; /**< the TIDs for which BA needs to be established
228 with the AP as recipient */
229 bool m_putAuxPhyToSleep{false}; //!< whether aux PHYs are put to sleep during DL/UL TXOPs
230 std::vector<FrameInfo> m_txPsdus; ///< transmitted PSDUs
231 Ptr<ApWifiMac> m_apMac; ///< AP wifi MAC
232 std::vector<Ptr<StaWifiMac>> m_staMacs; ///< MACs of the non-AP MLDs
233 std::vector<PacketSocketAddress> m_dlSockets; ///< packet socket address for DL traffic
234 std::vector<PacketSocketAddress> m_ulSockets; ///< packet socket address for UL traffic
235 uint16_t m_lastAid{0}; ///< AID of last associated station
236 Time m_duration{0}; ///< simulation duration
237 std::map<std::size_t, std::shared_ptr<EmlsrMainPhySwitchTrace>>
238 m_traceInfo; ///< EMLSR client ID-indexed map of trace info from last main PHY switch
239
240 private:
241 /**
242 * Callback connected to the ApWifiMac's AssociatedSta trace source.
243 * Start generating traffic (if needed) when all stations are associated.
244 *
245 * @param aid the AID assigned to the previous associated STA
246 */
247 void StaAssociated(uint16_t aid, Mac48Address /* addr */);
248
249 /**
250 * Callback connected to the QosTxop's BaEstablished trace source of the AP's BE AC.
251 *
252 * @param recipient the recipient of the established Block Ack agreement
253 * @param tid the TID
254 */
255 void BaEstablishedDl(Mac48Address recipient,
256 uint8_t tid,
257 std::optional<Mac48Address> /* gcrGroup */);
258
259 /**
260 * Callback connected to the QosTxop's BaEstablished trace source of a STA's BE AC.
261 *
262 * @param index the index of the STA which the callback is connected to
263 * @param recipient the recipient of the established Block Ack agreement
264 * @param tid the TID
265 */
266 void BaEstablishedUl(std::size_t index,
267 Mac48Address recipient,
268 uint8_t tid,
269 std::optional<Mac48Address> /* gcrGroup */);
270
271 /**
272 * Set the SSID on the next station that needs to start the association procedure, or start
273 * traffic if no other station left.
274 *
275 * @param count the number of STAs that completed the association procedure
276 */
277 void SetSsid(std::size_t count);
278
279 /**
280 * Start the generation of traffic (needs to be overridden)
281 */
282 virtual void StartTraffic()
283 {
284 }
285};
286
287/**
288 * @ingroup wifi-test
289 * @ingroup tests
290 *
291 * @brief Test the exchange of EML Operating Mode Notification frames.
292 *
293 * This test considers an AP MLD and a non-AP MLD with EMLSR activated. Upon association,
294 * the non-AP MLD sends an EML Operating Mode Notification frame, which is however corrupted
295 * by using a post reception error model (installed on the AP MLD). We keep corrupting the
296 * EML Notification frames transmitted by the non-AP MLD until the frame is dropped due to
297 * exceeded max retry limit. It is checked that:
298 *
299 * - the Association Request contains a Multi-Link Element including an EML Capabilities field
300 * that contains the expected values for Padding Delay and Transition Delay
301 * - the Association Response contains a Multi-Link Element including an EML Capabilities field
302 * that contains the expected value for Transition Timeout
303 * - all EML Notification frames contain the expected values for EMLSR Mode, EMLMR Mode and
304 * Link Bitmap fields and are transmitted on the link used for association
305 * - the correct EMLSR link set is stored by the EMLSR Manager, both when the transition
306 * timeout expires and when an EML Notification response is received from the AP MLD (thus,
307 * the correct EMLSR link set is stored after whichever of the two events occur first)
308 */
310{
311 public:
312 /**
313 * Constructor
314 *
315 * @param linksToEnableEmlsrOn IDs of links on which EMLSR mode should be enabled
316 * @param transitionTimeout the Transition Timeout advertised by the AP MLD
317 */
318 EmlOmnExchangeTest(const std::set<uint8_t>& linksToEnableEmlsrOn, Time transitionTimeout);
319 ~EmlOmnExchangeTest() override = default;
320
321 protected:
322 void DoSetup() override;
323 void DoRun() override;
324 void Transmit(Ptr<WifiMac> mac,
325 uint8_t phyId,
326 WifiConstPsduMap psduMap,
327 WifiTxVector txVector,
328 double txPowerW) override;
329
330 /**
331 * Callback invoked when the non-AP MLD receives the acknowledgment for a transmitted MPDU.
332 *
333 * @param mpdu the acknowledged MPDU
334 */
335 void TxOk(Ptr<const WifiMpdu> mpdu);
336 /**
337 * Callback invoked when the non-AP MLD drops the given MPDU for the given reason.
338 *
339 * @param reason the reason why the MPDU was dropped
340 * @param mpdu the dropped MPDU
341 */
343
344 /**
345 * Check the content of the EML Capabilities subfield of the Multi-Link Element included
346 * in the Association Request frame sent by the non-AP MLD.
347 *
348 * @param mpdu the MPDU containing the Association Request frame
349 * @param txVector the TXVECTOR used to transmit the frame
350 * @param linkId the ID of the link on which the frame was transmitted
351 */
353 const WifiTxVector& txVector,
354 uint8_t linkId);
355 /**
356 * Check the content of the EML Capabilities subfield of the Multi-Link Element included
357 * in the Association Response frame sent by the AP MLD to the EMLSR client.
358 *
359 * @param mpdu the MPDU containing the Association Response frame
360 * @param txVector the TXVECTOR used to transmit the frame
361 * @param linkId the ID of the link on which the frame was transmitted
362 */
364 const WifiTxVector& txVector,
365 uint8_t linkId);
366 /**
367 * Check the content of a received EML Operating Mode Notification frame.
368 *
369 * @param psdu the PSDU containing the EML Operating Mode Notification frame
370 * @param txVector the TXVECTOR used to transmit the frame
371 * @param linkId the ID of the link on which the frame was transmitted
372 */
374 const WifiTxVector& txVector,
375 uint8_t linkId);
376 /**
377 * Check that the EMLSR mode has been enabled on the expected EMLSR links.
378 */
379 void CheckEmlsrLinks();
380
381 private:
382 std::size_t m_checkEmlsrLinksCount; /**< counter for the number of times CheckEmlsrLinks
383 is called (should be two: when the transition
384 timeout expires and when the EML Notification
385 response from the AP MLD is received */
386 std::size_t m_emlNotificationDroppedCount; /**< counter for the number of times the EML
387 Notification frame sent by the non-AP MLD
388 has been dropped due to max retry limit */
389 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt packets at AP MLD
390 std::list<uint64_t> m_uidList; ///< list of UIDs of packets to corrupt
391};
392
393/**
394 * @ingroup wifi-test
395 * @ingroup tests
396 *
397 * @brief Test the transmission of DL frames to EMLSR clients.
398 *
399 * This test considers an AP MLD and a configurable number of non-AP MLDs that support EMLSR
400 * and a configurable number of non-AP MLDs that do not support EMLSR. All MLDs have three
401 * setup links, while the set of EMLSR links for the EMLSR clients is configurable.
402 * Block ack agreements (for TID 0, with the AP MLD as originator) are established with all
403 * the non-AP MLDs before that EMLSR clients send the EML Operating Mode Notification frame
404 * to enable the EMLSR mode on their EMLSR links.
405 *
406 * Before enabling EMLSR mode, it is checked that:
407 *
408 * - all EMLSR links (but the link used for ML setup) of the EMLSR clients are considered to
409 * be in power save mode and are blocked by the AP MLD; all the other links have transitioned
410 * to active mode and are not blocked
411 * - no MU-RTS Trigger Frame is sent as Initial control frame
412 * - In case of EMLSR clients having no link that is not an EMLSR link and is different than
413 * the link used for ML setup, the two A-MPDUs used to trigger BA establishment are
414 * transmitted one after another on the link used for ML setup. Otherwise, the two A-MPDUs
415 * are sent concurrently on two distinct links
416 *
417 * After enabling EMLSR mode, it is checked that:
418 *
419 * - all EMLSR links of the EMLSR clients are considered to be in active mode and are not
420 * blocked by the AP MLD
421 * - If all setup links are EMLSR links, the first two frame exchanges are both protected by
422 * MU-RTS TF and occur one after another. Otherwise, one frame exchange occurs on the
423 * non-EMLSR link and is not protected by MU-RTS TF; the other frame exchange occurs on an
424 * EMLSR link and is protected by MU-RTS TF
425 * - the AP MLD blocks transmission on all other EMLSR links when sending an ICF to an EMLSR client
426 * - After completing a frame exchange with an EMLSR client, the AP MLD can start another frame
427 * exchange with that EMLSR client within the same TXOP (after a SIFS) without sending an ICF
428 * - During the transition delay, all EMLSR links are not used for DL transmissions
429 * - The padding added to Initial Control frames is the largest among all the EMLSR clients
430 * solicited by the ICF
431 *
432 * After disabling EMLSR mode, it is checked that:
433 *
434 * - all EMLSR links (but the link used to exchange EML Notification frames) of the EMLSR clients
435 * are considered to be in power save mode and are blocked by the AP MLD
436 * - an MU-RTS Trigger Frame is sent by the AP MLD as ICF for sending the EML Notification
437 * response, unless the link used to exchange EML Notification frames is a non-EMLSR link
438 * - no MU-RTS Trigger Frame is used as ICF for QoS data frames
439 * - In case of EMLSR clients having no link that is not an EMLSR link and is different than
440 * the link used to exchange EML Notification frames, the two A-MPDUs are transmitted one
441 * after another on the link used to exchange EML Notification frames. Otherwise, the two
442 * A-MPDUs are sent concurrently on two distinct links
443 *
444 * Also, if the PutAuxPhyToSleep attribute is set to true, it is checked that aux PHYs are in
445 * sleep mode after receiving an ICF and are resumed from sleep after receiving the CF-End frame.
446 */
448{
449 public:
450 /**
451 * Parameters for the EMLSR DL TXOP test
452 */
453 struct Params
454 {
455 std::size_t nEmlsrStations; //!< number of non-AP MLDs that support EMLSR
456 std::size_t nNonEmlsrStations; //!< number of non-AP MLDs that do not support EMLSR
457 std::set<uint8_t>
458 linksToEnableEmlsrOn; //!< IDs of links on which EMLSR mode should be enabled
459 std::vector<Time> paddingDelay; //!< vector (whose size equals <i>nEmlsrStations</i>) of the
460 //!< padding delay values advertised by non-AP MLDs
461 std::vector<Time>
462 transitionDelay; //!< vector (whose size equals <i>nEmlsrStations</i>) of
463 //!< transition the delay values advertised by non-AP MLDs
464 Time transitionTimeout; //!< the Transition Timeout advertised by the AP MLD
465 bool putAuxPhyToSleep; //!< whether aux PHYs are put to sleep during DL/UL TXOPs
466 };
467
468 /**
469 * Constructor
470 *
471 * @param params parameters for the EMLSR DL TXOP test
472 */
473 EmlsrDlTxopTest(const Params& params);
474 ~EmlsrDlTxopTest() override = default;
475
476 protected:
477 void DoSetup() override;
478 void DoRun() override;
479 void Transmit(Ptr<WifiMac> mac,
480 uint8_t phyId,
481 WifiConstPsduMap psduMap,
482 WifiTxVector txVector,
483 double txPowerW) override;
484
485 /**
486 * Check that the simulation produced the expected results.
487 */
488 void CheckResults();
489
490 /**
491 * Check that the AP MLD considers the correct Power Management mode for the links setup
492 * with the given non-AP MLD. This method is intended to be called shortly after ML setup.
493 *
494 * @param address a link address of the given non-AP MLD
495 */
496 void CheckPmModeAfterAssociation(const Mac48Address& address);
497
498 /**
499 * Check that appropriate actions are taken when the AP MLD transmits an EML Operating Mode
500 * Notification response frame to an EMLSR client on the given link.
501 *
502 * @param mpdu the MPDU carrying the EML Operating Mode Notification frame
503 * @param txVector the TXVECTOR used to send the PPDU
504 * @param linkId the ID of the given link
505 */
507 const WifiTxVector& txVector,
508 uint8_t linkId);
509
510 /**
511 * Check that appropriate actions are taken when an EMLSR client transmits an EML Operating
512 * Mode Notification frame to the AP MLD on the given link.
513 *
514 * @param mpdu the MPDU carrying the EML Operating Mode Notification frame
515 * @param txVector the TXVECTOR used to send the PPDU
516 * @param linkId the ID of the given link
517 */
519 const WifiTxVector& txVector,
520 uint8_t linkId);
521
522 /**
523 * Check that appropriate actions are taken by the AP MLD transmitting an initial
524 * Control frame to an EMLSR client on the given link.
525 *
526 * @param mpdu the MPDU carrying the MU-RTS TF
527 * @param txVector the TXVECTOR used to send the PPDU
528 * @param linkId the ID of the given link
529 */
531 const WifiTxVector& txVector,
532 uint8_t linkId);
533
534 /**
535 * Check that appropriate actions are taken by the AP MLD transmitting a PPDU containing
536 * QoS data frames to EMLSR clients on the given link.
537 *
538 * @param psduMap the PSDU(s) carrying QoS data frames
539 * @param txVector the TXVECTOR used to send the PPDU
540 * @param linkId the ID of the given link
541 */
542 void CheckQosFrames(const WifiConstPsduMap& psduMap,
543 const WifiTxVector& txVector,
544 uint8_t linkId);
545
546 /**
547 * Check that appropriate actions are taken by the AP MLD receiving a PPDU containing
548 * BlockAck frames from EMLSR clients on the given link.
549 *
550 * @param psduMap the PSDU carrying BlockAck frames
551 * @param txVector the TXVECTOR used to send the PPDU
552 * @param phyId the ID of the PHY transmitting the PSDU(s)
553 */
554 void CheckBlockAck(const WifiConstPsduMap& psduMap,
555 const WifiTxVector& txVector,
556 uint8_t phyId);
557
558 private:
559 void StartTraffic() override;
560
561 /**
562 * Enable EMLSR mode on the next EMLSR client
563 */
564 void EnableEmlsrMode();
565
566 std::set<uint8_t> m_emlsrLinks; /**< IDs of the links on which EMLSR mode has to be enabled */
567 Time m_emlsrEnabledTime; //!< when EMLSR mode has been enabled on all EMLSR clients
568 const Time m_fe2to3delay; /**< time interval between 2nd and 3rd frame exchange sequences
569 after the enablement of EMLSR mode */
570 std::size_t m_countQoSframes; //!< counter for QoS frames (transition delay test)
571 std::size_t m_countBlockAck; //!< counter for BlockAck frames (transition delay test)
572 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt BlockAck at AP MLD
573};
574
575/**
576 * @ingroup wifi-test
577 * @ingroup tests
578 *
579 * @brief Test the transmission of UL frames from EMLSR clients.
580 *
581 * This test considers an AP MLD and a non-AP MLD that support EMLSR. The non-AP MLD setups three
582 * links, while the set of EMLSR links is configurable. Block ack agreements (for TID 0) for both
583 * DL and UL directions are established after that the EML Operating Mode Notification frames are
584 * exchanged to enable the EMLSR mode on the EMLSR links. Aux PHYs on the EMLSR client do not
585 * switch link, hence the main PHY will switch link (if needed) when terminating a TXOP.
586 *
587 * It is checked that:
588 *
589 * - Initially, aux PHYs are configured so that they are unable to transmit frames. Before
590 * generating the packets for the first UL data frame, transmissions on the link where the
591 * main PHY is operating and on the non-EMLSR link (if any) are blocked. Thus, the first UL data
592 * frame is held until transmissions on the link where the main PHY is operating are unblocked.
593 * The first UL data frame is sent by the main PHY without RTS protection. When the data frame
594 * exchange terminates, the MediumSyncDelay timer is started on the other EMLSR links and the
595 * CCA ED threshold is set as expected
596 * - If there is a non-EMLSR link, another data frame can be sent concurrently (without protection)
597 * on the non-EMLSR link
598 * - When the first UL data frame is transmitted, we make the aux PHYs on the EMLSR client capable
599 * of transmitting, we block transmissions on the link where the main PHY is operating and
600 * generate new UL packets, which will then be transmitted on a link where an aux PHY is
601 * operating. Thus, the aux PHY transmits an RTS frame and the main PHY will take over and
602 * transmit the second UL data frame. We check that, while the link on which the main PHY was
603 * operating is blocked because another EMLSR link is being used, new backoff values for that
604 * link are generated if and only if the QosTxop::GenerateBackoffIfTxopWithoutTx attribute is
605 * true; otherwise, a new backoff value is generated when the link is unblocked.
606 * - When the exchange of the second UL data frame terminates, we make the aux PHY unable to
607 * transmit, block transmissions on the non-EMLSR link (if any) and generate some more UL
608 * packets, which will then be transmitted by the main PHY. However, a MediumSyncDelay timer
609 * is now running on the link where the main PHY is operating, hence transmissions are protected
610 * by an RTS frame. We install a post reception error model on the AP MLD so that all RTS frames
611 * sent by the EMLSR client are not received by the AP MLD. We check that the EMLSR client makes
612 * at most the configured max number of transmission attempts and that another UL data frame is
613 * sent once the MediumSyncDelay timer is expired. We also check that the TX width of the RTS
614 * frames and the UL data frame equal the channel width used by the main PHY.
615 * - We check that no issue arises in case an aux PHY sends an RTS frame but the CTS response is
616 * not transmitted successfully. Specifically, we check that the main PHY is completing the
617 * channel switch when the (unsuccessful) reception of the CTS ends and that a new RTS/CTS
618 * exchange is carried out to protect the transmission of the last data frame.
619 * - While the main PHY is operating on the same link as an aux PHY (which does not switch
620 * channel), the aux PHY is put in sleep mode as soon as the main PHY starts operating on the
621 * link, stays in sleep mode until the TXOP ends and is resumed from sleep mode right after the
622 * end of the DL/UL TXOP.
623 * - When an aux PHY that is not TX capable gains a TXOP, it checks whether the main PHY can switch
624 * to the auxiliary link a start an UL TXOP. If the main PHY is switching, the aux PHY waits
625 * until the channel switch is completed and checks again; if the remaining backoff time on the
626 * preferred link is greater than the channel switch delay, the main PHY is requested to switch to
627 * the auxiliary link of the aux PHY. When the channel switch is completed, if the medium is
628 * idle on the auxiliary link and the backoff is zero, the main PHY starts an UL TXOP after a
629 * PIFS period; otherwise, the main PHY starts an UL TXOP when the backoff timer counts down to
630 * zero. The QoS data frame sent by the main PHY is not protected by RTS and the bandwidth it
631 * occupies is not affected by possible limitations on the aux PHY TX bandwidth capabilities.
632 *
633 * Also, if the PutAuxPhyToSleep attribute is set to true, it is checked that aux PHYs are in
634 * sleep mode a SIFS after receiving the ICF and are still in sleep mode right before receiving
635 * a Block Ack frame, and they are resumed from sleep after receiving the Block Ack frame.
636 */
638{
639 public:
640 /**
641 * Parameters for the EMLSR UL TXOP test
642 */
643 struct Params
644 {
645 std::set<uint8_t>
646 linksToEnableEmlsrOn; //!< IDs of links on which EMLSR mode should be enabled
647 MHz_u channelWidth; //!< width of the channels used by MLDs
648 MHz_u auxPhyChannelWidth; //!< max width supported by aux PHYs
649 Time mediumSyncDuration; //!< duration of the MediumSyncDelay timer
650 uint8_t msdMaxNTxops; //!< Max number of TXOPs that an EMLSR client is allowed
651 //!< to attempt to initiate while the MediumSyncDelay
652 //!< timer is running (zero indicates no limit)
653 bool genBackoffAndUseAuxPhyCca; //!< this variable controls two boolean values that are
654 //!< either both set to true or both set to false;
655 //!< the first value controls whether the backoff should be
656 //!< invoked when the AC gains the right to start a TXOP
657 //!< but it does not transmit any frame, the second value
658 //!< controls whether CCA info from aux PHY is used when
659 //!< aux PHY is not TX capable
660 uint8_t nSlotsLeftAlert; //!< value to set the ChannelAccessManager NSlotsLeft
661 //!< attribute to
662 bool putAuxPhyToSleep; //!< whether aux PHYs are put to sleep during DL/UL TXOPs
663 bool switchMainPhyBackDelayTimeout; //!< whether a SwitchMainPhyBackDelay timer expires
664 //!< after that the main PHY moved to an aux PHY link
665 };
666
667 /**
668 * Constructor
669 *
670 * @param params parameters for the EMLSR UL TXOP test
671 */
672 EmlsrUlTxopTest(const Params& params);
673 ~EmlsrUlTxopTest() override = default;
674
675 protected:
676 void DoSetup() override;
677 void DoRun() override;
678 void Transmit(Ptr<WifiMac> mac,
679 uint8_t phyId,
680 WifiConstPsduMap psduMap,
681 WifiTxVector txVector,
682 double txPowerW) override;
683
684 /**
685 * Check that the simulation produced the expected results.
686 */
687 void CheckResults();
688
689 /**
690 * Check that appropriate actions are taken by the EMLSR client when transmitting an RTS
691 * frame on the given link.
692 *
693 * @param mpdu the MPDU carrying the RTS frame
694 * @param txVector the TXVECTOR used to send the PPDU
695 * @param linkId the ID of the given link
696 */
697 void CheckRtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
698
699 /**
700 * Check that appropriate actions are taken by the EMLSR client when receiving a CTS
701 * frame on the given link.
702 *
703 * @param mpdu the MPDU carrying the CTS frame
704 * @param txVector the TXVECTOR used to send the PPDU
705 * @param linkId the ID of the given link
706 */
707 void CheckCtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
708
709 /**
710 * Check that appropriate actions are taken when an MLD transmits a PPDU containing
711 * QoS data frames on the given link.
712 *
713 * @param psduMap the PSDU(s) carrying QoS data frames
714 * @param txVector the TXVECTOR used to send the PPDU
715 * @param linkId the ID of the given link
716 */
717 void CheckQosFrames(const WifiConstPsduMap& psduMap,
718 const WifiTxVector& txVector,
719 uint8_t linkId);
720
721 /**
722 * Check that appropriate actions are taken when an MLD transmits a PPDU containing
723 * BlockAck frames on the given link.
724 *
725 * @param psduMap the PSDU carrying BlockAck frames
726 * @param txVector the TXVECTOR used to send the PPDU
727 * @param linkId the ID of the given link
728 */
729 void CheckBlockAck(const WifiConstPsduMap& psduMap,
730 const WifiTxVector& txVector,
731 uint8_t linkId);
732
733 private:
734 void StartTraffic() override;
735
736 /**
737 * Callback invoked when a new backoff value is generated by the EMLSR client.
738 *
739 * @param backoff the generated backoff value
740 * @param linkId the ID of the link for which the backoff value has been generated
741 */
742 void BackoffGenerated(uint32_t backoff, uint8_t linkId);
743
744 std::set<uint8_t> m_emlsrLinks; /**< IDs of the links on which EMLSR mode has to be enabled */
745 MHz_u m_channelWidth; //!< width of the channels used by MLDs
746 MHz_u m_auxPhyChannelWidth; //!< max width supported by aux PHYs
747 Time m_mediumSyncDuration; //!< duration of the MediumSyncDelay timer
748 uint8_t m_msdMaxNTxops; //!< Max number of TXOPs that an EMLSR client is allowed
749 //!< to attempt to initiate while the MediumSyncDelay
750 //!< timer is running (zero indicates no limit)
751 std::optional<uint8_t> m_nonEmlsrLink; //!< ID of the non-EMLSR link (if any)
752 Time m_emlsrEnabledTime; //!< when EMLSR mode has been enabled on all EMLSR clients
753 Time m_firstUlPktsGenTime; //!< generation time of the first two UL packets
754 const Time m_unblockMainPhyLinkDelay; //!< delay between the time the first two UL packets are
755 //!< generated and the time transmissions are unblocked
756 //!< on the link where the main PHY is operating on
757 Time m_lastMsdExpiryTime; //!< expiry time of the last MediumSyncDelay timer
758 bool m_checkBackoffStarted; //!< whether we are checking the generated backoff values
759 std::optional<Time> m_backoffEndTime; //!< expected backoff end time on main PHY link
760 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt packets
761 std::size_t m_countQoSframes; //!< counter for QoS frames
762 std::size_t m_countBlockAck; //!< counter for BlockAck frames
763 std::size_t m_countRtsframes; //!< counter for RTS frames
764 bool m_genBackoffIfTxopWithoutTx; //!< whether the backoff should be invoked when the AC
765 //!< gains the right to start a TXOP but it does not
766 //!< transmit any frame
767 bool m_useAuxPhyCca; //!< whether CCA info from aux PHY is used when
768 //!< aux PHY is not TX capable
769 uint8_t m_nSlotsLeftAlert; //!< value for ChannelAccessManager NSlotsLeft attribute
770 bool m_switchMainPhyBackDelayTimeout; //!< whether a SwitchMainPhyBackDelay timer expires
771 //!< after that the main PHY moved to an aux PHY link
772 std::optional<bool> m_corruptCts; //!< whether the transmitted CTS must be corrupted
773 Time m_5thQosFrameTxTime; //!< start transmission time of the 5th QoS data frame
774 MHz_u m_5thQosFrameExpWidth; //!< expected width of the 5th QoS data frame
775};
776
777/**
778 * @ingroup wifi-test
779 * @ingroup tests
780 *
781 * @brief Check UL OFDMA operations with EMLSR clients.
782 *
783 * This test considers an AP MLD and an EMLSR client and a non-AP MLD that setup three links with
784 * the AP MLD. Once block ack agreements (for TID 0) are established for the UL direction, the
785 * AP MLD starts requesting channel access (on all the links) through the Multi-User scheduler.
786 * Given that links are idle, AP MLD accesses the channel on all the links and concurrently sends
787 * Trigger Frames. When the transmission of the first Trigger Frame is over, a client application
788 * on the EMLSR client generates two packets addressed to the AP MLD.
789 *
790 * It is checked that:
791 * - when sending BSRP TF is disabled, the first Trigger Frame sent is an MU-RTS; otherwise, it is
792 * a BSRP Trigger Frame. In both cases, such Trigger Frame acts as an ICF for the EMLSR client
793 * - the other Trigger Frames sent concurrently with the ICF only solicit the non-EMLSR client
794 * (AP MLD has blocked transmissions to the EMLSR client upon preparing the first Trigger Frame)
795 * - the buffer status reported in QoS Null frames is as expected
796 * - the EMLSR client sends a QoS Data frame in a TB PPDU
797 */
799{
800 public:
801 /**
802 * Constructor
803 *
804 * @param enableBsrp whether MU scheduler sends BSRP TFs
805 */
806 EmlsrUlOfdmaTest(bool enableBsrp);
807
808 protected:
809 void DoSetup() override;
810 void DoRun() override;
811 void Transmit(Ptr<WifiMac> mac,
812 uint8_t phyId,
813 WifiConstPsduMap psduMap,
814 WifiTxVector txVector,
815 double txPowerW) override;
816
817 /**
818 * Check that the simulation produced the expected results.
819 */
820 void CheckResults();
821
822 private:
823 void StartTraffic() override;
824
825 bool m_enableBsrp; //!< whether MU scheduler sends BSRP TFs
826 std::size_t m_txPsdusPos; //!< position in the vector of TX PSDUs of the first ICF
827 Time m_startAccessReq; //!< start time of the first AP MLD access request via MU scheduler
828};
829
830/**
831 * @ingroup wifi-test
832 * @ingroup tests
833 *
834 * @brief Test the switching of PHYs on EMLSR clients.
835 *
836 * An AP MLD and an EMLSR client setup 3 links, on which EMLSR mode is enabled. The AP MLD
837 * transmits 4 QoS data frames (one after another, each protected by ICF):
838 *
839 * - the first one on the link used for ML setup, hence no PHY switch occurs
840 * - the second one on another link, thus causing the main PHY to switch link
841 * - the third one on the remaining link, thus causing the main PHY to switch link again
842 * - the fourth one on the link used for ML setup
843 *
844 * Afterwards, the EMLSR client transmits 2 QoS data frames; the first one on the link used for
845 * ML setup (hence, no RTS is sent), the second one on another link.
846 */
848{
849 public:
850 /**
851 * Parameters for the EMLSR link switching test
852 */
853 struct Params
854 {
855 bool
856 switchAuxPhy; //!< whether AUX PHY should switch channel to operate on the link on which
857 //!< the Main PHY was operating before moving to the link of the Aux PHY
858 bool resetCamStateAndInterruptSwitch; //!< this variable controls two boolean values that
859 //!< are either both set to true or both set to false;
860 //!< the first value controls whether to reset the
861 //!< state of the ChannelAccessManager associated
862 //!< with the link on which the main PHY has just
863 //!< switched to, the second value controls whether
864 //!< a main PHY channel switch can be interrupted
865 MHz_u auxPhyMaxChWidth; //!< max channel width supported by aux PHYs
866 };
867
868 /**
869 * Constructor
870 *
871 * @param params parameters for the EMLSR link switching test
872 */
873 EmlsrLinkSwitchTest(const Params& params);
874
875 ~EmlsrLinkSwitchTest() override = default;
876
877 protected:
878 void DoSetup() override;
879 void DoRun() override;
880 void Transmit(Ptr<WifiMac> mac,
881 uint8_t phyId,
882 WifiConstPsduMap psduMap,
883 WifiTxVector txVector,
884 double txPowerW) override;
885
886 /**
887 * Check that the simulation produced the expected results.
888 */
889 void CheckResults();
890
891 /**
892 * Check that the Main PHY (and possibly the Aux PHY) correctly switches channel when the
893 * reception of an ICF ends.
894 *
895 * @param psduMap the PSDU carrying the MU-RTS TF
896 * @param txVector the TXVECTOR used to send the PPDU
897 * @param linkId the ID of the given link
898 */
899 void CheckInitialControlFrame(const WifiConstPsduMap& psduMap,
900 const WifiTxVector& txVector,
901 uint8_t linkId);
902
903 /**
904 * Check that appropriate actions are taken by the AP MLD transmitting a PPDU containing
905 * QoS data frames to the EMLSR client on the given link.
906 *
907 * @param psduMap the PSDU(s) carrying QoS data frames
908 * @param txVector the TXVECTOR used to send the PPDU
909 * @param linkId the ID of the given link
910 */
911 void CheckQosFrames(const WifiConstPsduMap& psduMap,
912 const WifiTxVector& txVector,
913 uint8_t linkId);
914
915 /**
916 * Check that appropriate actions are taken by the EMLSR client transmitting a PPDU containing
917 * an RTS frame to the AP MLD on the given link.
918 *
919 * @param psduMap the PSDU carrying RTS frame
920 * @param txVector the TXVECTOR used to send the PPDU
921 * @param linkId the ID of the given link
922 */
923 void CheckRtsFrame(const WifiConstPsduMap& psduMap,
924 const WifiTxVector& txVector,
925 uint8_t linkId);
926
927 private:
928 bool m_switchAuxPhy; /**< whether AUX PHY should switch channel to operate on the link on which
929 the Main PHY was operating before moving to the link of Aux PHY */
930 bool
931 m_resetCamStateAndInterruptSwitch; /**< whether to reset the state of the
932 ChannelAccessManager associated with the link on which the main PHY
933 has just switched to and whether main PHY switch can be interrupted */
934 MHz_u m_auxPhyMaxChWidth; //!< max channel width supported by aux PHYs
935 std::size_t m_countQoSframes; //!< counter for QoS data frames
936 std::size_t m_countIcfFrames; //!< counter for ICF frames
937 std::size_t m_countRtsFrames; //!< counter for RTS frames
938 std::size_t m_txPsdusPos; //!< position in the vector of TX PSDUs of the first ICF
939 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt packets at AP MLD
940};
941
942/**
943 * @ingroup wifi-test
944 * @ingroup tests
945 *
946 * @brief wifi EMLSR Test Suite
947 */
949{
950 public:
952};
953
954/**
955 * @ingroup wifi-test
956 * @ingroup tests
957 *
958 * @brief Test CCA busy notifications on EMLSR clients.
959 *
960 * SwitchAuxPhy is set to true, so that the aux PHY starts switching when the main PHY switch is
961 * completed.
962 *
963 * - Main PHY switches to a link on which an aux PHY is operating. Right after the start of the
964 * channel switch, the AP transmits a frame to another device on the aux PHY link. Verify that,
965 * once the main PHY is operating on the new link, the channel access manager on that link is
966 * notified of CCA busy until the end of the transmission
967 * - When the main PHY switch is completed, the aux PHY switches to a link on which no PHY is
968 * operating. Before the aux PHY starts switching, the AP starts transmitting a frame to another
969 * device on the link on which no PHY is operating. Verify that, once the aux PHY is operating
970 * on the new link, the channel access manager on that link is notified of CCA busy until the
971 * end of the transmission
972 */
974{
975 public:
976 /**
977 * Constructor
978 *
979 * @param auxPhyMaxChWidth max channel width supported by aux PHYs
980 */
981 EmlsrCcaBusyTest(MHz_u auxPhyMaxChWidth);
982
983 ~EmlsrCcaBusyTest() override = default;
984
985 protected:
986 void DoSetup() override;
987 void DoRun() override;
988
989 private:
990 void StartTraffic() override;
991
992 /**
993 * Make the other MLD transmit a packet to the AP on the given link.
994 *
995 * @param linkId the ID of the given link
996 */
997 void TransmitPacketToAp(uint8_t linkId);
998
999 /**
1000 * Perform checks after that the preamble of the first PPDU has been received.
1001 */
1002 void CheckPoint1();
1003
1004 /**
1005 * Perform checks after that the main PHY completed the link switch.
1006 */
1007 void CheckPoint2();
1008
1009 /**
1010 * Perform checks after that the aux PHY completed the link switch.
1011 */
1012 void CheckPoint3();
1013
1014 MHz_u m_auxPhyMaxChWidth; //!< max channel width supported by aux PHYs
1015 Time m_channelSwitchDelay; //!< the PHY channel switch delay
1016 uint8_t m_currMainPhyLinkId; //!< the ID of the link the main PHY switches from
1017 uint8_t m_nextMainPhyLinkId; //!< the ID of the link the main PHY switches to
1018};
1019
1020/**
1021 * @ingroup wifi-test
1022 * @ingroup tests
1023 *
1024 * @brief Test ML setup and data exchange between an AP MLD and a single link EMLSR client.
1025 *
1026 * A single link EMLSR client performs ML setup with an AP MLD having three links and then enables
1027 * EMLSR mode on the unique link. A Block Ack agreement is established (for both the downlink and
1028 * uplink directions) and QoS data frames (aggregated in an A-MPDU) are transmitted by both the
1029 * AP MLD and the EMLSR client.
1030 *
1031 * It is checked that:
1032 * - the expected sequence of frames is transmitted, including ICFs before downlink transmissions
1033 * - EMLSR mode is enabled on the single EMLSR link
1034 * - the address of the EMLSR client is seen as an MLD address
1035 * - the AP MLD starts the transition delay timer at the end of each TXOP
1036 */
1038{
1039 public:
1040 /**
1041 * Constructor.
1042 *
1043 * @param switchAuxPhy whether aux PHYs switch link
1044 * @param auxPhyTxCapable whether aux PHYs are TX capable
1045 */
1046 SingleLinkEmlsrTest(bool switchAuxPhy, bool auxPhyTxCapable);
1047
1048 protected:
1049 void DoSetup() override;
1050 void DoRun() override;
1051
1052 void Transmit(Ptr<WifiMac> mac,
1053 uint8_t phyId,
1054 WifiConstPsduMap psduMap,
1055 WifiTxVector txVector,
1056 double txPowerW) override;
1057
1058 /// Actions and checks to perform upon the transmission of each frame
1059 struct Events
1060 {
1061 /**
1062 * Constructor.
1063 *
1064 * @param type the frame MAC header type
1065 * @param f function to perform actions and checks
1066 */
1068 std::function<void(Ptr<const WifiPsdu>, const WifiTxVector&)>&& f = {})
1069 : hdrType(type),
1070 func(f)
1071 {
1072 }
1073
1074 WifiMacType hdrType; ///< MAC header type of frame being transmitted
1075 std::function<void(Ptr<const WifiPsdu>, const WifiTxVector&)>
1076 func; ///< function to perform actions and checks
1077 };
1078
1079 private:
1080 bool m_switchAuxPhy; //!< whether aux PHYs switch link
1081 bool m_auxPhyTxCapable; //!< whether aux PHYs are TX capable
1082 std::list<Events> m_events; //!< list of events for a test run
1083 std::list<Events>::const_iterator m_eventIt; //!< iterator over the list of events
1084};
1085
1086#endif /* WIFI_EMLSR_TEST_H */
Test the exchange of EML Operating Mode Notification frames.
void CheckEmlCapabilitiesInAssocResp(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check the content of the EML Capabilities subfield of the Multi-Link Element included in the Associat...
void TxOk(Ptr< const WifiMpdu > mpdu)
Callback invoked when the non-AP MLD receives the acknowledgment for a transmitted MPDU.
std::list< uint64_t > m_uidList
list of UIDs of packets to corrupt
std::size_t m_checkEmlsrLinksCount
counter for the number of times CheckEmlsrLinks is called (should be two: when the transition timeout...
Ptr< ListErrorModel > m_errorModel
error rate model to corrupt packets at AP MLD
void DoSetup() override
Implementation to do any local setup required for this TestCase.
EmlOmnExchangeTest(const std::set< uint8_t > &linksToEnableEmlsrOn, Time transitionTimeout)
Constructor.
std::size_t m_emlNotificationDroppedCount
counter for the number of times the EML Notification frame sent by the non-AP MLD has been dropped du...
void CheckEmlsrLinks()
Check that the EMLSR mode has been enabled on the expected EMLSR links.
void CheckEmlCapabilitiesInAssocReq(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check the content of the EML Capabilities subfield of the Multi-Link Element included in the Associat...
~EmlOmnExchangeTest() override=default
void TxDropped(WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
Callback invoked when the non-AP MLD drops the given MPDU for the given reason.
void CheckEmlNotification(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, uint8_t linkId)
Check the content of a received EML Operating Mode Notification frame.
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 EML Operating Mode Notification frame serialization and deserialization.
void DoRun() override
Implementation to actually run this TestCase.
~EmlOperatingModeNotificationTest() override=default
Test CCA busy notifications on EMLSR clients.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint8_t m_nextMainPhyLinkId
the ID of the link the main PHY switches to
uint8_t m_currMainPhyLinkId
the ID of the link the main PHY switches from
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
MHz_u m_auxPhyMaxChWidth
max channel width supported by aux PHYs
~EmlsrCcaBusyTest() override=default
void TransmitPacketToAp(uint8_t linkId)
Make the other MLD transmit a packet to the AP on the given link.
void DoRun() override
Implementation to actually run this TestCase.
Time m_channelSwitchDelay
the PHY channel switch delay
void CheckPoint1()
Perform checks after that the preamble of the first PPDU has been received.
void CheckPoint3()
Perform checks after that the aux PHY completed the link switch.
EmlsrCcaBusyTest(MHz_u auxPhyMaxChWidth)
Constructor.
void CheckPoint2()
Perform checks after that the main PHY completed the link switch.
Test the transmission of DL frames to EMLSR clients.
void CheckInitialControlFrame(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken by the AP MLD transmitting an initial Control frame to an EM...
const Time m_fe2to3delay
time interval between 2nd and 3rd frame exchange sequences after the enablement of EMLSR mode
void CheckResults()
Check that the simulation produced the expected results.
void CheckPmModeAfterAssociation(const Mac48Address &address)
Check that the AP MLD considers the correct Power Management mode for the links setup with the given ...
EmlsrDlTxopTest(const Params &params)
Constructor.
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
Ptr< ListErrorModel > m_errorModel
error rate model to corrupt BlockAck at AP MLD
void CheckStaEmlNotificationFrame(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken when an EMLSR client transmits an EML Operating Mode Notific...
std::size_t m_countQoSframes
counter for QoS frames (transition delay test)
void CheckApEmlNotificationFrame(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken when the AP MLD transmits an EML Operating Mode Notification...
~EmlsrDlTxopTest() override=default
Time m_emlsrEnabledTime
when EMLSR mode has been enabled on all EMLSR clients
std::set< uint8_t > m_emlsrLinks
IDs of the links on which EMLSR mode has to be enabled.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void CheckQosFrames(const WifiConstPsduMap &psduMap, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken by the AP MLD transmitting a PPDU containing QoS data frames...
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 EnableEmlsrMode()
Enable EMLSR mode on the next EMLSR client.
void CheckBlockAck(const WifiConstPsduMap &psduMap, const WifiTxVector &txVector, uint8_t phyId)
Check that appropriate actions are taken by the AP MLD receiving a PPDU containing BlockAck frames fr...
void DoRun() override
Implementation to actually run this TestCase.
std::size_t m_countBlockAck
counter for BlockAck frames (transition delay test)
Base class for EMLSR Operations tests.
void BaEstablishedDl(Mac48Address recipient, uint8_t tid, std::optional< Mac48Address >)
Callback connected to the QosTxop's BaEstablished trace source of the AP's BE AC.
void MainPhySwitchInfoCallback(std::size_t index, const EmlsrMainPhySwitchTrace &info)
Callback connected to the EMLSR Manager MainPhySwitch trace source.
const std::array< std::string, 3 > m_channelsStr
array of strings defining the channels for the MLD links
std::size_t m_nNonEmlsrStations
number of stations to create that do not activate EMLSR
std::vector< uint8_t > m_establishBaDl
the TIDs for which BA needs to be established with the AP as originator
void CheckBlockedLink(Ptr< WifiMac > mac, Mac48Address dest, uint8_t linkId, WifiQueueBlockedReason reason, bool blocked, std::string description, bool testUnblockedForOtherReasons=true)
Check whether QoS data unicast transmissions addressed to the given destination on the given link are...
std::size_t m_nEmlsrStations
number of stations to create that activate EMLSR
std::vector< PacketSocketAddress > m_dlSockets
packet socket address for DL traffic
std::vector< Time > m_paddingDelay
Padding Delay advertised by the non-AP MLD.
std::set< uint8_t > m_linksToEnableEmlsrOn
IDs of the links on which EMLSR mode has to be enabled.
Ptr< ApWifiMac > m_apMac
AP wifi MAC.
~EmlsrOperationsTestBase() override=default
bool m_putAuxPhyToSleep
whether aux PHYs are put to sleep during DL/UL TXOPs
void BaEstablishedUl(std::size_t index, Mac48Address recipient, uint8_t tid, std::optional< Mac48Address >)
Callback connected to the QosTxop's BaEstablished trace source of a STA's BE AC.
TrafficDirection
Enumeration for traffic directions.
void CheckMsdTimerRunning(Ptr< StaWifiMac > staMac, uint8_t linkId, bool isRunning, const std::string &msg)
Check whether the MediumSyncDelay timer is running on the given link of the given device.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint8_t m_mainPhyId
ID of the main PHY.
Time m_duration
simulation duration
Ptr< PacketSocketClient > GetApplication(TrafficDirection dir, std::size_t staId, std::size_t count, std::size_t pktSize, uint8_t priority=0) const
std::vector< FrameInfo > m_txPsdus
transmitted PSDUs
virtual void Transmit(Ptr< WifiMac > mac, uint8_t phyId, WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
Callback invoked when a FEM passes PSDUs to the PHY.
uint16_t m_lastAid
AID of last associated station.
std::vector< Time > m_transitionDelay
Transition Delay advertised by the non-AP MLD.
void CheckMainPhyTraceInfo(std::size_t index, std::string_view reason, const std::optional< uint8_t > &fromLinkId, uint8_t toLinkId, bool checkFromLinkId=true, bool checkToLinkId=true)
Check information provided by the EMLSR Manager MainPhySwitch trace.
std::map< std::size_t, std::shared_ptr< EmlsrMainPhySwitchTrace > > m_traceInfo
EMLSR client ID-indexed map of trace info from last main PHY switch.
Time m_transitionTimeout
Transition Timeout advertised by the AP MLD.
const std::array< FrequencyRange, 3 > m_freqRanges
array of frequency ranges for MLD links
void SetSsid(std::size_t count)
Set the SSID on the next station that needs to start the association procedure, or start traffic if n...
std::vector< PacketSocketAddress > m_ulSockets
packet socket address for UL traffic
void StaAssociated(uint16_t aid, Mac48Address)
Callback connected to the ApWifiMac's AssociatedSta trace source.
void CheckAuxPhysSleepMode(Ptr< StaWifiMac > staMac, bool sleep)
Check whether aux PHYs of the given device are in sleep mode/awake.
std::vector< Ptr< StaWifiMac > > m_staMacs
MACs of the non-AP MLDs.
std::size_t m_nPhysPerEmlsrDevice
number of PHYs per EMLSR client
virtual void StartTraffic()
Start the generation of traffic (needs to be overridden)
std::vector< uint8_t > m_establishBaUl
the TIDs for which BA needs to be established with the AP as recipient
EmlsrOperationsTestBase(const std::string &name)
Constructor.
Check UL OFDMA operations with EMLSR clients.
Time m_startAccessReq
start time of the first AP MLD access request via MU scheduler
void DoRun() override
Implementation to actually run this TestCase.
void CheckResults()
Check that the simulation produced the expected results.
EmlsrUlOfdmaTest(bool enableBsrp)
Constructor.
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.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
bool m_enableBsrp
whether MU scheduler sends BSRP TFs
std::size_t m_txPsdusPos
position in the vector of TX PSDUs of the first ICF
Test the transmission of UL frames from EMLSR clients.
std::size_t m_countQoSframes
counter for QoS frames
Time m_emlsrEnabledTime
when EMLSR mode has been enabled on all EMLSR clients
const Time m_unblockMainPhyLinkDelay
delay between the time the first two UL packets are generated and the time transmissions are unblocke...
Ptr< ListErrorModel > m_errorModel
error rate model to corrupt packets
bool m_useAuxPhyCca
whether CCA info from aux PHY is used when aux PHY is not TX capable
Time m_5thQosFrameTxTime
start transmission time of the 5th QoS data frame
MHz_u m_5thQosFrameExpWidth
expected width of the 5th QoS data frame
MHz_u m_auxPhyChannelWidth
max width supported by aux PHYs
void BackoffGenerated(uint32_t backoff, uint8_t linkId)
Callback invoked when a new backoff value is generated by the EMLSR client.
bool m_switchMainPhyBackDelayTimeout
whether a SwitchMainPhyBackDelay timer expires after that the main PHY moved to an aux PHY link
std::optional< uint8_t > m_nonEmlsrLink
ID of the non-EMLSR link (if any)
Time m_lastMsdExpiryTime
expiry time of the last MediumSyncDelay timer
void DoSetup() override
Implementation to do any local setup required for this TestCase.
std::size_t m_countRtsframes
counter for RTS frames
void CheckCtsFrames(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken by the EMLSR client when receiving a CTS frame on the given ...
void DoRun() override
Implementation to actually run this TestCase.
Time m_firstUlPktsGenTime
generation time of the first two UL packets
std::optional< bool > m_corruptCts
whether the transmitted CTS must be corrupted
~EmlsrUlTxopTest() override=default
void CheckBlockAck(const WifiConstPsduMap &psduMap, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken when an MLD transmits a PPDU containing BlockAck frames on t...
void StartTraffic() override
Start the generation of traffic (needs to be overridden)
std::optional< Time > m_backoffEndTime
expected backoff end time on main PHY link
MHz_u m_channelWidth
width of the channels used by MLDs
std::set< uint8_t > m_emlsrLinks
IDs of the links on which EMLSR mode has to be enabled.
Time m_mediumSyncDuration
duration of the MediumSyncDelay timer
void CheckRtsFrames(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken by the EMLSR client when transmitting an RTS frame on the gi...
void CheckQosFrames(const WifiConstPsduMap &psduMap, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken when an MLD transmits a PPDU containing QoS data frames on t...
bool m_genBackoffIfTxopWithoutTx
whether the backoff should be invoked when the AC gains the right to start a TXOP but it does not tra...
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.
uint8_t m_nSlotsLeftAlert
value for ChannelAccessManager NSlotsLeft attribute
bool m_checkBackoffStarted
whether we are checking the generated backoff values
std::size_t m_countBlockAck
counter for BlockAck frames
void CheckResults()
Check that the simulation produced the expected results.
uint8_t m_msdMaxNTxops
Max number of TXOPs that an EMLSR client is allowed to attempt to initiate while the MediumSyncDelay ...
EmlsrUlTxopTest(const Params &params)
Constructor.
wifi EMLSR Test Suite
Subclass of TestCase class adding the ability to test the serialization and deserialization of a Head...
an EUI-48 address
Smart pointer class similar to boost::intrusive_ptr.
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
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1369
WifiMacDropReason
The reason why an MPDU was dropped.
Definition wifi-mac.h:71
WifiQueueBlockedReason
Enumeration of the reasons to block container queues.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr FrequencyRange WIFI_SPECTRUM_6_GHZ
Identifier for the frequency range covering the wifi spectrum in the 6 GHz band.
constexpr FrequencyRange WIFI_SPECTRUM_5_GHZ
Identifier for the frequency range covering the wifi spectrum in the 5 GHz band.
WifiMacType
Combination of valid MAC header type/subtype.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:38
constexpr FrequencyRange WIFI_SPECTRUM_2_4_GHZ
Identifier for the frequency range covering the wifi spectrum in the 2.4 GHz band.
Parameters for the EMLSR DL TXOP test.
std::vector< Time > paddingDelay
vector (whose size equals nEmlsrStations) of the padding delay values advertised by non-AP MLDs
std::size_t nNonEmlsrStations
number of non-AP MLDs that do not support EMLSR
std::set< uint8_t > linksToEnableEmlsrOn
IDs of links on which EMLSR mode should be enabled.
Time transitionTimeout
the Transition Timeout advertised by the AP MLD
bool putAuxPhyToSleep
whether aux PHYs are put to sleep during DL/UL TXOPs
std::vector< Time > transitionDelay
vector (whose size equals nEmlsrStations) of transition the delay values advertised by non-AP MLDs
std::size_t nEmlsrStations
number of non-AP MLDs that support EMLSR
Information about transmitted frames.
WifiConstPsduMap psduMap
transmitted PSDU map
uint8_t phyId
ID of the transmitting PHY.
Parameters for the EMLSR UL TXOP test.
bool switchMainPhyBackDelayTimeout
whether a SwitchMainPhyBackDelay timer expires after that the main PHY moved to an aux PHY link
MHz_u auxPhyChannelWidth
max width supported by aux PHYs
uint8_t msdMaxNTxops
Max number of TXOPs that an EMLSR client is allowed to attempt to initiate while the MediumSyncDelay ...
bool putAuxPhyToSleep
whether aux PHYs are put to sleep during DL/UL TXOPs
uint8_t nSlotsLeftAlert
value to set the ChannelAccessManager NSlotsLeft attribute to
Time mediumSyncDuration
duration of the MediumSyncDelay timer
std::set< uint8_t > linksToEnableEmlsrOn
IDs of links on which EMLSR mode should be enabled.
bool genBackoffAndUseAuxPhyCca
this variable controls two boolean values that are either both set to true or both set to false; the ...
MHz_u channelWidth
width of the channels used by MLDs
Base struct for EMLSR Main PHY switch traces.
std::string dir
uint32_t pktSize
packet size used for the simulation (in bytes)