This test verifies that communication between an AP and a STA resumes after that both switch channel and PHY band. More...
Public Member Functions | |
WifiChannelSwitchingTest () | |
Constructor. More... | |
~WifiChannelSwitchingTest () override | |
void | Associated (Mac48Address bssid) |
Callback invoked when a station associates with an AP. More... | |
void | ChannelSwitch () |
Request channel switch on both AP and STA. More... | |
void | DoRun () override |
Implementation to actually run this TestCase. More... | |
void | L7Receive (Ptr< const Packet > p, const Address &addr) |
Function to trace packets received by the server application. More... | |
void | SendPacket () |
Send a packet from the STA to the AP through a packet socket. More... | |
void | StateChange (uint32_t nodeId, Time start, Time duration, WifiPhyState state) |
Callback invoked when the PHY on the given node changes state. More... | |
void | Transmit (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) |
Callback invoked when PHY receives a PSDU to transmit from the MAC. More... | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. More... | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Attributes | |
NetDeviceContainer | m_apDevice |
AP device container. More... | |
NodeContainer | m_apNode |
AP node container. More... | |
uint8_t | m_assocCount |
count of completed Assoc Request procedures More... | |
std::array< uint8_t, 2 > | m_channelSwitchCount {0, 0} |
Per-node number of channel switch events. More... | |
uint32_t | m_payloadSize |
payload size in bytes More... | |
uint64_t | m_rxBytes |
RX bytes. More... | |
NetDeviceContainer | m_staDevice |
STA device container. More... | |
NodeContainer | m_staNode |
STA node container. More... | |
uint8_t | m_txCount |
count of transmissions More... | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum | TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
Protected Member Functions inherited from ns3::TestCase | |
TestCase (std::string name) | |
Constructor. More... | |
void | AddTestCase (TestCase *testCase, TestDuration duration=QUICK) |
Add an individual child TestCase to this test suite. More... | |
TestCase * | GetParent () const |
Get the parent of this TestCase. More... | |
bool | IsStatusFailure () const |
Check if any tests failed. More... | |
bool | IsStatusSuccess () const |
Check if all tests passed. More... | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. More... | |
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. More... | |
bool | MustAssertOnFailure () const |
Check if this run should assert on failure. More... | |
bool | MustContinueOnFailure () const |
Check if this run should continue on failure. More... | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. More... | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. More... | |
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 52 of file wifi-channel-switching-test.cc.
WifiChannelSwitchingTest::WifiChannelSwitchingTest | ( | ) |
Constructor.
Definition at line 116 of file wifi-channel-switching-test.cc.
|
override |
Definition at line 125 of file wifi-channel-switching-test.cc.
void WifiChannelSwitchingTest::Associated | ( | Mac48Address | bssid | ) |
Callback invoked when a station associates with an AP.
Tracks the number of times the association procedure is performed.
bssid | the BSSID |
Definition at line 130 of file wifi-channel-switching-test.cc.
References m_assocCount.
Referenced by DoRun().
void WifiChannelSwitchingTest::ChannelSwitch | ( | ) |
Request channel switch on both AP and STA.
Definition at line 201 of file wifi-channel-switching-test.cc.
References NS_LOG_INFO, and ns3::Config::Set().
Referenced by Transmit().
|
overridevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 221 of file wifi-channel-switching-test.cc.
References Associated(), ns3::Config::ConnectWithoutContext(), ns3::NodeContainer::Create(), L7Receive(), m_apDevice, m_apNode, m_assocCount, m_channelSwitchCount, m_payloadSize, m_rxBytes, m_staDevice, m_staNode, m_txCount, third::mac, ns3::MakeCallback(), third::mobility, NS_TEST_EXPECT_MSG_EQ, third::phy, ns3::Seconds(), SendPacket(), StateChange(), Transmit(), third::wifi, and ns3::WIFI_STANDARD_80211ax.
Function to trace packets received by the server application.
p | the packet |
addr | the address |
Definition at line 163 of file wifi-channel-switching-test.cc.
References ns3::Packet::GetSize(), m_payloadSize, and m_rxBytes.
Referenced by DoRun().
void WifiChannelSwitchingTest::SendPacket | ( | void | ) |
Send a packet from the STA to the AP through a packet socket.
Definition at line 172 of file wifi-channel-switching-test.cc.
References ns3::Node::AddApplication(), brite-generic-example::client, ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::PacketSocketHelper::Install(), m_apDevice, m_apNode, m_payloadSize, m_staDevice, m_staNode, ns3::MicroSeconds(), ns3::Seconds(), brite-generic-example::server, ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), and ns3::PacketSocketAddress::SetSingleDevice().
Referenced by DoRun().
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.
nodeId | the given node ID |
start | the time state changes |
duration | the time the PHY will stay in the new state |
state | the new PHY state |
Definition at line 209 of file wifi-channel-switching-test.cc.
References m_channelSwitchCount, and SWITCHING.
Referenced by DoRun().
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.
psduMap | the PSDU map |
txVector | the TX vector |
txPowerW | the tx power in Watts |
Definition at line 136 of file wifi-channel-switching-test.cc.
References ChannelSwitch(), m_txCount, NS_LOG_INFO, and ns3::WIFI_PHY_BAND_5GHZ.
Referenced by DoRun().
|
private |
AP device container.
Definition at line 107 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), and SendPacket().
|
private |
AP node container.
Definition at line 105 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), and SendPacket().
|
private |
count of completed Assoc Request procedures
Definition at line 109 of file wifi-channel-switching-test.cc.
Referenced by Associated(), and DoRun().
|
private |
Per-node number of channel switch events.
Definition at line 113 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), and StateChange().
|
private |
payload size in bytes
Definition at line 112 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), L7Receive(), and SendPacket().
|
private |
RX bytes.
Definition at line 111 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), and L7Receive().
|
private |
STA device container.
Definition at line 108 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), and SendPacket().
|
private |
STA node container.
Definition at line 106 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), and SendPacket().
|
private |
count of transmissions
Definition at line 110 of file wifi-channel-switching-test.cc.
Referenced by DoRun(), and Transmit().