32 #include "ns3/mesh-helper.h"
33 #include "ns3/simulator.h"
34 #include "ns3/mobility-helper.h"
35 #include "ns3/nqos-wifi-mac-helper.h"
36 #include "ns3/dsdv-helper.h"
37 #include "ns3/double.h"
38 #include "ns3/uinteger.h"
39 #include "ns3/v4ping-helper.h"
40 #include "ns3/string.h"
41 #include "ns3/boolean.h"
42 #include "ns3/yans-wifi-helper.h"
43 #include "ns3/pcap-file.h"
44 #include "ns3/internet-stack-helper.h"
45 #include "ns3/ipv4-address-helper.h"
46 #include "ns3/dsdv-packet.h"
47 #include "ns3/dsdv-rtable.h"
58 DsdvHeaderTestCase::DsdvHeaderTestCase ()
59 :
TestCase (
"Verifying the DSDV header")
62 DsdvHeaderTestCase::~DsdvHeaderTestCase ()
81 NS_TEST_ASSERT_MSG_EQ (packet->
GetSize (), 24,
"XXX");
88 NS_TEST_ASSERT_MSG_EQ (hdr2.GetDst (),
Ipv4Address (
"10.1.1.3"),
"XXX");
89 NS_TEST_ASSERT_MSG_EQ (hdr2.GetDstSeqno (),4,
"XXX");
90 NS_TEST_ASSERT_MSG_EQ (hdr2.GetHopCount (),1,
"XXX");
93 NS_TEST_ASSERT_MSG_EQ (hdr1.GetSerializedSize (),12,
"XXX");
94 NS_TEST_ASSERT_MSG_EQ (hdr1.GetDst (),
Ipv4Address (
"10.1.1.2"),
"XXX");
95 NS_TEST_ASSERT_MSG_EQ (hdr1.GetDstSeqno (),2,
"XXX");
96 NS_TEST_ASSERT_MSG_EQ (hdr1.GetHopCount (),2,
"XXX");
109 DsdvTableTestCase::DsdvTableTestCase ()
110 :
TestCase (
"Dsdv Routing Table test case")
113 DsdvTableTestCase::~DsdvTableTestCase ()
129 NS_TEST_EXPECT_MSG_EQ (rtable.
AddRoute (rEntry1),
true,
"add route");
137 NS_TEST_EXPECT_MSG_EQ (rtable.
AddRoute (rEntry2),
true,
"add route");
145 NS_TEST_EXPECT_MSG_EQ (rtable.
AddRoute (rEntry3),
true,
"add route");
153 NS_TEST_EXPECT_MSG_EQ (rtable.
AddRoute (rEntry4),
true,
"add route");
159 NS_TEST_ASSERT_MSG_EQ (rEntry.GetDestination (),
Ipv4Address (
"10.1.1.4"),
"XXX");
160 NS_TEST_ASSERT_MSG_EQ (rEntry.GetSeqNo (),2,
"XXX");
161 NS_TEST_ASSERT_MSG_EQ (rEntry.GetHop (),2,
"XXX");
165 NS_TEST_ASSERT_MSG_EQ (rEntry.GetDestination (),
Ipv4Address (
"10.1.1.2"),
"XXX");
166 NS_TEST_ASSERT_MSG_EQ (rEntry.GetSeqNo (),4,
"XXX");
167 NS_TEST_ASSERT_MSG_EQ (rEntry.GetHop (),1,
"XXX");
171 NS_TEST_ASSERT_MSG_EQ (rEntry.GetDestination (),
Ipv4Address (
"10.1.1.3"),
"XXX");
172 NS_TEST_ASSERT_MSG_EQ (rEntry.GetSeqNo (),4,
"XXX");
173 NS_TEST_ASSERT_MSG_EQ (rEntry.GetHop (),1,
"XXX");
177 NS_TEST_ASSERT_MSG_EQ (rEntry.GetDestination (),
Ipv4Address (
"10.1.1.255"),
"XXX");
179 NS_TEST_ASSERT_MSG_EQ (rEntry.GetInterface ().GetLocal (),
Ipv4Address (
"10.1.1.1"),
"XXX");
180 NS_TEST_ASSERT_MSG_EQ (rEntry.GetInterface ().GetBroadcast (),
Ipv4Address (
"10.1.1.255"),
"XXX");
181 NS_TEST_ASSERT_MSG_EQ (rtable.
RoutingTableSize (),4,
"Rtable size incorrect");
uint32_t RemoveHeader(Header &header)
a class to represent an Ipv4 address mask
uint32_t GetSize(void) const
TestSuite(std::string name, Type type=UNIT)
Constuct a new test suite.
The Routing table used by DSDV protocol.
static void Destroy(void)
bool AddRoute(RoutingTableEntry &r)
uint32_t RoutingTableSize()
Provides the number of routes present in that nodes routing table.
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
Ipv4 addresses are stored in host order in this class.
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
a class to store IPv4 address information on an interface
bool LookupRoute(Ipv4Address dst, RoutingTableEntry &rt)
void AddHeader(const Header &header)
virtual void DoRun(void)
Implementation to actually run this test case.