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

Send one packet from one WifiNetDevice to other. More...

+ Inheritance diagram for SendOnePacketTestCase:
+ Collaboration diagram for SendOnePacketTestCase:

Public Member Functions

 SendOnePacketTestCase ()
 Constructor.
 
- Public Member Functions inherited from WifiCoTraceHelperBaseTestCase
 WifiCoTraceHelperBaseTestCase (const std::string &testName)
 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 DoRun () override
 Executes test case and assertions.
 
void DoSetup () override
 Setup test case's scenario.
 

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 WifiCoTraceHelperBaseTestCase
void ConfigureTidToLinkMapping (const std::string &mapping)
 A helper function that sets tid-to-link mapping.
 
void DisableAggregation ()
 A helper function that disables frame aggregation.
 
const std::map< WifiPhyState, Time > & GetChannelOccupancy (size_t nodeId, size_t linkId, WifiCoTraceHelper &coHelper)
 It gets the channel occupancy of a link on a node measured by WifiCoTraceHelper.
 
Ptr< PacketSocketClientInstallPacketSocketClient (Ptr< Node > client, Ptr< Node > server, size_t prot, Time startAfter, size_t numPkts, size_t pktLen, size_t tid)
 A helper function that installs PacketSocketClient application on a node.
 
void InstallPacketSocketServer (Ptr< Node > node, Time startAfter, size_t prot)
 A helper function that installs PacketSocketServer on a node.
 
void SchedulePackets (Ptr< Node > from, Ptr< Node > to, Time startAfter, size_t numPkts, size_t pktLen, size_t tid)
 A helper function that schedules to send given number of packets from one node to another.
 
- 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.
 
- Protected Attributes inherited from WifiCoTraceHelperBaseTestCase
NetDeviceContainer m_devices
 Container of all devices instantiated in this test case.
 
NodeContainer m_nodes
 Container of all nodes instantiated in this test case.
 
Time m_simulationStop {Seconds(5.0)}
 Instant at which simulation should stop.
 
size_t protocol
 A unique Protocol used in each PacketSocketClient and PacketSocketServer pair.
 

Detailed Description

Send one packet from one WifiNetDevice to other.

This test case sends a single packet from one wifi device to another, operating in Adhoc mode, and compares the TX duration measured by WifiCoTraceHelper with the analytically calculated value.

Definition at line 274 of file wifi-co-trace-helper-test.cc.

Constructor & Destructor Documentation

◆ SendOnePacketTestCase()

SendOnePacketTestCase::SendOnePacketTestCase ( )

Constructor.

Definition at line 287 of file wifi-co-trace-helper-test.cc.

Member Function Documentation

◆ DoRun()

void SendOnePacketTestCase::DoRun ( )
overrideprivatevirtual

Executes test case and assertions.

Size of frame in Bytes = 204 (payload) + 34 (Mac & Phy Headers) = 238 Frame Size in bits + Phy service and tail bits = 238*8 + 22 = 1926 Phy rate at MCS 11, 40 MHz, 800 ns GI, 1 spatial stream = 286.6 Mbps Symbol duration = 12.8 + 0.8 = 13.6 us Number of symbols = ceil(1926 / (286.6 * 13.6)) = 1

If we replace payload size from 204 to 504 in the above calculation in comments, then number of symbols equals 2. Number of symbols = ceil(4326 / (286.6 * 13.6)) = 2

If we replace payload size from 204 to 1004 in the above calculation in comments, then number of symbols equals 3. Number of symbols = ceil(8326 / (286.6 * 13.6)) = 2

Data Packet

Preamble Duration = 48 us Symbol Duration = 12.8 + 0.8 (Guard Interval) = 13.6 us Tx Duration of a packet requiring 1 symbol = (1 * 13.6) + 48 = 61.6 us Tx Duration of a packet requiring 2 symbols = (2 * 13.6) + 48 = 75.2 us Tx Duration of a packet requiring 3 symbols = (3 * 13.6) + 48 = 88.8 us

Acknowledgement Packet

Preamble Duration = 20 us Symbol Duration = 4 us Number of symbols = 2 Tx Duration of Ack packet = 2*4 + 20 = 28 us

Implements ns3::TestCase.

Definition at line 294 of file wifi-co-trace-helper-test.cc.

References ns3::Simulator::Destroy(), ns3::NodeContainer::Get(), WifiCoTraceHelperBaseTestCase::GetChannelOccupancy(), WifiCoTraceHelperBaseTestCase::m_nodes, ns3::NanoSeconds(), NS_TEST_ASSERT_MSG_EQ, ns3::Simulator::Run(), WifiCoTraceHelperBaseTestCase::SchedulePackets(), ns3::Seconds(), and ns3::Simulator::Stop().

+ Here is the call graph for this function:

◆ DoSetup()

void SendOnePacketTestCase::DoSetup ( )
overrideprivatevirtual

Setup test case's scenario.

Reimplemented from ns3::TestCase.

Definition at line 389 of file wifi-co-trace-helper-test.cc.

References ns3::NodeContainer::Create(), ns3::CreateObject(), WifiCoTraceHelperBaseTestCase::DisableAggregation(), ns3::WifiPhyHelper::DLT_IEEE802_11_RADIO, ns3::PacketSocketHelper::Install(), WifiCoTraceHelperBaseTestCase::m_devices, WifiCoTraceHelperBaseTestCase::m_nodes, ns3::NanoSeconds(), ns3::Config::Set(), ns3::WIFI_SPECTRUM_5_GHZ, and ns3::WIFI_STANDARD_80211be.

+ Here is the call graph for this function:

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