A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-emlsr-txop-end-tracking-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Davide Magrin <davide@magr.in>
7 */
8
10
11#include "ns3/ap-wifi-mac.h"
12#include "ns3/boolean.h"
13#include "ns3/emlsr-manager.h"
14#include "ns3/node.h"
15#include "ns3/packet-socket-client.h"
16#include "ns3/qos-txop.h"
17#include "ns3/simulator.h"
18#include "ns3/sta-wifi-mac.h"
19#include "ns3/string.h"
20#include "ns3/test.h"
21#include "ns3/wifi-mac-queue-scheduler.h"
22#include "ns3/wifi-net-device.h"
23#include "ns3/wifi-phy.h"
24#include "ns3/wifi-remote-station-manager.h"
25#include "ns3/wifi-utils.h"
26
27#include <algorithm>
28#include <list>
29#include <optional>
30
31using namespace ns3;
32
33/**
34 * @ingroup wifi-test
35 * @ingroup tests
36 *
37 * @brief Test that a new EMLSR TXOP finalizes the tracking of the previous TXOP.
38 *
39 * With a non-zero TXOP limit, the AP MLD keeps a pending TXOP end event for a short
40 * window after each frame exchange of an EMLSR client's UL TXOP, waiting to see whether
41 * the TXOP holder continues its TXOP. If a TXOP-opening frame from a different EMLSR
42 * client is received in that window, the tracked TXOP is over: the pending event must
43 * be finalized (the previous holder switches back to listening operation, so the
44 * blocking of its other links ends) and the start-of-TXOP processing must run for the
45 * new holder (its other links become blocked).
46 *
47 * The AP MLD and the three non-AP MLDs are set up by the EMLSR test base class, with
48 * three links each (2.4 GHz, 5 GHz and 6 GHz). Two non-AP MLDs are EMLSR clients, with
49 * EMLSR mode enabled on link 1 (5 GHz), where their main PHY operates, and on link 2
50 * (6 GHz), where their aux PHY operates; the third one does not enable EMLSR and acts
51 * as a background station that only transmits on link 2. Once the traffic of the test
52 * starts, no frame is transmitted on link 0. All the packets are generated at times such
53 * that:
54 *
55 * - client 1 runs a two-exchange TXOP on link 1, whose TXOP limit is sized so that the
56 * closing Ack still announces a few tens of microseconds of unused protection: not
57 * enough for another frame exchange (or a CF-End frame), but enough to keep the TXOP
58 * end event pending after the TXOP has actually terminated;
59 * - client 2, whose main PHY leaves link 1 during client 1's first frame exchange (an
60 * aux PHY gained a TXOP on link 2, where the background station's first packet kept
61 * the medium busy at the time client 1's TXOP started), transmits its packet on
62 * link 2 and switches the main PHY back to link 1, which was left unattended in the
63 * meantime: the main PHY misses the protection announced by client 1 on link 1;
64 * - the main PHY completes the switch around the end of client 1's TXOP and gains
65 * channel access a short AIFS later, inside the TXOP end tracking window: the RTS it
66 * transmits (the MediumSyncDelay timer is running after the switch) reaches the AP
67 * MLD while the TXOP end event for client 1's terminated TXOP is still pending;
68 * - the background station's second packet keeps link 2 busy in the meantime, so that
69 * client 2's second packet is transmitted by the main PHY on link 1.
70 *
71 * The expected frame exchange sequence is depicted below (time flows left to right,
72 * consistently across links 1 and 2; frames transmitted by the AP MLD are above the
73 * time axes, frames transmitted by the stations below):
74 *
75 * @verbatim
76 * ┌───┐
77 * │Ack│
78 * [link 1] ─────────────┬────────┬────────────────────────┴───┴────────────┬────────┬───────
79 * │QoS Data│ │QoS Data│
80 * │client 1│ │client 1│
81 * └────────┘ └────────┘
82 *
83 * ┌───┐ ┌───┐ ┌───┐
84 * │Ack│ │CTS│ │Ack│
85 * [link 2] ──┬────────┬────────────┴───┴─┬────────┬─┴───┴───────┬────────┬────────────┴───┴─
86 * │QoS Data│ │ RTS │ │QoS Data│
87 * │ bg STA │ │client 2│ │client 2│
88 * └────────┘ └────────┘ └────────┘
89 *
90 * (client 2's main PHY completes the switch back to link 1, having missed the protection
91 * announced by client 1; the MediumSyncDelay timer is running:)
92 *
93 * client 1's TXOP is over, but the the AP MLD must have blocked client 2's
94 * announced protection keeps the link 2 and released client 1's links
95 * TXOP end event pending (both checked here)
96 * │ │
97 * ┌───┐ ┌───┐ ┌───┐
98 * │Ack│ │CTS│ │Ack│
99 * [link 1] ─────────────┴───┴─┬────────┬─┴───┴─┬────────┬───────┴───┴─
100 * │ RTS │ │QoS Data│
101 * │client 2│ │client 2│
102 * └────────┘ └────────┘
103 *
104 * ┌───┐
105 * │Ack│
106 * [link 2] ──┬────────┬───────────────────────────────────┴───┴───────
107 * │QoS Data│
108 * │ bg STA │
109 * └────────┘
110 * @endverbatim
111 *
112 * Association, Block Ack agreement establishment and EMLSR mode enabling are performed
113 * by the base class before the traffic of the test starts. The test checks the type and
114 * the transmitter (and, where relevant, the transmitting PHY) of every frame transmitted
115 * on each link against the sequence of that link (frames
116 * transmitted on distinct links at about the same time, such as the QoS Data frames of
117 * client 1 on link 1 and of client 2 on link 2, may occur in either order) and, upon
118 * transmission of the CTS in response to client 2's RTS on link 1, that the AP MLD has
119 * finalized the tracking of client 1's TXOP (transmissions to client 1 are no longer
120 * blocked as using another link, but are waiting for the transition delay) and has run
121 * the start-of-TXOP processing for client 2 (transmissions to client 2 on link 2 are
122 * blocked). If the AP MLD mistook the pending TXOP end event for an indication that
123 * client 1's TXOP is still ongoing, it would skip the start-of-TXOP processing for
124 * client 2 and this test would fail at that CTS, on the assert checking that
125 * transmissions to the EMLSR client the CTS is addressed to are blocked on the other
126 * links. With asserts disabled, the AP MLD blocks those transmissions anyway when
127 * sending the CTS, but it would not switch client 1 back to listening operation, and
128 * this test would fail on the checks that client 1 has been released.
129 */
131{
132 public:
134
135 protected:
136 void DoSetup() override;
137 void DoRun() override;
138 void Transmit(Ptr<WifiMac> mac,
139 uint8_t phyId,
140 WifiConstPsduMap psduMap,
141 WifiTxVector txVector,
142 double txPowerW) override;
143
144 private:
145 void StartTraffic() override;
146
147 /// Actions and checks to perform upon the transmission of each frame
148 struct Events
149 {
150 /**
151 * Constructor.
152 *
153 * @param type the frame MAC header type
154 * @param id the ID of the link on which the frame is expected
155 * @param tx the MAC of the device expected to transmit the frame
156 * @param phy the ID of the PHY expected to transmit the frame, if it is to be checked
157 * @param f function to perform actions and checks
158 */
160 linkId_t id,
161 Ptr<WifiMac> tx,
162 std::optional<uint8_t> phy = std::nullopt,
163 std::function<void(const WifiConstPsduMap&, const WifiTxVector&)>&& f = {})
164 : hdrType(type),
165 linkId(id),
166 txMac(tx),
167 phyId(phy),
168 func(f)
169 {
170 }
171
172 WifiMacType hdrType; ///< MAC header type of the frame
173 linkId_t linkId; ///< ID of the link on which the frame is expected
174 Ptr<WifiMac> txMac; ///< MAC of the device expected to transmit the frame
175 std::optional<uint8_t> phyId; ///< ID of the PHY expected to transmit the frame, if any
176 std::function<void(const WifiConstPsduMap&, const WifiTxVector&)>
177 func; ///< actions and checks to perform
178 };
179
180 /// Insert elements in the list of expected events (transmitted frames)
181 void InsertEvents();
182
183 /// Check the AP MLD's blocked queues after the takeover of the ended TXOP:
184 /// client 2's other link must be blocked, client 1's links must be released
186
187 /// EMLSR link on which the main PHYs operate (5 GHz)
188 static constexpr linkId_t MAIN_LINK = 1;
189 /// EMLSR link on which the aux PHYs operate (6 GHz)
190 static constexpr linkId_t AUX_LINK = 2;
191 /// ID of the main PHY of the EMLSR clients (initially operating on MAIN_LINK)
192 static constexpr uint8_t MAIN_PHY_ID = 1;
193 /// ID of the aux PHY of the EMLSR clients operating on AUX_LINK
194 static constexpr uint8_t AUX_PHY_ID = 2;
195 /// TID of the packets transmitted in the TXOPs under test and of the background
196 /// station's second packet
197 static constexpr tid_t TXOP_TID = 5;
198 /// AC of TXOP_TID, whose TXOP limit is set
199 static constexpr AcIndex TXOP_AC = AC_VI;
200 /// TID of the background station's first packet
201 static constexpr tid_t BG_STA_TID = 0;
202
203 std::list<Events> m_events; ///< list of events for the test run
204 bool m_trafficStarted{false}; ///< whether the traffic of the test run has started
205 /// TXOP limit for TXOP_AC: sized so that client 1's TXOP comprises two frame
206 /// exchanges and its closing Ack announces unused protection that is shorter than
207 /// a CF-End frame but longer than the TXOP end tracking window
209};
210
212 : EmlsrOperationsTestBase("Check that a new EMLSR TXOP finalizes the tracking of the previous "
213 "TXOP")
214{
219 // the timing of the frame exchange sequence is calibrated on the durations of the frames
220 // transmitted on 20 MHz channels at the rates set in DoSetup
221 m_channelsStr = {"{2, 20, BAND_2_4GHZ, 0}"s,
222 "{36, 20, BAND_5GHZ, 0}"s,
223 "{1, 20, BAND_6GHZ, 0}"s};
227 m_duration = Seconds(1);
228}
229
230void
232{
234
235 // rates and channel switch delay the timing of the frame exchange sequence is calibrated on
236 std::vector<Ptr<WifiMac>> macs{m_apMac};
237 macs.insert(macs.end(), m_staMacs.cbegin(), m_staMacs.cend());
238 for (const auto& mac : macs)
239 {
240 for (auto linkId : {MAIN_LINK, AUX_LINK})
241 {
242 mac->GetWifiRemoteStationManager(linkId)->SetAttribute("DataMode",
243 StringValue("HeMcs3"));
244 mac->GetWifiRemoteStationManager(linkId)->SetAttribute("ControlMode",
245 StringValue("OfdmRate6Mbps"));
246 }
247 for (uint8_t phyId = 0; phyId < mac->GetDevice()->GetNPhys(); ++phyId)
248 {
249 mac->GetDevice()->GetPhy(phyId)->SetAttribute("ChannelSwitchDelay",
251 }
252 }
253
254 for (std::size_t i = 0; i < m_nEmlsrStations; ++i)
255 {
256 // the main PHY switches to the link on which an aux PHY gained a TXOP and
257 // switches back to its link when the TXOP ends, leaving that link unattended in
258 // the meantime
259 m_staMacs.at(i)->GetEmlsrManager()->SetAttribute("SwitchAuxPhy", BooleanValue(false));
260 }
261
262 // a non-zero TXOP limit on the main PHYs' link, advertised to the clients upon association
263 m_apMac->GetQosTxop(TXOP_AC)->SetTxopLimit(m_txopLimit, MAIN_LINK);
264}
265
266void
268{
269 m_trafficStarted = true;
270 InsertEvents();
271
272 // deterministic channel access (no random backoff) and a zero TXOP limit for
273 // client 2 and the background station, whose exchanges are then self-contained
274 // (no CF-End truncation): the frame sequence stays minimal and the protection
275 // they announce expires with each exchange
276 for (const auto& staMac : m_staMacs)
277 {
278 const std::vector<uint32_t> zeroCws(staMac->GetNLinks(), 0);
279 for (const auto& [aci, ac] : wifiAcList)
280 {
281 staMac->GetQosTxop(aci)->SetMinCws(zeroCws);
282 staMac->GetQosTxop(aci)->SetMaxCws(zeroCws);
283 }
284 }
285 for (std::size_t i : {1, 2})
286 {
287 m_staMacs.at(i)->GetQosTxop(TXOP_AC)->SetTxopLimits(
288 std::vector<Time>(m_staMacs.at(i)->GetNLinks(), Time{0}));
289 }
290
291 // the EMLSR clients transmit on the EMLSR links only and the background station on the
292 // aux PHYs' link only
293 const auto apMld = m_apMac->GetAddress();
294 m_staMacs.at(0)->BlockUnicastTxOnLinks(WifiQueueBlockedReason::TID_NOT_MAPPED, apMld, {0});
295 m_staMacs.at(1)->BlockUnicastTxOnLinks(WifiQueueBlockedReason::TID_NOT_MAPPED, apMld, {0});
296 m_staMacs.at(2)->BlockUnicastTxOnLinks(WifiQueueBlockedReason::TID_NOT_MAPPED,
297 apMld,
298 {0, MAIN_LINK});
299
300 // the background station's first packet keeps the aux PHYs' link busy when client 1's
301 // first packet arrives
302 Simulator::Schedule(MicroSeconds(850), [this]() {
303 m_staMacs.at(2)->GetDevice()->GetNode()->AddApplication(
304 GetApplication(UPLINK, 2, 1, 1250, BG_STA_TID));
305 });
306 // client 1's first packet: starts its two-exchange TXOP on the main PHYs' link (the
307 // remaining packets are generated upon transmission of the frames in the events list)
308 Simulator::Schedule(MicroSeconds(1000), [this]() {
309 m_staMacs.at(0)->GetDevice()->GetNode()->AddApplication(
310 GetApplication(UPLINK, 0, 1, 1300, TXOP_TID));
311 });
312}
313
314void
316{
317 const auto client1Mld = m_staMacs.at(0)->GetAddress();
318 const auto client2Mld = m_staMacs.at(1)->GetAddress();
319
320 // start-of-TXOP processing for the new holder: its other link is blocked
322 client2Mld,
323 AUX_LINK,
325 true,
326 "Client 2 holds a TXOP on link 1");
328 client2Mld,
329 MAIN_LINK,
331 false,
332 "Client 2 holds a TXOP on link 1");
333
334 // the previous holder has been switched back to listening operation: the blocking
335 // of its links as using another link has ended and the transition delay has started
336 for (auto linkId : {MAIN_LINK, AUX_LINK})
337 {
339 client1Mld,
340 linkId,
342 true,
343 "Client 1's TXOP has ended");
344 }
345
346 // after the 64 us transition delay, client 1 is fully unblocked while client 2's
347 // TXOP blocking persists
348 Simulator::Schedule(MicroSeconds(65), [=, this]() {
349 for (auto linkId : {MAIN_LINK, AUX_LINK})
350 {
352 client1Mld,
353 linkId,
355 false,
356 "The transition delay of client 1 has elapsed");
357 }
359 client2Mld,
360 AUX_LINK,
362 true,
363 "Client 2 still holds a TXOP on link 1");
364 });
365}
366
367void
369{
370 const auto& ap = m_apMac;
371 const auto& client1 = m_staMacs.at(0);
372 const auto& client2 = m_staMacs.at(1);
373 const auto& bgSta = m_staMacs.at(2);
374
375 // 1. the background station's first packet keeps link 2 busy, so that client 1's
376 // TXOP starts on link 1 (and client 2's aux PHY does not gain link 2 immediately)
377 m_events.emplace_back(WIFI_MAC_QOSDATA, AUX_LINK, bgSta);
378
379 // 2. first frame exchange of client 1's TXOP on link 1. Client 1's second packet
380 // is generated now, so that it is transmitted in a second frame exchange of the
381 // same TXOP; client 2's packet is generated while link 1 is busy, so that only its
382 // aux PHY on link 2 can gain channel access (once the background station's frame
383 // exchange is over)
384 m_events.emplace_back(WIFI_MAC_QOSDATA,
385 MAIN_LINK,
386 client1,
387 std::nullopt,
388 [this](const WifiConstPsduMap& psduMap, const WifiTxVector& txVector) {
389 m_staMacs.at(0)->GetDevice()->GetNode()->AddApplication(
390 GetApplication(UPLINK, 0, 1, 1300, TXOP_TID));
391 Simulator::Schedule(MicroSeconds(50), [this]() {
392 m_staMacs.at(1)->GetDevice()->GetNode()->AddApplication(
393 GetApplication(UPLINK, 1, 1, 950, TXOP_TID));
394 });
395 });
396 // 3. Ack to the background station on link 2
397 m_events.emplace_back(WIFI_MAC_CTL_ACK, AUX_LINK, ap);
398
399 // 4. RTS transmitted on link 2 by client 2's aux PHY; the main PHY leaves link 1
400 // before the end of client 1's first QoS Data frame, hence it misses the NAV set
401 // by client 1's frames
402 m_events.emplace_back(WIFI_MAC_CTL_RTS, AUX_LINK, client2, AUX_PHY_ID);
403 // 5. CTS to client 2 on link 2
404 m_events.emplace_back(WIFI_MAC_CTL_CTS, AUX_LINK, ap);
405 // 6. Ack completing client 1's first frame exchange on link 1
406 m_events.emplace_back(WIFI_MAC_CTL_ACK, MAIN_LINK, ap);
407
408 // 7. client 2's QoS Data frame on link 2, transmitted by the main PHY. The
409 // background station's second packet is generated now, so that it is transmitted
410 // on link 2 as soon as the protection announced by client 2 expires
411 m_events.emplace_back(WIFI_MAC_QOSDATA,
412 AUX_LINK,
413 client2,
415 [this](const WifiConstPsduMap& psduMap, const WifiTxVector& txVector) {
416 m_staMacs.at(2)->GetDevice()->GetNode()->AddApplication(
417 GetApplication(UPLINK, 2, 1, 1000, TXOP_TID));
418 });
419 // 8. second frame exchange of client 1's TXOP on link 1
420 m_events.emplace_back(WIFI_MAC_QOSDATA, MAIN_LINK, client1);
421 // 9. Ack ending client 2's TXOP on link 2: its main PHY starts switching back to
422 // link 1
423 m_events.emplace_back(WIFI_MAC_CTL_ACK, AUX_LINK, ap);
424
425 // 10. the background station's second packet occupies link 2. Client 2's second
426 // packet is generated once this frame is on the air, so that it can only be
427 // transmitted on link 1 by the main PHY
428 m_events.emplace_back(WIFI_MAC_QOSDATA,
429 AUX_LINK,
430 bgSta,
431 std::nullopt,
432 [this](const WifiConstPsduMap& psduMap, const WifiTxVector& txVector) {
433 Simulator::Schedule(MicroSeconds(10), [this]() {
434 m_staMacs.at(1)->GetDevice()->GetNode()->AddApplication(
435 GetApplication(UPLINK, 1, 1, 400, TXOP_TID));
436 });
437 });
438
439 // 11. Ack closing client 1's TXOP on link 1: the announced protection is not
440 // enough for another frame exchange or a CF-End frame, but it keeps the TXOP end
441 // event pending for the duration of the tracking window
442 m_events.emplace_back(WIFI_MAC_CTL_ACK,
443 MAIN_LINK,
444 ap,
445 std::nullopt,
446 [this](const WifiConstPsduMap& psduMap, const WifiTxVector& txVector) {
447 // client 1 is still accounted as being in a TXOP
449 m_staMacs.at(0)->GetAddress(),
450 AUX_LINK,
452 true,
453 "Client 1 closes its TXOP");
454 });
455
456 // 12. RTS transmitted on link 1 by client 2's main PHY (the MediumSyncDelay timer
457 // is running after the switch): a TXOP-opening frame from a different EMLSR client
458 // received while the TXOP end event of client 1's terminated TXOP is still pending
459 m_events.emplace_back(WIFI_MAC_CTL_RTS,
460 MAIN_LINK,
461 client2,
463 [this](const WifiConstPsduMap& psduMap, const WifiTxVector& txVector) {
464 // the TXOP end event has not expired yet (it would have switched
465 // client 1 back to listening operation), otherwise this test would
466 // not exercise the takeover of the ended TXOP
468 m_staMacs.at(0)->GetAddress(),
469 AUX_LINK,
471 true,
472 "Client 2 starts transmitting the RTS while the "
473 "TXOP end event for client 1's TXOP is pending");
474 });
475
476 // 13. CTS to client 2 on link 1: the AP MLD has processed the start of client 2's
477 // TXOP, hence it must have finalized the tracking of client 1's TXOP (had the
478 // start-of-TXOP processing been skipped, transmitting this CTS would assert,
479 // because transmissions to client 2 on link 2 would not be blocked)
480 m_events.emplace_back(WIFI_MAC_CTL_CTS,
481 MAIN_LINK,
482 ap,
483 std::nullopt,
484 [this](const WifiConstPsduMap& psduMap, const WifiTxVector& txVector) {
486 });
487
488 // 14. client 2's QoS Data frame on link 1
489 m_events.emplace_back(WIFI_MAC_QOSDATA, MAIN_LINK, client2, MAIN_PHY_ID);
490 // 15. Ack to the background station on link 2
491 m_events.emplace_back(WIFI_MAC_CTL_ACK, AUX_LINK, ap);
492 // 16. Ack to client 2 on link 1
493 m_events.emplace_back(WIFI_MAC_CTL_ACK, MAIN_LINK, ap);
494}
495
496void
498 uint8_t phyId,
499 WifiConstPsduMap psduMap,
500 WifiTxVector txVector,
501 double txPowerW)
502{
503 EmlsrOperationsTestBase::Transmit(mac, phyId, psduMap, txVector, txPowerW);
504
505 if (!m_trafficStarted)
506 {
507 return;
508 }
509
510 const auto linkId = mac->GetLinkForPhy(phyId);
511 NS_TEST_ASSERT_MSG_EQ(linkId.has_value(), true, "No link found for PHY ID " << +phyId);
512 const auto& hdr = psduMap.cbegin()->second->GetHeader(0);
513
514 // the expected frame is the first pending event on the link the frame is transmitted
515 // on: frames transmitted on distinct links at about the same time may occur in either
516 // order, depending on the slot boundaries on each link
517 auto it = std::find_if(m_events.begin(), m_events.end(), [&](const Events& event) {
518 return event.linkId == *linkId;
519 });
520 NS_TEST_ASSERT_MSG_EQ((it != m_events.end()),
521 true,
522 "Unexpected frame of type "
523 << hdr.GetTypeString() << " transmitted on link " << +linkId.value()
524 << " at time " << Simulator::Now().As(Time::US));
525
526 // check that the expected frame is being transmitted
527 NS_TEST_ASSERT_MSG_EQ(hdr.GetTypeString(),
528 std::string(WifiMacHeader(it->hdrType).GetTypeString()),
529 "Unexpected MAC header type for frame transmitted on link "
530 << +linkId.value() << " at time " << Simulator::Now().As(Time::US));
531
533 it->txMac,
534 "Unexpected transmitter for frame of type "
535 << hdr.GetTypeString() << " transmitted on link " << +linkId.value()
536 << " at time " << Simulator::Now().As(Time::US));
537 if (it->phyId.has_value())
538 {
540 +it->phyId.value(),
541 "Unexpected transmitting PHY for frame of type "
542 << hdr.GetTypeString() << " transmitted on link "
543 << +linkId.value() << " at time "
544 << Simulator::Now().As(Time::US));
545 }
546
547 // perform actions and checks, if any
548 if (it->func)
549 {
550 it->func(psduMap, txVector);
551 }
552
553 m_events.erase(it);
554}
555
556void
558{
561
562 NS_TEST_EXPECT_MSG_EQ(m_events.empty(), true, "Not all events took place");
563
565}
566
567/**
568 * @ingroup wifi-test
569 * @ingroup tests
570 *
571 * @brief wifi EMLSR TXOP end tracking Test Suite
572 */
578
584
std::size_t m_nNonEmlsrStations
number of stations to create that do not activate EMLSR
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< 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.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
uint8_t m_mainPhyId
ID of the main PHY.
Time m_duration
simulation duration
Ptr< PacketSocketClient > GetApplication(TrafficDirection dir, std::size_t staId, std::size_t count, std::size_t pktSize, uint8_t priority=0) const
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.
std::vector< Time > m_transitionDelay
Transition Delay advertised by the non-AP MLD.
std::array< std::string, 3 > m_channelsStr
array of strings defining the channels for the MLD links
std::vector< Ptr< StaWifiMac > > m_staMacs
MACs of the non-AP MLDs.
std::vector< uint8_t > m_establishBaUl
the TIDs for which BA needs to be established with the AP as recipient
EmlsrOperationsTestBase(const std::string &name)
Constructor.
Test that a new EMLSR TXOP finalizes the tracking of the previous TXOP.
static constexpr uint8_t AUX_PHY_ID
ID of the aux PHY of the EMLSR clients operating on AUX_LINK.
static constexpr AcIndex TXOP_AC
AC of TXOP_TID, whose TXOP limit is set.
void InsertEvents()
Insert elements in the list of expected events (transmitted frames).
void CheckQueuesAfterTakeover()
Check the AP MLD's blocked queues after the takeover of the ended TXOP: client 2's other link must be...
std::list< Events > m_events
list of events for the test run
static constexpr tid_t TXOP_TID
TID of the packets transmitted in the TXOPs under test and of the background station's second packet.
static constexpr tid_t BG_STA_TID
TID of the background station's first packet.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
static constexpr linkId_t MAIN_LINK
EMLSR link on which the main PHYs operate (5 GHz).
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.
static constexpr uint8_t MAIN_PHY_ID
ID of the main PHY of the EMLSR clients (initially operating on MAIN_LINK).
static constexpr linkId_t AUX_LINK
EMLSR link on which the aux PHYs operate (6 GHz).
const Time m_txopLimit
TXOP limit for TXOP_AC: sized so that client 1's TXOP comprises two frame exchanges and its closing A...
void StartTraffic() override
Start the generation of traffic (needs to be overridden).
void DoRun() override
Implementation to actually run this TestCase.
bool m_trafficStarted
whether the traffic of the test run has started
wifi EMLSR TXOP end tracking Test Suite
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition simulator.h:580
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:125
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:191
static void Run()
Run the simulation.
Definition simulator.cc:161
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:169
Hold variables of type string.
Definition string.h:45
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:296
@ QUICK
Fast test.
Definition test.h:1057
Type
Type of test.
Definition test.h:1271
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Definition test.cc:494
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
@ US
microsecond
Definition nstime.h:108
Implements the IEEE 802.11 MAC header.
virtual const char * GetTypeString() const
Return a string corresponds to the header type.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
Definition test.h:133
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:240
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1347
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1313
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition qos-utils.h:64
@ AC_VI
Video.
Definition qos-utils.h:70
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint8_t tid_t
IEEE 802.11-2020 9.2.4.5.2 TID subfield.
Definition wifi-utils.h:73
WifiMacType
Combination of valid MAC header type/subtype.
@ WIFI_MAC_CTL_RTS
@ WIFI_MAC_CTL_CTS
@ WIFI_MAC_CTL_ACK
@ WIFI_MAC_QOSDATA
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
Definition wifi-ppdu.h:39
uint8_t linkId_t
IEEE 802.11be D7.0 Figure 9-207e—Link ID Info field format.
Definition wifi-utils.h:76
const std::map< AcIndex, WifiAc > wifiAcList
Map containing the four ACs in increasing order of priority (according to Table 10-1 "UP-to-AC Mappin...
Definition qos-utils.cc:115
Actions and checks to perform upon the transmission of each frame.
linkId_t linkId
ID of the link on which the frame is expected.
Events(WifiMacType type, linkId_t id, Ptr< WifiMac > tx, std::optional< uint8_t > phy=std::nullopt, std::function< void(const WifiConstPsduMap &, const WifiTxVector &)> &&f={})
Constructor.
std::function< void(const WifiConstPsduMap &, const WifiTxVector &)> func
actions and checks to perform
WifiMacType hdrType
MAC header type of the frame.
Ptr< WifiMac > txMac
MAC of the device expected to transmit the frame.
std::optional< uint8_t > phyId
ID of the PHY expected to transmit the frame, if any.
static WifiEmlsrTxopEndTrackingTestSuite g_wifiEmlsrTxopEndTrackingTestSuite
the test suite