A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::olsr::HelloRegressionTest Class Reference

Trivial (still useful) test of OLSR operation. More...

#include "hello-regression-test.h"

+ Inheritance diagram for ns3::olsr::HelloRegressionTest:
+ Collaboration diagram for ns3::olsr::HelloRegressionTest:

Public Member Functions

 HelloRegressionTest ()
 
 ~HelloRegressionTest () override
 
- 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 CreateNodes ()
 Create & configure test network.
 
void DoRun () override
 Implementation to actually run this TestCase.
 
void ReceivePktProbeA (Ptr< Socket > socket)
 Receive raw data on node A.
 
void ReceivePktProbeB (Ptr< Socket > socket)
 Receive raw data on node B.
 

Private Attributes

uint8_t m_countA
 Packet counter on node A.
 
uint8_t m_countB
 Packet counter on node B.
 
Ptr< Ipv4RawSocketImplm_rxSocketA
 Receiving socket on node A.
 
Ptr< Ipv4RawSocketImplm_rxSocketB
 Receiving socket on node B.
 
const Time m_time
 Total simulation time.
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum  TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, TestDuration duration=QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

Trivial (still useful) test of OLSR operation.

This test creates 2 stations with point-to-point link and runs OLSR without any extra traffic. It is expected that only HELLO messages will be sent.

Expected trace (5 seconds):

 1       2
 |------>|   HELLO (empty) src = 10.1.1.1
 |<------|   HELLO (empty) src = 10.1.1.2
 |------>|   HELLO (Link type: Asymmetric link, Neighbor address: 10.1.1.2) src = 10.1.1.1
 |<------|   HELLO (Link type: Asymmetric link, Neighbor address: 10.1.1.1) src = 10.1.1.2
 |------>|   HELLO (Link type: Symmetric link, Neighbor address: 10.1.1.2) src = 10.1.1.1
 |<------|   HELLO (Link type: Symmetric link, Neighbor address: 10.1.1.1) src = 10.1.1.2

Definition at line 53 of file hello-regression-test.h.

Constructor & Destructor Documentation

◆ HelloRegressionTest()

ns3::olsr::HelloRegressionTest::HelloRegressionTest ( )

Definition at line 46 of file hello-regression-test.cc.

◆ ~HelloRegressionTest()

ns3::olsr::HelloRegressionTest::~HelloRegressionTest ( )
override

Definition at line 54 of file hello-regression-test.cc.

Member Function Documentation

◆ CreateNodes()

◆ DoRun()

void ns3::olsr::HelloRegressionTest::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 59 of file hello-regression-test.cc.

References CreateNodes(), ns3::Simulator::Destroy(), m_rxSocketA, m_rxSocketB, m_time, ns3::Simulator::Run(), ns3::RngSeedManager::SetRun(), ns3::RngSeedManager::SetSeed(), and ns3::Simulator::Stop().

+ Here is the call graph for this function:

◆ ReceivePktProbeA()

void ns3::olsr::HelloRegressionTest::ReceivePktProbeA ( Ptr< Socket socket)
private

Receive raw data on node A.

Parameters
socketreceiving socket

Definition at line 110 of file hello-regression-test.cc.

References ns3::olsr::MessageHeader::GetHello(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::Hello::linkMessages, m_countA, NS_ASSERT, and NS_TEST_EXPECT_MSG_EQ.

Referenced by CreateNodes().

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

◆ ReceivePktProbeB()

void ns3::olsr::HelloRegressionTest::ReceivePktProbeB ( Ptr< Socket socket)
private

Receive raw data on node B.

Parameters
socketreceiving socket

Definition at line 164 of file hello-regression-test.cc.

References ns3::olsr::MessageHeader::GetHello(), ns3::olsr::MessageHeader::GetOriginatorAddress(), ns3::olsr::MessageHeader::Hello::linkMessages, m_countA, m_countB, NS_ASSERT, and NS_TEST_EXPECT_MSG_EQ.

Referenced by CreateNodes().

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

Member Data Documentation

◆ m_countA

uint8_t ns3::olsr::HelloRegressionTest::m_countA
private

Packet counter on node A.

Definition at line 72 of file hello-regression-test.h.

Referenced by ReceivePktProbeA(), and ReceivePktProbeB().

◆ m_countB

uint8_t ns3::olsr::HelloRegressionTest::m_countB
private

Packet counter on node B.

Definition at line 81 of file hello-regression-test.h.

Referenced by ReceivePktProbeB().

◆ m_rxSocketA

Ptr<Ipv4RawSocketImpl> ns3::olsr::HelloRegressionTest::m_rxSocketA
private

Receiving socket on node A.

Definition at line 74 of file hello-regression-test.h.

Referenced by CreateNodes(), and DoRun().

◆ m_rxSocketB

Ptr<Ipv4RawSocketImpl> ns3::olsr::HelloRegressionTest::m_rxSocketB
private

Receiving socket on node B.

Definition at line 83 of file hello-regression-test.h.

Referenced by CreateNodes(), and DoRun().

◆ m_time

const Time ns3::olsr::HelloRegressionTest::m_time
private

Total simulation time.

Definition at line 61 of file hello-regression-test.h.

Referenced by DoRun().


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