24 #include "ns3/olsr-routing-protocol.h"
25 #include "ns3/ipv4-header.h"
30 #define OLSR_WILL_NEVER 0
31 #define OLSR_WILL_LOW 1
33 #define OLSR_WILL_DEFAULT 3
35 #define OLSR_WILL_HIGH 6
37 #define OLSR_WILL_ALWAYS 7
49 virtual void DoRun (
void);
55 :
TestCase (
"Check OLSR MPR computing mechanism")
79 protocol->m_state.InsertNeighborTuple (neigbor);
81 protocol->m_state.InsertNeighborTuple (neigbor);
86 protocol->m_state.InsertTwoHopNeighborTuple (tuple);
89 protocol->m_state.InsertTwoHopNeighborTuple (tuple);
91 protocol->MprComputation ();
102 protocol->m_state.InsertTwoHopNeighborTuple (tuple);
104 protocol->MprComputation ();
107 NS_TEST_EXPECT_MSG_EQ ((mpr.find (
"10.0.0.2") != mpr.end ()),
true,
"Node 1 must select node 2 as MPR");
119 protocol->m_state.InsertTwoHopNeighborTuple (tuple);
121 protocol->MprComputation ();
124 NS_TEST_EXPECT_MSG_EQ ((mpr.find (
"10.0.0.2") != mpr.end ()),
true,
"Node 1 must select node 2 as MPR");
125 NS_TEST_EXPECT_MSG_EQ ((mpr.find (
"10.0.0.3") != mpr.end ()),
true,
"Node 1 must select node 3 as MPR");
139 protocol->m_state.InsertNeighborTuple (neigbor);
141 protocol->MprComputation ();
144 NS_TEST_EXPECT_MSG_EQ ((mpr.find (
"10.0.0.7") != mpr.end ()),
true,
"Node 1 must select node 7 as MPR");
159 protocol->m_state.InsertNeighborTuple (neigbor);
162 protocol->m_state.InsertTwoHopNeighborTuple (tuple);
164 protocol->MprComputation ();
167 NS_TEST_EXPECT_MSG_EQ ((mpr.find (
"10.0.0.9") == mpr.end ()),
true,
"Node 1 must NOT select node 8 as MPR");
#define OLSR_WILL_ALWAYS
Willingness for forwarding packets from other nodes: always.
This class encapsulates all data structures needed for maintaining internal state of an OLSR node...
smart pointer class similar to boost::intrusive_ptr
Testcase for MPR computation mechanism.
enum ns3::olsr::NeighborTuple::Status status
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
virtual void DoRun(void)
Run test case.
uint8_t willingness
A value between 0 and 7 specifying the node's willingness to carry traffic on behalf of other nodes...
Time expirationTime
Time at which this tuple expires and must be removed.
Ipv4Address neighborMainAddr
Main address of a neighbor node.
Ipv4Address twoHopNeighborAddr
Main address of a 2-hop neighbor with a symmetric link to nb_main_addr.
ns3::olsr::OlsrProtocolTestSuite g_olsrProtocolTestSuite
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual child TestCase case to this TestCase.
#define OLSR_WILL_NEVER
Willingness for forwarding packets from other nodes: never.
Ipv4 addresses are stored in host order in this class.
std::set< Ipv4Address > MprSet
MPR Set type.
MprSet GetMprSet() const
Gets an MPR Set needed by tests.
Ipv4Address neighborMainAddr
Main address of a neighbor.
#define OLSR_WILL_DEFAULT
Willingness for forwarding packets from other nodes: medium.