A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ipv6-ripng-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Universita' di Firenze
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
7 */
8
9#include "ns3/boolean.h"
10#include "ns3/enum.h"
11#include "ns3/icmpv6-l4-protocol.h"
12#include "ns3/inet6-socket-address.h"
13#include "ns3/internet-stack-helper.h"
14#include "ns3/ipv6-address-helper.h"
15#include "ns3/ipv6-l3-protocol.h"
16#include "ns3/log.h"
17#include "ns3/node-container.h"
18#include "ns3/node.h"
19#include "ns3/ripng-helper.h"
20#include "ns3/ripng.h"
21#include "ns3/simple-channel.h"
22#include "ns3/simple-net-device.h"
23#include "ns3/simulator.h"
24#include "ns3/socket-factory.h"
25#include "ns3/socket.h"
26#include "ns3/test.h"
27#include "ns3/udp-l4-protocol.h"
28#include "ns3/udp-socket-factory.h"
29
30#include <limits>
31#include <string>
32
33using namespace ns3;
34
35/**
36 * \ingroup internet-test
37 *
38 * \brief IPv6 RIPng Test
39 */
40class Ipv6RipngTest : public TestCase
41{
42 Ptr<Packet> m_receivedPacket; //!< Received packet
43
44 /**
45 * \brief Send data.
46 * \param socket The sending socket.
47 * \param to Destination address.
48 */
49 void DoSendData(Ptr<Socket> socket, std::string to);
50 /**
51 * \brief Send data.
52 * \param socket The sending socket.
53 * \param to Destination address.
54 */
55 void SendData(Ptr<Socket> socket, std::string to);
56
57 public:
58 void DoRun() override;
60
61 /**
62 * \brief Receive data.
63 * \param socket The receiving socket.
64 */
65 void ReceivePkt(Ptr<Socket> socket);
66};
67
69 : TestCase("RIPng")
70{
71}
72
73void
75{
76 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
77 m_receivedPacket = socket->Recv(std::numeric_limits<uint32_t>::max(), 0);
78 NS_TEST_ASSERT_MSG_EQ(availableData,
80 "Received packet size is not equal to Rx buffer size");
81}
82
83void
85{
86 Address realTo = Inet6SocketAddress(Ipv6Address(to.c_str()), 1234);
87 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(Create<Packet>(123), 0, realTo), 123, "100");
88}
89
90void
91Ipv6RipngTest::SendData(Ptr<Socket> socket, std::string to)
92{
94 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
95 Seconds(60),
97 this,
98 socket,
99 to);
102}
103
104void
106{
107 // Create topology
108
109 Ptr<Node> txNode = CreateObject<Node>();
110 Ptr<Node> rxNode = CreateObject<Node>();
111 Ptr<Node> routerA = CreateObject<Node>();
112 Ptr<Node> routerB = CreateObject<Node>();
113 Ptr<Node> routerC = CreateObject<Node>();
114
115 NodeContainer nodes(txNode, rxNode);
116 NodeContainer routers(routerA, routerB, routerC);
117 NodeContainer all(nodes, routers);
118
119 RipNgHelper ripNgRouting;
120 InternetStackHelper internetv6routers;
121 internetv6routers.SetRoutingHelper(ripNgRouting);
122 internetv6routers.Install(routers);
123
124 InternetStackHelper internetv6nodes;
125 internetv6nodes.Install(nodes);
126
131
132 // Sender Node
134 {
136 txDev->SetAddress(Mac48Address("00:00:00:00:00:01"));
137 txNode->AddDevice(txDev);
138 }
139 net1.Add(txDev);
140
141 // Router A
142 Ptr<SimpleNetDevice> fwDev1routerA;
143 Ptr<SimpleNetDevice> fwDev2routerA;
144 { // first interface
145 fwDev1routerA = CreateObject<SimpleNetDevice>();
146 fwDev1routerA->SetAddress(Mac48Address("00:00:00:00:00:02"));
147 routerA->AddDevice(fwDev1routerA);
148 }
149 net1.Add(fwDev1routerA);
150
151 { // second interface
152 fwDev2routerA = CreateObject<SimpleNetDevice>();
153 fwDev2routerA->SetAddress(Mac48Address("00:00:00:00:00:03"));
154 routerA->AddDevice(fwDev2routerA);
155 }
156 net2.Add(fwDev2routerA);
157
158 // Router B
159 Ptr<SimpleNetDevice> fwDev1routerB;
160 Ptr<SimpleNetDevice> fwDev2routerB;
161 { // first interface
162 fwDev1routerB = CreateObject<SimpleNetDevice>();
163 fwDev1routerB->SetAddress(Mac48Address("00:00:00:00:00:04"));
164 routerB->AddDevice(fwDev1routerB);
165 }
166 net2.Add(fwDev1routerB);
167
168 { // second interface
169 fwDev2routerB = CreateObject<SimpleNetDevice>();
170 fwDev2routerB->SetAddress(Mac48Address("00:00:00:00:00:05"));
171 routerB->AddDevice(fwDev2routerB);
172 }
173 net3.Add(fwDev2routerB);
174
175 // Router C
176 Ptr<SimpleNetDevice> fwDev1routerC;
177 Ptr<SimpleNetDevice> fwDev2routerC;
178 { // first interface
179 fwDev1routerC = CreateObject<SimpleNetDevice>();
180 fwDev1routerC->SetAddress(Mac48Address("00:00:00:00:00:06"));
181 routerC->AddDevice(fwDev1routerC);
182 }
183 net3.Add(fwDev1routerC);
184
185 { // second interface
186 fwDev2routerC = CreateObject<SimpleNetDevice>();
187 fwDev2routerC->SetAddress(Mac48Address("00:00:00:00:00:07"));
188 routerC->AddDevice(fwDev2routerC);
189 }
190 net4.Add(fwDev2routerC);
191
192 // Rx node
194 { // first interface
196 rxDev->SetAddress(Mac48Address("00:00:00:00:00:08"));
197 rxNode->AddDevice(rxDev);
198 }
199 net4.Add(rxDev);
200
201 // link the channels
203 txDev->SetChannel(channel1);
204 fwDev1routerA->SetChannel(channel1);
205
207 fwDev2routerA->SetChannel(channel2);
208 fwDev1routerB->SetChannel(channel2);
209
211 fwDev2routerB->SetChannel(channel3);
212 fwDev1routerC->SetChannel(channel3);
213
215 fwDev2routerC->SetChannel(channel4);
216 rxDev->SetChannel(channel4);
217
218 // Setup IPv6 addresses and forwarding
220
221 ipv6.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
223 iic1.SetForwarding(1, true);
225
227 iic2.SetForwarding(0, true);
228 iic2.SetForwarding(1, true);
229
231 iic3.SetForwarding(0, true);
232 iic3.SetForwarding(1, true);
233
234 ipv6.SetBase(Ipv6Address("2001:2::"), Ipv6Prefix(64));
236 iic4.SetForwarding(0, true);
238
239 // Create the UDP sockets
240 Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<UdpSocketFactory>();
241 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
243 rxSocket->Bind(Inet6SocketAddress(Ipv6Address("2001:2::200:ff:fe00:8"), 1234)),
244 0,
245 "trivial");
246 rxSocket->SetRecvCallback(MakeCallback(&Ipv6RipngTest::ReceivePkt, this));
247
248 Ptr<SocketFactory> txSocketFactory = txNode->GetObject<UdpSocketFactory>();
249 Ptr<Socket> txSocket = txSocketFactory->CreateSocket();
250 txSocket->SetAllowBroadcast(true);
251
252 // ------ Now the tests ------------
253
254 // Unicast test
255 SendData(txSocket, "2001:2::200:ff:fe00:8");
256 NS_TEST_EXPECT_MSG_EQ(m_receivedPacket->GetSize(), 123, "IPv6 RIPng should work.");
257
259
261}
262
263// Ipv6RipngCountToInfinityTest
264
265/**
266 * \ingroup internet-test
267 *
268 * \brief IPv6 RIPng count to infinity Test
269 */
271{
272 Ptr<Packet> m_receivedPacket; //!< Received packet
273
274 /**
275 * \brief Send data.
276 * \param socket The sending socket.
277 * \param to Destination address.
278 */
279 void DoSendData(Ptr<Socket> socket, std::string to);
280 /**
281 * \brief Send data.
282 * \param socket The sending socket.
283 * \param to Destination address.
284 */
285 void SendData(Ptr<Socket> socket, std::string to);
286
287 public:
288 void DoRun() override;
290
291 /**
292 * \brief Receive data.
293 * \param socket The receiving socket.
294 */
295 void ReceivePkt(Ptr<Socket> socket);
296};
297
299 : TestCase("RIPng counting to infinity")
300{
301}
302
303void
305{
306 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
307 m_receivedPacket = socket->Recv(std::numeric_limits<uint32_t>::max(), 0);
308 NS_TEST_ASSERT_MSG_EQ(availableData,
310 "Received packet size is not equal to Rx buffer size");
311}
312
313void
315{
316 Address realTo = Inet6SocketAddress(Ipv6Address(to.c_str()), 1234);
317 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(Create<Packet>(123), 0, realTo), 123, "100");
318}
319
320void
322{
324 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
325 Seconds(60),
327 this,
328 socket,
329 to);
332}
333
334void
336{
337 // Create topology
338
339 Ptr<Node> txNode = CreateObject<Node>();
340 Ptr<Node> rxNode = CreateObject<Node>();
341 Ptr<Node> routerA = CreateObject<Node>();
342 Ptr<Node> routerB = CreateObject<Node>();
343 Ptr<Node> routerC = CreateObject<Node>();
344
345 NodeContainer nodes(txNode, rxNode);
346 NodeContainer routers(routerA, routerB, routerC);
347 NodeContainer all(nodes, routers);
348
349 RipNgHelper ripNgRouting;
350 // Change the router's interface metric to 10, must not send packets (count to infinity)
351 // note: Interface 0 is the loopback.
352 ripNgRouting.SetInterfaceMetric(routerA, 2, 10);
353 ripNgRouting.SetInterfaceMetric(routerB, 1, 10);
354 ripNgRouting.SetInterfaceMetric(routerB, 2, 10);
355 ripNgRouting.SetInterfaceMetric(routerC, 1, 10);
356
357 InternetStackHelper internetv6routers;
358 internetv6routers.SetRoutingHelper(ripNgRouting);
359 internetv6routers.Install(routers);
360
361 InternetStackHelper internetv6nodes;
362 internetv6nodes.Install(nodes);
363
368
369 // Sender Node
371 {
373 txDev->SetAddress(Mac48Address("00:00:00:00:00:01"));
374 txNode->AddDevice(txDev);
375 }
376 net1.Add(txDev);
377
378 // Router A
379 Ptr<SimpleNetDevice> fwDev1routerA;
380 Ptr<SimpleNetDevice> fwDev2routerA;
381 { // first interface
382 fwDev1routerA = CreateObject<SimpleNetDevice>();
383 fwDev1routerA->SetAddress(Mac48Address("00:00:00:00:00:02"));
384 routerA->AddDevice(fwDev1routerA);
385 }
386 net1.Add(fwDev1routerA);
387
388 { // second interface
389 fwDev2routerA = CreateObject<SimpleNetDevice>();
390 fwDev2routerA->SetAddress(Mac48Address("00:00:00:00:00:03"));
391 routerA->AddDevice(fwDev2routerA);
392 }
393 net2.Add(fwDev2routerA);
394
395 // Router B
396 Ptr<SimpleNetDevice> fwDev1routerB;
397 Ptr<SimpleNetDevice> fwDev2routerB;
398 { // first interface
399 fwDev1routerB = CreateObject<SimpleNetDevice>();
400 fwDev1routerB->SetAddress(Mac48Address("00:00:00:00:00:04"));
401 routerB->AddDevice(fwDev1routerB);
402 }
403 net2.Add(fwDev1routerB);
404
405 { // second interface
406 fwDev2routerB = CreateObject<SimpleNetDevice>();
407 fwDev2routerB->SetAddress(Mac48Address("00:00:00:00:00:05"));
408 routerB->AddDevice(fwDev2routerB);
409 }
410 net3.Add(fwDev2routerB);
411
412 // Router C
413 Ptr<SimpleNetDevice> fwDev1routerC;
414 Ptr<SimpleNetDevice> fwDev2routerC;
415 { // first interface
416 fwDev1routerC = CreateObject<SimpleNetDevice>();
417 fwDev1routerC->SetAddress(Mac48Address("00:00:00:00:00:06"));
418 routerC->AddDevice(fwDev1routerC);
419 }
420 net3.Add(fwDev1routerC);
421
422 { // second interface
423 fwDev2routerC = CreateObject<SimpleNetDevice>();
424 fwDev2routerC->SetAddress(Mac48Address("00:00:00:00:00:07"));
425 routerC->AddDevice(fwDev2routerC);
426 }
427 net4.Add(fwDev2routerC);
428
429 // Rx node
431 { // first interface
433 rxDev->SetAddress(Mac48Address("00:00:00:00:00:08"));
434 rxNode->AddDevice(rxDev);
435 }
436 net4.Add(rxDev);
437
438 // link the channels
440 txDev->SetChannel(channel1);
441 fwDev1routerA->SetChannel(channel1);
442
444 fwDev2routerA->SetChannel(channel2);
445 fwDev1routerB->SetChannel(channel2);
446
448 fwDev2routerB->SetChannel(channel3);
449 fwDev1routerC->SetChannel(channel3);
450
452 fwDev2routerC->SetChannel(channel4);
453 rxDev->SetChannel(channel4);
454
455 // Setup IPv6 addresses and forwarding
457
458 ipv6.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
460 iic1.SetForwarding(1, true);
462
464 iic2.SetForwarding(0, true);
465 iic2.SetForwarding(1, true);
466
468 iic3.SetForwarding(0, true);
469 iic3.SetForwarding(1, true);
470
471 ipv6.SetBase(Ipv6Address("2001:2::"), Ipv6Prefix(64));
473 iic4.SetForwarding(0, true);
475
476 // Create the UDP sockets
477 Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<UdpSocketFactory>();
478 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
480 rxSocket->Bind(Inet6SocketAddress(Ipv6Address("2001:2::200:ff:fe00:8"), 1234)),
481 0,
482 "trivial");
483 rxSocket->SetRecvCallback(MakeCallback(&Ipv6RipngCountToInfinityTest::ReceivePkt, this));
484
485 Ptr<SocketFactory> txSocketFactory = txNode->GetObject<UdpSocketFactory>();
486 Ptr<Socket> txSocket = txSocketFactory->CreateSocket();
487 txSocket->SetAllowBroadcast(true);
488
489 // ------ Now the tests ------------
490
491 SendData(txSocket, "2001:2::200:ff:fe00:8");
492 NS_TEST_EXPECT_MSG_EQ(m_receivedPacket->GetSize(), 0, "RIPng counting to infinity.");
493
495}
496
497/**
498 * \ingroup internet-test
499 *
500 * \brief IPv6 RIPng SplitHorizon strategy Test
501 */
503{
506
507 public:
508 void DoRun() override;
509 /**
510 * \brief Constructor.
511 * \param strategy The SplitHorizon strategy.
512 */
514
515 /**
516 * \brief Receive data.
517 * \param socket The receiving socket.
518 */
519 void ReceivePktProbe(Ptr<Socket> socket);
520};
521
524 : TestCase("RIPng Split Horizon strategy")
525{
526 m_setStrategy = strategy;
527}
528
529void
531{
532 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
533 Address srcAddr;
534 Ptr<Packet> receivedPacketProbe =
535 socket->RecvFrom(std::numeric_limits<uint32_t>::max(), 0, srcAddr);
536 NS_TEST_ASSERT_MSG_EQ(availableData,
537 receivedPacketProbe->GetSize(),
538 "ReceivedPacketProbe size is not equal to the Rx buffer size");
539 Ipv6Address senderAddress = Inet6SocketAddress::ConvertFrom(srcAddr).GetIpv6();
540
541 if (senderAddress == "fe80::200:ff:fe00:4")
542 {
543 RipNgHeader hdr;
544 receivedPacketProbe->RemoveHeader(hdr);
545 std::list<RipNgRte> rtes = hdr.GetRteList();
546
547 // validate the RTEs before processing
548 for (auto iter = rtes.begin(); iter != rtes.end(); iter++)
549 {
550 if (iter->GetPrefix() == "2001:1::")
551 {
552 bool correct = false;
553 if (iter->GetRouteMetric() == 16)
554 {
555 correct = true;
557 }
558 else if (iter->GetRouteMetric() == 2)
559 {
560 correct = true;
562 }
563 NS_TEST_EXPECT_MSG_EQ(correct,
564 true,
565 "RIPng: unexpected metric value: " << iter->GetRouteMetric());
566 }
567 }
568 }
569}
570
571void
573{
574 // Create topology
575
576 Ptr<Node> fakeNode = CreateObject<Node>();
577 Ptr<Node> listener = CreateObject<Node>();
578
579 Ptr<Node> routerA = CreateObject<Node>();
580 Ptr<Node> routerB = CreateObject<Node>();
581
582 NodeContainer listeners(listener, fakeNode);
583 NodeContainer routers(routerA, routerB);
584 NodeContainer all(routers, listeners);
585
586 RipNgHelper ripNgRouting;
587 ripNgRouting.Set("SplitHorizon", EnumValue(m_setStrategy));
588
589 InternetStackHelper internetv6routers;
590 internetv6routers.SetRoutingHelper(ripNgRouting);
591 internetv6routers.Install(routers);
592
593 InternetStackHelper internetv6nodes;
594 internetv6nodes.Install(listeners);
595
598
599 // Fake Node
600 Ptr<SimpleNetDevice> silentDev;
601 {
602 silentDev = CreateObject<SimpleNetDevice>();
603 silentDev->SetAddress(Mac48Address("00:00:00:00:00:01"));
604 fakeNode->AddDevice(silentDev);
605 }
606 net0.Add(silentDev);
607
608 // Router A
609 Ptr<SimpleNetDevice> silentDevRouterA;
610 Ptr<SimpleNetDevice> fwDevRouterA;
611 { // silent interface
612 silentDevRouterA = CreateObject<SimpleNetDevice>();
613 silentDevRouterA->SetAddress(Mac48Address("00:00:00:00:00:02"));
614 routerA->AddDevice(silentDevRouterA);
615 }
616 net0.Add(silentDevRouterA);
617
618 { // first interface
619 fwDevRouterA = CreateObject<SimpleNetDevice>();
620 fwDevRouterA->SetAddress(Mac48Address("00:00:00:00:00:03"));
621 routerA->AddDevice(fwDevRouterA);
622 }
623 net1.Add(fwDevRouterA);
624
625 // Router B
626 Ptr<SimpleNetDevice> fwDevRouterB;
627 { // first interface
628 fwDevRouterB = CreateObject<SimpleNetDevice>();
629 fwDevRouterB->SetAddress(Mac48Address("00:00:00:00:00:04"));
630 routerB->AddDevice(fwDevRouterB);
631 }
632 net1.Add(fwDevRouterB);
633
634 // listener A
635 Ptr<SimpleNetDevice> listenerDev;
636 {
637 listenerDev = CreateObject<SimpleNetDevice>();
638 listenerDev->SetAddress(Mac48Address("00:00:00:00:00:05"));
639 listener->AddDevice(listenerDev);
640 }
641 net1.Add(listenerDev);
642
643 // link the channels
645 silentDev->SetChannel(channel0);
646 silentDevRouterA->SetChannel(channel0);
647
649 fwDevRouterA->SetChannel(channel1);
650 fwDevRouterB->SetChannel(channel1);
651 listenerDev->SetChannel(channel1);
652
653 // Setup IPv6 addresses and forwarding
655
656 ipv6.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
658
660 iic1.SetForwarding(0, true);
661 iic1.SetForwarding(1, true);
662
663 // Create the UDP sockets
664 Ptr<SocketFactory> rxSocketFactory = listener->GetObject<UdpSocketFactory>();
665 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
666 rxSocket->BindToNetDevice(listenerDev);
667 NS_TEST_EXPECT_MSG_EQ(rxSocket->Bind(Inet6SocketAddress(Ipv6Address("ff02::9"), 521)),
668 0,
669 "trivial");
670 rxSocket->SetRecvCallback(
672
673 // ------ Now the tests ------------
674
675 // If the strategy is Split Horizon, then no packet will be received.
677
680 NS_TEST_EXPECT_MSG_EQ(m_detectedStrategy, m_setStrategy, "RIPng counting to infinity.");
681
683}
684
685/**
686 * \ingroup internet-test
687 *
688 * \brief IPv6 RIPng TestSuite
689 */
691{
692 public:
694 : TestSuite("ipv6-ripng", Type::UNIT)
695 {
696 AddTestCase(new Ipv6RipngTest, TestCase::Duration::QUICK);
697 AddTestCase(new Ipv6RipngCountToInfinityTest, TestCase::Duration::QUICK);
699 TestCase::Duration::QUICK);
701 TestCase::Duration::QUICK);
703 TestCase::Duration::QUICK);
704 }
705};
706
707static Ipv6RipngTestSuite g_ipv6ripngTestSuite; //!< Static variable for test initialization
IPv6 RIPng count to infinity Test.
void SendData(Ptr< Socket > socket, std::string to)
Send data.
void DoSendData(Ptr< Socket > socket, std::string to)
Send data.
void ReceivePkt(Ptr< Socket > socket)
Receive data.
Ptr< Packet > m_receivedPacket
Received packet.
void DoRun() override
Implementation to actually run this TestCase.
IPv6 RIPng SplitHorizon strategy Test.
Ipv6RipngSplitHorizonStrategyTest(RipNg::SplitHorizonType_e strategy)
Constructor.
RipNg::SplitHorizonType_e m_setStrategy
Strategy set.
void DoRun() override
Implementation to actually run this TestCase.
RipNg::SplitHorizonType_e m_detectedStrategy
Strategy detected.
void ReceivePktProbe(Ptr< Socket > socket)
Receive data.
IPv6 RIPng Test.
Ptr< Packet > m_receivedPacket
Received packet.
void DoRun() override
Implementation to actually run this TestCase.
void SendData(Ptr< Socket > socket, std::string to)
Send data.
void DoSendData(Ptr< Socket > socket, std::string to)
Send data.
void ReceivePkt(Ptr< Socket > socket)
Receive data.
IPv6 RIPng TestSuite.
a polymophic address class
Definition address.h:90
Hold variables of type enum.
Definition enum.h:52
An Inet6 address class.
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
Ipv6Address GetIpv6() const
Get the IPv6 address.
aggregate IP/TCP/UDP functionality to existing Nodes.
void Install(std::string nodeName) const
Aggregate implementations of the ns3::Ipv4, ns3::Ipv6, ns3::Udp, and ns3::Tcp classes onto the provid...
void SetRoutingHelper(const Ipv4RoutingHelper &routing)
Helper class to auto-assign global IPv6 unicast addresses.
Ipv6InterfaceContainer AssignWithoutAddress(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer but do not assign any IPv6 addresses.
void SetBase(Ipv6Address network, Ipv6Prefix prefix, Ipv6Address base=Ipv6Address("::1"))
Set the base network number, network prefix, and base interface ID.
Ipv6InterfaceContainer AssignWithoutOnLink(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses, but do not set the on-link property ...
Describes an IPv6 address.
Keep track of a set of IPv6 interfaces.
void SetForwarding(uint32_t i, bool state)
Set the state of the stack (act as a router or as an host) for the specified index.
void SetDefaultRouteInAllNodes(uint32_t router)
Set the default route for all the devices (except the router itself).
Describes an IPv6 prefix.
an EUI-48 address
holds a vector of ns3::NetDevice pointers
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
keep track of a set of node pointers.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition packet.h:850
void RemoveAllByteTags()
Remove all byte tags stored in this packet.
Definition packet.cc:382
Smart pointer class similar to boost::intrusive_ptr.
RipNgHeader - see RFC 2080
std::list< RipNgRte > GetRteList() const
Get the list of the RTEs included in the message.
Helper class that adds RIPng routing to nodes.
void SetInterfaceMetric(Ptr< Node > node, uint32_t interface, uint8_t metric)
Set a metric for an interface.
void Set(std::string name, const AttributeValue &value)
SplitHorizonType_e
Split Horizon strategy type.
Definition ripng.h:213
@ SPLIT_HORIZON
Split Horizon.
Definition ripng.h:215
@ POISON_REVERSE
Poison Reverse Split Horizon.
Definition ripng.h:216
@ NO_SPLIT_HORIZON
No Split Horizon.
Definition ripng.h:214
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
Definition simulator.cc:131
static void ScheduleWithContext(uint32_t context, const Time &delay, FUNC f, Ts &&... args)
Schedule an event with the given context.
Definition simulator.h:577
static void Run()
Run the simulation.
Definition simulator.cc:167
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Definition simulator.cc:175
encapsulates test code
Definition test.h:1050
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
Definition test.cc:292
A suite of tests to run.
Definition test.h:1267
Type
Type of test.
Definition test.h:1274
static constexpr auto UNIT
Definition test.h:1291
API to create UDP socket instances.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Definition object.h:619
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
#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.
Definition test.h:134
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Definition test.h:241
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition nstime.h:1308
static Ipv6RipngTestSuite g_ipv6ripngTestSuite
Static variable for test initialization.
NodeContainer nodes
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...
Definition callback.h:684