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
44{
45 public:
51
52 private:
53 void DoRun() override;
54};
55
72{
73 public:
79 EmlsrOperationsTestBase(const std::string& name);
80 ~EmlsrOperationsTestBase() override = default;
81
83 enum TrafficDirection : uint8_t
84 {
86 UPLINK
87 };
88
89 protected:
99 virtual void Transmit(Ptr<WifiMac> mac,
100 uint8_t phyId,
101 WifiConstPsduMap psduMap,
102 WifiTxVector txVector,
103 double txPowerW);
104
114 std::size_t staId,
115 std::size_t count,
116 std::size_t pktSize) const;
117
132 Mac48Address dest,
133 uint8_t linkId,
135 bool blocked,
136 std::string description,
137 bool testUnblockedForOtherReasons = true);
138
139 void DoSetup() override;
140
143 {
147 uint8_t linkId;
148 uint8_t phyId;
149 };
150
151 uint8_t m_mainPhyId{0};
152 std::set<uint8_t> m_linksToEnableEmlsrOn;
154 std::size_t m_nEmlsrStations{1};
155 std::size_t m_nNonEmlsrStations{0};
158 std::vector<Time> m_paddingDelay{
159 {MicroSeconds(32)}};
160 std::vector<Time> m_transitionDelay{
161 {MicroSeconds(16)}};
162 bool m_establishBaDl{false};
164 bool m_establishBaUl{false};
166 std::vector<FrameInfo> m_txPsdus;
168 std::vector<Ptr<StaWifiMac>> m_staMacs;
169 std::vector<PacketSocketAddress> m_dlSockets;
170 std::vector<PacketSocketAddress> m_ulSockets;
171 uint16_t m_lastAid{0};
173
174 private:
182 void SetSsid(uint16_t aid, Mac48Address /* addr */);
183
187 virtual void StartTraffic()
188 {
189 }
190};
191
215{
216 public:
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
240 void TxOk(Ptr<const WifiMpdu> mpdu);
248
258 const WifiTxVector& txVector,
259 uint8_t linkId);
269 const WifiTxVector& txVector,
270 uint8_t linkId);
279 const WifiTxVector& txVector,
280 uint8_t linkId);
284 void CheckEmlsrLinks();
285
286 private:
295 std::list<uint64_t> m_uidList;
296};
297
350{
351 public:
355 struct Params
356 {
357 std::size_t nEmlsrStations;
358 std::size_t nNonEmlsrStations;
359 std::set<uint8_t>
361 std::vector<Time> paddingDelay;
363 std::vector<Time>
367 };
368
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
389 void CheckResults();
390
397 void CheckPmModeAfterAssociation(const Mac48Address& address);
398
408 const WifiTxVector& txVector,
409 uint8_t linkId);
410
420 const WifiTxVector& txVector,
421 uint8_t linkId);
422
431 void CheckQosFrames(const WifiConstPsduMap& psduMap,
432 const WifiTxVector& txVector,
433 uint8_t linkId);
434
443 void CheckBlockAck(const WifiConstPsduMap& psduMap,
444 const WifiTxVector& txVector,
445 uint8_t phyId);
446
447 private:
448 void StartTraffic() override;
449
453 void EnableEmlsrMode();
454
455 std::set<uint8_t> m_emlsrLinks;
459 std::size_t m_countQoSframes;
460 std::size_t m_countBlockAck;
462};
463
510{
511 public:
515 struct Params
516 {
517 std::set<uint8_t>
519 uint16_t channelWidth;
522 uint8_t msdMaxNTxops;
528 };
529
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
550 void CheckResults();
551
560 void CheckRtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
561
570 void CheckCtsFrames(Ptr<const WifiMpdu> mpdu, const WifiTxVector& txVector, uint8_t linkId);
571
580 void CheckQosFrames(const WifiConstPsduMap& psduMap,
581 const WifiTxVector& txVector,
582 uint8_t linkId);
583
592 void CheckBlockAck(const WifiConstPsduMap& psduMap,
593 const WifiTxVector& txVector,
594 uint8_t linkId);
595
596 private:
597 void StartTraffic() override;
598
605 void BackoffGenerated(uint32_t backoff, uint8_t linkId);
606
607 std::set<uint8_t> m_emlsrLinks;
608 uint16_t m_channelWidth;
614 std::optional<uint8_t> m_nonEmlsrLink;
622 std::optional<Time> m_backoffEndTime;
624 std::size_t m_countQoSframes;
625 std::size_t m_countBlockAck;
626 std::size_t m_countRtsframes;
630 std::optional<bool> m_corruptCts;
631};
632
650{
651 public:
655 struct Params
656 {
657 bool
663 };
664
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
686 void CheckResults();
687
696 void CheckInitialControlFrame(const WifiConstPsduMap& psduMap,
697 const WifiTxVector& txVector,
698 uint8_t linkId);
699
708 void CheckQosFrames(const WifiConstPsduMap& psduMap,
709 const WifiTxVector& txVector,
710 uint8_t linkId);
711
712 private:
718 std::size_t m_countQoSframes;
719 std::size_t m_txPsdusPos;
720};
721
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:1060
A suite of tests to run.
Definition: test.h:1256
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:1350
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:77
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)