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

This test verifies that communication between an AP and a STA resumes after that both switch channel and PHY band. More...

+ Inheritance diagram for WifiChannelSwitchingTest:
+ Collaboration diagram for WifiChannelSwitchingTest:

Public Member Functions

 WifiChannelSwitchingTest ()
 Constructor.
 
 ~WifiChannelSwitchingTest () override
 
void Associated (Mac48Address bssid)
 Callback invoked when a station associates with an AP.
 
void ChannelSwitch ()
 Request channel switch on both AP and STA.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void L7Receive (Ptr< const Packet > p, const Address &addr)
 Function to trace packets received by the server application.
 
void SendPacket ()
 Send a packet from the STA to the AP through a packet socket.
 
void StateChange (uint32_t nodeId, Time start, Time duration, WifiPhyState state)
 Callback invoked when the PHY on the given node changes state.
 
void Transmit (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW)
 Callback invoked when PHY receives a PSDU to transmit from the MAC.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Attributes

NetDeviceContainer m_apDevice
 AP device container.
 
NodeContainer m_apNode
 AP node container.
 
uint8_t m_assocCount
 count of completed Assoc Request procedures
 
std::array< uint8_t, 2 > m_channelSwitchCount {0, 0}
 Per-node number of channel switch events.
 
uint32_t m_payloadSize
 payload size in bytes
 
uint64_t m_rxBytes
 RX bytes.
 
NetDeviceContainer m_staDevice
 STA device container.
 
NodeContainer m_staNode
 STA node container.
 
uint8_t m_txCount
 count of transmissions
 

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...
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto QUICK = Duration::QUICK
 Deprecated test duration simple enums.
 
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto TAKES_FOREVER = Duration::TAKES_FOREVER
 
- 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.
 
TestCaseGetParent () 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.
 

Detailed Description

This test verifies that communication between an AP and a STA resumes after that both switch channel and PHY band.

The channel switch is scheduled to happen during the transmission of a frame sent by the STA to the AP. AP discards the frame, STA associates with the AP again and the AP finally receives the frame successfully.

Definition at line 41 of file wifi-channel-switching-test.cc.

Constructor & Destructor Documentation

◆ WifiChannelSwitchingTest()

WifiChannelSwitchingTest::WifiChannelSwitchingTest ( )

Constructor.

Definition at line 105 of file wifi-channel-switching-test.cc.

◆ ~WifiChannelSwitchingTest()

WifiChannelSwitchingTest::~WifiChannelSwitchingTest ( )
override

Definition at line 114 of file wifi-channel-switching-test.cc.

Member Function Documentation

◆ Associated()

void WifiChannelSwitchingTest::Associated ( Mac48Address bssid)

Callback invoked when a station associates with an AP.

Tracks the number of times the association procedure is performed.

Parameters
bssidthe BSSID

Definition at line 119 of file wifi-channel-switching-test.cc.

References m_assocCount.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ ChannelSwitch()

void WifiChannelSwitchingTest::ChannelSwitch ( )

Request channel switch on both AP and STA.

Definition at line 190 of file wifi-channel-switching-test.cc.

References NS_LOG_INFO, and ns3::Config::Set().

Referenced by Transmit().

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

◆ DoRun()

void WifiChannelSwitchingTest::DoRun ( )
overridevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 210 of file wifi-channel-switching-test.cc.

References ns3::WifiHelper::AssignStreams(), Associated(), ns3::Config::ConnectWithoutContext(), ns3::NodeContainer::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), L7Receive(), m_apDevice, m_apNode, m_assocCount, m_channelSwitchCount, m_payloadSize, m_rxBytes, m_staDevice, m_staNode, m_txCount, ns3::MakeCallback(), NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::Seconds(), SendPacket(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), StateChange(), ns3::Simulator::Stop(), Transmit(), and ns3::WIFI_STANDARD_80211ax.

+ Here is the call graph for this function:

◆ L7Receive()

void WifiChannelSwitchingTest::L7Receive ( Ptr< const Packet > p,
const Address & addr )

Function to trace packets received by the server application.

Parameters
pthe packet
addrthe address

Definition at line 152 of file wifi-channel-switching-test.cc.

References m_payloadSize, and m_rxBytes.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ SendPacket()

void WifiChannelSwitchingTest::SendPacket ( )

Send a packet from the STA to the AP through a packet socket.

Definition at line 161 of file wifi-channel-switching-test.cc.

References ns3::Node::AddApplication(), ns3::CreateObject(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::PacketSocketHelper::Install(), m_apDevice, m_apNode, m_payloadSize, m_staDevice, m_staNode, ns3::MicroSeconds(), ns3::Seconds(), ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), and ns3::PacketSocketAddress::SetSingleDevice().

Referenced by DoRun().

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

◆ StateChange()

void WifiChannelSwitchingTest::StateChange ( uint32_t nodeId,
ns3::Time start,
ns3::Time duration,
WifiPhyState state )

Callback invoked when the PHY on the given node changes state.

Parameters
nodeIdthe given node ID
startthe time state changes
durationthe time the PHY will stay in the new state
statethe new PHY state

Definition at line 198 of file wifi-channel-switching-test.cc.

References m_channelSwitchCount.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ Transmit()

void WifiChannelSwitchingTest::Transmit ( WifiConstPsduMap psduMap,
WifiTxVector txVector,
double txPowerW )

Callback invoked when PHY receives a PSDU to transmit from the MAC.

Tracks the number of times a QoS data frame is transmitted by the STA.

Parameters
psduMapthe PSDU map
txVectorthe TX vector
txPowerWthe tx power in Watts

Definition at line 125 of file wifi-channel-switching-test.cc.

References ns3::WifiPhy::CalculateTxDuration(), ChannelSwitch(), m_txCount, NS_LOG_INFO, ns3::Simulator::Schedule(), and ns3::WIFI_PHY_BAND_5GHZ.

Referenced by DoRun().

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

Member Data Documentation

◆ m_apDevice

NetDeviceContainer WifiChannelSwitchingTest::m_apDevice
private

AP device container.

Definition at line 96 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), and SendPacket().

◆ m_apNode

NodeContainer WifiChannelSwitchingTest::m_apNode
private

AP node container.

Definition at line 94 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), and SendPacket().

◆ m_assocCount

uint8_t WifiChannelSwitchingTest::m_assocCount
private

count of completed Assoc Request procedures

Definition at line 98 of file wifi-channel-switching-test.cc.

Referenced by Associated(), and DoRun().

◆ m_channelSwitchCount

std::array<uint8_t, 2> WifiChannelSwitchingTest::m_channelSwitchCount {0, 0}
private

Per-node number of channel switch events.

Definition at line 102 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), and StateChange().

◆ m_payloadSize

uint32_t WifiChannelSwitchingTest::m_payloadSize
private

payload size in bytes

Definition at line 101 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), L7Receive(), and SendPacket().

◆ m_rxBytes

uint64_t WifiChannelSwitchingTest::m_rxBytes
private

RX bytes.

Definition at line 100 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), and L7Receive().

◆ m_staDevice

NetDeviceContainer WifiChannelSwitchingTest::m_staDevice
private

STA device container.

Definition at line 97 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), and SendPacket().

◆ m_staNode

NodeContainer WifiChannelSwitchingTest::m_staNode
private

STA node container.

Definition at line 95 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), and SendPacket().

◆ m_txCount

uint8_t WifiChannelSwitchingTest::m_txCount
private

count of transmissions

Definition at line 99 of file wifi-channel-switching-test.cc.

Referenced by DoRun(), and Transmit().


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