A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
WifiDisassocAndReassocTest Class Reference

Test association, disassociation and reassociation in various scenarios. More...

#include "wifi-association-test.h"

Inheritance diagram for WifiDisassocAndReassocTest:
Collaboration diagram for WifiDisassocAndReassocTest:

Classes

struct  Params
 Configuration parameters specific to this test. More...

Public Types

using SetupLinksInfo = std::pair<linkId_t , linkId_t >
 Setup Links info for AP info objects.
Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...

Public Member Functions

 WifiDisassocAndReassocTest (const BaseParams &baseParams, const Params &params)
 Constructor.
Public Member Functions inherited from WifiAssociationTestBase
 WifiAssociationTestBase (const std::string &name, const BaseParams &baseParams)
 Constructor.
 ~WifiAssociationTestBase () override=default
Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 Caller graph was not generated because of its size.
virtual ~TestCase ()
 Destructor.
std::string GetName () const
TestCase & operator= (const TestCase &)=delete

Protected Member Functions

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 AssocSeenBySta (Mac48Address bssid) override
 Callback invoked when a STA completes association with an AP.
void CheckAfterDisassoc (Ptr< WifiMac > local)
 Check that the expected operations are performed by the local device after disassociation.
void CheckRemoteApInfo (bool firstAssoc)
 Check that the STA stores the expected info about the AP it is expected to be associated with.
void CheckRemoteStaInfo (bool firstAssoc)
 Check that the AP which the STA is expected to be associated with stores the expected info about the STA in its remote station managers.
void DisassocSeenByAp (ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress) override
 Callback invoked when the given AP detects that the given STA has disassociated.
void InsertEvents ()
 Insert elements in the list of expected events (transmitted frames).
void StartRoaming ()
 Take actions connected to roaming.
Protected Member Functions inherited from WifiAssociationTestBase
virtual void DisassocSeenBySta (Mac48Address bssid)
 Callback invoked when a STA transitions to unassociated state.
Ptr< PacketSocketClient > GetApplication (WifiDirection dir, std::size_t apId, 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.
Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
TestCase * GetParent () const
 Get the parent of this TestCase.
bool IsStatusFailure () const
 Check if any tests failed.
bool IsStatusSuccess () const
 Check if all tests passed.
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.

Private Member Functions

void DoRun () override
 Implementation to actually run this TestCase.
void DoSetup () override
 Implementation to do any local setup required for this TestCase.

Private Attributes

Ptr< ListErrorModel > m_ap1ErrorModel
 error rate model to install on the first AP
std::size_t m_assocSeenByAp1Count {0}
 number of associations with AP 1 (seen by AP 1)
std::size_t m_assocSeenByAp2Count {0}
 number of associations with AP 2 (seen by AP 2)
Time m_assocTime
 time at which last association took place
std::size_t m_assocWithAp1Count {0}
 number of associations with AP 1 (seen by STA)
std::size_t m_assocWithAp2Count {0}
 number of associations with AP 2 (seen by STA)
linkId_t m_baLinkId
 ID of the link on which the BA is sent before roaming.
const std::size_t m_firstApId {1}
 the ID of the AP (possibly affiliated with an AP MLD) that is the recipient of the first Assoc Request
const std::size_t m_nPackets {5}
 number of packets generated in a burst
Params m_params
 parameters specific for this test
Ptr< ListErrorModel > m_staErrorModel
 error rate model to install on the STA

Additional Inherited Members

Protected Attributes inherited from WifiAssociationTestBase
Ptr< ApWifiMac > m_ap1Mac
 AP 1 wifi MAC.
std::map< WifiDirection, PacketSocketAddress > m_ap1Sockets
 packet socket addresses for DL/UL traffic from AP1
Ptr< ApWifiMac > m_ap2Mac
 AP 2 wifi MAC.
std::map< WifiDirection, PacketSocketAddress > m_ap2Sockets
 packet socket addresses for DL/UL traffic from AP2
std::string m_assocMgrTypeId {"ns3::WifiDefaultAssocManager"}
 Association Manager type ID.
BaseParams m_baseParams
 configuration parameters
bool m_checkTxPsdus {false}
 whether TX PSDUs should be checked against the list of events
Time m_duration {Seconds(0.8)}
 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
Ptr< StaWifiMac > m_staMac
 STA wifi MAC.

Detailed Description

Test association, disassociation and reassociation in various scenarios.

Example scenario for uplink traffic (STA sends Disassociation frame before roaming to another AP)

                  request
 ┌───┬───┬───┐ disassociation         ┌─────┐                             ┌───┬───┬───┐
 │QoS│   │QoS│     | ┌────────┐       │Assoc│               ┌───┐         │QoS│   │QoS│

STA │ 1 │...│ n │ | │Disassoc│ │ Req │ │Ack│ │ 1 │...│ n │ ─────┴───X───┴───┴─────v─┴────────┴───────┴─────┴───────────────┴───┴─^───────┴───┴───┴───┴───── |—optional–| | BA agreement ┌──┐ ┌───┐ establishment AP 1 │BA│ │Ack│ between STA and AP 2 ──────────────────┴──X─────────────┴───┴──────────────────────────────────────────────────────── ┌─────┐ ┌───┐ │Assoc│ ┌──┐ AP 2 │Ack│ │ Resp│ │BA│ ─────────────────────────────────────────────────┴───┴───┴─────┴───────────────────────────┴──┴─

After each association, it is checked that:

  • the station manager of the AP operating on a given link reports that the STA is associated if and only if that link is expected to be setup
  • the station manager of the AP operating on a given link returns the address of the STA affiliated to the non-AP MLD and operating on that link if and only if the STA performs ML setup (instead of legacy association) and that link is expected to be setup
  • the STA has setup the expected links and the BSSIDs are correct

After the first association, a first set of (DL or UL) packets are generated, transmitted to/by the first AP. The first two MPDUs in the transmitted A-MPDU are corrupted; the receiver sends the acknowledgment, which however is corrupted and is not received. Disassociation is then requested (before BlockAck timeout, if a Disassociation frame is sent, or after BlockAckTimeout, otherwise) so that a BlockAckReq is queued when the STA actually disassociates (tested). On both the STA side (when disassociation is requested, if a Disassociation frame is not sent, or when the Disassociation frame is acked, otherwise) and the AP side (when the Disassociation frame is received, if the STA sends a Disassociation frame, or when the Reassociation frame is received, if the STA does not send a Disassociation frame and associates with the same AP again), it is checked that:

  • transmissions of unicast frames (but management frames) on all links setup by the STA are blocked with DISASSOCIATION reason
  • [STA side only] QoS data frames are still queued
  • [STA side only] no BAR (having link addresses) is queued anymore if ML setup was performed or STA notified disassociation to the AP
  • Block Ack agreement has been destroyed if and only if STA notified disassociation to the AP

After the second association, it is checked that:

  • a new Block Ack agreement is established if STA roams to a different AP or if STA destroyed the previous agreement (which occurs when STA sends a Disassociation frame) or legacy association is performed and STA setups a different link than before
  • STA has not dropped the BlockAckReq frame if and only if STA has not sent a Disassociation frame (otherwise all control frames are dropped), STA established legacy association and reassociates with the same AP (and same link)
  • if STA has a queued BlockAckReq frame, such a frame is transmitted first, followed by a BlockAck response; afterwards, STA retransmits the two MPDUs that are indicated as not received in the BlockAck response. Otherwise, all the QoS data frames are retransmitted.

Definition at line 285 of file wifi-association-test.h.

Member Typedef Documentation

◆ SetupLinksInfo

Setup Links info for AP info objects.

Definition at line 289 of file wifi-association-test.h.

Constructor & Destructor Documentation

◆ WifiDisassocAndReassocTest()

WifiDisassocAndReassocTest::WifiDisassocAndReassocTest ( const BaseParams & baseParams,
const Params & params )

Constructor.

Parameters
baseParamscommon configuration parameters
paramsparameters specific for this test

Definition at line 302 of file wifi-association-test.cc.

References WifiAssociationTestBase::WifiAssociationTestBase(), ns3::CreateObject(), ns3::DOWNLINK, m_ap1ErrorModel, WifiAssociationTestBase::m_assocMgrTypeId, WifiAssociationTestBase::m_framesToSkip, m_params, m_staErrorModel, NS_TEST_ASSERT_MSG_EQ, ns3::UPLINK, ns3::WIFI_MAC_CTL_END, ns3::WIFI_MAC_DATA_NULL, and ns3::WIFI_MAC_MGT_BEACON.

Here is the call graph for this function:

Member Function Documentation

◆ AssocSeenByAp()

void WifiDisassocAndReassocTest::AssocSeenByAp ( ApWifiMac * apMac,
uint16_t aid,
Mac48Address staAddress )
overrideprotectedvirtual

Callback invoked when the given AP detects that the given STA has completed association.

Parameters
apMacthe MAC of the given AP
aidthe AID of the associated STA
staAddressthe address of the associated STA

Reimplemented from WifiAssociationTestBase.

Definition at line 384 of file wifi-association-test.cc.

References CheckRemoteStaInfo(), ns3::WifiMac::GetAddress(), InsertEvents(), WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_assocSeenByAp1Count, m_assocSeenByAp2Count, m_assocTime, WifiAssociationTestBase::m_checkTxPsdus, ns3::Simulator::Now(), NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, and ns3::Simulator::Schedule().

Here is the call graph for this function:

◆ AssocSeenBySta()

void WifiDisassocAndReassocTest::AssocSeenBySta ( Mac48Address bssid)
overrideprotectedvirtual

Callback invoked when a STA completes association with an AP.

Parameters
bssidthe AP address

Reimplemented from WifiAssociationTestBase.

Definition at line 356 of file wifi-association-test.cc.

References CheckRemoteApInfo(), WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_assocWithAp1Count, m_assocWithAp2Count, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, and ns3::Simulator::Schedule().

Here is the call graph for this function:

◆ CheckAfterDisassoc()

void WifiDisassocAndReassocTest::CheckAfterDisassoc ( Ptr< WifiMac > local)
protected

Check that the expected operations are performed by the local device after disassociation.

Parameters
localthe MAC of the local device

Definition at line 595 of file wifi-association-test.cc.

References ns3::AC_BE, ns3::DISASSOCIATION, ns3::DOWNLINK, WifiAssociationTestBase::m_ap1Mac, m_baLinkId, m_nPackets, m_params, WifiAssociationTestBase::m_staMac, ns3::MakeWifiUnicastQueueId(), ns3::ML_SETUP, NS_TEST_EXPECT_MSG_EQ, ns3::StaticCast(), ns3::UPLINK, ns3::WIFI_CTL_QUEUE, ns3::WIFI_QOSDATA_QUEUE, and ns3::wifiAcList.

Referenced by InsertEvents().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckRemoteApInfo()

void WifiDisassocAndReassocTest::CheckRemoteApInfo ( bool firstAssoc)
protected

Check that the STA stores the expected info about the AP it is expected to be associated with.

Parameters
firstAssoctrue/false if the STA associated for the first/second time

Definition at line 521 of file wifi-association-test.cc.

References WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_firstApId, m_params, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_TEST_ASSERT_MSG_EQ, and NS_TEST_EXPECT_MSG_EQ.

Referenced by AssocSeenBySta().

Here is the caller graph for this function:

◆ CheckRemoteStaInfo()

void WifiDisassocAndReassocTest::CheckRemoteStaInfo ( bool firstAssoc)
protected

Check that the AP which the STA is expected to be associated with stores the expected info about the STA in its remote station managers.

Parameters
firstAssoctrue/false if the STA associated for the first/second time

Definition at line 441 of file wifi-association-test.cc.

References WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_firstApId, m_params, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_TEST_ASSERT_MSG_EQ, and NS_TEST_EXPECT_MSG_EQ.

Referenced by AssocSeenByAp().

Here is the caller graph for this function:

◆ DisassocSeenByAp()

void WifiDisassocAndReassocTest::DisassocSeenByAp ( ApWifiMac * apMac,
uint16_t aid,
Mac48Address staAddress )
overrideprotectedvirtual

Callback invoked when the given AP detects that the given STA has disassociated.

Parameters
apMacthe MAC of the given AP
aidthe AID of the STA that disassociated
staAddressthe address of the STA that disassociated

Reimplemented from WifiAssociationTestBase.

Definition at line 422 of file wifi-association-test.cc.

References ns3::ApWifiMac::GetMldOrLinkAddressByAid(), NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, and ns3::Simulator::Schedule().

Here is the call graph for this function:

◆ DoRun()

void WifiDisassocAndReassocTest::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 950 of file wifi-association-test.cc.

References ns3::Simulator::Destroy(), m_assocSeenByAp1Count, m_assocSeenByAp2Count, m_assocWithAp1Count, m_assocWithAp2Count, WifiAssociationTestBase::m_duration, WifiAssociationTestBase::m_events, m_firstApId, m_params, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), and ns3::Simulator::Stop().

Here is the call graph for this function:

◆ DoSetup()

void WifiDisassocAndReassocTest::DoSetup ( )
overrideprivatevirtual

Implementation to do any local setup required for this TestCase.

Subclasses should override this method to perform any costly per-test setup before DoRun is invoked.

Reimplemented from WifiAssociationTestBase.

Definition at line 320 of file wifi-association-test.cc.

References WifiAssociationTestBase::DoSetup(), ns3::DynamicCast(), m_ap1ErrorModel, WifiAssociationTestBase::m_ap1Mac, m_params, m_staErrorModel, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_TEST_ASSERT_MSG_NE, and ns3::Config::SetDefault().

Here is the call graph for this function:

◆ InsertEvents()

◆ StartRoaming()

void WifiDisassocAndReassocTest::StartRoaming ( )
protected

Take actions connected to roaming.

Definition at line 567 of file wifi-association-test.cc.

References ns3::DynamicCast(), WifiAssociationTestBase::m_ap1Mac, WifiAssociationTestBase::m_ap2Mac, m_params, WifiAssociationTestBase::m_staMac, ns3::ML_SETUP, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_NE.

Referenced by InsertEvents().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_ap1ErrorModel

Ptr<ListErrorModel> WifiDisassocAndReassocTest::m_ap1ErrorModel
private

error rate model to install on the first AP

Definition at line 365 of file wifi-association-test.h.

Referenced by WifiDisassocAndReassocTest(), DoSetup(), and InsertEvents().

◆ m_assocSeenByAp1Count

std::size_t WifiDisassocAndReassocTest::m_assocSeenByAp1Count {0}
private

number of associations with AP 1 (seen by AP 1)

Definition at line 362 of file wifi-association-test.h.

Referenced by AssocSeenByAp(), and DoRun().

◆ m_assocSeenByAp2Count

std::size_t WifiDisassocAndReassocTest::m_assocSeenByAp2Count {0}
private

number of associations with AP 2 (seen by AP 2)

Definition at line 363 of file wifi-association-test.h.

Referenced by AssocSeenByAp(), and DoRun().

◆ m_assocTime

Time WifiDisassocAndReassocTest::m_assocTime
private

time at which last association took place

Definition at line 357 of file wifi-association-test.h.

Referenced by AssocSeenByAp().

◆ m_assocWithAp1Count

std::size_t WifiDisassocAndReassocTest::m_assocWithAp1Count {0}
private

number of associations with AP 1 (seen by STA)

Definition at line 360 of file wifi-association-test.h.

Referenced by AssocSeenBySta(), and DoRun().

◆ m_assocWithAp2Count

std::size_t WifiDisassocAndReassocTest::m_assocWithAp2Count {0}
private

number of associations with AP 2 (seen by STA)

Definition at line 361 of file wifi-association-test.h.

Referenced by AssocSeenBySta(), and DoRun().

◆ m_baLinkId

linkId_t WifiDisassocAndReassocTest::m_baLinkId
private
Initial value:
{
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...
Definition wifi-utils.h:307

ID of the link on which the BA is sent before roaming.

Definition at line 358 of file wifi-association-test.h.

Referenced by CheckAfterDisassoc(), and InsertEvents().

◆ m_firstApId

const std::size_t WifiDisassocAndReassocTest::m_firstApId {1}
private

the ID of the AP (possibly affiliated with an AP MLD) that is the recipient of the first Assoc Request

Definition at line 353 of file wifi-association-test.h.

Referenced by CheckRemoteApInfo(), CheckRemoteStaInfo(), DoRun(), and InsertEvents().

◆ m_nPackets

const std::size_t WifiDisassocAndReassocTest::m_nPackets {5}
private

number of packets generated in a burst

Definition at line 356 of file wifi-association-test.h.

Referenced by CheckAfterDisassoc(), and InsertEvents().

◆ m_params

Params WifiDisassocAndReassocTest::m_params
private

◆ m_staErrorModel

Ptr<ListErrorModel> WifiDisassocAndReassocTest::m_staErrorModel
private

error rate model to install on the STA

Definition at line 364 of file wifi-association-test.h.

Referenced by WifiDisassocAndReassocTest(), DoSetup(), and InsertEvents().


The documentation for this class was generated from the following files: