Spectrum Wifi Phy Multiple Spectrum Test. More...
Public Member Functions | |
SpectrumWifiPhyMultipleInterfacesTest (bool trackSignalsInactiveInterfaces) | |
Constructor. | |
![]() | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Types | |
using | SpectrumChannelInfos = std::tuple< Ptr< MultiModelSpectrumChannel >, uint16_t, uint16_t > |
typedef for spectrum channel infos | |
Private Member Functions | |
void | CheckCcaIndication (std::size_t index, bool expectedCcaBusyIndication, Time switchingDelay) |
Verify CCA indication reported by a given PHY. | |
void | CheckInterferences (Ptr< ExtSpectrumWifiPhy > phy, const FrequencyRange &freqRange, uint16_t channelWidth, bool interferencesExpected) |
Schedule now to check the interferences. | |
void | CheckResults (std::size_t index, uint32_t expectedNumRx, FrequencyRange expectedFrequencyRangeActiveRfInterface, const std::vector< std::size_t > &expectedConnectedPhysPerChannel) |
Verify results. | |
void | DoCheckInterferences (Ptr< ExtSpectrumWifiPhy > phy, const FrequencyRange &freqRange, uint16_t channelWidth, bool interferencesExpected) |
Check the interferences. | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
void | DoSetup () override |
Implementation to do any local setup required for this TestCase. | |
void | DoTeardown () override |
Implementation to do any local setup required for this TestCase. | |
void | Reset () |
Reset function. | |
void | RxCallback (std::size_t index, Ptr< const Packet > packet, RxPowerWattPerChannelBand rxPowersW) |
Callback triggered when a packet is received by a PHY. | |
void | SendPpdu (Ptr< SpectrumWifiPhy > phy, double txPowerDbm) |
Send PPDU function. | |
void | SwitchChannel (std::size_t index, WifiPhyBand band, uint8_t channelNumber, uint16_t channelWidth) |
Switch channel function. | |
Private Attributes | |
std::vector< uint32_t > | m_counts {0} |
count number of packets received by PHYs | |
Time | m_lastTxEnd {0} |
hold the time at which the last transmission ended | |
Time | m_lastTxStart {0} |
hold the time at which the last transmission started | |
std::vector< std::unique_ptr< TestPhyListener > > | m_listeners {} |
listeners | |
std::vector< Ptr< ExtSpectrumWifiPhy > > | m_rxPhys {} |
RX PHYs. | |
std::vector< SpectrumChannelInfos > | m_spectrumChannelInfos |
Spectrum channels infos. | |
bool | m_trackSignalsInactiveInterfaces |
flag to indicate whether signals coming from inactive spectrum PHY interfaces are tracked during the test | |
std::vector< Ptr< ExtSpectrumWifiPhy > > | m_txPhys {} |
TX PHYs. | |
Additional Inherited Members | |
![]() | |
enum | TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
![]() | |
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. | |
Spectrum Wifi Phy Multiple Spectrum Test.
This test is testing the ability to plug multiple spectrum channels to the spectrum wifi PHY. It considers 4 TX-RX PHY pairs that are independent from each others and are plugged to different spectrum channels that are covering different frequency range. Each RX PHY is also attached to each of the other 3 spectrum channels it can switch to.
In the first scenario, we consider the default case where each TX-RX PHY pairs are operating on different frequency ranges and hence using independent spectrum channels. We validate that no packets is received from other TX PHYs attached to different spectrum channels and we also verify the amount of connected PHYs to each spectrum channel is exactly 2. The test also makes sure each PHY has only one active spectrum channel and that the active one is operating at the expected frequency range.
In the second scenario, we consecutively switch the channel of all RX PHYs to the one of each TX PHY. We validate that packets are received by all PHYs and we also verify the amount of connected PHYs to each spectrum channels is either 5 (1 TX PHY and 4 RX PHYs) or 1 (the TX PHY left alone).
Definition at line 837 of file spectrum-wifi-phy-test.cc.
|
private |
typedef for spectrum channel infos
Definition at line 940 of file spectrum-wifi-phy-test.cc.
SpectrumWifiPhyMultipleInterfacesTest::SpectrumWifiPhyMultipleInterfacesTest | ( | bool | trackSignalsInactiveInterfaces | ) |
Constructor.
trackSignalsInactiveInterfaces | flag to indicate whether signals coming from inactive spectrum PHY interfaces shall be tracked during the test |
Definition at line 957 of file spectrum-wifi-phy-test.cc.
|
private |
Verify CCA indication reported by a given PHY.
index | the index to identify the RX PHY to check |
expectedCcaBusyIndication | flag to indicate whether a CCA BUSY notification is expected |
switchingDelay | delay between the TX has started and the time RX switched to the TX channel |
Definition at line 1092 of file spectrum-wifi-phy-test.cc.
References m_lastTxEnd, m_lastTxStart, m_listeners, NS_LOG_FUNCTION, NS_TEST_ASSERT_MSG_EQ, and ns3::Seconds().
Referenced by DoRun().
|
private |
Schedule now to check the interferences.
phy | the PHY for which the check has to be executed |
freqRange | the frequency range for which the check has to be executed |
channelWidth | the channel width for which the check has to be executed |
interferencesExpected | flag whether interferences are expected to have been tracked |
Definition at line 1016 of file spectrum-wifi-phy-test.cc.
References DoCheckInterferences(), m_trackSignalsInactiveInterfaces, and ns3::Simulator::ScheduleNow().
Referenced by DoRun().
|
private |
Verify results.
index | the index to identify the RX PHY to check |
expectedNumRx | the expected number of RX events for that PHY |
expectedFrequencyRangeActiveRfInterface | the expected frequency range (in MHz) of the active RF interface |
expectedConnectedPhysPerChannel | the expected number of PHYs attached for each spectrum channel |
Definition at line 1055 of file spectrum-wifi-phy-test.cc.
References m_counts, m_listeners, m_rxPhys, m_spectrumChannelInfos, NS_ASSERT, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ.
Referenced by DoRun().
|
private |
Check the interferences.
phy | the PHY for which the check has to be executed |
freqRange | the frequency range for which the check has to be executed |
channelWidth | the channel width for which the check has to be executed |
interferencesExpected | flag whether interferences are expected to have been tracked |
Definition at line 1037 of file spectrum-wifi-phy-test.cc.
References ns3::PointerValue::Get(), NS_ASSERT, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ.
Referenced by CheckInterferences().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
< CCA-ED threshold in dBm
< delay in seconds between channel switch is triggered and a transmission gets started
< delay in seconds between start of test and moment results are verified
< delay in seconds between start of test and moment results are flushed
< delay in microseconds between a transmission has started and a point in time the transmission is ongoing
Implements ns3::TestCase.
Definition at line 1245 of file spectrum-wifi-phy-test.cc.
References CHANNEL_NUMBER, CHANNEL_WIDTH, CheckCcaIndication(), CheckInterferences(), CheckResults(), ns3::WifiPhyOperatingChannel::FindFirst(), m_rxPhys, m_trackSignalsInactiveInterfaces, m_txPhys, ns3::MicroSeconds(), NS_LOG_FUNCTION, Reset(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), SendPpdu(), SwitchChannel(), ns3::WIFI_PHY_BAND_5GHZ, and ns3::WIFI_STANDARD_80211ax.
|
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 ns3::TestCase.
Definition at line 1136 of file spectrum-wifi-phy-test.cc.
References ns3::WifiPhyOperatingChannel::FindFirst(), m_counts, m_listeners, m_rxPhys, m_spectrumChannelInfos, m_trackSignalsInactiveInterfaces, m_txPhys, ns3::MakeCallback(), NS_LOG_FUNCTION, RxCallback(), ns3::Seconds(), ns3::WIFI_PHY_BAND_2_4GHZ, ns3::WIFI_PHY_BAND_5GHZ, ns3::WIFI_PHY_BAND_6GHZ, and ns3::WIFI_STANDARD_80211ax.
|
overrideprivatevirtual |
Implementation to do any local setup required for this TestCase.
Subclasses should override this method to perform any costly per-test teardown
Reimplemented from ns3::TestCase.
Definition at line 1228 of file spectrum-wifi-phy-test.cc.
References ns3::Simulator::Destroy(), m_rxPhys, m_txPhys, and NS_LOG_FUNCTION.
|
private |
Reset function.
Definition at line 1113 of file spectrum-wifi-phy-test.cc.
References m_counts, m_listeners, m_rxPhys, m_txPhys, NS_LOG_FUNCTION, and SwitchChannel().
Referenced by DoRun().
|
private |
Callback triggered when a packet is received by a PHY.
index | the index to identify the RX PHY |
packet | the received packet |
rxPowersW | the received power per channel band in watts |
Definition at line 1005 of file spectrum-wifi-phy-test.cc.
References m_counts, m_rxPhys, and NS_LOG_FUNCTION.
Referenced by DoSetup().
|
private |
Send PPDU function.
phy | the PHY to transmit the signal |
txPowerDbm | the power in dBm to transmit the signal (this is also the received power since we do not have propagation loss to simplify) |
Definition at line 980 of file spectrum-wifi-phy-test.cc.
References ns3::WifiPhy::CalculateTxDuration(), ns3::HePhy::GetHeMcs0(), m_lastTxEnd, m_lastTxStart, ns3::Simulator::Now(), NS_LOG_FUNCTION, ns3::WifiMacHeader::SetAddr1(), ns3::WifiMacHeader::SetQosTid(), ns3::WifiMacHeader::SetSequenceNumber(), ns3::WifiMacHeader::SetType(), ns3::SU_STA_ID, ns3::WIFI_MAC_QOSDATA, and ns3::WIFI_PREAMBLE_HE_SU.
Referenced by DoRun().
|
private |
Switch channel function.
index | the index to identify the RX PHY |
band | the PHY band to use |
channelNumber | number the channel number to use |
channelWidth | the channel width to use |
Definition at line 965 of file spectrum-wifi-phy-test.cc.
References m_listeners, m_rxPhys, NS_LOG_FUNCTION, and ns3::Seconds().
Referenced by DoRun(), and Reset().
|
private |
count number of packets received by PHYs
Definition at line 951 of file spectrum-wifi-phy-test.cc.
Referenced by CheckResults(), DoSetup(), Reset(), and RxCallback().
|
private |
hold the time at which the last transmission ended
Definition at line 954 of file spectrum-wifi-phy-test.cc.
Referenced by CheckCcaIndication(), and SendPpdu().
|
private |
hold the time at which the last transmission started
Definition at line 953 of file spectrum-wifi-phy-test.cc.
Referenced by CheckCcaIndication(), and SendPpdu().
|
private |
listeners
Definition at line 949 of file spectrum-wifi-phy-test.cc.
Referenced by CheckCcaIndication(), CheckResults(), DoSetup(), Reset(), and SwitchChannel().
|
private |
RX PHYs.
Definition at line 948 of file spectrum-wifi-phy-test.cc.
Referenced by CheckResults(), DoRun(), DoSetup(), DoTeardown(), Reset(), RxCallback(), and SwitchChannel().
|
private |
Spectrum channels infos.
Definition at line 946 of file spectrum-wifi-phy-test.cc.
Referenced by CheckResults(), and DoSetup().
|
private |
flag to indicate whether signals coming from inactive spectrum PHY interfaces are tracked during the test
Definition at line 943 of file spectrum-wifi-phy-test.cc.
Referenced by CheckInterferences(), DoRun(), and DoSetup().
|
private |
TX PHYs.
Definition at line 947 of file spectrum-wifi-phy-test.cc.
Referenced by DoRun(), DoSetup(), DoTeardown(), and Reset().