Traffic Control Flow Control Test Case. More...
Public Member Functions | |
TcFlowControlTestCase (QueueSizeUnit tt, uint32_t deviceQueueLength, uint32_t totalTxPackets) | |
Constructor. | |
~TcFlowControlTestCase () override | |
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 | CheckDeviceQueueStopped (Ptr< NetDevice > dev, bool value, const std::string msg) |
Check if the device queue is in the expected status (stopped or not) | |
void | CheckPacketsInDeviceQueue (Ptr< NetDevice > dev, uint16_t nPackets, const std::string msg) |
Check if the device queue stores the expected number of packets. | |
void | CheckPacketsInQueueDisc (Ptr< NetDevice > dev, uint16_t nPackets, const std::string msg) |
Check if the queue disc stores the expected number of packets. | |
void | DoRun () override |
Implementation to actually run this TestCase. | |
void | SendPackets (Ptr< Node > n, uint16_t nPackets) |
Instruct a node to send a specified number of packets. | |
Private Attributes | |
uint32_t | m_deviceQueueLength |
the queue length of the device | |
uint32_t | m_totalTxPackets |
the toal number of packets to transmit | |
QueueSizeUnit | m_type |
the test type | |
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. | |
Traffic Control Flow Control Test Case.
Definition at line 81 of file tc-flow-control-test-suite.cc.
TcFlowControlTestCase::TcFlowControlTestCase | ( | QueueSizeUnit | tt, |
uint32_t | deviceQueueLength, | ||
uint32_t | totalTxPackets ) |
Constructor.
tt | the test type |
deviceQueueLength | the queue length of the device |
totalTxPackets | the total number of packets to transmit |
Definition at line 128 of file tc-flow-control-test-suite.cc.
|
override |
Definition at line 138 of file tc-flow-control-test-suite.cc.
|
private |
Check if the device queue is in the expected status (stopped or not)
dev | the device |
value | the expected status of the queue (true means stopped) |
msg | the message to print if the status of the device queue is different |
Definition at line 164 of file tc-flow-control-test-suite.cc.
References NS_ASSERT_MSG, and NS_TEST_EXPECT_MSG_EQ.
Referenced by DoRun().
|
private |
Check if the device queue stores the expected number of packets.
dev | the device |
nPackets | the expected number of packets stored in the device queue |
msg | the message to print if a different number of packets are stored |
Definition at line 153 of file tc-flow-control-test-suite.cc.
References ns3::PointerValue::Get(), and NS_TEST_EXPECT_MSG_EQ.
Referenced by DoRun().
|
private |
Check if the queue disc stores the expected number of packets.
dev | the device the queue disc is installed on |
nPackets | the expected number of packets stored in the queue disc |
msg | the message to print if a different number of packets are stored |
Definition at line 174 of file tc-flow-control-test-suite.cc.
References NS_TEST_EXPECT_MSG_EQ.
Referenced by DoRun().
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 184 of file tc-flow-control-test-suite.cc.
References ns3::Object::AggregateObject(), CheckDeviceQueueStopped(), CheckPacketsInDeviceQueue(), CheckPacketsInQueueDisc(), ns3::NodeContainer::Create(), ns3::CreateObject(), ns3::TrafficControlHelper::Default(), ns3::Simulator::Destroy(), ns3::DynamicCast(), ns3::NetDeviceContainer::Get(), ns3::NodeContainer::Get(), ns3::SimpleNetDeviceHelper::Install(), ns3::TrafficControlHelper::Install(), m_deviceQueueLength, m_totalTxPackets, m_type, ns3::MilliSeconds(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), SendPackets(), ns3::SimpleNetDeviceHelper::SetDeviceAttribute(), and ns3::SimpleNetDeviceHelper::SetQueue().
Instruct a node to send a specified number of packets.
n | the node |
nPackets | the number of packets to send |
Definition at line 143 of file tc-flow-control-test-suite.cc.
References ns3::Create().
Referenced by DoRun().
|
private |
the queue length of the device
Definition at line 124 of file tc-flow-control-test-suite.cc.
Referenced by DoRun().
|
private |
the toal number of packets to transmit
Definition at line 125 of file tc-flow-control-test-suite.cc.
Referenced by DoRun().
|
private |