9#ifndef WIFI_ASSOC_TEST_H
10#define WIFI_ASSOC_TEST_H
12#include "ns3/ap-wifi-mac.h"
14#include "ns3/multi-model-spectrum-channel.h"
15#include "ns3/packet-socket-client.h"
16#include "ns3/spectrum-wifi-helper.h"
17#include "ns3/sta-wifi-mac.h"
19#include "ns3/wifi-assoc-manager.h"
57 const std::list<StaWifiMac::ApInfo::SetupLinksInfo>& setupLinks);
132 uint8_t priority = 0)
const;
210 std::set<WifiMacType>
351 void DoRun()
override;
390 return (os <<
"BaseParams{AP 1: " << params.ap1Channels <<
", AP 2: " << params.ap2Channels
391 <<
", STA: " << params.staChannels <<
"}");
404 os <<
"Params{" << params.trafficDir <<
", "
406 << (params.sendDisassoc ?
"Send" :
"Do NOT send") <<
" Disassoc frame";
407 os <<
" [1st] AP link ID: " << params.firstApLinkId <<
", Setup links: ";
408 for (
const auto& [staLinkId, apLinkID] : params.firstSetupLinks)
410 os <<
"(" << +staLinkId <<
"," << +apLinkID <<
")";
412 os <<
" [2nd] AP ID: " << params.secondApId <<
", AP link ID: " << params.secondApLinkId
413 <<
", Setup links: ";
414 for (
const auto& [staLinkId, apLinkID] : params.secondSetupLinks)
416 os <<
"(" << +staLinkId <<
"," << +apLinkID <<
")";
virtual void DisassocSeenByAp(ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress)
Callback invoked when the given AP detects that the given STA has disassociated.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
virtual void DisassocSeenBySta(Mac48Address bssid)
Callback invoked when a STA transitions to unassociated state.
WifiAssociationTestBase(const std::string &name, const BaseParams &baseParams)
Constructor.
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.
Ptr< ApWifiMac > m_ap1Mac
AP 1 wifi MAC.
Ptr< StaWifiMac > m_staMac
STA wifi MAC.
virtual void AssocSeenBySta(Mac48Address bssid)
Callback invoked when a STA completes association with an AP.
std::string m_assocMgrTypeId
Association Manager type ID.
bool m_checkTxPsdus
whether TX PSDUs should be checked against the list of events
Ptr< PacketSocketClient > GetApplication(WifiDirection dir, std::size_t apId, std::size_t count, std::size_t pktSize, uint8_t priority=0) const
Ptr< ApWifiMac > m_ap2Mac
AP 2 wifi MAC.
BaseParams m_baseParams
configuration parameters
std::map< WifiDirection, PacketSocketAddress > m_ap1Sockets
packet socket addresses for DL/UL traffic from AP1
virtual void StartTraffic()
Start the generation of traffic (needs to be overridden).
virtual void AssocSeenByAp(ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress)
Callback invoked when the given AP detects that the given STA has completed association.
std::map< WifiDirection, PacketSocketAddress > m_ap2Sockets
packet socket addresses for DL/UL traffic from AP2
Time m_duration
simulation duration
std::list< Events > m_events
list of events for a test run
std::set< WifiMacType > m_framesToSkip
frames that must not be checked against the list of events
~WifiAssociationTestBase() override=default
WifiAssociationTestSuite()
void InsertEvents()
Insert elements in the list of expected events (transmitted frames).
Params m_params
parameters specific for this test
linkId_t m_baLinkId
ID of the link on which the BA is sent before roaming.
Ptr< ListErrorModel > m_ap1ErrorModel
error rate model to install on the first AP
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void StartRoaming()
Take actions connected to roaming.
void AssocSeenByAp(ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress) override
Callback invoked when the given AP detects that the given STA has completed association.
void DisassocSeenByAp(ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress) override
Callback invoked when the given AP detects that the given STA has disassociated.
Time m_assocTime
time at which last association took place
std::size_t m_assocWithAp2Count
number of associations with AP 2 (seen by STA)
void CheckAfterDisassoc(Ptr< WifiMac > local)
Check that the expected operations are performed by the local device after disassociation.
std::size_t m_assocSeenByAp2Count
number of associations with AP 2 (seen by AP 2)
void CheckRemoteApInfo(bool firstAssoc)
Check that the STA stores the expected info about the AP it is expected to be associated with.
void AssocSeenBySta(Mac48Address bssid) override
Callback invoked when a STA completes association with an AP.
WifiDisassocAndReassocTest(const BaseParams &baseParams, const Params ¶ms)
Constructor.
std::size_t m_assocSeenByAp1Count
number of associations with AP 1 (seen by AP 1)
const std::size_t m_firstApId
the ID of the AP (possibly affiliated with an AP MLD) that is the recipient of the first Assoc Reques...
Ptr< ListErrorModel > m_staErrorModel
error rate model to install on the STA
std::pair< linkId_t, linkId_t > SetupLinksInfo
Setup Links info for AP info objects.
const std::size_t m_nPackets
number of packets generated in a burst
void CheckRemoteStaInfo(bool firstAssoc)
Check that the AP which the STA is expected to be associated with stores the expected info about the ...
std::size_t m_assocWithAp1Count
number of associations with AP 1 (seen by STA)
void DoRun() override
Implementation to actually run this TestCase.
Test Association Manager allowing users to explicitly configure the best AP to associate with.
bool CanBeReturned(const StaWifiMac::ApInfo &apInfo) const override
Allow subclasses to choose whether the given ApInfo shall be returned or discarded when the STA wifi ...
void SetBestAp(Mac48Address bssid, const std::list< StaWifiMac::ApInfo::SetupLinksInfo > &setupLinks)
Set the best AP to associate with.
std::list< StaWifiMac::ApInfo::SetupLinksInfo > m_setupLinks
the list of links to setup
void NotifyChannelSwitched(linkId_t linkId) override
Notify that the given link has completed channel switching.
bool Compare(const StaWifiMac::ApInfo &lhs, const StaWifiMac::ApInfo &rhs) const override
Compare two ApInfo objects for the purpose of keeping a sorted list of ApInfo objects.
Mac48Address m_bestAp
the MAC address of the AP to associate with
static TypeId GetTypeId()
Get the type ID.
bool CanBeInserted(const StaWifiMac::ApInfo &apInfo) const override
Allow subclasses to choose whether the given ApInfo shall be considered and hence inserted in the sor...
void DoStartScanning() override
Start a scanning procedure.
Smart pointer class similar to boost::intrusive_ptr.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
WifiAssocManager()
Constructor (protected as this is an abstract base class).
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Time Seconds(double value)
Construct a Time in the indicated unit.
WifiAssocType
Type of association performed by this device (provided that it is supported by the standard configure...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
static constexpr uint8_t SINGLE_LINK_OP_ID
Link ID for single link operations (helps tracking places where correct link ID is to be used to supp...
WifiMacType
Combination of valid MAC header type/subtype.
WifiDirection
Wifi direction.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
uint8_t linkId_t
IEEE 802.11be D7.0 Figure 9-207e—Link ID Info field format.
Configuration parameters common to all subclasses.
std::string ap1Channels
Semicolon separated (no spaces) list of channel settings for the links of AP 1.
std::string staChannels
Semicolon separated (no spaces) list of channel settings for the links of STA.
std::string ap2Channels
Semicolon separated (no spaces) list of channel settings for the links of AP 2.
Events(WifiMacType type, std::function< void(Ptr< const WifiPsdu >, const WifiTxVector &, linkId_t)> &&f={})
Constructor.
std::function< void(Ptr< const WifiPsdu >, const WifiTxVector &, linkId_t)> func
function to perform actions and checks
WifiMacType hdrType
MAC header type of frame being transmitted.
Configuration parameters specific to this test.
std::size_t secondApId
the ID (1 or 2) of the AP (possibly affiliated with an AP MLD) that is the recipient of the second As...
std::list< SetupLinksInfo > secondSetupLinks
links to setup with the second AP
std::list< SetupLinksInfo > firstSetupLinks
links to setup with the first AP
WifiAssocType assocType
the association type (legacy or ML setup)
std::size_t secondApLinkId
the ID of the link (as seen by the AP) that is used to send the second Association Request
std::size_t firstApLinkId
the ID of the link (as seen by the AP) that is used to send the first Association Request
WifiDirection trafficDir
traffic direction
bool sendDisassoc
whether the STA notifies disassociation to the AP
Struct to hold information regarding observed AP through active/passive scanning.