9#include "ns3/icmpv4-l4-protocol.h"
10#include "ns3/icmpv6-l4-protocol.h"
11#include "ns3/internet-stack-helper.h"
12#include "ns3/ipv4-address-helper.h"
13#include "ns3/ipv4-l3-protocol.h"
14#include "ns3/ipv6-address-helper.h"
15#include "ns3/ipv6-l3-protocol.h"
16#include "ns3/nix-vector-helper.h"
17#include "ns3/simple-net-device-helper.h"
18#include "ns3/simulator.h"
19#include "ns3/socket-factory.h"
20#include "ns3/socket.h"
22#include "ns3/udp-l4-protocol.h"
23#include "ns3/udp-socket-factory.h"
89 void DoRun()
override;
102 :
TestCase(
"three router, two path test")
113 "availableData should be equal to the size of packet received.");
281 int32_t ifIndex = ipv4->GetInterfaceForDevice(
dAdC.Get(0));
286 ifIndex = ipv6->GetInterfaceForDevice(
dAdC.Get(0));
305 ipv4 =
nBnC.Get(1)->GetObject<
Ipv4>();
306 ifIndex = ipv4->GetInterfaceForDevice(
dBdC.Get(1));
310 ipv6 =
nBnC.Get(1)->GetObject<
Ipv6>();
311 ifIndex = ipv6->GetInterfaceForDevice(
dBdC.Get(1));
327 "IPv4 and IPv6 Nix-Vector Routing should have received only 1 packet.");
331 "Time: +3s, Nix Routing\n"
332 "Route path from Node 0 to Node 4, Nix Vector: 01001 (5 bits left)\n"
333 "10.1.0.1 (Node 0) ----> 10.1.0.2 (Node 1)\n"
334 "10.1.4.1 (Node 1) ----> 10.1.4.2 (Node 3)\n"
335 "10.1.3.1 (Node 3) ----> 10.1.3.2 (Node 4)\n\n";
339 "Time: +3s, Nix Routing\n"
340 "Route path from Node 0 to Node 4, Nix Vector: 01001 (5 bits left)\n"
341 "2001::200:ff:fe00:1 (Node 0) ----> fe80::200:ff:fe00:2 (Node 1)\n"
342 "fe80::200:ff:fe00:9 (Node 1) ----> fe80::200:ff:fe00:a (Node 3)\n"
343 "fe80::200:ff:fe00:7 (Node 3) ----> 2001:3::200:ff:fe00:8 (Node 4)\n\n";
347 "Time: +9s, Nix Routing\n"
348 "Route path from Node 0 to Node 4, Nix Vector: 0111 (4 bits left)\n"
349 "10.1.0.1 (Node 0) ----> 10.1.0.2 (Node 1)\n"
350 "10.1.1.1 (Node 1) ----> 10.1.1.2 (Node 2)\n"
351 "10.1.2.1 (Node 2) ----> 10.1.2.2 (Node 3)\n"
352 "10.1.3.1 (Node 3) ----> 10.1.3.2 (Node 4)\n\n";
356 "Time: +9s, Nix Routing\n"
357 "Route path from Node 0 to Node 4, Nix Vector: 0111 (4 bits left)\n"
358 "2001::200:ff:fe00:1 (Node 0) ----> fe80::200:ff:fe00:2 (Node 1)\n"
359 "fe80::200:ff:fe00:3 (Node 1) ----> fe80::200:ff:fe00:4 (Node 2)\n"
360 "fe80::200:ff:fe00:5 (Node 2) ----> fe80::200:ff:fe00:6 (Node 3)\n"
361 "fe80::200:ff:fe00:7 (Node 3) ----> 2001:3::200:ff:fe00:8 (Node 4)\n\n";
364 const std::string
emptyCaches =
"Node: 0, Time: +7s, Local time: +7s, Nix Routing\n"
367 "Node: 1, Time: +7s, Local time: +7s, Nix Routing\n"
370 "Node: 2, Time: +7s, Local time: +7s, Nix Routing\n"
373 "Node: 3, Time: +7s, Local time: +7s, Nix Routing\n"
376 "Node: 4, Time: +7s, Local time: +7s, Nix Routing\n"
The topology is of the form:
void DoSendDatav4(Ptr< Socket > socket, Ipv4Address to)
Send data immediately after being called.
void DoRun() override
Implementation to actually run this TestCase.
std::vector< uint32_t > m_receivedPacketSizes
Received packet sizes.
Ptr< Packet > m_receivedPacket
Received packet.
void ReceivePkt(Ptr< Socket > socket)
Receive data.
void DoSendDatav6(Ptr< Socket > socket, Ipv6Address to)
Send data immediately after being called.
void SendData(Time delay, Ptr< Socket > socket, Ipv4Address to)
Schedules the DoSendData () function to send the data.
IPv4 Nix-Vector Routing TestSuite.
NixVectorRoutingTestSuite()
a polymophic address class
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
Ipv4 addresses are stored in host order in this class.
Access to the IPv4 forwarding table, interfaces, and configuration.
virtual void SetDown(uint32_t interface)=0
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Helper class to auto-assign global IPv6 unicast addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Describes an IPv6 address.
Access to the IPv6 forwarding table, interfaces, and configuration.
virtual void SetDown(uint32_t interface)=0
Set the interface into the "down" state.
Keep track of a set of IPv6 interfaces.
Describes an IPv6 prefix.
holds a vector of ns3::NetDevice pointers
Helper class that adds Nix-vector routing to nodes.
keep track of a set of node pointers.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Smart pointer class similar to boost::intrusive_ptr.
build a set of SimpleNetDevice objects
void SetNetDevicePointToPointMode(bool pointToPointMode)
SimpleNetDevice is Broadcast capable and ARP needing.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
static constexpr auto UNIT
Simulation virtual time values and global simulation resolution.
API to create UDP socket instances.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static NixVectorRoutingTestSuite g_nixVectorRoutingTestSuite
Static variable for test initialization.