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