Test for A-MSDU and A-MPDU aggregation. More...
Public Member Functions | |
PreservePacketsInAmpdus (bool notifyMacHdrRxEnd) | |
Constructor. | |
~PreservePacketsInAmpdus () override | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Member Functions | |
void | NotifyMacForwardUp (Ptr< const Packet > p) |
Callback invoked when the receiver MAC forwards a packet up to the upper layer. | |
void | NotifyMacHeaderEndRx (Ptr< WifiMac > mac, const WifiMacHeader &macHdr, const WifiTxVector &txVector, Time psduDuration) |
Callback invoked when the reception of the MAC header of an MPDU is completed. | |
void | NotifyMacTransmit (Ptr< const Packet > packet) |
Callback invoked when an MSDU is passed to the MAC. | |
void | NotifyPsduForwardedDown (WifiConstPsduMap psduMap, WifiTxVector txVector, double txPowerW) |
Callback invoked when the sender MAC passes a PSDU(s) to the PHY. | |
Private Attributes | |
std::vector< Ptr< WifiMpdu > >::const_iterator | m_expectedMpdu |
next MPDU expected to be received | |
std::size_t | m_nMacHdrs {0} |
Number of notified MAC headers in QoS data frames. | |
std::vector< std::size_t > | m_nMpdus |
Number of MPDUs in PSDUs passed to the PHY. | |
std::vector< std::size_t > | m_nMsdus |
Number of MSDUs in MPDUs passed to the PHY. | |
bool | m_notifyMacHdrRxEnd |
whether notification of MAC header reception end is enabled | |
std::list< Ptr< const Packet > > | m_packetList |
List of packets passed to the MAC. | |
Ptr< const WifiPsdu > | m_txPsdu |
PSDU being transmitted. | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum class | Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
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. | |
TestCase * | GetParent () const |
Get the parent of this TestCase. | |
bool | IsStatusFailure () const |
Check if any tests failed. | |
bool | IsStatusSuccess () const |
Check if all tests passed. | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. | |
void | ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line) |
Log the failure of this TestCase. | |
bool | MustAssertOnFailure () const |
Check if this run should assert on failure. | |
bool | MustContinueOnFailure () const |
Check if this run should continue on failure. | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. | |
Test for A-MSDU and A-MPDU aggregation.
This test aims to check that the packets passed to the MAC layer (on the sender side) are forwarded up to the upper layer (on the receiver side) when A-MSDU and A-MPDU aggregation are used. This test checks that no packet copies are performed, hence packets can be tracked by means of a pointer.
In this test, an HT STA sends 8 packets (each of 1000 bytes) to an HT AP. The block ack threshold is set to 2, hence the first packet is sent as an MPDU containing a single MSDU because the establishment of a Block Ack agreement is not triggered yet. The maximum A-MSDU size is set to 4500 bytes and the maximum A-MPDU size is set to 7500 bytes, hence the remaining packets are sent in an A-MPDU containing two MPDUs, the first one including 4 MSDUs and the second one including 3 MPDUs.
It is also checked that the MAC header of every MPDU is notified to the FrameExchangeManager while the PSDU is being transmitted.
Definition at line 947 of file wifi-aggregation-test.cc.
PreservePacketsInAmpdus::PreservePacketsInAmpdus | ( | bool | notifyMacHdrRxEnd | ) |
Constructor.
notifyMacHdrRxEnd | whether notification of MAC header reception end is enabled |
Definition at line 1000 of file wifi-aggregation-test.cc.
|
override |
Definition at line 1007 of file wifi-aggregation-test.cc.
|
overridevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 1103 of file wifi-aggregation-test.cc.
References ns3::Node::AddApplication(), ns3::NodeContainer::Create(), ns3::CreateObject(), ns3::YansWifiChannelHelper::Default(), ns3::Simulator::Destroy(), ns3::DynamicCast(), ns3::NodeContainer::Get(), ns3::PacketSocketHelper::Install(), m_nMacHdrs, m_nMpdus, m_nMsdus, m_notifyMacHdrRxEnd, m_packetList, ns3::MakeCallback(), ns3::MicroSeconds(), NotifyMacForwardUp(), NotifyMacHeaderEndRx(), NotifyMacTransmit(), NotifyPsduForwardedDown(), NS_TEST_EXPECT_MSG_EQ, ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::Config::SetDefault(), ns3::PacketSocketAddress::SetPhysicalAddress(), ns3::PacketSocketAddress::SetProtocol(), ns3::PacketSocketAddress::SetSingleDevice(), ns3::Simulator::Stop(), and ns3::WIFI_STANDARD_80211n.
Callback invoked when the receiver MAC forwards a packet up to the upper layer.
p | the packet |
Definition at line 1095 of file wifi-aggregation-test.cc.
References m_packetList, and NS_TEST_EXPECT_MSG_EQ.
Referenced by DoRun().
|
private |
Callback invoked when the reception of the MAC header of an MPDU is completed.
mac | the MAC to which the reception of the MAC header is notified |
macHdr | the MAC header of the MPDU being received |
txVector | the TXVECTOR used to transmit the PSDU |
psduDuration | the remaining duration of the PSDU |
Definition at line 1055 of file wifi-aggregation-test.cc.
References ns3::WifiPsdu::end(), ns3::WifiMacHeader::GetSequenceNumber(), m_expectedMpdu, m_nMacHdrs, m_txPsdu, ns3::NanoSeconds(), NS_TEST_ASSERT_MSG_EQ, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_NE, and ns3::Simulator::Schedule().
Referenced by DoRun().
Callback invoked when an MSDU is passed to the MAC.
packet | the MSDU to transmit |
Definition at line 1012 of file wifi-aggregation-test.cc.
References m_packetList.
Referenced by DoRun().
|
private |
Callback invoked when the sender MAC passes a PSDU(s) to the PHY.
psduMap | the PSDU map |
txVector | the TX vector |
txPowerW | the transmit power in Watts |
Definition at line 1018 of file wifi-aggregation-test.cc.
References ns3::WifiPsdu::begin(), m_expectedMpdu, m_nMpdus, m_nMsdus, m_notifyMacHdrRxEnd, m_txPsdu, NS_TEST_EXPECT_MSG_EQ, ns3::PeekPointer(), and ns3::SU_STA_ID.
Referenced by DoRun().
next MPDU expected to be received
Definition at line 966 of file wifi-aggregation-test.cc.
Referenced by NotifyMacHeaderEndRx(), and NotifyPsduForwardedDown().
|
private |
Number of notified MAC headers in QoS data frames.
Definition at line 967 of file wifi-aggregation-test.cc.
Referenced by DoRun(), and NotifyMacHeaderEndRx().
|
private |
Number of MPDUs in PSDUs passed to the PHY.
Definition at line 962 of file wifi-aggregation-test.cc.
Referenced by DoRun(), and NotifyPsduForwardedDown().
|
private |
Number of MSDUs in MPDUs passed to the PHY.
Definition at line 963 of file wifi-aggregation-test.cc.
Referenced by DoRun(), and NotifyPsduForwardedDown().
|
private |
whether notification of MAC header reception end is enabled
Definition at line 968 of file wifi-aggregation-test.cc.
Referenced by DoRun(), and NotifyPsduForwardedDown().
List of packets passed to the MAC.
Definition at line 961 of file wifi-aggregation-test.cc.
Referenced by DoRun(), NotifyMacForwardUp(), and NotifyMacTransmit().
PSDU being transmitted.
Definition at line 964 of file wifi-aggregation-test.cc.
Referenced by NotifyMacHeaderEndRx(), and NotifyPsduForwardedDown().