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

Spectrum Wifi Phy Multiple Spectrum Test. More...

+ Inheritance diagram for SpectrumWifiPhyMultipleInterfacesTest:
+ Collaboration diagram for SpectrumWifiPhyMultipleInterfacesTest:

Public Types

enum class  ChannelSwitchScenario : uint8_t { BEFORE_TX = 0 , BETWEEN_TX_RX }
 Enumeration for channel switching scenarios. More...
 
- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 

Public Member Functions

 SpectrumWifiPhyMultipleInterfacesTest (bool trackSignalsInactiveInterfaces, ChannelSwitchScenario chanSwitchScenario)
 Constructor.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

void CheckCcaIndication (std::size_t index, bool expectedCcaBusyIndication, Time switchingDelay, Time propagationDelay)
 Verify CCA indication reported by a given PHY.
 
void CheckInterferences (Ptr< SpectrumWifiPhy > phy, const FrequencyRange &freqRange, const WifiSpectrumBandInfo &band, bool interferencesExpected)
 Schedule now to check the interferences.
 
void CheckResults (std::size_t index, uint32_t expectedNumRx, uint32_t expectedNumRxSuccess, uint32_t expectedRxBytes, FrequencyRange expectedFrequencyRangeActiveRfInterface, const std::vector< std::size_t > &expectedConnectedPhysPerChannel)
 Verify results.
 
void CheckRxingState (Ptr< SpectrumWifiPhy > phy, bool rxingExpected)
 Verify rxing state of the interference helper.
 
void DoCheckInterferences (Ptr< SpectrumWifiPhy > phy, const WifiSpectrumBandInfo &band, 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 RxFailure (std::size_t index, Ptr< const WifiPsdu > psdu)
 Receive failure function.
 
void RxSuccess (std::size_t index, Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, const std::vector< bool > &statusPerMpdu)
 Receive success function.
 
void SendPpdu (Ptr< SpectrumWifiPhy > phy, dBm_u txPower, uint32_t payloadSize)
 Send PPDU function.
 
void SwitchChannel (Ptr< SpectrumWifiPhy > phy, WifiPhyBand band, uint8_t channelNumber, MHz_u channelWidth, std::optional< std::size_t > listenerIndex)
 Switch channel function.
 

Private Attributes

ChannelSwitchScenario m_chanSwitchScenario
 the channel switch scenario to consider for the test
 
std::vector< uint32_tm_countRxFailure
 count number of packets unsuccessfully received by PHYs
 
std::vector< uint32_tm_countRxSuccess
 count number of packets successfully received by PHYs
 
std::vector< uint32_tm_counts
 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::shared_ptr< TestPhyListener > > m_listeners {}
 listeners
 
std::vector< uint32_tm_rxBytes
 count number of received bytes
 
std::vector< Ptr< SpectrumWifiPhy > > m_rxPhys {}
 RX PHYs.
 
std::vector< Ptr< MultiModelSpectrumChannel > > m_spectrumChannels
 Spectrum channels.
 
bool m_trackSignalsInactiveInterfaces
 flag to indicate whether signals coming from inactive spectrum PHY interfaces are tracked during the test
 
std::vector< Ptr< SpectrumWifiPhy > > m_txPhys {}
 TX PHYs.
 

Additional Inherited Members

- 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

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 1600 of file spectrum-wifi-phy-test.cc.

Member Enumeration Documentation

◆ ChannelSwitchScenario

Enumeration for channel switching scenarios.

Enumerator
BEFORE_TX 

start TX after channel switch is completed

BETWEEN_TX_RX 

perform channel switch during propagation delay (after TX and before RX)

Definition at line 1604 of file spectrum-wifi-phy-test.cc.

Constructor & Destructor Documentation

◆ SpectrumWifiPhyMultipleInterfacesTest()

SpectrumWifiPhyMultipleInterfacesTest::SpectrumWifiPhyMultipleInterfacesTest ( bool trackSignalsInactiveInterfaces,
ChannelSwitchScenario chanSwitchScenario )

Constructor.

Parameters
trackSignalsInactiveInterfacesflag to indicate whether signals coming from inactive spectrum PHY interfaces shall be tracked during the test
chanSwitchScenariothe channel switching scenario to consider for the test

Definition at line 1770 of file spectrum-wifi-phy-test.cc.

Member Function Documentation

◆ CheckCcaIndication()

void SpectrumWifiPhyMultipleInterfacesTest::CheckCcaIndication ( std::size_t index,
bool expectedCcaBusyIndication,
Time switchingDelay,
Time propagationDelay )
private

Verify CCA indication reported by a given PHY.

Parameters
indexthe index to identify the RX PHY to check
expectedCcaBusyIndicationflag to indicate whether a CCA BUSY notification is expected
switchingDelaydelay between the TX has started and the time RX switched to the TX channel
propagationDelaythe propagation delay

Definition at line 1948 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().

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

◆ CheckInterferences()

void SpectrumWifiPhyMultipleInterfacesTest::CheckInterferences ( Ptr< SpectrumWifiPhy > phy,
const FrequencyRange & freqRange,
const WifiSpectrumBandInfo & band,
bool interferencesExpected )
private

Schedule now to check the interferences.

Parameters
phythe PHY for which the check has to be executed
freqRangethe frequency range for which the check has to be executed
bandthe band for which the check has to be executed
interferencesExpectedflag whether interferences are expected to have been tracked

Definition at line 1869 of file spectrum-wifi-phy-test.cc.

References DoCheckInterferences(), m_trackSignalsInactiveInterfaces, and ns3::Simulator::ScheduleNow().

Referenced by DoRun().

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

◆ CheckResults()

void SpectrumWifiPhyMultipleInterfacesTest::CheckResults ( std::size_t index,
uint32_t expectedNumRx,
uint32_t expectedNumRxSuccess,
uint32_t expectedRxBytes,
FrequencyRange expectedFrequencyRangeActiveRfInterface,
const std::vector< std::size_t > & expectedConnectedPhysPerChannel )
private

Verify results.

Parameters
indexthe index to identify the RX PHY to check
expectedNumRxthe expected number of RX events for that PHY
expectedNumRxSuccessthe expected amount of successfully received packets
expectedRxBytesthe expected amount of received bytes
expectedFrequencyRangeActiveRfInterfacethe expected frequency range (in MHz) of the active RF interface
expectedConnectedPhysPerChannelthe expected number of PHYs attached for each spectrum channel

Definition at line 1905 of file spectrum-wifi-phy-test.cc.

References m_countRxFailure, m_countRxSuccess, m_counts, m_listeners, m_rxPhys, m_spectrumChannels, NS_ASSERT, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ CheckRxingState()

void SpectrumWifiPhyMultipleInterfacesTest::CheckRxingState ( Ptr< SpectrumWifiPhy > phy,
bool rxingExpected )
private

Verify rxing state of the interference helper.

Parameters
phythe PHY to which the interference helper instance is attached
rxingExpectedflag whether the interference helper is expected to be in rxing state or not

Definition at line 1971 of file spectrum-wifi-phy-test.cc.

References ns3::DynamicCast(), ns3::PointerValue::Get(), NS_ASSERT, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ.

Referenced by SwitchChannel().

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

◆ DoCheckInterferences()

void SpectrumWifiPhyMultipleInterfacesTest::DoCheckInterferences ( Ptr< SpectrumWifiPhy > phy,
const WifiSpectrumBandInfo & band,
bool interferencesExpected )
private

Check the interferences.

Parameters
phythe PHY for which the check has to be executed
bandthe band for which the check has to be executed
interferencesExpectedflag whether interferences are expected to have been tracked

Definition at line 1889 of file spectrum-wifi-phy-test.cc.

References ns3::DynamicCast(), ns3::PointerValue::Get(), NS_ASSERT, NS_LOG_FUNCTION, and NS_TEST_ASSERT_MSG_EQ.

Referenced by CheckInterferences().

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

◆ DoRun()

void SpectrumWifiPhyMultipleInterfacesTest::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

< CCA-ED threshold

< 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 2148 of file spectrum-wifi-phy-test.cc.

References BEFORE_TX, CHANNEL_NUMBER, CHANNEL_WIDTH, CheckCcaIndication(), CheckInterferences(), CheckResults(), ns3::WifiPhyOperatingChannel::FindFirst(), m_chanSwitchScenario, m_rxPhys, m_trackSignalsInactiveInterfaces, m_txPhys, ns3::MicroSeconds(), ns3::NanoSeconds(), NS_LOG_FUNCTION, Reset(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), SendPpdu(), ns3::Simulator::Stop(), SwitchChannel(), ns3::WIFI_PHY_BAND_5GHZ, and ns3::WIFI_STANDARD_80211ax.

+ Here is the call graph for this function:

◆ DoSetup()

void SpectrumWifiPhyMultipleInterfacesTest::DoSetup ( )
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.

< frequency range covered by the interface

< channel number the interface operates on

< PHY band the interface operates on

< name of the PHY band the interface operates on

Reimplemented from ns3::TestCase.

Definition at line 2019 of file spectrum-wifi-phy-test.cc.

References ns3::SpectrumWifiPhyHelper::AddChannel(), BETWEEN_TX_RX, ns3::CreateObject(), ns3::WifiPhyHelper::DLT_IEEE802_11_RADIO, ns3::DynamicCast(), ns3::NodeContainer::Get(), m_chanSwitchScenario, m_countRxFailure, m_countRxSuccess, m_counts, m_listeners, m_rxBytes, m_rxPhys, m_spectrumChannels, m_trackSignalsInactiveInterfaces, m_txPhys, ns3::MakeCallback(), ns3::FrequencyRange::maxFrequency, ns3::FrequencyRange::minFrequency, ns3::NanoSeconds(), NS_LOG_FUNCTION, RxCallback(), RxFailure(), RxSuccess(), ns3::WifiPhyHelper::Set(), ns3::WifiPhyHelper::SetInterferenceHelper(), ns3::WifiPhyHelper::SetPcapDataLinkType(), ns3::WIFI_PHY_BAND_2_4GHZ, ns3::WIFI_PHY_BAND_5GHZ, ns3::WIFI_PHY_BAND_6GHZ, ns3::WIFI_SPECTRUM_2_4_GHZ, ns3::WIFI_SPECTRUM_5_GHZ, ns3::WIFI_SPECTRUM_6_GHZ, and ns3::WIFI_STANDARD_80211be.

+ Here is the call graph for this function:

◆ DoTeardown()

void SpectrumWifiPhyMultipleInterfacesTest::DoTeardown ( )
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 2131 of file spectrum-wifi-phy-test.cc.

References ns3::Simulator::Destroy(), m_rxPhys, m_txPhys, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ Reset()

void SpectrumWifiPhyMultipleInterfacesTest::Reset ( )
private

Reset function.

Definition at line 1982 of file spectrum-wifi-phy-test.cc.

References m_countRxFailure, m_countRxSuccess, m_counts, m_listeners, m_rxBytes, m_rxPhys, m_txPhys, NS_LOG_FUNCTION, and SwitchChannel().

Referenced by DoRun().

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

◆ RxCallback()

void SpectrumWifiPhyMultipleInterfacesTest::RxCallback ( std::size_t index,
Ptr< const Packet > packet,
RxPowerWattPerChannelBand rxPowersW )
private

Callback triggered when a packet is received by a PHY.

Parameters
indexthe index to identify the RX PHY
packetthe received packet
rxPowersWthe received power per channel band in watts

Definition at line 1838 of file spectrum-wifi-phy-test.cc.

References m_counts, m_rxBytes, m_rxPhys, and NS_LOG_FUNCTION.

Referenced by DoSetup().

+ Here is the caller graph for this function:

◆ RxFailure()

void SpectrumWifiPhyMultipleInterfacesTest::RxFailure ( std::size_t index,
Ptr< const WifiPsdu > psdu )
private

Receive failure function.

Parameters
indexindex of the RX STA
psduthe PSDU

Definition at line 1862 of file spectrum-wifi-phy-test.cc.

References m_countRxFailure, and NS_LOG_FUNCTION.

Referenced by DoSetup().

+ Here is the caller graph for this function:

◆ RxSuccess()

void SpectrumWifiPhyMultipleInterfacesTest::RxSuccess ( std::size_t index,
Ptr< const WifiPsdu > psdu,
RxSignalInfo rxSignalInfo,
const WifiTxVector & txVector,
const std::vector< bool > & statusPerMpdu )
private

Receive success function.

Parameters
indexindex of the RX STA
psduthe PSDU
rxSignalInfothe info on the received signal (
See also
RxSignalInfo)
Parameters
txVectorthe transmit vector
statusPerMpdureception status per MPDU

Definition at line 1851 of file spectrum-wifi-phy-test.cc.

References m_countRxSuccess, and NS_LOG_FUNCTION.

Referenced by DoSetup().

+ Here is the caller graph for this function:

◆ SendPpdu()

void SpectrumWifiPhyMultipleInterfacesTest::SendPpdu ( Ptr< SpectrumWifiPhy > phy,
dBm_u txPower,
uint32_t payloadSize )
private

Send PPDU function.

Parameters
phythe PHY to transmit the signal
txPowerthe power to transmit the signal (this is also the received power since we do not have propagation loss to simplify)
payloadSizethe payload size in bytes

Definition at line 1803 of file spectrum-wifi-phy-test.cc.

References ns3::WifiPhy::CalculateTxDuration(), ns3::Create(), ns3::HePhy::GetHeMcs11(), m_lastTxEnd, m_lastTxStart, ns3::NanoSeconds(), 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().

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

◆ SwitchChannel()

void SpectrumWifiPhyMultipleInterfacesTest::SwitchChannel ( Ptr< SpectrumWifiPhy > phy,
WifiPhyBand band,
uint8_t channelNumber,
MHz_u channelWidth,
std::optional< std::size_t > listenerIndex )
private

Switch channel function.

Parameters
phythe PHY to switch
bandthe PHY band to use
channelNumbernumber the channel number to use
channelWidththe channel width to use
listenerIndexindex of the listener for that PHY, if PHY is a RX PHY

Definition at line 1780 of file spectrum-wifi-phy-test.cc.

References CheckRxingState(), m_listeners, NS_LOG_FUNCTION, ns3::Simulator::ScheduleNow(), and ns3::Seconds().

Referenced by DoRun(), and Reset().

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

Member Data Documentation

◆ m_chanSwitchScenario

ChannelSwitchScenario SpectrumWifiPhyMultipleInterfacesTest::m_chanSwitchScenario
private

the channel switch scenario to consider for the test

Definition at line 1753 of file spectrum-wifi-phy-test.cc.

Referenced by DoRun(), and DoSetup().

◆ m_countRxFailure

std::vector<uint32_t> SpectrumWifiPhyMultipleInterfacesTest::m_countRxFailure
private

count number of packets unsuccessfully received by PHYs

Definition at line 1763 of file spectrum-wifi-phy-test.cc.

Referenced by CheckResults(), DoSetup(), Reset(), and RxFailure().

◆ m_countRxSuccess

std::vector<uint32_t> SpectrumWifiPhyMultipleInterfacesTest::m_countRxSuccess
private

count number of packets successfully received by PHYs

Definition at line 1761 of file spectrum-wifi-phy-test.cc.

Referenced by CheckResults(), DoSetup(), Reset(), and RxSuccess().

◆ m_counts

std::vector<uint32_t> SpectrumWifiPhyMultipleInterfacesTest::m_counts
private

count number of packets received by PHYs

Definition at line 1759 of file spectrum-wifi-phy-test.cc.

Referenced by CheckResults(), DoSetup(), Reset(), and RxCallback().

◆ m_lastTxEnd

Time SpectrumWifiPhyMultipleInterfacesTest::m_lastTxEnd {0}
private

hold the time at which the last transmission ended

Definition at line 1767 of file spectrum-wifi-phy-test.cc.

Referenced by CheckCcaIndication(), and SendPpdu().

◆ m_lastTxStart

Time SpectrumWifiPhyMultipleInterfacesTest::m_lastTxStart {0}
private

hold the time at which the last transmission started

Definition at line 1766 of file spectrum-wifi-phy-test.cc.

Referenced by CheckCcaIndication(), and SendPpdu().

◆ m_listeners

std::vector<std::shared_ptr<TestPhyListener> > SpectrumWifiPhyMultipleInterfacesTest::m_listeners {}
private

listeners

Definition at line 1757 of file spectrum-wifi-phy-test.cc.

Referenced by CheckCcaIndication(), CheckResults(), DoSetup(), Reset(), and SwitchChannel().

◆ m_rxBytes

std::vector<uint32_t> SpectrumWifiPhyMultipleInterfacesTest::m_rxBytes
private

count number of received bytes

Definition at line 1764 of file spectrum-wifi-phy-test.cc.

Referenced by DoSetup(), Reset(), and RxCallback().

◆ m_rxPhys

std::vector<Ptr<SpectrumWifiPhy> > SpectrumWifiPhyMultipleInterfacesTest::m_rxPhys {}
private

RX PHYs.

Definition at line 1756 of file spectrum-wifi-phy-test.cc.

Referenced by CheckResults(), DoRun(), DoSetup(), DoTeardown(), Reset(), and RxCallback().

◆ m_spectrumChannels

std::vector<Ptr<MultiModelSpectrumChannel> > SpectrumWifiPhyMultipleInterfacesTest::m_spectrumChannels
private

Spectrum channels.

Definition at line 1754 of file spectrum-wifi-phy-test.cc.

Referenced by CheckResults(), and DoSetup().

◆ m_trackSignalsInactiveInterfaces

bool SpectrumWifiPhyMultipleInterfacesTest::m_trackSignalsInactiveInterfaces
private

flag to indicate whether signals coming from inactive spectrum PHY interfaces are tracked during the test

Definition at line 1750 of file spectrum-wifi-phy-test.cc.

Referenced by CheckInterferences(), DoRun(), and DoSetup().

◆ m_txPhys

std::vector<Ptr<SpectrumWifiPhy> > SpectrumWifiPhyMultipleInterfacesTest::m_txPhys {}
private

TX PHYs.

Definition at line 1755 of file spectrum-wifi-phy-test.cc.

Referenced by DoRun(), DoSetup(), DoTeardown(), and Reset().


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