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 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Stefano Avallone <stavallo@unina.it>
18 */
19
20#ifndef WIFI_EMLSR_TEST_H
21#define WIFI_EMLSR_TEST_H
22
23#include "ns3/ap-wifi-mac.h"
24#include "ns3/error-model.h"
25#include "ns3/header-serialization-test.h"
26#include "ns3/packet-socket-address.h"
27#include "ns3/packet-socket-client.h"
28#include "ns3/sta-wifi-mac.h"
29#include "ns3/test.h"
30#include "ns3/wifi-mac-queue-scheduler.h"
31#include "ns3/wifi-mac.h"
32#include "ns3/wifi-ppdu.h"
33#include "ns3/wifi-psdu.h"
34
35using namespace ns3;
36
37/**
38 * \ingroup wifi-test
39 * \ingroup tests
40 *
41 * \brief Test EML Operating Mode Notification frame serialization and deserialization
42 */
44{
45 public:
46 /**
47 * Constructor
48 */
51
52 private:
53 void DoRun() override;
54};
55
56/**
57 * \ingroup wifi-test
58 * \ingroup tests
59 *
60 * \brief Base class for EMLSR Operations tests
61 *
62 * This base class setups and configures one AP MLD, a variable number of non-AP MLDs with
63 * EMLSR activated and a variable number of non-AP MLD with EMLSR deactivated. Every MLD has
64 * three links, each operating on a distinct PHY band (2.4 GHz, 5 GHz and 6 GHz). Therefore,
65 * it is expected that three links are setup by the non-AP MLD(s). The values for the Padding
66 * Delay, the Transition Delay and the Transition Timeout are provided as argument to the
67 * constructor of this class, along with the IDs of the links on which EMLSR mode must be
68 * enabled for the non-AP MLDs (this information is used to set the EmlsrLinkSet attribute
69 * of the DefaultEmlsrManager installed on the non-AP MLDs).
70 */
72{
73 public:
74 /**
75 * Constructor
76 *
77 * \param name The name of the new TestCase created
78 */
79 EmlsrOperationsTestBase(const std::string& name);
80 ~EmlsrOperationsTestBase() override = default;
81
82 /// Enumeration for traffic directions
83 enum TrafficDirection : uint8_t
84 {
86 UPLINK
87 };
88
89 protected:
90 /**
91 * Callback invoked when a FEM passes PSDUs to the PHY.
92 *
93 * \param mac the MAC transmitting the PSDUs
94 * \param phyId the ID of the PHY transmitting the PSDUs
95 * \param psduMap the PSDU map
96 * \param txVector the TX vector
97 * \param txPowerW the tx power in Watts
98 */
99 virtual void Transmit(Ptr<WifiMac> mac,
100 uint8_t phyId,
101 WifiConstPsduMap psduMap,
102 WifiTxVector txVector,
103 double txPowerW);
104
105 /**
106 * \param dir the traffic direction (downlink/uplink)
107 * \param staId the index (starting at 0) of the non-AP MLD generating/receiving packets
108 * \param count the number of packets to generate
109 * \param pktSize the size of the packets to generate
110 * \return an application generating the given number packets of the given size from/to the
111 * AP MLD to/from the given non-AP MLD
112 */
114 std::size_t staId,
115 std::size_t count,
116 std::size_t pktSize) const;
117
118 /**
119 * Check whether QoS data unicast transmissions addressed to the given destination on the
120 * given link are blocked or unblocked for the given reason on the given device.
121 *
122 * \param mac the MAC of the given device
123 * \param dest the MAC address of the given destination
124 * \param linkId the ID of the given link
125 * \param reason the reason for blocking transmissions to test
126 * \param blocked whether transmissions are blocked for the given reason
127 * \param description text indicating when this check is performed
128 * \param testUnblockedForOtherReasons whether to test if transmissions are unblocked for
129 * all the reasons other than the one provided
130 */
132 Mac48Address dest,
133 uint8_t linkId,
135 bool blocked,
136 std::string description,
137 bool testUnblockedForOtherReasons = true);
138
139 void DoSetup() override;
140
141 /// Information about transmitted frames
143 {
144 Time startTx; ///< TX start time
145 WifiConstPsduMap psduMap; ///< transmitted PSDU map
146 WifiTxVector txVector; ///< TXVECTOR
147 uint8_t linkId; ///< link ID
148 uint8_t phyId; ///< ID of the transmitting PHY
149 };
150
151 uint8_t m_mainPhyId{0}; //!< ID of the main PHY
152 std::set<uint8_t> m_linksToEnableEmlsrOn; /**< IDs of the links on which EMLSR mode has to
153 be enabled */
154 std::size_t m_nEmlsrStations{1}; ///< number of stations to create that activate EMLSR
155 std::size_t m_nNonEmlsrStations{0}; /**< number of stations to create that do not
156 activate EMLSR */
157 Time m_transitionTimeout{MicroSeconds(128)}; ///< Transition Timeout advertised by the AP MLD
158 std::vector<Time> m_paddingDelay{
159 {MicroSeconds(32)}}; ///< Padding Delay advertised by the non-AP MLD
160 std::vector<Time> m_transitionDelay{
161 {MicroSeconds(16)}}; ///< Transition Delay advertised by the non-AP MLD
162 bool m_establishBaDl{false}; /**< whether BA needs to be established (for TID 0)
163 with the AP as originator */
164 bool m_establishBaUl{false}; /**< whether BA needs to be established (for TID 0)
165 with the AP as recipient */
166 std::vector<FrameInfo> m_txPsdus; ///< transmitted PSDUs
167 Ptr<ApWifiMac> m_apMac; ///< AP wifi MAC
168 std::vector<Ptr<StaWifiMac>> m_staMacs; ///< MACs of the non-AP MLDs
169 std::vector<PacketSocketAddress> m_dlSockets; ///< packet socket address for DL traffic
170 std::vector<PacketSocketAddress> m_ulSockets; ///< packet socket address for UL traffic
171 uint16_t m_lastAid{0}; ///< AID of last associated station
172 Time m_duration{0}; ///< simulation duration
173
174 private:
175 /**
176 * Set the SSID on the next station that needs to start the association procedure.
177 * This method is connected to the ApWifiMac's AssociatedSta trace source.
178 * Start generating traffic (if needed) when all stations are associated.
179 *
180 * \param aid the AID assigned to the previous associated STA
181 */
182 void SetSsid(uint16_t aid, Mac48Address /* addr */);
183
184 /**
185 * Start the generation of traffic (needs to be overridden)
186 */
187 virtual void StartTraffic()
188 {
189 }
190};
191
192/**
193 * \ingroup wifi-test
194 * \ingroup tests
195 *
196 * \brief Test the exchange of EML Operating Mode Notification frames.
197 *
198 * This test considers an AP MLD and a non-AP MLD with EMLSR activated. Upon association,
199 * the non-AP MLD sends an EML Operating Mode Notification frame, which is however corrupted
200 * by using a post reception error model (installed on the AP MLD). We keep corrupting the
201 * EML Notification frames transmitted by the non-AP MLD until the frame is dropped due to
202 * exceeded max retry limit. It is checked that:
203 *
204 * - the Association Request contains a Multi-Link Element including an EML Capabilities field
205 * that contains the expected values for Padding Delay and Transition Delay
206 * - the Association Response contains a Multi-Link Element including an EML Capabilities field
207 * that contains the expected value for Transition Timeout
208 * - all EML Notification frames contain the expected values for EMLSR Mode, EMLMR Mode and
209 * Link Bitmap fields and are transmitted on the link used for association
210 * - the correct EMLSR link set is stored by the EMLSR Manager, both when the transition
211 * timeout expires and when an EML Notification response is received from the AP MLD (thus,
212 * the correct EMLSR link set is stored after whichever of the two events occur first)
213 */
215{
216 public:
217 /**
218 * Constructor
219 *
220 * \param linksToEnableEmlsrOn IDs of links on which EMLSR mode should be enabled
221 * \param transitionTimeout the Transition Timeout advertised by the AP MLD
222 */
223 EmlOmnExchangeTest(const std::set<uint8_t>& linksToEnableEmlsrOn, Time transitionTimeout);
224 ~EmlOmnExchangeTest() override = default;
225
226 protected:
227 void DoSetup() override;
228 void DoRun() override;
229 void Transmit(Ptr<WifiMac> mac,
230 uint8_t phyId,
231 WifiConstPsduMap psduMap,
232 WifiTxVector txVector,
233 double txPowerW) override;
234
235 /**
236 * Callback invoked when the non-AP MLD receives the acknowledgment for a transmitted MPDU.
237 *
238 * \param mpdu the acknowledged MPDU
239 */
240 void TxOk(Ptr<const WifiMpdu> mpdu);
241 /**
242 * Callback invoked when the non-AP MLD drops the given MPDU for the given reason.
243 *
244 * \param reason the reason why the MPDU was dropped
245 * \param mpdu the dropped MPDU
246 */
248
249 /**
250 * Check the content of the EML Capabilities subfield of the Multi-Link Element included
251 * in the Association Request frame sent by the non-AP MLD.
252 *
253 * \param mpdu the MPDU containing the Association Request frame
254 * \param txVector the TXVECTOR used to transmit the frame
255 * \param linkId the ID of the link on which the frame was transmitted
256 */
258 const WifiTxVector& txVector,
259 uint8_t linkId);
260 /**
261 * Check the content of the EML Capabilities subfield of the Multi-Link Element included
262 * in the Association Response frame sent by the AP MLD to the EMLSR client.
263 *
264 * \param mpdu the MPDU containing the Association Response frame
265 * \param txVector the TXVECTOR used to transmit the frame
266 * \param linkId the ID of the link on which the frame was transmitted
267 */
269 const WifiTxVector& txVector,
270 uint8_t linkId);
271 /**
272 * Check the content of a received EML Operating Mode Notification frame.
273 *
274 * \param psdu the PSDU containing the EML Operating Mode Notification frame
275 * \param txVector the TXVECTOR used to transmit the frame
276 * \param linkId the ID of the link on which the frame was transmitted
277 */
279 const WifiTxVector& txVector,
280 uint8_t linkId);
281 /**
282 * Check that the EMLSR mode has been enabled on the expected EMLSR links.
283 */
284 void CheckEmlsrLinks();
285
286 private:
287 std::size_t m_checkEmlsrLinksCount; /**< counter for the number of times CheckEmlsrLinks
288 is called (should be two: when the transition
289 timeout expires and when the EML Notification
290 response from the AP MLD is received */
291 std::size_t m_emlNotificationDroppedCount; /**< counter for the number of times the EML
292 Notification frame sent by the non-AP MLD
293 has been dropped due to max retry limit */
294 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt packets at AP MLD
295 std::list<uint64_t> m_uidList; ///< list of UIDs of packets to corrupt
296};
297
298/**
299 * \ingroup wifi-test
300 * \ingroup tests
301 *
302 * \brief Test the transmission of DL frames to EMLSR clients.
303 *
304 * This test considers an AP MLD and a configurable number of non-AP MLDs that support EMLSR
305 * and a configurable number of non-AP MLDs that do not support EMLSR. All MLDs have three
306 * setup links, while the set of EMLSR links for the EMLSR clients is configurable.
307 * Block ack agreements (for TID 0, with the AP MLD as originator) are established with all
308 * the non-AP MLDs before that EMLSR clients send the EML Operating Mode Notification frame
309 * to enable the EMLSR mode on their EMLSR links.
310 *
311 * Before enabling EMLSR mode, it is checked that:
312 *
313 * - all EMLSR links (but the link used for ML setup) of the EMLSR clients are considered to
314 * be in power save mode and are blocked by the AP MLD; all the other links have transitioned
315 * to active mode and are not blocked
316 * - no MU-RTS Trigger Frame is sent as Initial control frame
317 * - In case of EMLSR clients having no link that is not an EMLSR link and is different than
318 * the link used for ML setup, the two A-MPDUs used to trigger BA establishment are
319 * transmitted one after another on the link used for ML setup. Otherwise, the two A-MPDUs
320 * are sent concurrently on two distinct links
321 *
322 * After enabling EMLSR mode, it is checked that:
323 *
324 * - all EMLSR links of the EMLSR clients are considered to be in active mode and are not
325 * blocked by the AP MLD
326 * - If all setup links are EMLSR links, the first two frame exchanges are both protected by
327 * MU-RTS TF and occur one after another. Otherwise, one frame exchange occurs on the
328 * non-EMLSR link and is not protected by MU-RTS TF; the other frame exchange occurs on an
329 * EMLSR link and is protected by MU-RTS TF
330 * - the AP MLD blocks transmission on all other EMLSR links when sending an ICF to an EMLSR client
331 * - After completing a frame exchange with an EMLSR client, the AP MLD can start another frame
332 * exchange with that EMLSR client within the same TXOP (after a SIFS) without sending an ICF
333 * - During the transition delay, all EMLSR links are not used for DL transmissions
334 * - The padding added to Initial Control frames is the largest among all the EMLSR clients
335 * solicited by the ICF
336 *
337 * After disabling EMLSR mode, it is checked that:
338 *
339 * - all EMLSR links (but the link used to exchange EML Notification frames) of the EMLSR clients
340 * are considered to be in power save mode and are blocked by the AP MLD
341 * - an MU-RTS Trigger Frame is sent by the AP MLD as ICF for sending the EML Notification
342 * response, unless the link used to exchange EML Notification frames is a non-EMLSR link
343 * - no MU-RTS Trigger Frame is used as ICF for QoS data frames
344 * - In case of EMLSR clients having no link that is not an EMLSR link and is different than
345 * the link used to exchange EML Notification frames, the two A-MPDUs are transmitted one
346 * after another on the link used to exchange EML Notification frames. Otherwise, the two
347 * A-MPDUs are sent concurrently on two distinct links
348 */
350{
351 public:
352 /**
353 * Parameters for the EMLSR DL TXOP test
354 */
355 struct Params
356 {
357 std::size_t nEmlsrStations; //!< number of non-AP MLDs that support EMLSR
358 std::size_t nNonEmlsrStations; //!< number of non-AP MLDs that do not support EMLSR
359 std::set<uint8_t>
360 linksToEnableEmlsrOn; //!< IDs of links on which EMLSR mode should be enabled
361 std::vector<Time> paddingDelay; //!< vector (whose size equals <i>nEmlsrStations</i>) of the
362 //!< padding delay values advertised by non-AP MLDs
363 std::vector<Time>
364 transitionDelay; //!< vector (whose size equals <i>nEmlsrStations</i>) of
365 //!< transition the delay values advertised by non-AP MLDs
366 Time transitionTimeout; //!< the Transition Timeout advertised by the AP MLD
367 };
368
369 /**
370 * Constructor
371 *
372 * \param params parameters for the EMLSR DL TXOP test
373 */
374 EmlsrDlTxopTest(const Params& params);
375 ~EmlsrDlTxopTest() override = default;
376
377 protected:
378 void DoSetup() override;
379 void DoRun() override;
380 void Transmit(Ptr<WifiMac> mac,
381 uint8_t phyId,
382 WifiConstPsduMap psduMap,
383 WifiTxVector txVector,
384 double txPowerW) override;
385
386 /**
387 * Check that the simulation produced the expected results.
388 */
389 void CheckResults();
390
391 /**
392 * Check that the AP MLD considers the correct Power Management mode for the links setup
393 * with the given non-AP MLD. This method is intended to be called shortly after ML setup.
394 *
395 * \param address a link address of the given non-AP MLD
396 */
397 void CheckPmModeAfterAssociation(const Mac48Address& address);
398
399 /**
400 * Check that appropriate actions are taken when the AP MLD transmits an EML Operating Mode
401 * Notification response frame to an EMLSR client on the given link.
402 *
403 * \param mpdu the MPDU carrying the EML Operating Mode Notification frame
404 * \param txVector the TXVECTOR used to send the PPDU
405 * \param linkId the ID of the given link
406 */
408 const WifiTxVector& txVector,
409 uint8_t linkId);
410
411 /**
412 * Check that appropriate actions are taken when an EMLSR client transmits an EML Operating
413 * Mode Notification frame to the AP MLD on the given link.
414 *
415 * \param mpdu the MPDU carrying the EML Operating Mode Notification frame
416 * \param txVector the TXVECTOR used to send the PPDU
417 * \param linkId the ID of the given link
418 */
420 const WifiTxVector& txVector,
421 uint8_t linkId);
422
423 /**
424 * Check that appropriate actions are taken by the AP MLD transmitting an initial
425 * Control frame to an EMLSR client on the given link.
426 *
427 * \param mpdu the MPDU carrying the MU-RTS TF
428 * \param txVector the TXVECTOR used to send the PPDU
429 * \param linkId the ID of the given link
430 */
432 const WifiTxVector& txVector,
433 uint8_t linkId);
434
435 /**
436 * Check that appropriate actions are taken by the AP MLD transmitting a PPDU containing
437 * QoS data frames to EMLSR clients on the given link.
438 *
439 * \param psduMap the PSDU(s) carrying QoS data frames
440 * \param txVector the TXVECTOR used to send the PPDU
441 * \param linkId the ID of the given link
442 */
443 void CheckQosFrames(const WifiConstPsduMap& psduMap,
444 const WifiTxVector& txVector,
445 uint8_t linkId);
446
447 /**
448 * Check that appropriate actions are taken by the AP MLD receiving a PPDU containing
449 * BlockAck frames from EMLSR clients on the given link.
450 *
451 * \param psduMap the PSDU carrying BlockAck frames
452 * \param txVector the TXVECTOR used to send the PPDU
453 * \param phyId the ID of the PHY transmitting the PSDU(s)
454 */
455 void CheckBlockAck(const WifiConstPsduMap& psduMap,
456 const WifiTxVector& txVector,
457 uint8_t phyId);
458
459 private:
460 void StartTraffic() override;
461
462 /**
463 * Enable EMLSR mode on the next EMLSR client
464 */
465 void EnableEmlsrMode();
466
467 std::set<uint8_t> m_emlsrLinks; /**< IDs of the links on which EMLSR mode has to be enabled */
468 Time m_emlsrEnabledTime; //!< when EMLSR mode has been enabled on all EMLSR clients
469 const Time m_fe2to3delay; /**< time interval between 2nd and 3rd frame exchange sequences
470 after the enablement of EMLSR mode */
471 std::size_t m_countQoSframes; //!< counter for QoS frames (transition delay test)
472 std::size_t m_countBlockAck; //!< counter for BlockAck frames (transition delay test)
473 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt BlockAck at AP MLD
474};
475
476/**
477 * \ingroup wifi-test
478 * \ingroup tests
479 *
480 * \brief Test the transmission of UL frames from EMLSR clients.
481 *
482 * This test considers an AP MLD and a non-AP MLD that support EMLSR. The non-AP MLD setups three
483 * links, while the set of EMLSR links is configurable. Block ack agreements (for TID 0) for both
484 * DL and UL directions are established after that the EML Operating Mode Notification frames are
485 * exchanged to enable the EMLSR mode on the EMLSR links. Aux PHYs on the EMLSR client do not
486 * switch link, hence the main PHY will switch link (if needed) when terminating a TXOP.
487 *
488 * It is checked that:
489 *
490 * - Initially, aux PHYs are configured so that they are unable to transmit frames. Before
491 * generating the packets for the first UL data frame, transmissions on the link where the
492 * main PHY is operating and on the non-EMLSR link (if any) are blocked. Thus, the first UL data
493 * frame is held until transmissions on the link where the main PHY is operating are unblocked.
494 * The first UL data frame is sent by the main PHY without RTS protection. When the data frame
495 * exchange terminates, the MediumSyncDelay timer is started on the other EMLSR links and the
496 * CCA ED threshold is set as expected
497 * - If there is a non-EMLSR link, another data frame can be sent concurrently (without protection)
498 * on the non-EMLSR link
499 * - When the first UL data frame is transmitted, we make the aux PHYs on the EMLSR client capable
500 * of transmitting, we block transmissions on the link where the main PHY is operating and
501 * generate new UL packets, which will then be transmitted on a link where an aux PHY is
502 * operating. Thus, the aux PHY transmits an RTS frame and the main PHY will take over and
503 * transmit the second UL data frame. We check that, while the link on which the main PHY was
504 * operating is blocked because another EMLSR link is being used, new backoff values for that
505 * link are generated if and only if the QosTxop::GenerateBackoffIfTxopWithoutTx attribute is
506 * true; otherwise, a new backoff value is generated when the link is unblocked.
507 * - When the exchange of the second UL data frame terminates, we make the aux PHY unable to
508 * transmit, block transmissions on the non-EMLSR link (if any) and generate some more UL
509 * packets, which will then be transmitted by the main PHY. However, a MediumSyncDelay timer
510 * is now running on the link where the main PHY is operating, hence transmissions are protected
511 * by an RTS frame. We install a post reception error model on the AP MLD so that all RTS frames
512 * sent by the EMLSR client are not received by the AP MLD. We check that the EMLSR client makes
513 * at most the configured max number of transmission attempts and that another UL data frame is
514 * sent once the MediumSyncDelay timer is expired. We also check that the TX width of the RTS
515 * frames and the UL data frame equal the channel width used by the main PHY.
516 * - We check that no issue arises in case an aux PHY sends an RTS frame but the CTS response is
517 * not transmitted successfully. Specifically, we check that the main PHY is completing the
518 * channel switch when the (unsuccessful) reception of the CTS ends and that a new RTS/CTS
519 * exchange is carried out to protect the transmission of the last data frame.
520 */
522{
523 public:
524 /**
525 * Parameters for the EMLSR UL TXOP test
526 */
527 struct Params
528 {
529 std::set<uint8_t>
530 linksToEnableEmlsrOn; //!< IDs of links on which EMLSR mode should be enabled
531 uint16_t channelWidth; //!< width (MHz) of the channels used by MLDs
532 uint16_t auxPhyChannelWidth; //!< max width (MHz) supported by aux PHYs
533 Time mediumSyncDuration; //!< duration of the MediumSyncDelay timer
534 uint8_t msdMaxNTxops; //!< Max number of TXOPs that an EMLSR client is allowed
535 //!< to attempt to initiate while the MediumSyncDelay
536 //!< timer is running (zero indicates no limit)
537 bool genBackoffIfTxopWithoutTx; //!< whether the backoff should be invoked when the AC
538 //!< gains the right to start a TXOP but it does not
539 //!< transmit any frame
540 };
541
542 /**
543 * Constructor
544 *
545 * \param params parameters for the EMLSR UL TXOP test
546 */
547 EmlsrUlTxopTest(const Params& params);
548 ~EmlsrUlTxopTest() override = default;
549
550 protected:
551 void DoSetup() override;
552 void DoRun() override;
553 void Transmit(Ptr<WifiMac> mac,
554 uint8_t phyId,
555 WifiConstPsduMap psduMap,
556 WifiTxVector txVector,
557 double txPowerW) override;
558
559 /**
560 * Check that the simulation produced the expected results.
561 */
562 void CheckResults();
563
564 /**
565 * Check that appropriate actions are taken by the EMLSR client when transmitting an RTS
566 * frame on the given link.
567 *
568 * \param mpdu the MPDU carrying the RTS frame
569 * \param txVector the TXVECTOR used to send the PPDU
570 * \param linkId the ID of the given link
571 */
572 void CheckRtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
573
574 /**
575 * Check that appropriate actions are taken by the EMLSR client when receiving a CTS
576 * frame on the given link.
577 *
578 * \param mpdu the MPDU carrying the CTS frame
579 * \param txVector the TXVECTOR used to send the PPDU
580 * \param linkId the ID of the given link
581 */
582 void CheckCtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
583
584 /**
585 * Check that appropriate actions are taken when an MLD transmits a PPDU containing
586 * QoS data frames on the given link.
587 *
588 * \param psduMap the PSDU(s) carrying QoS data frames
589 * \param txVector the TXVECTOR used to send the PPDU
590 * \param linkId the ID of the given link
591 */
592 void CheckQosFrames(const WifiConstPsduMap& psduMap,
593 const WifiTxVector& txVector,
594 uint8_t linkId);
595
596 /**
597 * Check that appropriate actions are taken when an MLD transmits a PPDU containing
598 * BlockAck frames on the given link.
599 *
600 * \param psduMap the PSDU carrying BlockAck frames
601 * \param txVector the TXVECTOR used to send the PPDU
602 * \param linkId the ID of the given link
603 */
604 void CheckBlockAck(const WifiConstPsduMap& psduMap,
605 const WifiTxVector& txVector,
606 uint8_t linkId);
607
608 private:
609 void StartTraffic() override;
610
611 /**
612 * Callback invoked when a new backoff value is generated by the EMLSR client.
613 *
614 * \param backoff the generated backoff value
615 * \param linkId the ID of the link for which the backoff value has been generated
616 */
617 void BackoffGenerated(uint32_t backoff, uint8_t linkId);
618
619 std::set<uint8_t> m_emlsrLinks; /**< IDs of the links on which EMLSR mode has to be enabled */
620 uint16_t m_channelWidth; //!< width (MHz) of the channels used by MLDs
621 uint16_t m_auxPhyChannelWidth; //!< max width (MHz) supported by aux PHYs
622 Time m_mediumSyncDuration; //!< duration of the MediumSyncDelay timer
623 uint8_t m_msdMaxNTxops; //!< Max number of TXOPs that an EMLSR client is allowed
624 //!< to attempt to initiate while the MediumSyncDelay
625 //!< timer is running (zero indicates no limit)
626 std::optional<uint8_t> m_nonEmlsrLink; //!< ID of the non-EMLSR link (if any)
627 Time m_emlsrEnabledTime; //!< when EMLSR mode has been enabled on all EMLSR clients
628 Time m_firstUlPktsGenTime; //!< generation time of the first two UL packets
629 const Time m_unblockMainPhyLinkDelay; //!< delay between the time the first two UL packets are
630 //!< generated and the time transmissions are unblocked
631 //!< on the link where the main PHY is operating on
632 Time m_lastMsdExpiryTime; //!< expiry time of the last MediumSyncDelay timer
633 bool m_checkBackoffStarted; //!< whether we are checking the generated backoff values
634 std::optional<Time> m_backoffEndTime; //!< expected backoff end time on main PHY link
635 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt packets
636 std::size_t m_countQoSframes; //!< counter for QoS frames
637 std::size_t m_countBlockAck; //!< counter for BlockAck frames
638 std::size_t m_countRtsframes; //!< counter for RTS frames
639 bool m_genBackoffIfTxopWithoutTx; //!< whether the backoff should be invoked when the AC
640 //!< gains the right to start a TXOP but it does not
641 //!< transmit any frame
642 std::optional<bool> m_corruptCts; //!< whether the transmitted CTS must be corrupted
643};
644
645/**
646 * \ingroup wifi-test
647 * \ingroup tests
648 *
649 * \brief Test the switching of PHYs on EMLSR clients.
650 *
651 * An AP MLD and an EMLSR client setup 3 links, on which EMLSR mode is enabled. The AP MLD
652 * transmits 4 QoS data frames (one after another, each protected by ICF):
653 *
654 * - the first one on the link used for ML setup, hence no PHY switch occurs
655 * - the second one on another link, thus causing the main PHY to switch link
656 * - the third one on the remaining link, thus causing the main PHY to switch link again
657 * - the fourth one on the link used for ML setup; if the aux PHYs switches link, there is
658 * one aux PHY listening on such a link and the main PHY switches to this link, otherwise
659 * no PHY is listening on such a link and there is no response to the ICF sent by the AP MLD
660 */
662{
663 public:
664 /**
665 * Parameters for the EMLSR link switching test
666 */
667 struct Params
668 {
669 bool
670 switchAuxPhy; //!< whether AUX PHY should switch channel to operate on the link on which
671 //!< the Main PHY was operating before moving to the link of the Aux PHY
672 bool resetCamState; //!< whether to reset the state of the ChannelAccessManager associated
673 //!< with the link on which the main PHY has just switched to
674 uint16_t auxPhyMaxChWidth; //!< max channel width (MHz) supported by aux PHYs
675 };
676
677 /**
678 * Constructor
679 *
680 * \param params parameters for the EMLSR link switching test
681 */
682 EmlsrLinkSwitchTest(const Params& params);
683
684 ~EmlsrLinkSwitchTest() override = default;
685
686 protected:
687 void DoSetup() override;
688 void DoRun() override;
689 void Transmit(Ptr<WifiMac> mac,
690 uint8_t phyId,
691 WifiConstPsduMap psduMap,
692 WifiTxVector txVector,
693 double txPowerW) override;
694
695 /**
696 * Check that the simulation produced the expected results.
697 */
698 void CheckResults();
699
700 /**
701 * Check that the Main PHY (and possibly the Aux PHY) correctly switches channel when the
702 * reception of an ICF ends.
703 *
704 * \param psduMap the PSDU carrying the MU-RTS TF
705 * \param txVector the TXVECTOR used to send the PPDU
706 * \param linkId the ID of the given link
707 */
708 void CheckInitialControlFrame(const WifiConstPsduMap& psduMap,
709 const WifiTxVector& txVector,
710 uint8_t linkId);
711
712 /**
713 * Check that appropriate actions are taken by the AP MLD transmitting a PPDU containing
714 * QoS data frames to the EMLSR client on the given link.
715 *
716 * \param psduMap the PSDU(s) carrying QoS data frames
717 * \param txVector the TXVECTOR used to send the PPDU
718 * \param linkId the ID of the given link
719 */
720 void CheckQosFrames(const WifiConstPsduMap& psduMap,
721 const WifiTxVector& txVector,
722 uint8_t linkId);
723
724 private:
725 bool m_switchAuxPhy; /**< whether AUX PHY should switch channel to operate on the link on which
726 the Main PHY was operating before moving to the link of Aux PHY */
727 bool m_resetCamState; /**< whether to reset the state of the ChannelAccessManager associated
728 with the link on which the main PHY has just switched to */
729 uint16_t m_auxPhyMaxChWidth; //!< max channel width (MHz) supported by aux PHYs
730 std::size_t m_countQoSframes; //!< counter for QoS data frames
731 std::size_t m_txPsdusPos; //!< a position in the vector of TX PSDUs
732};
733
734/**
735 * \ingroup wifi-test
736 * \ingroup tests
737 *
738 * \brief wifi EMLSR Test Suite
739 */
741{
742 public:
744};
745
746#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.
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.
EmlOperatingModeNotificationTest()
Constructor.
void DoRun() override
Implementation to actually run this TestCase.
~EmlOperatingModeNotificationTest() override=default
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 ...
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.
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
TrafficDirection
Enumeration for traffic directions.
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.
Time m_transitionTimeout
Transition Timeout advertised by the AP MLD.
std::vector< PacketSocketAddress > m_ulSockets
packet socket address for UL traffic
std::vector< Ptr< StaWifiMac > > m_staMacs
MACs of the non-AP MLDs.
virtual void StartTraffic()
Start the generation of traffic (needs to be overridden)
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
uint16_t m_channelWidth
width (MHz) of the channels used by MLDs
void BackoffGenerated(uint32_t backoff, uint8_t linkId)
Callback invoked when a new backoff value is generated by the EMLSR client.
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
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.
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 ...
uint16_t m_auxPhyChannelWidth
max width (MHz) supported by aux PHYs
wifi EMLSR Test Suite
Subclass of TestCase class adding the ability to test the serialization and deserialization of a Head...
an EUI-48 address
Definition: mac48-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
encapsulates test code
Definition: test.h:1061
A suite of tests to run.
Definition: test.h:1273
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
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:1343
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:80
WifiQueueBlockedReason
Enumeration of the reasons to block container queues.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
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
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.
uint16_t auxPhyChannelWidth
max width (MHz) supported by aux PHYs
bool genBackoffIfTxopWithoutTx
whether the backoff should be invoked when the AC gains the right to start a TXOP but it does not tra...
uint8_t msdMaxNTxops
Max number of TXOPs that an EMLSR client is allowed to attempt to initiate while the MediumSyncDelay ...
uint16_t channelWidth
width (MHz) of the channels used by MLDs
Time mediumSyncDuration
duration of the MediumSyncDelay timer
std::set< uint8_t > linksToEnableEmlsrOn
IDs of links on which EMLSR mode should be enabled.
std::string dir
uint32_t pktSize
packet size used for the simulation (in bytes)