wifi: Doxygen updates for test files (thanks to Robert Ammon)
This commit is contained in:
@@ -20,15 +20,15 @@
|
||||
|
||||
/*
|
||||
* This program is used to generate plots found in the paper
|
||||
* G. Pei and Tom Henderson, "Validation of ns-3 802.11b PHY model",
|
||||
* G. Pei and Tom Henderson, "Validation of ns-3 802.11b PHY model",
|
||||
* available online at http://www.nsnam.org/~pei/80211b.pdf
|
||||
*
|
||||
*
|
||||
* It can be compiled as a C program and relies on a library installation of
|
||||
* the GNU Scientific Library (gsl). To compile:
|
||||
* the GNU Scientific Library (gsl). To compile:
|
||||
* gcc 80211b.c -o 80211b -lm -lgsl -lgslcblas
|
||||
*
|
||||
* The executable output should be redirected into a text file 80211b.txt
|
||||
* ./80211b > 80211b.txt
|
||||
* ./80211b > 80211b.txt
|
||||
*
|
||||
* Then gnuplot can load the associated plot file which references 80211b.txt:
|
||||
* gnuplot 80211b.plt
|
||||
@@ -46,10 +46,22 @@
|
||||
#define WLAN_SIR_perfect 10.0 // if SIR > 10dB, perfect reception
|
||||
#define WLAN_SIR_impossible 0.1 // if SIR < -10dB, impossible to receive
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \defgroup wifi-test wifi module tests
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief fn_parameter_t structure
|
||||
*/
|
||||
typedef struct fn_parameter_t
|
||||
{
|
||||
double beta;
|
||||
double n;
|
||||
double beta; ///< beta
|
||||
double n; ///< n
|
||||
} fn_parameters;
|
||||
|
||||
double QFunction (double x)
|
||||
@@ -201,9 +213,9 @@ int main (int argc, char * argv[])
|
||||
{
|
||||
double rss, sinr;
|
||||
double totalPkt = 200.0;
|
||||
//double noise = 1.552058; // (dB) this noise figure value corresponds to
|
||||
// -99 dBm noise floor reported in CMU paper
|
||||
double noise = 7; // (dB) this noise figure value corresponds to the
|
||||
//double noise = 1.552058; // (dB) this noise figure value corresponds to
|
||||
// -99 dBm noise floor reported in CMU paper
|
||||
double noise = 7; // (dB) this noise figure value corresponds to the
|
||||
// default in YansWifiPhy, and matches CMU testbed results
|
||||
double EcNc, EbN01, EbN02, EbN05, EbN011;
|
||||
double ieee1,ieee2,ieee5,ieee11;
|
||||
|
||||
@@ -28,6 +28,11 @@ using namespace ns3;
|
||||
NS_LOG_COMPONENT_DEFINE ("BlockAckTest");
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Packet Buffering Case A
|
||||
*
|
||||
* This simple test verifies the correctness of buffering for packets received
|
||||
* under block ack. In order to completely understand this example is important to cite
|
||||
* section 9.10.3 in IEEE802.11 standard:
|
||||
@@ -66,7 +71,7 @@ public:
|
||||
virtual ~PacketBufferingCaseA ();
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
std::list<uint16_t> m_expectedBuffer;
|
||||
std::list<uint16_t> m_expectedBuffer; ///< expected test buffer
|
||||
};
|
||||
|
||||
PacketBufferingCaseA::PacketBufferingCaseA ()
|
||||
@@ -127,7 +132,13 @@ PacketBufferingCaseA::DoRun (void)
|
||||
}
|
||||
|
||||
|
||||
/* ----- = old packets
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Packet Buffering Case B
|
||||
*
|
||||
* ----- = old packets
|
||||
* +++++ = new packets
|
||||
*
|
||||
* CASE B: startSeq > endSeq
|
||||
@@ -157,7 +168,7 @@ public:
|
||||
virtual ~PacketBufferingCaseB ();
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
std::list<uint16_t> m_expectedBuffer;
|
||||
std::list<uint16_t> m_expectedBuffer; ///< expected test buffer
|
||||
};
|
||||
|
||||
PacketBufferingCaseB::PacketBufferingCaseB ()
|
||||
@@ -232,14 +243,19 @@ PacketBufferingCaseB::DoRun (void)
|
||||
}
|
||||
|
||||
|
||||
//Test for block ack header
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Test for block ack header
|
||||
*/
|
||||
class CtrlBAckResponseHeaderTest : public TestCase
|
||||
{
|
||||
public:
|
||||
CtrlBAckResponseHeaderTest ();
|
||||
private:
|
||||
virtual void DoRun ();
|
||||
CtrlBAckResponseHeader m_blockAckHdr;
|
||||
CtrlBAckResponseHeader m_blockAckHdr; ///< block ack header
|
||||
};
|
||||
|
||||
CtrlBAckResponseHeaderTest::CtrlBAckResponseHeaderTest ()
|
||||
@@ -293,7 +309,12 @@ CtrlBAckResponseHeaderTest::DoRun (void)
|
||||
NS_TEST_EXPECT_MSG_EQ (m_blockAckHdr.IsPacketReceived (80), false, "error in compressed bitmap");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Block Ack Test Suite
|
||||
*/
|
||||
class BlockAckTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -308,4 +329,4 @@ BlockAckTestSuite::BlockAckTestSuite ()
|
||||
AddTestCase (new CtrlBAckResponseHeaderTest, TestCase::QUICK);
|
||||
}
|
||||
|
||||
static BlockAckTestSuite g_blockAckTestSuite;
|
||||
static BlockAckTestSuite g_blockAckTestSuite; ///< the test suite
|
||||
|
||||
@@ -28,34 +28,63 @@ using namespace ns3;
|
||||
|
||||
class DcfManagerTest;
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Dcf State Test
|
||||
*/
|
||||
class DcfStateTest : public DcfState
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param dca the DCA TXOP
|
||||
*/
|
||||
DcfStateTest (Ptr<DcaTxop> dca);
|
||||
/**
|
||||
* Queue transmit function
|
||||
* \param txTime the transmit time
|
||||
* \param expectedGrantTime the expected grant time
|
||||
*/
|
||||
void QueueTx (uint64_t txTime, uint64_t expectedGrantTime);
|
||||
|
||||
|
||||
private:
|
||||
friend class DcfManagerTest;
|
||||
|
||||
typedef std::pair<uint64_t,uint64_t> ExpectedGrant;
|
||||
typedef std::list<ExpectedGrant> ExpectedGrants;
|
||||
typedef std::pair<uint64_t,uint64_t> ExpectedGrant; //!< the expected grant typedef
|
||||
typedef std::list<ExpectedGrant> ExpectedGrants; //!< the collection of expected grants typedef
|
||||
/// ExpectedCollision structure
|
||||
struct ExpectedCollision
|
||||
{
|
||||
uint64_t at;
|
||||
uint32_t nSlots;
|
||||
uint64_t at; //!< at
|
||||
uint32_t nSlots; //!< number of slots
|
||||
};
|
||||
typedef std::list<struct ExpectedCollision> ExpectedCollisions;
|
||||
typedef std::list<struct ExpectedCollision> ExpectedCollisions; //!< expected collisions typedef
|
||||
|
||||
ExpectedCollisions m_expectedInternalCollision;
|
||||
ExpectedCollisions m_expectedCollision;
|
||||
ExpectedGrants m_expectedGrants;
|
||||
ExpectedCollisions m_expectedInternalCollision; //!< expected internal collisions
|
||||
ExpectedCollisions m_expectedCollision; //!< expected collision
|
||||
ExpectedGrants m_expectedGrants; //!< expected grants
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Dca Txop Test
|
||||
*/
|
||||
class DcaTxopTest : public DcaTxop
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param test the test DCF manager
|
||||
* \param i the DCF state
|
||||
*/
|
||||
DcaTxopTest (DcfManagerTest *test, uint32_t i);
|
||||
|
||||
|
||||
@@ -68,59 +97,177 @@ private:
|
||||
void NotifyWakeUp (void);
|
||||
void DoDispose (void);
|
||||
|
||||
DcfManagerTest *m_test;
|
||||
uint32_t m_i;
|
||||
DcfManagerTest *m_test; //!< the test DCF manager
|
||||
uint32_t m_i; //!< the DCF state
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Dcf Manager Test
|
||||
*/
|
||||
class DcfManagerTest : public TestCase
|
||||
{
|
||||
public:
|
||||
DcfManagerTest ();
|
||||
virtual void DoRun (void);
|
||||
|
||||
/**
|
||||
* Notify access granted function
|
||||
* \param i the DCF state
|
||||
*/
|
||||
void NotifyAccessGranted (uint32_t i);
|
||||
/**
|
||||
* Notify internal collision function
|
||||
* \param i the DCF state
|
||||
*/
|
||||
void NotifyInternalCollision (uint32_t i);
|
||||
/**
|
||||
* Notify collision function
|
||||
* \param i the DCF state
|
||||
*/
|
||||
void NotifyCollision (uint32_t i);
|
||||
/**
|
||||
* Notify channel switching function
|
||||
* \param i the DCF state
|
||||
*/
|
||||
void NotifyChannelSwitching (uint32_t i);
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Start test function
|
||||
* \param slotTime the slot time
|
||||
* \param sifs the SIFS
|
||||
* \param eifsNoDifsNoSifs the EIFS no DIFS no SIFS
|
||||
* \param ackTimeoutValue the ack timeout value
|
||||
*/
|
||||
void StartTest (uint64_t slotTime, uint64_t sifs, uint64_t eifsNoDifsNoSifs, uint32_t ackTimeoutValue = 20);
|
||||
/**
|
||||
* Add DCF state function
|
||||
* \param aifsn the AIFSN
|
||||
*/
|
||||
void AddDcfState (uint32_t aifsn);
|
||||
/// End test function
|
||||
void EndTest (void);
|
||||
/**
|
||||
* Expect internal collision function
|
||||
* \param time the expectedtime
|
||||
* \param nSlots the number of slots
|
||||
* \param from the expected from
|
||||
*/
|
||||
void ExpectInternalCollision (uint64_t time, uint32_t nSlots, uint32_t from);
|
||||
/**
|
||||
* Expect internal collision function
|
||||
* \param time the expectedtime
|
||||
* \param nSlots the number of slots
|
||||
* \param from the expected from
|
||||
*/
|
||||
void ExpectCollision (uint64_t time, uint32_t nSlots, uint32_t from);
|
||||
/**
|
||||
* Add expect collision function
|
||||
* \param at
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddRxOkEvt (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add receive error event function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddRxErrorEvt (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add receive inside SIFS event function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddRxInsideSifsEvt (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add transmit event function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddTxEvt (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add NAV reset function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddNavReset (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add NAV start function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddNavStart (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add ack timeout reset function
|
||||
* \param at the event time
|
||||
*/
|
||||
void AddAckTimeoutReset (uint64_t at);
|
||||
/**
|
||||
* Add access function
|
||||
* \param at the event time
|
||||
* \param txTime the transmit time
|
||||
* \param expectedGrantTime the expected grant time
|
||||
* \param from
|
||||
*/
|
||||
void AddAccessRequest (uint64_t at, uint64_t txTime,
|
||||
uint64_t expectedGrantTime, uint32_t from);
|
||||
/**
|
||||
* Add access request with ack timeout
|
||||
* \param at time to schedule DoAccessRequest event
|
||||
* \param txTime DoAccessRequest txTime
|
||||
* \param expectedGrantTime DoAccessRequest expectedGrantTime
|
||||
* \param from DoAccessRequest DcfStateTest
|
||||
*/
|
||||
void AddAccessRequestWithAckTimeout (uint64_t at, uint64_t txTime,
|
||||
uint64_t expectedGrantTime, uint32_t from);
|
||||
///\param at time to schedule DoAccessRequest event
|
||||
///\param txTime DoAccessRequest txTime
|
||||
///\param expectedGrantTime DoAccessRequest expectedGrantTime
|
||||
///\param ackDelay is delay of the ack after txEnd
|
||||
///\param from DoAccessRequest DcfStateTest
|
||||
/**
|
||||
* Add access request with successful ack
|
||||
* \param at time to schedule DoAccessRequest event
|
||||
* \param txTime DoAccessRequest txTime
|
||||
* \param expectedGrantTime DoAccessRequest expectedGrantTime
|
||||
* \param ackDelay is delay of the ack after txEnd
|
||||
* \param from DoAccessRequest DcfStateTest
|
||||
*/
|
||||
void AddAccessRequestWithSuccessfullAck (uint64_t at, uint64_t txTime,
|
||||
uint64_t expectedGrantTime, uint32_t ackDelay, uint32_t from);
|
||||
/**
|
||||
* Add access request with successful ack
|
||||
* \param txTime DoAccessRequest txTime
|
||||
* \param expectedGrantTime DoAccessRequest expectedGrantTime
|
||||
* \param state DcfStateTest
|
||||
*/
|
||||
void DoAccessRequest (uint64_t txTime, uint64_t expectedGrantTime, DcfStateTest *state);
|
||||
/**
|
||||
* Add CCA busy event function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddCcaBusyEvt (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add switching event function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddSwitchingEvt (uint64_t at, uint64_t duration);
|
||||
/**
|
||||
* Add receive start event function
|
||||
* \param at the event time
|
||||
* \param duration the duration
|
||||
*/
|
||||
void AddRxStartEvt (uint64_t at, uint64_t duration);
|
||||
|
||||
typedef std::vector<DcfStateTest *> DcfStates;
|
||||
typedef std::vector<Ptr<DcaTxopTest> > Dca;
|
||||
typedef std::vector<DcfStateTest *> DcfStates; //!< the DCF test states typedef
|
||||
typedef std::vector<Ptr<DcaTxopTest> > Dca; //!< the DCA TXOP tests typedef
|
||||
|
||||
Ptr<DcfManager> m_dcfManager;
|
||||
DcfStates m_dcfStates;
|
||||
Dca m_dca;
|
||||
uint32_t m_ackTimeoutValue;
|
||||
Ptr<DcfManager> m_dcfManager; //!< the DCF manager
|
||||
DcfStates m_dcfStates; //!< the DCF states
|
||||
Dca m_dca; //!< the DCA
|
||||
uint32_t m_ackTimeoutValue; //!< the ack timeout value
|
||||
};
|
||||
|
||||
DcfStateTest::DcfStateTest (Ptr<DcaTxop> dca)
|
||||
@@ -305,8 +452,8 @@ DcfManagerTest::EndTest (void)
|
||||
delete state;
|
||||
}
|
||||
m_dcfStates.clear ();
|
||||
|
||||
for (Dca::const_iterator i = m_dca.begin (); i != m_dca.end (); i++)
|
||||
|
||||
for (Dca::const_iterator i = m_dca.begin (); i != m_dca.end (); i++)
|
||||
{
|
||||
Ptr<DcaTxopTest> dca = *i;
|
||||
dca->Dispose ();
|
||||
@@ -764,6 +911,12 @@ DcfManagerTest::DoRun (void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Dcf Test Suite
|
||||
*/
|
||||
class DcfTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -27,6 +27,12 @@
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Power Rate Adaptation Test
|
||||
*/
|
||||
class PowerRateAdaptationTest : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -34,11 +40,17 @@ public:
|
||||
|
||||
virtual void DoRun (void);
|
||||
private:
|
||||
/// Test parf function
|
||||
void TestParf ();
|
||||
/// Test aparf function
|
||||
void TestAparf ();
|
||||
/**
|
||||
* Configure nde function
|
||||
* \returns the node
|
||||
*/
|
||||
Ptr<Node> ConfigureNode ();
|
||||
|
||||
ObjectFactory m_manager;
|
||||
ObjectFactory m_manager; ///< manager
|
||||
};
|
||||
|
||||
PowerRateAdaptationTest::PowerRateAdaptationTest ()
|
||||
@@ -562,7 +574,12 @@ PowerRateAdaptationTest::DoRun (void)
|
||||
TestAparf ();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Power Rate Adaptation Test Suite
|
||||
*/
|
||||
class PowerRateAdaptationTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -575,4 +592,4 @@ PowerRateAdaptationTestSuite::PowerRateAdaptationTestSuite ()
|
||||
AddTestCase (new PowerRateAdaptationTest, TestCase::QUICK);
|
||||
}
|
||||
|
||||
static PowerRateAdaptationTestSuite g_powerRateAdaptationTestSuite;
|
||||
static PowerRateAdaptationTestSuite g_powerRateAdaptationTestSuite; ///< the test suite
|
||||
|
||||
@@ -32,20 +32,51 @@ static const uint16_t CHANNEL_NUMBER = 36;
|
||||
static const uint32_t FREQUENCY = 5180; // MHz
|
||||
static const uint32_t CHANNEL_WIDTH = 20; // MHz
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Spectrum Wifi Phy Basic Test
|
||||
*/
|
||||
class SpectrumWifiPhyBasicTest : public TestCase
|
||||
{
|
||||
public:
|
||||
SpectrumWifiPhyBasicTest ();
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* \param name reference name
|
||||
*/
|
||||
SpectrumWifiPhyBasicTest (std::string name);
|
||||
virtual ~SpectrumWifiPhyBasicTest ();
|
||||
protected:
|
||||
virtual void DoSetup (void);
|
||||
Ptr<SpectrumWifiPhy> m_phy;
|
||||
Ptr<SpectrumWifiPhy> m_phy; ///< Phy
|
||||
/**
|
||||
* Make signal function
|
||||
* \param txPowerWatts the transmit power in watts
|
||||
* \returns Ptr<SpectrumSignalParameters>
|
||||
*/
|
||||
Ptr<SpectrumSignalParameters> MakeSignal (double txPowerWatts);
|
||||
/**
|
||||
* Send signal function
|
||||
* \param txPowerWatts the transmit power in watts
|
||||
*/
|
||||
void SendSignal (double txPowerWatts);
|
||||
/**
|
||||
* Spectrum wifi receive success function
|
||||
* \param p the packet
|
||||
* \param snr the SNR
|
||||
* \param txVector the transmit vector
|
||||
*/
|
||||
void SpectrumWifiPhyRxSuccess (Ptr<Packet> p, double snr, WifiTxVector txVector);
|
||||
/**
|
||||
* Spectrum wifi receive failure function
|
||||
* \param p the packet
|
||||
* \param snr the SNR
|
||||
*/
|
||||
void SpectrumWifiPhyRxFailure (Ptr<Packet> p, double snr);
|
||||
uint32_t m_count;
|
||||
uint32_t m_count; ///< count
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
};
|
||||
@@ -63,7 +94,7 @@ SpectrumWifiPhyBasicTest::SpectrumWifiPhyBasicTest (std::string name)
|
||||
}
|
||||
|
||||
// Make a Wi-Fi signal to inject directly to the StartRx() method
|
||||
Ptr<SpectrumSignalParameters>
|
||||
Ptr<SpectrumSignalParameters>
|
||||
SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts)
|
||||
{
|
||||
WifiTxVector txVector = WifiTxVector (WifiPhy::GetOfdmRate6Mbps (), 0, 0, WIFI_PREAMBLE_LONG, false, 1, 1, 0, 20, false, false);
|
||||
@@ -76,7 +107,7 @@ SpectrumWifiPhyBasicTest::MakeSignal (double txPowerWatts)
|
||||
hdr.SetType (WIFI_MAC_QOSDATA);
|
||||
hdr.SetQosTid (0);
|
||||
uint32_t size = pkt->GetSize () + hdr.GetSize () + trailer.GetSerializedSize ();
|
||||
Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency(), mpdutype, 0);
|
||||
Time txDuration = m_phy->CalculateTxDuration (size, txVector, m_phy->GetFrequency (), mpdutype, 0);
|
||||
hdr.SetDuration (txDuration);
|
||||
|
||||
pkt->AddHeader (hdr);
|
||||
@@ -138,18 +169,24 @@ SpectrumWifiPhyBasicTest::DoRun (void)
|
||||
{
|
||||
double txPowerWatts = 0.010;
|
||||
// Send packets spaced 1 second apart; all should be received
|
||||
Simulator::Schedule (Seconds (1), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (Seconds (2), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (Seconds (3), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (Seconds (1), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (Seconds (2), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (Seconds (3), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
// Send packets spaced 1 microsecond second apart; only one should be received
|
||||
Simulator::Schedule (MicroSeconds (4000000), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (MicroSeconds (4000001), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (MicroSeconds (4000000), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (MicroSeconds (4000001), &SpectrumWifiPhyBasicTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Run ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (m_count, 4, "Didn't receive right number of packets");
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Test Phy Listener
|
||||
*/
|
||||
class TestPhyListener : public ns3::WifiPhyListener
|
||||
{
|
||||
public:
|
||||
@@ -157,11 +194,11 @@ public:
|
||||
* Create a test PhyListener
|
||||
*
|
||||
*/
|
||||
TestPhyListener (void) :
|
||||
m_notifyRxStart (0),
|
||||
m_notifyRxEndOk (0),
|
||||
m_notifyRxEndError (0),
|
||||
m_notifyMaybeCcaBusyStart (0)
|
||||
TestPhyListener (void)
|
||||
: m_notifyRxStart (0),
|
||||
m_notifyRxEndOk (0),
|
||||
m_notifyRxEndError (0),
|
||||
m_notifyMaybeCcaBusyStart (0)
|
||||
{
|
||||
}
|
||||
virtual ~TestPhyListener ()
|
||||
@@ -195,14 +232,19 @@ public:
|
||||
virtual void NotifyWakeup (void)
|
||||
{
|
||||
}
|
||||
uint32_t m_notifyRxStart;
|
||||
uint32_t m_notifyRxEndOk;
|
||||
uint32_t m_notifyRxEndError;
|
||||
uint32_t m_notifyMaybeCcaBusyStart;
|
||||
uint32_t m_notifyRxStart; ///< notify receive start
|
||||
uint32_t m_notifyRxEndOk; ///< notify receive end OK
|
||||
uint32_t m_notifyRxEndError; ///< notify receive end error
|
||||
uint32_t m_notifyMaybeCcaBusyStart; ///< notify maybe CCA busy start
|
||||
private:
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Spectrum Wifi Phy Listener Test
|
||||
*/
|
||||
class SpectrumWifiPhyListenerTest : public SpectrumWifiPhyBasicTest
|
||||
{
|
||||
public:
|
||||
@@ -211,7 +253,7 @@ public:
|
||||
private:
|
||||
virtual void DoSetup (void);
|
||||
virtual void DoRun (void);
|
||||
TestPhyListener* m_listener;
|
||||
TestPhyListener* m_listener; ///< listener
|
||||
};
|
||||
|
||||
SpectrumWifiPhyListenerTest::SpectrumWifiPhyListenerTest ()
|
||||
@@ -235,7 +277,7 @@ void
|
||||
SpectrumWifiPhyListenerTest::DoRun (void)
|
||||
{
|
||||
double txPowerWatts = 0.010;
|
||||
Simulator::Schedule (Seconds (1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Schedule (Seconds (1), &SpectrumWifiPhyListenerTest::SendSignal, this, txPowerWatts);
|
||||
Simulator::Run ();
|
||||
|
||||
NS_TEST_ASSERT_MSG_EQ (m_count, 1, "Didn't receive right number of packets");
|
||||
@@ -247,6 +289,12 @@ SpectrumWifiPhyListenerTest::DoRun (void)
|
||||
delete m_listener;
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Spectrum Wifi Phy Test Suite
|
||||
*/
|
||||
class SpectrumWifiPhyTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -260,4 +308,4 @@ SpectrumWifiPhyTestSuite::SpectrumWifiPhyTestSuite ()
|
||||
AddTestCase (new SpectrumWifiPhyListenerTest, TestCase::QUICK);
|
||||
}
|
||||
|
||||
static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite;
|
||||
static SpectrumWifiPhyTestSuite spectrumWifiPhyTestSuite; ///< the test suite
|
||||
|
||||
@@ -30,6 +30,12 @@ NS_LOG_COMPONENT_DEFINE ("InterferenceHelperTxDurationTest");
|
||||
static const double CHANNEL_1_MHZ = 2412.0; // a 2.4 GHz center frequency (MHz)
|
||||
static const double CHANNEL_36_MHZ = 5180.0; // a 5 GHz center frequency (MHz)
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Tx Duration Test
|
||||
*/
|
||||
class TxDurationTest : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -418,7 +424,12 @@ TxDurationTest::DoRun (void)
|
||||
NS_TEST_EXPECT_MSG_EQ (retval, true, "an 802.11ax duration failed");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Tx Duration Test Suite
|
||||
*/
|
||||
class TxDurationTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -431,4 +442,4 @@ TxDurationTestSuite::TxDurationTestSuite ()
|
||||
AddTestCase (new TxDurationTest, TestCase::QUICK);
|
||||
}
|
||||
|
||||
static TxDurationTestSuite g_txDurationTestSuite;
|
||||
static TxDurationTestSuite g_txDurationTestSuite; ///< the test suite
|
||||
|
||||
@@ -32,6 +32,12 @@
|
||||
|
||||
using namespace ns3;
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Ampdu Aggregation Test
|
||||
*/
|
||||
class AmpduAggregationTest : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -39,14 +45,14 @@ public:
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
Ptr<MacLow> m_low;
|
||||
Ptr<YansWifiPhy> m_phy;
|
||||
Ptr<EdcaTxopN> m_edca;
|
||||
MacTxMiddle *m_txMiddle;
|
||||
Ptr<WifiRemoteStationManager> m_manager;
|
||||
ObjectFactory m_factory;
|
||||
Ptr<MpduAggregator> m_mpduAggregator;
|
||||
DcfManager *m_dcfManager;
|
||||
Ptr<MacLow> m_low; ///< MacLow
|
||||
Ptr<YansWifiPhy> m_phy; ///< Phy
|
||||
Ptr<EdcaTxopN> m_edca; ///< EDCA
|
||||
MacTxMiddle *m_txMiddle; ///< MacTxMiddle
|
||||
Ptr<WifiRemoteStationManager> m_manager; ///< remote station manager
|
||||
ObjectFactory m_factory; ///< factory
|
||||
Ptr<MpduAggregator> m_mpduAggregator; ///< A-MPDU aggregrator
|
||||
DcfManager *m_dcfManager; ///< DCF manager
|
||||
};
|
||||
|
||||
AmpduAggregationTest::AmpduAggregationTest ()
|
||||
@@ -230,19 +236,24 @@ AmpduAggregationTest::DoRun (void)
|
||||
m_edca->GetQueue ()->Remove (pkt3);
|
||||
|
||||
Simulator::Destroy ();
|
||||
|
||||
|
||||
delete m_txMiddle;
|
||||
|
||||
|
||||
m_low->Dispose ();
|
||||
m_low = 0;
|
||||
|
||||
|
||||
m_edca->Dispose ();
|
||||
m_edca = 0;
|
||||
|
||||
delete m_dcfManager;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Two Level Aggregation Test
|
||||
*/
|
||||
class TwoLevelAggregationTest : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -250,13 +261,13 @@ public:
|
||||
|
||||
private:
|
||||
virtual void DoRun (void);
|
||||
Ptr<MacLow> m_low;
|
||||
Ptr<YansWifiPhy> m_phy;
|
||||
Ptr<EdcaTxopN> m_edca;
|
||||
Ptr<WifiRemoteStationManager> m_manager;
|
||||
ObjectFactory m_factory;
|
||||
Ptr<MsduAggregator> m_msduAggregator;
|
||||
Ptr<MpduAggregator> m_mpduAggregator;
|
||||
Ptr<MacLow> m_low; ///< MacLow
|
||||
Ptr<YansWifiPhy> m_phy; ///< Phy
|
||||
Ptr<EdcaTxopN> m_edca; ///< EDCA
|
||||
Ptr<WifiRemoteStationManager> m_manager; ///< remote station manager
|
||||
ObjectFactory m_factory; ///< factory
|
||||
Ptr<MsduAggregator> m_msduAggregator; ///< A-MSDU aggregator
|
||||
Ptr<MpduAggregator> m_mpduAggregator; ///< A-MPDU aggregator
|
||||
};
|
||||
|
||||
TwoLevelAggregationTest::TwoLevelAggregationTest ()
|
||||
@@ -380,18 +391,23 @@ TwoLevelAggregationTest::DoRun (void)
|
||||
|
||||
result = (packet != 0);
|
||||
NS_TEST_EXPECT_MSG_EQ (result, false, "aggregation failed to stop as queue is empty");
|
||||
|
||||
|
||||
Simulator::Destroy ();
|
||||
|
||||
|
||||
m_low->Dispose ();
|
||||
m_low = 0;
|
||||
|
||||
|
||||
m_edca->Dispose ();
|
||||
m_edca = 0;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Wifi Aggregation Test Suite
|
||||
*/
|
||||
class WifiAggregationTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -405,4 +421,4 @@ WifiAggregationTestSuite::WifiAggregationTestSuite ()
|
||||
AddTestCase (new TwoLevelAggregationTest, TestCase::QUICK);
|
||||
}
|
||||
|
||||
static WifiAggregationTestSuite g_wifiAggregationTestSuite;
|
||||
static WifiAggregationTestSuite g_wifiAggregationTestSuite; ///< the test suite
|
||||
|
||||
@@ -36,6 +36,12 @@ FromRss (double rssDbw)
|
||||
return pow (10.0, sinrDb / 10.0);
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Wifi Error Rate Models Test Case Dsss
|
||||
*/
|
||||
class WifiErrorRateModelsTestCaseDsss : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -140,6 +146,12 @@ WifiErrorRateModelsTestCaseDsss::DoRun (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Wifi Error Rate Models Test Case Nist
|
||||
*/
|
||||
class WifiErrorRateModelsTestCaseNist : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -277,6 +289,12 @@ WifiErrorRateModelsTestCaseNist::DoRun (void)
|
||||
NS_TEST_ASSERT_MSG_EQ_TOL (ps, 0.999, 0.001, "Not equal within tolerance");
|
||||
}
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Wifi Error Rate Models Test Suite
|
||||
*/
|
||||
class WifiErrorRateModelsTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -290,5 +308,5 @@ WifiErrorRateModelsTestSuite::WifiErrorRateModelsTestSuite ()
|
||||
AddTestCase (new WifiErrorRateModelsTestCaseNist, TestCase::QUICK);
|
||||
}
|
||||
|
||||
static WifiErrorRateModelsTestSuite wifiErrorRateModelsTestSuite;
|
||||
static WifiErrorRateModelsTestSuite wifiErrorRateModelsTestSuite; ///< the test suite
|
||||
|
||||
|
||||
@@ -72,7 +72,12 @@ AssignWifiRandomStreams (Ptr<WifiMac> mac, int64_t stream)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Wifi Test
|
||||
*/
|
||||
class WifiTest : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -82,13 +87,23 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
/// Run one function
|
||||
void RunOne (void);
|
||||
/**
|
||||
* Create one function
|
||||
* \param pos the position
|
||||
* \param channel the wifi channel
|
||||
*/
|
||||
void CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
|
||||
/**
|
||||
* Send one packet function
|
||||
* \param dev the device
|
||||
*/
|
||||
void SendOnePacket (Ptr<WifiNetDevice> dev);
|
||||
|
||||
ObjectFactory m_manager;
|
||||
ObjectFactory m_mac;
|
||||
ObjectFactory m_propDelay;
|
||||
ObjectFactory m_manager; ///< manager
|
||||
ObjectFactory m_mac; ///< MAC
|
||||
ObjectFactory m_propDelay; ///< propagation delay
|
||||
};
|
||||
|
||||
WifiTest::WifiTest ()
|
||||
@@ -182,7 +197,12 @@ WifiTest::DoRun (void)
|
||||
RunOne ();
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Qos Utils Is Old Packet Test
|
||||
*/
|
||||
class QosUtilsIsOldPacketTest : public TestCase
|
||||
{
|
||||
public:
|
||||
@@ -211,7 +231,6 @@ public:
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* See \bugid{991}
|
||||
*/
|
||||
@@ -224,13 +243,27 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Create one function
|
||||
* \param pos the position
|
||||
* \param channel the wifi channel
|
||||
* \returns the node
|
||||
*/
|
||||
Ptr<Node> CreateOne (Vector pos, Ptr<YansWifiChannel> channel);
|
||||
/**
|
||||
* Send one packet function
|
||||
* \param dev the device
|
||||
*/
|
||||
void SendOnePacket (Ptr<WifiNetDevice> dev);
|
||||
/**
|
||||
* Switch channel function
|
||||
* \param dev the device
|
||||
*/
|
||||
void SwitchCh (Ptr<WifiNetDevice> dev);
|
||||
|
||||
ObjectFactory m_manager;
|
||||
ObjectFactory m_mac;
|
||||
ObjectFactory m_propDelay;
|
||||
ObjectFactory m_manager; ///< manager
|
||||
ObjectFactory m_mac; ///< MAC
|
||||
ObjectFactory m_propDelay; ///< propagation delay
|
||||
};
|
||||
|
||||
InterferenceHelperSequenceTest::InterferenceHelperSequenceTest ()
|
||||
@@ -331,12 +364,12 @@ InterferenceHelperSequenceTest::DoRun (void)
|
||||
* 1) no backoff occurs if the frame arrives and the idle time >= DIFS or AIFSn
|
||||
* (this is 'DCF immediate access', Figure 9-3 of IEEE 802.11-2012)
|
||||
* 2) a backoff occurs for the second frame that arrives (this is clearly
|
||||
* stated in Sec. 9.3.4.2 of IEEE 802.11-2012, (basic access, which
|
||||
* stated in Sec. 9.3.4.2 of IEEE 802.11-2012, (basic access, which
|
||||
* applies to group-addressed frames) where it states
|
||||
* "If, under these conditions, the medium is determined by the CS
|
||||
* mechanism to be busy when a STA desires to initiate the initial frame
|
||||
* of a frame exchange sequence (described in Annex G), exclusive of the
|
||||
* CF period, the random backoff procedure described in 9.3.4.3
|
||||
* "If, under these conditions, the medium is determined by the CS
|
||||
* mechanism to be busy when a STA desires to initiate the initial frame
|
||||
* of a frame exchange sequence (described in Annex G), exclusive of the
|
||||
* CF period, the random backoff procedure described in 9.3.4.3
|
||||
* shall be followed."
|
||||
* and from 9.3.4.3
|
||||
* "The result of this procedure is that transmitted
|
||||
@@ -346,8 +379,8 @@ InterferenceHelperSequenceTest::DoRun (void)
|
||||
* and the frames are spaced by (backoff + DIFS) time intervals
|
||||
* (where backoff is a random number of slot sizes up to maximum CW)
|
||||
*
|
||||
* The following test case should _not_ generate virtual collision for
|
||||
* the second frame. The seed and run numbers were pick such that the
|
||||
* The following test case should _not_ generate virtual collision for
|
||||
* the second frame. The seed and run numbers were pick such that the
|
||||
* second frame gets backoff = 1 slot.
|
||||
*
|
||||
* frame 1, frame 2
|
||||
@@ -366,13 +399,13 @@ InterferenceHelperSequenceTest::DoRun (void)
|
||||
*
|
||||
* The buggy behavior observed in prior versions was shown by picking
|
||||
* RngSeedManager::SetRun (17);
|
||||
* which generated a 0 slot backoff for frame 2. Then, frame 2
|
||||
* experiences a virtual collision and re-selects the backoff again.
|
||||
* As a result, the _actual_ backoff experience by frame 2 is less likely
|
||||
* to be 0 since that would require two successions of 0 backoff (one that
|
||||
* which generated a 0 slot backoff for frame 2. Then, frame 2
|
||||
* experiences a virtual collision and re-selects the backoff again.
|
||||
* As a result, the _actual_ backoff experience by frame 2 is less likely
|
||||
* to be 0 since that would require two successions of 0 backoff (one that
|
||||
* generates the virtual collision and one after the virtual collision).
|
||||
*
|
||||
* See \bugid{555} for past behavior.
|
||||
* See \bugid{555} for past behavior.
|
||||
*/
|
||||
|
||||
class DcfImmediateAccessBroadcastTestCase : public TestCase
|
||||
@@ -384,16 +417,24 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Send one packet function
|
||||
* \param dev the device
|
||||
*/
|
||||
void SendOnePacket (Ptr<WifiNetDevice> dev);
|
||||
|
||||
ObjectFactory m_manager;
|
||||
ObjectFactory m_mac;
|
||||
ObjectFactory m_propDelay;
|
||||
ObjectFactory m_manager; ///< manager
|
||||
ObjectFactory m_mac; ///< MAC
|
||||
ObjectFactory m_propDelay; ///< propagation delay
|
||||
|
||||
Time m_firstTransmissionTime;
|
||||
Time m_secondTransmissionTime;
|
||||
unsigned int m_numSentPackets;
|
||||
Time m_firstTransmissionTime; ///< first transmission time
|
||||
Time m_secondTransmissionTime; ///< second transmission time
|
||||
unsigned int m_numSentPackets; ///< number of sent packets
|
||||
|
||||
/**
|
||||
* Notify Phy transmit begin
|
||||
* \param p the packet
|
||||
*/
|
||||
void NotifyPhyTxBegin (Ptr<const Packet> p);
|
||||
};
|
||||
|
||||
@@ -517,8 +558,14 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
uint32_t m_received;
|
||||
uint32_t m_received; ///< received
|
||||
|
||||
/**
|
||||
* Receive function
|
||||
* \param context the context
|
||||
* \param p the packet
|
||||
* \param adr the address
|
||||
*/
|
||||
void Receive (std::string context, Ptr<const Packet> p, const Address &adr);
|
||||
|
||||
};
|
||||
@@ -609,13 +656,13 @@ Bug730TestCase::DoRun (void)
|
||||
Ptr<PacketSocketClient> client = CreateObject<PacketSocketClient> ();
|
||||
client->SetAttribute ("PacketSize", UintegerValue (1460));
|
||||
client->SetRemote (socket);
|
||||
wifiStaNode.Get(0)->AddApplication (client);
|
||||
wifiStaNode.Get (0)->AddApplication (client);
|
||||
client->SetStartTime (Seconds (1));
|
||||
client->SetStopTime (Seconds (51.0));
|
||||
|
||||
Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
|
||||
server->SetLocal (socket);
|
||||
wifiApNode.Get(0)->AddApplication (server);
|
||||
wifiApNode.Get (0)->AddApplication (server);
|
||||
server->SetStartTime (Seconds (0.0));
|
||||
server->SetStopTime (Seconds (52.0));
|
||||
|
||||
@@ -632,7 +679,13 @@ Bug730TestCase::DoRun (void)
|
||||
NS_TEST_ASSERT_MSG_EQ (result, true, "packet reception unexpectedly stopped after adapting fragmentation threshold!");
|
||||
}
|
||||
|
||||
class SetChannelFrequencyTest: public TestCase
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Set Channel Frequency Test
|
||||
*/
|
||||
class SetChannelFrequencyTest : public TestCase
|
||||
{
|
||||
public:
|
||||
SetChannelFrequencyTest ();
|
||||
@@ -641,7 +694,11 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Get yans wifi phy function
|
||||
* \param nc the device collection
|
||||
* \returns the wifi phy
|
||||
*/
|
||||
Ptr<YansWifiPhy> GetYansWifiPhyPtr (const NetDeviceContainer &nc) const;
|
||||
|
||||
};
|
||||
@@ -683,289 +740,289 @@ SetChannelFrequencyTest::DoRun ()
|
||||
|
||||
// Cases taken from src/wifi/examples/wifi-phy-configuration.cc example
|
||||
{
|
||||
// case 0
|
||||
// Default configuration, without WifiHelper::SetStandard or WifiHelper
|
||||
phySta = CreateObject<YansWifiPhy> ();
|
||||
// The default results in an invalid configuration of channel 0,
|
||||
// width 20, and frequency 0 MHz
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 0, "default configuration");
|
||||
// case 0
|
||||
// Default configuration, without WifiHelper::SetStandard or WifiHelper
|
||||
phySta = CreateObject<YansWifiPhy> ();
|
||||
// The default results in an invalid configuration of channel 0,
|
||||
// width 20, and frequency 0 MHz
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 0, "default configuration");
|
||||
}
|
||||
{
|
||||
// case 1
|
||||
WifiHelper wifi;
|
||||
// By default, WifiHelper will use WIFI_PHY_STANDARD_80211a
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 36, width 20, frequency 5180
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "default configuration");
|
||||
// case 1
|
||||
WifiHelper wifi;
|
||||
// By default, WifiHelper will use WIFI_PHY_STANDARD_80211a
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 36, width 20, frequency 5180
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "default configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "default configuration");
|
||||
}
|
||||
{
|
||||
// case 2
|
||||
WifiHelper wifi;
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 1, width 22, frequency 2412
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 1, "802.11b configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 22, "802.11b configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2412, "802.11b configuration");
|
||||
// case 2
|
||||
WifiHelper wifi;
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211b);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 1, width 22, frequency 2412
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 1, "802.11b configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 22, "802.11b configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2412, "802.11b configuration");
|
||||
}
|
||||
{
|
||||
// case 3
|
||||
WifiHelper wifi;
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211g);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 1, width 20, frequency 2412
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 1, "802.11g configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11g configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2412, "802.11g configuration");
|
||||
// case 3
|
||||
WifiHelper wifi;
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211g);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 1, width 20, frequency 2412
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 1, "802.11g configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11g configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2412, "802.11g configuration");
|
||||
}
|
||||
{
|
||||
// case 4
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11n-5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11n-5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11n-5GHz configuration");
|
||||
// case 4
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11n-5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11n-5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11n-5GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 5
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 1, "802.11n-2.4GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11n-2.4GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2412, "802.11n-2.4GHz configuration");
|
||||
// case 5
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_2_4GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 1, "802.11n-2.4GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11n-2.4GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 2412, "802.11n-2.4GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 6
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 42, "802.11ac configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 80, "802.11ac configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5210, "802.11ac configuration");
|
||||
// case 6
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211ac);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 42, "802.11ac configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 80, "802.11ac configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5210, "802.11ac configuration");
|
||||
}
|
||||
{
|
||||
// case 7
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211_10MHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 172, "802.11 10Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 10, "802.11 10Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5860, "802.11 10Mhz configuration");
|
||||
// case 7
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211_10MHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 172, "802.11 10Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 10, "802.11 10Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5860, "802.11 10Mhz configuration");
|
||||
}
|
||||
{
|
||||
// case 8
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211_5MHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 5, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5860, "802.11 5Mhz configuration");
|
||||
// case 8
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211_5MHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 5, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5860, "802.11 5Mhz configuration");
|
||||
}
|
||||
{
|
||||
// case 9
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_holland);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 36, width 20, frequency 5180
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5Mhz configuration");
|
||||
// case 9
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_holland);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// We expect channel 36, width 20, frequency 5180
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5Mhz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5Mhz configuration");
|
||||
}
|
||||
{
|
||||
// case 10
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
phy.Set ("ChannelNumber", UintegerValue(44));
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 44, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5220, "802.11 5GHz configuration");
|
||||
// case 10
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
phy.Set ("ChannelNumber", UintegerValue (44));
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 44, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5220, "802.11 5GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 11
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
phy.Set ("ChannelNumber", UintegerValue(44));
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// Post-install reconfiguration to channel number 40
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue(40));
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
|
||||
// case 11
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
phy.Set ("ChannelNumber", UintegerValue (44));
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// Post-install reconfiguration to channel number 40
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelNumber", UintegerValue (40));
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 12
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
phy.Set ("ChannelNumber", UintegerValue (44));
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// Post-install reconfiguration to channel width 40 MHz
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth", UintegerValue(40));
|
||||
// Although channel 44 is configured originally for 20 MHz, we
|
||||
// allow it to be used for 40 MHz here
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 44, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5220, "802.11 5GHz configuration");
|
||||
// case 12
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
phy.Set ("ChannelNumber", UintegerValue (44));
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// Post-install reconfiguration to channel width 40 MHz
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth", UintegerValue (40));
|
||||
// Although channel 44 is configured originally for 20 MHz, we
|
||||
// allow it to be used for 40 MHz here
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 44, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5220, "802.11 5GHz configuration");
|
||||
}
|
||||
// modify cases 13 and 14 to avoid Config::SetDefault ()
|
||||
// modify cases 13 and 14 to avoid Config::SetDefault ()
|
||||
{
|
||||
// case 13
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (44));
|
||||
// Post-install reconfiguration to channel width 40 MHz
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth", UintegerValue(40));
|
||||
// Although channel 44 is configured originally for 20 MHz, we
|
||||
// allow it to be used for 40 MHz here
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 44, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5220, "802.11 5GHz configuration");
|
||||
// case 13
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (44));
|
||||
// Post-install reconfiguration to channel width 40 MHz
|
||||
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/$ns3::YansWifiPhy/ChannelWidth", UintegerValue (40));
|
||||
// Although channel 44 is configured originally for 20 MHz, we
|
||||
// allow it to be used for 40 MHz here
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 44, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5220, "802.11 5GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 14
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
// Test that setting Frequency to a non-standard value will zero the
|
||||
// channel number
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5281));
|
||||
// We expect channel number to be zero since frequency doesn't match
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5281, "802.11 5GHz configuration");
|
||||
// case 14
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
// Test that setting Frequency to a non-standard value will zero the
|
||||
// channel number
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5281));
|
||||
// We expect channel number to be zero since frequency doesn't match
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5281, "802.11 5GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 15:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// Test that setting Frequency to a standard value will set the
|
||||
// channel number correctly
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5500));
|
||||
// We expect channel number to be 100 due to frequency 5500
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 100, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5500, "802.11 5GHz configuration");
|
||||
// case 15:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// Test that setting Frequency to a standard value will set the
|
||||
// channel number correctly
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5500));
|
||||
// We expect channel number to be 100 due to frequency 5500
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 100, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5500, "802.11 5GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 16:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// This case will error exit due to invalid channel number unless
|
||||
// we provide the DefineChannelNumber() below
|
||||
phySta->DefineChannelNumber (99, WIFI_PHY_STANDARD_80211n_5GHZ, 5185, 40);
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (99));
|
||||
// case 16:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
// This case will error exit due to invalid channel number unless
|
||||
// we provide the DefineChannelNumber() below
|
||||
phySta->DefineChannelNumber (99, WIFI_PHY_STANDARD_80211n_5GHZ, 5185, 40);
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (99));
|
||||
}
|
||||
{
|
||||
// case 17:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
// Test how channel number behaves when frequency is non-standard
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5181));
|
||||
// We expect channel number to be 0 due to unknown center frequency 5181
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5181, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5180));
|
||||
// We expect channel number to be 36 due to known center frequency 5180
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5179));
|
||||
// We expect channel number to be 0 due to unknown center frequency 5179
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5179, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
// case 17:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
// Test how channel number behaves when frequency is non-standard
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5181));
|
||||
// We expect channel number to be 0 due to unknown center frequency 5181
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5181, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5180));
|
||||
// We expect channel number to be 36 due to known center frequency 5180
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5179));
|
||||
// We expect channel number to be 0 due to unknown center frequency 5179
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5179, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
}
|
||||
{
|
||||
// case 18:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
// Set both channel and frequency to consistent values
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get(0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5200));
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (40));
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
|
||||
// Set both channel and frequency to inconsistent values
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5200));
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
// We expect channel number to be 36
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5200));
|
||||
// We expect channel number to be 40
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5179));
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
// We expect channel number to be 36
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5179));
|
||||
// We expect channel number to be 0
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5179, "802.11 5GHz configuration");
|
||||
// case 18:
|
||||
WifiHelper wifi;
|
||||
wifi.SetRemoteStationManager ("ns3::IdealWifiManager");
|
||||
// Set both channel and frequency to consistent values
|
||||
wifi.SetStandard (WIFI_PHY_STANDARD_80211n_5GHZ);
|
||||
staDevice = wifi.Install (phy, macSta, wifiStaNode.Get (0));
|
||||
phySta = GetYansWifiPhyPtr (staDevice);
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5200));
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (40));
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
|
||||
// Set both channel and frequency to inconsistent values
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5200));
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
// We expect channel number to be 36
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5200));
|
||||
// We expect channel number to be 40
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 40, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5200, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5179));
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
// We expect channel number to be 36
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 36, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5180, "802.11 5GHz configuration");
|
||||
phySta->SetAttribute ("ChannelNumber", UintegerValue (36));
|
||||
phySta->SetAttribute ("Frequency", UintegerValue (5179));
|
||||
// We expect channel number to be 0
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelNumber (), 0, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetChannelWidth (), 20, "802.11 5GHz configuration");
|
||||
NS_TEST_ASSERT_MSG_EQ (phySta->GetFrequency (), 5179, "802.11 5GHz configuration");
|
||||
}
|
||||
|
||||
Simulator::Destroy ();
|
||||
Simulator::Destroy ();
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
/**
|
||||
* Make sure that when virtual collision occurs the wifi remote station manager
|
||||
* Make sure that when virtual collision occurs the wifi remote station manager
|
||||
* is triggered and the retry counter is increased.
|
||||
*
|
||||
* See \bugid{2222}
|
||||
@@ -981,9 +1038,15 @@ public:
|
||||
|
||||
|
||||
private:
|
||||
uint32_t m_countInternalCollisions;
|
||||
uint32_t m_countInternalCollisions; ///< count internal collisions
|
||||
|
||||
/// Populate ARP cache function
|
||||
void PopulateArpCache ();
|
||||
/**
|
||||
* Transmit data failed function
|
||||
* \param context the context
|
||||
* \param adr the MAC address
|
||||
*/
|
||||
void TxDataFailedTrace (std::string context, Mac48Address adr);
|
||||
};
|
||||
|
||||
@@ -1008,7 +1071,7 @@ void
|
||||
Bug2222TestCase::DoRun (void)
|
||||
{
|
||||
m_countInternalCollisions = 0;
|
||||
|
||||
|
||||
//Generate same backoff for AC_VI and AC_VO
|
||||
//The below combination will work
|
||||
RngSeedManager::SetSeed (1);
|
||||
@@ -1063,22 +1126,22 @@ Bug2222TestCase::DoRun (void)
|
||||
clientLowPriority->SetAttribute ("MaxPackets", UintegerValue (1));
|
||||
clientLowPriority->SetAttribute ("Priority", UintegerValue (4)); //AC_VI
|
||||
clientLowPriority->SetRemote (socket);
|
||||
wifiNodes.Get(0)->AddApplication (clientLowPriority);
|
||||
wifiNodes.Get (0)->AddApplication (clientLowPriority);
|
||||
clientLowPriority->SetStartTime (Seconds (1.0));
|
||||
clientLowPriority->SetStopTime (Seconds (2.0));
|
||||
|
||||
|
||||
Ptr<PacketSocketClient> clientHighPriority = CreateObject<PacketSocketClient> ();
|
||||
clientHighPriority->SetAttribute ("PacketSize", UintegerValue (1460));
|
||||
clientHighPriority->SetAttribute ("MaxPackets", UintegerValue (1));
|
||||
clientHighPriority->SetAttribute ("Priority", UintegerValue (6)); //AC_VO
|
||||
clientHighPriority->SetRemote (socket);
|
||||
wifiNodes.Get(0)->AddApplication (clientHighPriority);
|
||||
wifiNodes.Get (0)->AddApplication (clientHighPriority);
|
||||
clientHighPriority->SetStartTime (Seconds (1.0));
|
||||
clientHighPriority->SetStopTime (Seconds (2.0));
|
||||
|
||||
Ptr<PacketSocketServer> server = CreateObject<PacketSocketServer> ();
|
||||
server->SetLocal (socket);
|
||||
wifiNodes.Get(1)->AddApplication (server);
|
||||
wifiNodes.Get (1)->AddApplication (server);
|
||||
server->SetStartTime (Seconds (1.0));
|
||||
server->SetStopTime (Seconds (2.0));
|
||||
|
||||
@@ -1091,8 +1154,12 @@ Bug2222TestCase::DoRun (void)
|
||||
NS_TEST_ASSERT_MSG_EQ (m_countInternalCollisions, 1, "unexpected number of internal collisions!");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* \ingroup wifi-test
|
||||
* \ingroup tests
|
||||
*
|
||||
* \brief Wifi Test Suite
|
||||
*/
|
||||
class WifiTestSuite : public TestSuite
|
||||
{
|
||||
public:
|
||||
@@ -1111,4 +1178,4 @@ WifiTestSuite::WifiTestSuite ()
|
||||
AddTestCase (new Bug2222TestCase, TestCase::QUICK); //Bug 2222
|
||||
}
|
||||
|
||||
static WifiTestSuite g_wifiTestSuite;
|
||||
static WifiTestSuite g_wifiTestSuite; ///< the test suite
|
||||
|
||||
Reference in New Issue
Block a user