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 by the AP MLD transmitting 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 by the AP MLD transmitting an initial
413 * Control frame to an EMLSR client on the given link.
414 *
415 * \param mpdu the MPDU carrying the MU-RTS TF
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 a PPDU containing
425 * QoS data frames to EMLSR clients on the given link.
426 *
427 * \param psduMap the PSDU(s) carrying QoS data frames
428 * \param txVector the TXVECTOR used to send the PPDU
429 * \param linkId the ID of the given link
430 */
431 void CheckQosFrames(const WifiConstPsduMap& psduMap,
432 const WifiTxVector& txVector,
433 uint8_t linkId);
434
435 /**
436 * Check that appropriate actions are taken by the AP MLD receiving a PPDU containing
437 * BlockAck frames from EMLSR clients on the given link.
438 *
439 * \param psduMap the PSDU carrying BlockAck frames
440 * \param txVector the TXVECTOR used to send the PPDU
441 * \param phyId the ID of the PHY transmitting the PSDU(s)
442 */
443 void CheckBlockAck(const WifiConstPsduMap& psduMap,
444 const WifiTxVector& txVector,
445 uint8_t phyId);
446
447 private:
448 void StartTraffic() override;
449
450 /**
451 * Enable EMLSR mode on the next EMLSR client
452 */
453 void EnableEmlsrMode();
454
455 std::set<uint8_t> m_emlsrLinks; /**< IDs of the links on which EMLSR mode has to be enabled */
456 Time m_emlsrEnabledTime; //!< when EMLSR mode has been enabled on all EMLSR clients
457 const Time m_fe2to3delay; /**< time interval between 2nd and 3rd frame exchange sequences
458 after the enablement of EMLSR mode */
459 std::size_t m_countQoSframes; //!< counter for QoS frames (transition delay test)
460 std::size_t m_countBlockAck; //!< counter for BlockAck frames (transition delay test)
461 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt BlockAck at AP MLD
462};
463
464/**
465 * \ingroup wifi-test
466 * \ingroup tests
467 *
468 * \brief Test the transmission of UL frames from EMLSR clients.
469 *
470 * This test considers an AP MLD and a non-AP MLD that support EMLSR. The non-AP MLD setups three
471 * links, while the set of EMLSR links is configurable. Block ack agreements (for TID 0) for both
472 * DL and UL directions are established after that the EML Operating Mode Notification frames are
473 * exchanged to enable the EMLSR mode on the EMLSR links. Aux PHYs on the EMLSR client do not
474 * switch link, hence the main PHY will switch link (if needed) when terminating a TXOP.
475 *
476 * It is checked that:
477 *
478 * - Initially, aux PHYs are configured so that they are unable to transmit frames. Before
479 * generating the packets for the first UL data frame, transmissions on the link where the
480 * main PHY is operating and on the non-EMLSR link (if any) are blocked. Thus, the first UL data
481 * frame is held until transmissions on the link where the main PHY is operating are unblocked.
482 * The first UL data frame is sent by the main PHY without RTS protection. When the data frame
483 * exchange terminates, the MediumSyncDelay timer is started on the other EMLSR links and the
484 * CCA ED threshold is set as expected
485 * - If there is a non-EMLSR link, another data frame can be sent concurrently (without protection)
486 * on the non-EMLSR link
487 * - When the first UL data frame is transmitted, we make the aux PHYs on the EMLSR client capable
488 * of transmitting, we block transmissions on the link where the main PHY is operating and
489 * generate new UL packets, which will then be transmitted on a link where an aux PHY is
490 * operating. Thus, the aux PHY transmits an RTS frame and the main PHY will take over and
491 * transmit the second UL data frame. We check that, while the link on which the main PHY was
492 * operating is blocked because another EMLSR link is being used, new backoff values for that
493 * link are generated if and only if the QosTxop::GenerateBackoffIfTxopWithoutTx attribute is
494 * true; otherwise, a new backoff value is generated when the link is unblocked.
495 * - When the exchange of the second UL data frame terminates, we make the aux PHY unable to
496 * transmit, block transmissions on the non-EMLSR link (if any) and generate some more UL
497 * packets, which will then be transmitted by the main PHY. However, a MediumSyncDelay timer
498 * is now running on the link where the main PHY is operating, hence transmissions are protected
499 * by an RTS frame. We install a post reception error model on the AP MLD so that all RTS frames
500 * sent by the EMLSR client are not received by the AP MLD. We check that the EMLSR client makes
501 * at most the configured max number of transmission attempts and that another UL data frame is
502 * sent once the MediumSyncDelay timer is expired. We also check that the TX width of the RTS
503 * frames and the UL data frame equal the channel width used by the main PHY.
504 * - We check that no issue arises in case an aux PHY sends an RTS frame but the CTS response is
505 * not transmitted successfully. Specifically, we check that the main PHY is completing the
506 * channel switch when the (unsuccessful) reception of the CTS ends and that a new RTS/CTS
507 * exchange is carried out to protect the transmission of the last data frame.
508 */
510{
511 public:
512 /**
513 * Parameters for the EMLSR UL TXOP test
514 */
515 struct Params
516 {
517 std::set<uint8_t>
518 linksToEnableEmlsrOn; //!< IDs of links on which EMLSR mode should be enabled
519 uint16_t channelWidth; //!< width (MHz) of the channels used by MLDs
520 uint16_t auxPhyChannelWidth; //!< max width (MHz) supported by aux PHYs
521 Time mediumSyncDuration; //!< duration of the MediumSyncDelay timer
522 uint8_t msdMaxNTxops; //!< Max number of TXOPs that an EMLSR client is allowed
523 //!< to attempt to initiate while the MediumSyncDelay
524 //!< timer is running (zero indicates no limit)
525 bool genBackoffIfTxopWithoutTx; //!< whether the backoff should be invoked when the AC
526 //!< gains the right to start a TXOP but it does not
527 //!< transmit any frame
528 };
529
530 /**
531 * Constructor
532 *
533 * \param params parameters for the EMLSR UL TXOP test
534 */
535 EmlsrUlTxopTest(const Params& params);
536 ~EmlsrUlTxopTest() override = default;
537
538 protected:
539 void DoSetup() override;
540 void DoRun() override;
541 void Transmit(Ptr<WifiMac> mac,
542 uint8_t phyId,
543 WifiConstPsduMap psduMap,
544 WifiTxVector txVector,
545 double txPowerW) override;
546
547 /**
548 * Check that the simulation produced the expected results.
549 */
550 void CheckResults();
551
552 /**
553 * Check that appropriate actions are taken by the EMLSR client when transmitting an RTS
554 * frame on the given link.
555 *
556 * \param mpdu the MPDU carrying the RTS frame
557 * \param txVector the TXVECTOR used to send the PPDU
558 * \param linkId the ID of the given link
559 */
560 void CheckRtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
561
562 /**
563 * Check that appropriate actions are taken by the EMLSR client when receiving a CTS
564 * frame on the given link.
565 *
566 * \param mpdu the MPDU carrying the CTS frame
567 * \param txVector the TXVECTOR used to send the PPDU
568 * \param linkId the ID of the given link
569 */
570 void CheckCtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
571
572 /**
573 * Check that appropriate actions are taken when an MLD transmits a PPDU containing
574 * QoS data frames on the given link.
575 *
576 * \param psduMap the PSDU(s) carrying QoS data frames
577 * \param txVector the TXVECTOR used to send the PPDU
578 * \param linkId the ID of the given link
579 */
580 void CheckQosFrames(const WifiConstPsduMap& psduMap,
581 const WifiTxVector& txVector,
582 uint8_t linkId);
583
584 /**
585 * Check that appropriate actions are taken when an MLD transmits a PPDU containing
586 * BlockAck frames on the given link.
587 *
588 * \param psduMap the PSDU carrying BlockAck frames
589 * \param txVector the TXVECTOR used to send the PPDU
590 * \param linkId the ID of the given link
591 */
592 void CheckBlockAck(const WifiConstPsduMap& psduMap,
593 const WifiTxVector& txVector,
594 uint8_t linkId);
595
596 private:
597 void StartTraffic() override;
598
599 /**
600 * Callback invoked when a new backoff value is generated by the EMLSR client.
601 *
602 * \param backoff the generated backoff value
603 * \param linkId the ID of the link for which the backoff value has been generated
604 */
605 void BackoffGenerated(uint32_t backoff, uint8_t linkId);
606
607 std::set<uint8_t> m_emlsrLinks; /**< IDs of the links on which EMLSR mode has to be enabled */
608 uint16_t m_channelWidth; //!< width (MHz) of the channels used by MLDs
609 uint16_t m_auxPhyChannelWidth; //!< max width (MHz) supported by aux PHYs
610 Time m_mediumSyncDuration; //!< duration of the MediumSyncDelay timer
611 uint8_t m_msdMaxNTxops; //!< Max number of TXOPs that an EMLSR client is allowed
612 //!< to attempt to initiate while the MediumSyncDelay
613 //!< timer is running (zero indicates no limit)
614 std::optional<uint8_t> m_nonEmlsrLink; //!< ID of the non-EMLSR link (if any)
615 Time m_emlsrEnabledTime; //!< when EMLSR mode has been enabled on all EMLSR clients
616 Time m_firstUlPktsGenTime; //!< generation time of the first two UL packets
617 const Time m_unblockMainPhyLinkDelay; //!< delay between the time the first two UL packets are
618 //!< generated and the time transmissions are unblocked
619 //!< on the link where the main PHY is operating on
620 Time m_lastMsdExpiryTime; //!< expiry time of the last MediumSyncDelay timer
621 bool m_checkBackoffStarted; //!< whether we are checking the generated backoff values
622 std::optional<Time> m_backoffEndTime; //!< expected backoff end time on main PHY link
623 Ptr<ListErrorModel> m_errorModel; ///< error rate model to corrupt packets
624 std::size_t m_countQoSframes; //!< counter for QoS frames
625 std::size_t m_countBlockAck; //!< counter for BlockAck frames
626 std::size_t m_countRtsframes; //!< counter for RTS frames
627 bool m_genBackoffIfTxopWithoutTx; //!< whether the backoff should be invoked when the AC
628 //!< gains the right to start a TXOP but it does not
629 //!< transmit any frame
630 std::optional<bool> m_corruptCts; //!< whether the transmitted CTS must be corrupted
631};
632
633/**
634 * \ingroup wifi-test
635 * \ingroup tests
636 *
637 * \brief Test the switching of PHYs on EMLSR clients.
638 *
639 * An AP MLD and an EMLSR client setup 3 links, on which EMLSR mode is enabled. The AP MLD
640 * transmits 4 QoS data frames (one after another, each protected by ICF):
641 *
642 * - the first one on the link used for ML setup, hence no PHY switch occurs
643 * - the second one on another link, thus causing the main PHY to switch link
644 * - the third one on the remaining link, thus causing the main PHY to switch link again
645 * - the fourth one on the link used for ML setup; if the aux PHYs switches link, there is
646 * one aux PHY listening on such a link and the main PHY switches to this link, otherwise
647 * no PHY is listening on such a link and there is no response to the ICF sent by the AP MLD
648 */
650{
651 public:
652 /**
653 * Parameters for the EMLSR link switching test
654 */
655 struct Params
656 {
657 bool
658 switchAuxPhy; //!< whether AUX PHY should switch channel to operate on the link on which
659 //!< the Main PHY was operating before moving to the link of the Aux PHY
660 bool resetCamState; //!< whether to reset the state of the ChannelAccessManager associated
661 //!< with the link on which the main PHY has just switched to
662 uint16_t auxPhyMaxChWidth; //!< max channel width (MHz) supported by aux PHYs
663 };
664
665 /**
666 * Constructor
667 *
668 * \param params parameters for the EMLSR link switching test
669 */
670 EmlsrLinkSwitchTest(const Params& params);
671
672 ~EmlsrLinkSwitchTest() override = default;
673
674 protected:
675 void DoSetup() override;
676 void DoRun() override;
677 void Transmit(Ptr<WifiMac> mac,
678 uint8_t phyId,
679 WifiConstPsduMap psduMap,
680 WifiTxVector txVector,
681 double txPowerW) override;
682
683 /**
684 * Check that the simulation produced the expected results.
685 */
686 void CheckResults();
687
688 /**
689 * Check that the Main PHY (and possibly the Aux PHY) correctly switches channel when the
690 * reception of an ICF ends.
691 *
692 * \param psduMap the PSDU carrying the MU-RTS TF
693 * \param txVector the TXVECTOR used to send the PPDU
694 * \param linkId the ID of the given link
695 */
696 void CheckInitialControlFrame(const WifiConstPsduMap& psduMap,
697 const WifiTxVector& txVector,
698 uint8_t linkId);
699
700 /**
701 * Check that appropriate actions are taken by the AP MLD transmitting a PPDU containing
702 * QoS data frames to the EMLSR client on the given link.
703 *
704 * \param psduMap the PSDU(s) carrying QoS data frames
705 * \param txVector the TXVECTOR used to send the PPDU
706 * \param linkId the ID of the given link
707 */
708 void CheckQosFrames(const WifiConstPsduMap& psduMap,
709 const WifiTxVector& txVector,
710 uint8_t linkId);
711
712 private:
713 bool m_switchAuxPhy; /**< whether AUX PHY should switch channel to operate on the link on which
714 the Main PHY was operating before moving to the link of Aux PHY */
715 bool m_resetCamState; /**< whether to reset the state of the ChannelAccessManager associated
716 with the link on which the main PHY has just switched to */
717 uint16_t m_auxPhyMaxChWidth; //!< max channel width (MHz) supported by aux PHYs
718 std::size_t m_countQoSframes; //!< counter for QoS data frames
719 std::size_t m_txPsdusPos; //!< a position in the vector of TX PSDUs
720};
721
722/**
723 * \ingroup wifi-test
724 * \ingroup tests
725 *
726 * \brief wifi EMLSR Test Suite
727 */
729{
730 public:
732};
733
734#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
std::size_t m_countQoSframes
counter for QoS frames (transition delay test)
~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.
void CheckEmlNotificationFrame(Ptr< const WifiMpdu > mpdu, const WifiTxVector &txVector, uint8_t linkId)
Check that appropriate actions are taken by the AP MLD transmitting an EML Operating Mode Notificatio...
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:1268
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)