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. | |
~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 AP to the STA 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 |
TestCase & | operator= (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 | 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. | |
void | AddTestCase (TestCase *testCase, TestDuration 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. | |
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 AP to the STA. STA discards the frame, associates with the AP again and 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(), 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.
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 m_payloadSize, and m_rxBytes.
Referenced by DoRun().
void WifiChannelSwitchingTest::SendPacket | ( | ) |
Send a packet from the AP to the STA through a packet socket.
Definition at line 172 of file wifi-channel-switching-test.cc.
References ns3::Node::AddApplication(), 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().
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.
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 AP.
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 ns3::WifiPhy::CalculateTxDuration(), ChannelSwitch(), m_txCount, NS_LOG_INFO, ns3::Simulator::Schedule(), 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().