A Discrete-Event Network Simulator
API
ipv6-ripng-test.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014 Universita' di Firenze
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
18 */
19
20#include "ns3/boolean.h"
21#include "ns3/enum.h"
22#include "ns3/icmpv6-l4-protocol.h"
23#include "ns3/inet6-socket-address.h"
24#include "ns3/internet-stack-helper.h"
25#include "ns3/ipv6-address-helper.h"
26#include "ns3/ipv6-l3-protocol.h"
27#include "ns3/log.h"
28#include "ns3/node-container.h"
29#include "ns3/node.h"
30#include "ns3/ripng-helper.h"
31#include "ns3/ripng.h"
32#include "ns3/simple-channel.h"
33#include "ns3/simple-net-device.h"
34#include "ns3/simulator.h"
35#include "ns3/socket-factory.h"
36#include "ns3/socket.h"
37#include "ns3/test.h"
38#include "ns3/udp-l4-protocol.h"
39#include "ns3/udp-socket-factory.h"
40
41#include <limits>
42#include <string>
43
44using namespace ns3;
45
52class Ipv6RipngTest : public TestCase
53{
55
61 void DoSendData(Ptr<Socket> socket, std::string to);
67 void SendData(Ptr<Socket> socket, std::string to);
68
69 public:
70 void DoRun() override;
72
77 void ReceivePkt(Ptr<Socket> socket);
78};
79
81 : TestCase("RIPng")
82{
83}
84
85void
87{
88 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
90 NS_TEST_ASSERT_MSG_EQ(availableData,
92 "Received packet size is not equal to Rx buffer size");
93}
94
95void
97{
98 Address realTo = Inet6SocketAddress(Ipv6Address(to.c_str()), 1234);
99 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(Create<Packet>(123), 0, realTo), 123, "100");
100}
101
102void
104{
105 m_receivedPacket = Create<Packet>();
106 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
107 Seconds(60),
109 this,
110 socket,
111 to);
112 Simulator::Stop(Seconds(66));
113 Simulator::Run();
114}
115
116void
118{
119 // Create topology
120
121 Ptr<Node> txNode = CreateObject<Node>();
122 Ptr<Node> rxNode = CreateObject<Node>();
123 Ptr<Node> routerA = CreateObject<Node>();
124 Ptr<Node> routerB = CreateObject<Node>();
125 Ptr<Node> routerC = CreateObject<Node>();
126
127 NodeContainer nodes(txNode, rxNode);
128 NodeContainer routers(routerA, routerB, routerC);
129 NodeContainer all(nodes, routers);
130
131 RipNgHelper ripNgRouting;
132 InternetStackHelper internetv6routers;
133 internetv6routers.SetRoutingHelper(ripNgRouting);
134 internetv6routers.Install(routers);
135
136 InternetStackHelper internetv6nodes;
137 internetv6nodes.Install(nodes);
138
143
144 // Sender Node
146 {
147 txDev = CreateObject<SimpleNetDevice>();
148 txDev->SetAddress(Mac48Address("00:00:00:00:00:01"));
149 txNode->AddDevice(txDev);
150 }
151 net1.Add(txDev);
152
153 // Router A
154 Ptr<SimpleNetDevice> fwDev1routerA;
155 Ptr<SimpleNetDevice> fwDev2routerA;
156 { // first interface
157 fwDev1routerA = CreateObject<SimpleNetDevice>();
158 fwDev1routerA->SetAddress(Mac48Address("00:00:00:00:00:02"));
159 routerA->AddDevice(fwDev1routerA);
160 }
161 net1.Add(fwDev1routerA);
162
163 { // second interface
164 fwDev2routerA = CreateObject<SimpleNetDevice>();
165 fwDev2routerA->SetAddress(Mac48Address("00:00:00:00:00:03"));
166 routerA->AddDevice(fwDev2routerA);
167 }
168 net2.Add(fwDev2routerA);
169
170 // Router B
171 Ptr<SimpleNetDevice> fwDev1routerB;
172 Ptr<SimpleNetDevice> fwDev2routerB;
173 { // first interface
174 fwDev1routerB = CreateObject<SimpleNetDevice>();
175 fwDev1routerB->SetAddress(Mac48Address("00:00:00:00:00:04"));
176 routerB->AddDevice(fwDev1routerB);
177 }
178 net2.Add(fwDev1routerB);
179
180 { // second interface
181 fwDev2routerB = CreateObject<SimpleNetDevice>();
182 fwDev2routerB->SetAddress(Mac48Address("00:00:00:00:00:05"));
183 routerB->AddDevice(fwDev2routerB);
184 }
185 net3.Add(fwDev2routerB);
186
187 // Router C
188 Ptr<SimpleNetDevice> fwDev1routerC;
189 Ptr<SimpleNetDevice> fwDev2routerC;
190 { // first interface
191 fwDev1routerC = CreateObject<SimpleNetDevice>();
192 fwDev1routerC->SetAddress(Mac48Address("00:00:00:00:00:06"));
193 routerC->AddDevice(fwDev1routerC);
194 }
195 net3.Add(fwDev1routerC);
196
197 { // second interface
198 fwDev2routerC = CreateObject<SimpleNetDevice>();
199 fwDev2routerC->SetAddress(Mac48Address("00:00:00:00:00:07"));
200 routerC->AddDevice(fwDev2routerC);
201 }
202 net4.Add(fwDev2routerC);
203
204 // Rx node
206 { // first interface
207 rxDev = CreateObject<SimpleNetDevice>();
208 rxDev->SetAddress(Mac48Address("00:00:00:00:00:08"));
209 rxNode->AddDevice(rxDev);
210 }
211 net4.Add(rxDev);
212
213 // link the channels
214 Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel>();
215 txDev->SetChannel(channel1);
216 fwDev1routerA->SetChannel(channel1);
217
218 Ptr<SimpleChannel> channel2 = CreateObject<SimpleChannel>();
219 fwDev2routerA->SetChannel(channel2);
220 fwDev1routerB->SetChannel(channel2);
221
222 Ptr<SimpleChannel> channel3 = CreateObject<SimpleChannel>();
223 fwDev2routerB->SetChannel(channel3);
224 fwDev1routerC->SetChannel(channel3);
225
226 Ptr<SimpleChannel> channel4 = CreateObject<SimpleChannel>();
227 fwDev2routerC->SetChannel(channel4);
228 rxDev->SetChannel(channel4);
229
230 // Setup IPv6 addresses and forwarding
232
233 ipv6.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
235 iic1.SetForwarding(1, true);
237
239 iic2.SetForwarding(0, true);
240 iic2.SetForwarding(1, true);
241
243 iic3.SetForwarding(0, true);
244 iic3.SetForwarding(1, true);
245
246 ipv6.SetBase(Ipv6Address("2001:2::"), Ipv6Prefix(64));
248 iic4.SetForwarding(0, true);
250
251 // Create the UDP sockets
252 Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<UdpSocketFactory>();
253 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
255 rxSocket->Bind(Inet6SocketAddress(Ipv6Address("2001:2::200:ff:fe00:8"), 1234)),
256 0,
257 "trivial");
258 rxSocket->SetRecvCallback(MakeCallback(&Ipv6RipngTest::ReceivePkt, this));
259
260 Ptr<SocketFactory> txSocketFactory = txNode->GetObject<UdpSocketFactory>();
261 Ptr<Socket> txSocket = txSocketFactory->CreateSocket();
262 txSocket->SetAllowBroadcast(true);
263
264 // ------ Now the tests ------------
265
266 // Unicast test
267 SendData(txSocket, "2001:2::200:ff:fe00:8");
268 NS_TEST_EXPECT_MSG_EQ(m_receivedPacket->GetSize(), 123, "IPv6 RIPng should work.");
269
271
272 Simulator::Destroy();
273}
274
275// Ipv6RipngCountToInfinityTest
276
284{
286
292 void DoSendData(Ptr<Socket> socket, std::string to);
298 void SendData(Ptr<Socket> socket, std::string to);
299
300 public:
301 void DoRun() override;
303
308 void ReceivePkt(Ptr<Socket> socket);
309};
310
312 : TestCase("RIPng counting to infinity")
313{
314}
315
316void
318{
319 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
321 NS_TEST_ASSERT_MSG_EQ(availableData,
323 "Received packet size is not equal to Rx buffer size");
324}
325
326void
328{
329 Address realTo = Inet6SocketAddress(Ipv6Address(to.c_str()), 1234);
330 NS_TEST_EXPECT_MSG_EQ(socket->SendTo(Create<Packet>(123), 0, realTo), 123, "100");
331}
332
333void
335{
336 m_receivedPacket = Create<Packet>();
337 Simulator::ScheduleWithContext(socket->GetNode()->GetId(),
338 Seconds(60),
340 this,
341 socket,
342 to);
343 Simulator::Stop(Seconds(66));
344 Simulator::Run();
345}
346
347void
349{
350 // Create topology
351
352 Ptr<Node> txNode = CreateObject<Node>();
353 Ptr<Node> rxNode = CreateObject<Node>();
354 Ptr<Node> routerA = CreateObject<Node>();
355 Ptr<Node> routerB = CreateObject<Node>();
356 Ptr<Node> routerC = CreateObject<Node>();
357
358 NodeContainer nodes(txNode, rxNode);
359 NodeContainer routers(routerA, routerB, routerC);
360 NodeContainer all(nodes, routers);
361
362 RipNgHelper ripNgRouting;
363 // Change the router's interface metric to 10, must not send packets (count to infinity)
364 // note: Interface 0 is the loopback.
365 ripNgRouting.SetInterfaceMetric(routerA, 2, 10);
366 ripNgRouting.SetInterfaceMetric(routerB, 1, 10);
367 ripNgRouting.SetInterfaceMetric(routerB, 2, 10);
368 ripNgRouting.SetInterfaceMetric(routerC, 1, 10);
369
370 InternetStackHelper internetv6routers;
371 internetv6routers.SetRoutingHelper(ripNgRouting);
372 internetv6routers.Install(routers);
373
374 InternetStackHelper internetv6nodes;
375 internetv6nodes.Install(nodes);
376
381
382 // Sender Node
384 {
385 txDev = CreateObject<SimpleNetDevice>();
386 txDev->SetAddress(Mac48Address("00:00:00:00:00:01"));
387 txNode->AddDevice(txDev);
388 }
389 net1.Add(txDev);
390
391 // Router A
392 Ptr<SimpleNetDevice> fwDev1routerA;
393 Ptr<SimpleNetDevice> fwDev2routerA;
394 { // first interface
395 fwDev1routerA = CreateObject<SimpleNetDevice>();
396 fwDev1routerA->SetAddress(Mac48Address("00:00:00:00:00:02"));
397 routerA->AddDevice(fwDev1routerA);
398 }
399 net1.Add(fwDev1routerA);
400
401 { // second interface
402 fwDev2routerA = CreateObject<SimpleNetDevice>();
403 fwDev2routerA->SetAddress(Mac48Address("00:00:00:00:00:03"));
404 routerA->AddDevice(fwDev2routerA);
405 }
406 net2.Add(fwDev2routerA);
407
408 // Router B
409 Ptr<SimpleNetDevice> fwDev1routerB;
410 Ptr<SimpleNetDevice> fwDev2routerB;
411 { // first interface
412 fwDev1routerB = CreateObject<SimpleNetDevice>();
413 fwDev1routerB->SetAddress(Mac48Address("00:00:00:00:00:04"));
414 routerB->AddDevice(fwDev1routerB);
415 }
416 net2.Add(fwDev1routerB);
417
418 { // second interface
419 fwDev2routerB = CreateObject<SimpleNetDevice>();
420 fwDev2routerB->SetAddress(Mac48Address("00:00:00:00:00:05"));
421 routerB->AddDevice(fwDev2routerB);
422 }
423 net3.Add(fwDev2routerB);
424
425 // Router C
426 Ptr<SimpleNetDevice> fwDev1routerC;
427 Ptr<SimpleNetDevice> fwDev2routerC;
428 { // first interface
429 fwDev1routerC = CreateObject<SimpleNetDevice>();
430 fwDev1routerC->SetAddress(Mac48Address("00:00:00:00:00:06"));
431 routerC->AddDevice(fwDev1routerC);
432 }
433 net3.Add(fwDev1routerC);
434
435 { // second interface
436 fwDev2routerC = CreateObject<SimpleNetDevice>();
437 fwDev2routerC->SetAddress(Mac48Address("00:00:00:00:00:07"));
438 routerC->AddDevice(fwDev2routerC);
439 }
440 net4.Add(fwDev2routerC);
441
442 // Rx node
444 { // first interface
445 rxDev = CreateObject<SimpleNetDevice>();
446 rxDev->SetAddress(Mac48Address("00:00:00:00:00:08"));
447 rxNode->AddDevice(rxDev);
448 }
449 net4.Add(rxDev);
450
451 // link the channels
452 Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel>();
453 txDev->SetChannel(channel1);
454 fwDev1routerA->SetChannel(channel1);
455
456 Ptr<SimpleChannel> channel2 = CreateObject<SimpleChannel>();
457 fwDev2routerA->SetChannel(channel2);
458 fwDev1routerB->SetChannel(channel2);
459
460 Ptr<SimpleChannel> channel3 = CreateObject<SimpleChannel>();
461 fwDev2routerB->SetChannel(channel3);
462 fwDev1routerC->SetChannel(channel3);
463
464 Ptr<SimpleChannel> channel4 = CreateObject<SimpleChannel>();
465 fwDev2routerC->SetChannel(channel4);
466 rxDev->SetChannel(channel4);
467
468 // Setup IPv6 addresses and forwarding
470
471 ipv6.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
473 iic1.SetForwarding(1, true);
475
477 iic2.SetForwarding(0, true);
478 iic2.SetForwarding(1, true);
479
481 iic3.SetForwarding(0, true);
482 iic3.SetForwarding(1, true);
483
484 ipv6.SetBase(Ipv6Address("2001:2::"), Ipv6Prefix(64));
486 iic4.SetForwarding(0, true);
488
489 // Create the UDP sockets
490 Ptr<SocketFactory> rxSocketFactory = rxNode->GetObject<UdpSocketFactory>();
491 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
493 rxSocket->Bind(Inet6SocketAddress(Ipv6Address("2001:2::200:ff:fe00:8"), 1234)),
494 0,
495 "trivial");
496 rxSocket->SetRecvCallback(MakeCallback(&Ipv6RipngCountToInfinityTest::ReceivePkt, this));
497
498 Ptr<SocketFactory> txSocketFactory = txNode->GetObject<UdpSocketFactory>();
499 Ptr<Socket> txSocket = txSocketFactory->CreateSocket();
500 txSocket->SetAllowBroadcast(true);
501
502 // ------ Now the tests ------------
503
504 SendData(txSocket, "2001:2::200:ff:fe00:8");
505 NS_TEST_EXPECT_MSG_EQ(m_receivedPacket->GetSize(), 0, "RIPng counting to infinity.");
506
507 Simulator::Destroy();
508}
509
517{
520
521 public:
522 void DoRun() override;
528
533 void ReceivePktProbe(Ptr<Socket> socket);
534};
535
538 : TestCase("RIPng Split Horizon strategy")
539{
540 m_setStrategy = strategy;
541}
542
543void
545{
546 uint32_t availableData [[maybe_unused]] = socket->GetRxAvailable();
547 Address srcAddr;
548 Ptr<Packet> receivedPacketProbe =
549 socket->RecvFrom(std::numeric_limits<uint32_t>::max(), 0, srcAddr);
550 NS_TEST_ASSERT_MSG_EQ(availableData,
551 receivedPacketProbe->GetSize(),
552 "ReceivedPacketProbe size is not equal to the Rx buffer size");
553 Ipv6Address senderAddress = Inet6SocketAddress::ConvertFrom(srcAddr).GetIpv6();
554
555 if (senderAddress == "fe80::200:ff:fe00:4")
556 {
557 RipNgHeader hdr;
558 receivedPacketProbe->RemoveHeader(hdr);
559 std::list<RipNgRte> rtes = hdr.GetRteList();
560
561 // validate the RTEs before processing
562 for (std::list<RipNgRte>::iterator iter = rtes.begin(); iter != rtes.end(); iter++)
563 {
564 if (iter->GetPrefix() == "2001:1::")
565 {
566 bool correct = false;
567 if (iter->GetRouteMetric() == 16)
568 {
569 correct = true;
570 m_detectedStrategy = RipNg::POISON_REVERSE;
571 }
572 else if (iter->GetRouteMetric() == 2)
573 {
574 correct = true;
575 m_detectedStrategy = RipNg::NO_SPLIT_HORIZON;
576 }
577 NS_TEST_EXPECT_MSG_EQ(correct,
578 true,
579 "RIPng: unexpected metric value: " << iter->GetRouteMetric());
580 }
581 }
582 }
583}
584
585void
587{
588 // Create topology
589
590 Ptr<Node> fakeNode = CreateObject<Node>();
591 Ptr<Node> listener = CreateObject<Node>();
592
593 Ptr<Node> routerA = CreateObject<Node>();
594 Ptr<Node> routerB = CreateObject<Node>();
595
596 NodeContainer listeners(listener, fakeNode);
597 NodeContainer routers(routerA, routerB);
598 NodeContainer all(routers, listeners);
599
600 RipNgHelper ripNgRouting;
601 ripNgRouting.Set("SplitHorizon", EnumValue(m_setStrategy));
602
603 InternetStackHelper internetv6routers;
604 internetv6routers.SetRoutingHelper(ripNgRouting);
605 internetv6routers.Install(routers);
606
607 InternetStackHelper internetv6nodes;
608 internetv6nodes.Install(listeners);
609
612
613 // Fake Node
614 Ptr<SimpleNetDevice> silentDev;
615 {
616 silentDev = CreateObject<SimpleNetDevice>();
617 silentDev->SetAddress(Mac48Address("00:00:00:00:00:01"));
618 fakeNode->AddDevice(silentDev);
619 }
620 net0.Add(silentDev);
621
622 // Router A
623 Ptr<SimpleNetDevice> silentDevRouterA;
624 Ptr<SimpleNetDevice> fwDevRouterA;
625 { // silent interface
626 silentDevRouterA = CreateObject<SimpleNetDevice>();
627 silentDevRouterA->SetAddress(Mac48Address("00:00:00:00:00:02"));
628 routerA->AddDevice(silentDevRouterA);
629 }
630 net0.Add(silentDevRouterA);
631
632 { // first interface
633 fwDevRouterA = CreateObject<SimpleNetDevice>();
634 fwDevRouterA->SetAddress(Mac48Address("00:00:00:00:00:03"));
635 routerA->AddDevice(fwDevRouterA);
636 }
637 net1.Add(fwDevRouterA);
638
639 // Router B
640 Ptr<SimpleNetDevice> fwDevRouterB;
641 { // first interface
642 fwDevRouterB = CreateObject<SimpleNetDevice>();
643 fwDevRouterB->SetAddress(Mac48Address("00:00:00:00:00:04"));
644 routerB->AddDevice(fwDevRouterB);
645 }
646 net1.Add(fwDevRouterB);
647
648 // listener A
649 Ptr<SimpleNetDevice> listenerDev;
650 {
651 listenerDev = CreateObject<SimpleNetDevice>();
652 listenerDev->SetAddress(Mac48Address("00:00:00:00:00:05"));
653 listener->AddDevice(listenerDev);
654 }
655 net1.Add(listenerDev);
656
657 // link the channels
658 Ptr<SimpleChannel> channel0 = CreateObject<SimpleChannel>();
659 silentDev->SetChannel(channel0);
660 silentDevRouterA->SetChannel(channel0);
661
662 Ptr<SimpleChannel> channel1 = CreateObject<SimpleChannel>();
663 fwDevRouterA->SetChannel(channel1);
664 fwDevRouterB->SetChannel(channel1);
665 listenerDev->SetChannel(channel1);
666
667 // Setup IPv6 addresses and forwarding
669
670 ipv6.SetBase(Ipv6Address("2001:1::"), Ipv6Prefix(64));
672
674 iic1.SetForwarding(0, true);
675 iic1.SetForwarding(1, true);
676
677 // Create the UDP sockets
678 Ptr<SocketFactory> rxSocketFactory = listener->GetObject<UdpSocketFactory>();
679 Ptr<Socket> rxSocket = rxSocketFactory->CreateSocket();
680 rxSocket->BindToNetDevice(listenerDev);
681 NS_TEST_EXPECT_MSG_EQ(rxSocket->Bind(Inet6SocketAddress(Ipv6Address("ff02::9"), 521)),
682 0,
683 "trivial");
684 rxSocket->SetRecvCallback(
686
687 // ------ Now the tests ------------
688
689 // If the strategy is Split Horizon, then no packet will be received.
690 m_detectedStrategy = RipNg::SPLIT_HORIZON;
691
692 Simulator::Stop(Seconds(66));
693 Simulator::Run();
694 NS_TEST_EXPECT_MSG_EQ(m_detectedStrategy, m_setStrategy, "RIPng counting to infinity.");
695
696 Simulator::Destroy();
697}
698
706{
707 public:
709 : TestSuite("ipv6-ripng", UNIT)
710 {
711 AddTestCase(new Ipv6RipngTest, TestCase::QUICK);
712 AddTestCase(new Ipv6RipngCountToInfinityTest, TestCase::QUICK);
713 AddTestCase(new Ipv6RipngSplitHorizonStrategyTest(RipNg::POISON_REVERSE), TestCase::QUICK);
714 AddTestCase(new Ipv6RipngSplitHorizonStrategyTest(RipNg::SPLIT_HORIZON), TestCase::QUICK);
715 AddTestCase(new Ipv6RipngSplitHorizonStrategyTest(RipNg::NO_SPLIT_HORIZON),
716 TestCase::QUICK);
717 }
718};
719
#define max(a, b)
Definition: 80211b.c:43
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:92
Hold variables of type enum.
Definition: enum.h:56
An Inet6 address class.
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.
Definition: ipv6-address.h:50
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.
Definition: ipv6-address.h:456
an EUI-48 address
Definition: mac48-address.h:46
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 AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:138
uint32_t GetId() const
Definition: node.cc:117
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:471
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:294
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
void RemoveAllByteTags()
Remove all byte tags stored in this packet.
Definition: packet.cc:393
RipNgHeader - see RFC 2080
Definition: ripng-header.h:146
std::list< RipNgRte > GetRteList() const
Get the list of the RTEs included in the message.
Helper class that adds RIPng routing to nodes.
Definition: ripng-helper.h:41
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)
Definition: ripng-helper.cc:83
SplitHorizonType_e
Split Horizon strategy type.
Definition: ripng.h:223
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
virtual uint32_t GetRxAvailable() const =0
Return number of bytes which can be returned from one or multiple calls to Recv.
virtual Ptr< Packet > Recv(uint32_t maxSize, uint32_t flags)=0
Read data from the socket.
virtual Ptr< Node > GetNode() const =0
Return the node this socket is associated with.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
encapsulates test code
Definition: test.h:1060
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Definition: test.cc:305
A suite of tests to run.
Definition: test.h:1256
@ UNIT
This test suite implements a Unit Test.
Definition: test.h:1265
API to create UDP socket instances.
#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:144
#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:251
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1338
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:691