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

Base class for association tests. More...

#include "wifi-association-test.h"

Inheritance diagram for WifiAssociationTestBase:
Collaboration diagram for WifiAssociationTestBase:

Classes

struct  BaseParams
 Configuration parameters common to all subclasses. More...
struct  Events
 Actions and checks to perform upon the transmission of each frame. More...

Public Member Functions

 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

virtual void AssocSeenByAp (ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress)
 Callback invoked when the given AP detects that the given STA has completed association.
virtual void AssocSeenBySta (Mac48Address bssid)
 Callback invoked when a STA completes association with an AP.
virtual void DisassocSeenByAp (ApWifiMac *apMac, uint16_t aid, Mac48Address staAddress)
 Callback invoked when the given AP detects that the given STA has disassociated.
virtual void DisassocSeenBySta (Mac48Address bssid)
 Callback invoked when a STA transitions to unassociated state.
void DoSetup () override
 Implementation to do any local setup required for this TestCase.
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.

Protected Attributes

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.

Private Member Functions

virtual void StartTraffic ()
 Start the generation of traffic (needs to be overridden).

Additional Inherited Members

Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...

Detailed Description

Base class for association tests.

Setup one non-AP STA and two APs with a configurable number of links.

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

Constructor & Destructor Documentation

◆ WifiAssociationTestBase()

WifiAssociationTestBase::WifiAssociationTestBase ( const std::string & name,
const BaseParams & baseParams )

Constructor.

Parameters
nameThe name of the new TestCase created
baseParamscommon configuration parameters

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

References ns3::TestCase::TestCase(), and m_baseParams.

Referenced by WifiDisassocAndReassocTest::WifiDisassocAndReassocTest().

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

◆ ~WifiAssociationTestBase()

WifiAssociationTestBase::~WifiAssociationTestBase ( )
overridedefault

References dir.

Member Function Documentation

◆ AssocSeenByAp()

virtual void WifiAssociationTestBase::AssocSeenByAp ( ApWifiMac * apMac,
uint16_t aid,
Mac48Address staAddress )
inlineprotectedvirtual

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 in WifiDisassocAndReassocTest.

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

Referenced by DoSetup().

Here is the caller graph for this function:

◆ AssocSeenBySta()

virtual void WifiAssociationTestBase::AssocSeenBySta ( Mac48Address bssid)
inlineprotectedvirtual

Callback invoked when a STA completes association with an AP.

Parameters
bssidthe AP address

Reimplemented in WifiDisassocAndReassocTest.

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

Referenced by DoSetup().

Here is the caller graph for this function:

◆ DisassocSeenByAp()

virtual void WifiAssociationTestBase::DisassocSeenByAp ( ApWifiMac * apMac,
uint16_t aid,
Mac48Address staAddress )
inlineprotectedvirtual

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 in WifiDisassocAndReassocTest.

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

Referenced by DoSetup().

Here is the caller graph for this function:

◆ DisassocSeenBySta()

virtual void WifiAssociationTestBase::DisassocSeenBySta ( Mac48Address bssid)
inlineprotectedvirtual

Callback invoked when a STA transitions to unassociated state.

Parameters
bssidthe address of the AP the STA was associated with

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

Referenced by DoSetup().

Here is the caller graph for this function:

◆ DoSetup()

void WifiAssociationTestBase::DoSetup ( )
overrideprotectedvirtual

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 ns3::TestCase.

Reimplemented in WifiDisassocAndReassocTest.

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

References ns3::WifiHelper::AssignStreams(), AssocSeenByAp(), AssocSeenBySta(), ns3::CreateObject(), DisassocSeenByAp(), DisassocSeenBySta(), ns3::WifiPhyHelper::DLT_IEEE802_11_RADIO, ns3::DOWNLINK, ns3::DynamicCast(), ns3::PacketSocketHelper::Install(), m_ap1Mac, m_ap1Sockets, m_ap2Mac, m_ap2Sockets, m_assocMgrTypeId, m_baseParams, m_duration, m_staMac, ns3::MakeCallback(), nodes, NS_TEST_ASSERT_MSG_NE, ns3::PeekPointer(), ns3::Seconds(), ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), ns3::PacketSocketAddress::SetSingleDevice(), ns3::SplitString(), Transmit(), ns3::UPLINK, and ns3::WIFI_STANDARD_80211be.

Referenced by WifiDisassocAndReassocTest::DoSetup().

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

◆ GetApplication()

Ptr< PacketSocketClient > WifiAssociationTestBase::GetApplication ( WifiDirection dir,
std::size_t apId,
std::size_t count,
std::size_t pktSize,
uint8_t priority = 0 ) const
protected
Parameters
dirthe traffic direction (uplink/downlink)
apIdthe AP ID (1 or 2)
countthe number of packets to generate
pktSizethe size of the packets to generate
priorityuser priority for generated packets
Returns
an application generating the given number packets from/to the given AP to/from the STA

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

References ns3::CreateObject(), dir, m_ap1Sockets, m_ap2Sockets, m_duration, ns3::MicroSeconds(), and ns3::Simulator::Now().

Referenced by WifiDisassocAndReassocTest::InsertEvents().

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

◆ StartTraffic()

virtual void WifiAssociationTestBase::StartTraffic ( )
inlineprivatevirtual

Start the generation of traffic (needs to be overridden).

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

◆ Transmit()

void WifiAssociationTestBase::Transmit ( Ptr< WifiMac > mac,
uint8_t phyId,
WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW )
protectedvirtual

Callback invoked when a FEM passes PSDUs to the PHY.

Parameters
macthe MAC transmitting the PSDUs
phyIdthe ID of the PHY transmitting the PSDUs
psduMapthe PSDU map
txVectorthe TX vector
txPowerWthe tx power in Watts

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

References ns3::WifiMacHeader::GetTypeString(), m_checkTxPsdus, m_events, m_framesToSkip, ns3::Simulator::Now(), NS_LOG_INFO, NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, and ns3::Time::US.

Referenced by DoSetup().

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

Member Data Documentation

◆ m_ap1Mac

◆ m_ap1Sockets

std::map<WifiDirection, PacketSocketAddress> WifiAssociationTestBase::m_ap1Sockets
protected

packet socket addresses for DL/UL traffic from AP1

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

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

◆ m_ap2Mac

◆ m_ap2Sockets

std::map<WifiDirection, PacketSocketAddress> WifiAssociationTestBase::m_ap2Sockets
protected

packet socket addresses for DL/UL traffic from AP2

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

Referenced by DoSetup(), and GetApplication().

◆ m_assocMgrTypeId

std::string WifiAssociationTestBase::m_assocMgrTypeId {"ns3::WifiDefaultAssocManager"}
protected

Association Manager type ID.

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

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

◆ m_baseParams

BaseParams WifiAssociationTestBase::m_baseParams
protected

configuration parameters

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

Referenced by WifiAssociationTestBase(), and DoSetup().

◆ m_checkTxPsdus

bool WifiAssociationTestBase::m_checkTxPsdus {false}
protected

whether TX PSDUs should be checked against the list of events

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

Referenced by WifiDisassocAndReassocTest::AssocSeenByAp(), and Transmit().

◆ m_duration

Time WifiAssociationTestBase::m_duration {Seconds(0.8)}
protected

simulation duration

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

Referenced by WifiDisassocAndReassocTest::DoRun(), DoSetup(), and GetApplication().

◆ m_events

std::list<Events> WifiAssociationTestBase::m_events
protected

list of events for a test run

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

Referenced by WifiDisassocAndReassocTest::DoRun(), WifiDisassocAndReassocTest::InsertEvents(), and Transmit().

◆ m_framesToSkip

std::set<WifiMacType> WifiAssociationTestBase::m_framesToSkip
protected

frames that must not be checked against the list of events

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

Referenced by WifiDisassocAndReassocTest::WifiDisassocAndReassocTest(), and Transmit().

◆ m_staMac


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