|
|
| 20 |
|
20 |
|
| 21 |
#include "aodv-regression.h" |
21 |
#include "aodv-regression.h" |
| 22 |
#include "bug-772.h" |
22 |
#include "bug-772.h" |
| 23 |
#include "loopback.h" |
|
|
| 24 |
|
23 |
|
| 25 |
#include "ns3/simulator.h" |
24 |
#include "ns3/simulator.h" |
| 26 |
#include "ns3/mobility-helper.h" |
25 |
#include "ns3/mobility-helper.h" |
|
|
| 32 |
#include "ns3/internet-stack-helper.h" |
31 |
#include "ns3/internet-stack-helper.h" |
| 33 |
#include "ns3/ipv4-address-helper.h" |
32 |
#include "ns3/ipv4-address-helper.h" |
| 34 |
#include "ns3/abort.h" |
33 |
#include "ns3/abort.h" |
| 35 |
#include "ns3/udp-echo-helper.h" |
|
|
| 36 |
#include "ns3/mobility-model.h" |
34 |
#include "ns3/mobility-model.h" |
| 37 |
#include "ns3/pcap-file.h" |
35 |
#include "ns3/pcap-file.h" |
| 38 |
#include "ns3/aodv-helper.h" |
36 |
#include "ns3/aodv-helper.h" |
| 39 |
#include "ns3/v4ping-helper.h" |
|
|
| 40 |
#include "ns3/nqos-wifi-mac-helper.h" |
37 |
#include "ns3/nqos-wifi-mac-helper.h" |
| 41 |
#include "ns3/config.h" |
38 |
#include "ns3/config.h" |
| 42 |
#include "ns3/pcap-test.h" |
39 |
#include "ns3/pcap-test.h" |
| 43 |
#include "ns3/rng-seed-manager.h" |
40 |
#include "ns3/rng-seed-manager.h" |
|
|
41 |
#include "ns3/icmpv4.h" |
| 44 |
#include <sstream> |
42 |
#include <sstream> |
| 45 |
|
43 |
|
| 46 |
using namespace ns3; |
44 |
using namespace ns3; |
| 47 |
using namespace aodv; |
45 |
// using namespace aodv; |
| 48 |
//----------------------------------------------------------------------------- |
46 |
//----------------------------------------------------------------------------- |
| 49 |
// Test suite |
47 |
// Test suite |
| 50 |
//----------------------------------------------------------------------------- |
48 |
//----------------------------------------------------------------------------- |
|
|
| 56 |
SetDataDir (NS_TEST_SOURCEDIR); |
54 |
SetDataDir (NS_TEST_SOURCEDIR); |
| 57 |
// General RREQ-RREP-RRER test case |
55 |
// General RREQ-RREP-RRER test case |
| 58 |
AddTestCase (new ChainRegressionTest ("aodv-chain-regression-test"), TestCase::QUICK); |
56 |
AddTestCase (new ChainRegressionTest ("aodv-chain-regression-test"), TestCase::QUICK); |
| 59 |
/// \internal |
57 |
// \bugid{606} test case, should crash if bug is not fixed |
| 60 |
/// \bugid{606} test case, should crash if bug is not fixed |
|
|
| 61 |
AddTestCase (new ChainRegressionTest ("bug-606-test", Seconds (10), 3, Seconds (1)), TestCase::QUICK); |
58 |
AddTestCase (new ChainRegressionTest ("bug-606-test", Seconds (10), 3, Seconds (1)), TestCase::QUICK); |
| 62 |
/// \internal |
59 |
// \bugid{772} UDP test case |
| 63 |
/// \bugid{772} UDP test case |
|
|
| 64 |
AddTestCase (new Bug772ChainTest ("udp-chain-test", "ns3::UdpSocketFactory", Seconds (3), 10), TestCase::QUICK); |
60 |
AddTestCase (new Bug772ChainTest ("udp-chain-test", "ns3::UdpSocketFactory", Seconds (3), 10), TestCase::QUICK); |
| 65 |
/// \internal |
61 |
// \bugid{772} TCP test case |
| 66 |
/// \bugid{772} TCP test case |
|
|
| 67 |
AddTestCase (new Bug772ChainTest ("tcp-chain-test", "ns3::TcpSocketFactory", Seconds (3), 10), TestCase::QUICK); |
62 |
AddTestCase (new Bug772ChainTest ("tcp-chain-test", "ns3::TcpSocketFactory", Seconds (3), 10), TestCase::QUICK); |
| 68 |
// Ping loopback test case |
|
|
| 69 |
AddTestCase (new LoopbackTestCase (), TestCase::QUICK); |
| 70 |
} |
63 |
} |
| 71 |
} g_aodvRegressionTestSuite; |
64 |
} g_aodvRegressionTestSuite; |
| 72 |
|
65 |
|
|
|
| 81 |
m_time (t), |
74 |
m_time (t), |
| 82 |
m_size (size), |
75 |
m_size (size), |
| 83 |
m_step (120), |
76 |
m_step (120), |
| 84 |
m_arpAliveTimeout (arpAliveTimeout) |
77 |
m_arpAliveTimeout (arpAliveTimeout), |
|
|
78 |
m_seq (0) |
| 85 |
{ |
79 |
{ |
| 86 |
} |
80 |
} |
| 87 |
|
81 |
|
|
|
| 91 |
} |
85 |
} |
| 92 |
|
86 |
|
| 93 |
void |
87 |
void |
|
|
88 |
ChainRegressionTest::SendPing () |
| 89 |
{ |
| 90 |
if (Simulator::Now () >= m_time) |
| 91 |
{ |
| 92 |
return; |
| 93 |
} |
| 94 |
|
| 95 |
Ptr<Packet> p = Create<Packet> (); |
| 96 |
Icmpv4Echo echo; |
| 97 |
echo.SetSequenceNumber (m_seq); |
| 98 |
m_seq++; |
| 99 |
echo.SetIdentifier (0); |
| 100 |
|
| 101 |
Ptr<Packet> dataPacket = Create<Packet> (56); |
| 102 |
echo.SetData (dataPacket); |
| 103 |
p->AddHeader (echo); |
| 104 |
Icmpv4Header header; |
| 105 |
header.SetType (Icmpv4Header::ECHO); |
| 106 |
header.SetCode (0); |
| 107 |
if (Node::ChecksumEnabled ()) |
| 108 |
{ |
| 109 |
header.EnableChecksum (); |
| 110 |
} |
| 111 |
p->AddHeader (header); |
| 112 |
m_socket->Send (p, 0); |
| 113 |
Simulator::Schedule (Seconds (1), &ChainRegressionTest::SendPing, this); |
| 114 |
} |
| 115 |
|
| 116 |
void |
| 94 |
ChainRegressionTest::DoRun () |
117 |
ChainRegressionTest::DoRun () |
| 95 |
{ |
118 |
{ |
| 96 |
RngSeedManager::SetSeed (12345); |
119 |
RngSeedManager::SetSeed (12345); |
|
|
| 173 |
Ipv4InterfaceContainer interfaces = address.Assign (devices); |
196 |
Ipv4InterfaceContainer interfaces = address.Assign (devices); |
| 174 |
|
197 |
|
| 175 |
// 3. Setup ping |
198 |
// 3. Setup ping |
| 176 |
V4PingHelper ping (interfaces.GetAddress (m_size - 1)); |
199 |
m_socket = Socket::CreateSocket (m_nodes->Get (0), TypeId::LookupByName ("ns3::Ipv4RawSocketFactory")); |
| 177 |
ping.SetAttribute ("Verbose", BooleanValue (false)); // don't need verbose ping in regression test |
200 |
m_socket->SetAttribute ("Protocol", UintegerValue (1)); // icmp |
| 178 |
ApplicationContainer p = ping.Install (m_nodes->Get (0)); |
201 |
// m_socket->SetRecvCallback (MakeCallback (&V4Ping::Receive, this)); |
| 179 |
p.Start (Seconds (0)); |
202 |
InetSocketAddress src = InetSocketAddress (Ipv4Address::GetAny (), 0); |
| 180 |
p.Stop (m_time); |
203 |
m_socket->Bind (src); |
|
|
204 |
InetSocketAddress dst = InetSocketAddress (interfaces.GetAddress (m_size - 1), 0); |
| 205 |
m_socket->Connect (dst); |
| 206 |
|
| 207 |
SendPing (); |
| 181 |
|
208 |
|
| 182 |
// 4. write PCAP |
209 |
// 4. write PCAP |
| 183 |
wifiPhy.EnablePcapAll (CreateTempDirFilename (m_prefix)); |
210 |
wifiPhy.EnablePcapAll (CreateTempDirFilename (m_prefix)); |