15#include "ns3/candidate-queue.h"
16#include "ns3/config.h"
17#include "ns3/global-route-manager-impl.h"
18#include "ns3/global-routing.h"
19#include "ns3/internet-module.h"
20#include "ns3/internet-stack-helper.h"
21#include "ns3/ipv4-global-routing-helper.h"
22#include "ns3/ipv6-global-routing-helper.h"
23#include "ns3/network-module.h"
24#include "ns3/node-container.h"
25#include "ns3/rng-seed-manager.h"
26#include "ns3/simple-net-device-helper.h"
27#include "ns3/simulator.h"
73 void DoRun()
override;
96 std::vector<Ipv4Address>& dests,
97 std::vector<Ipv4Address>& gws);
107 std::vector<Ipv6Address>& dests,
108 std::vector<Ipv6Address>& gws);
111 std::vector<GlobalRoutingLSA<Ipv4Manager>*>
m_lsasv4;
112 std::vector<GlobalRoutingLSA<Ipv6Manager>*>
m_lsasv6;
122 std::vector<Ipv4Address>& dests,
123 std::vector<Ipv4Address>& gws)
126 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
137 std::vector<Ipv6Address>& dests,
138 std::vector<Ipv6Address>& gws)
141 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
176 stack.SetRoutingHelper(globalhelperv4);
177 stack.SetRoutingHelper(globalhelperv6);
178 stack.Install(
nodes);
194 address.SetBase(
"10.1.1.0",
"255.255.255.252");
196 address.SetBase(
"10.1.2.0",
"255.255.255.252");
198 address.SetBase(
"10.1.3.0",
"255.255.255.252");
231 lsa0->SetLinkStateId(
"0.0.0.0");
232 lsa0->SetAdvertisingRouter(
"0.0.0.0");
233 lsa0->SetNode(
nodes.Get(0));
234 lsa0->AddLinkRecord(lr0);
235 lsa0->AddLinkRecord(lr1);
253 lsa1->SetLinkStateId(
"0.0.0.1");
254 lsa1->SetAdvertisingRouter(
"0.0.0.1");
255 lsa1->AddLinkRecord(lr2);
256 lsa1->AddLinkRecord(lr3);
257 lsa1->SetNode(
nodes.Get(1));
299 lsa2->SetLinkStateId(
"0.0.0.2");
300 lsa2->SetAdvertisingRouter(
"0.0.0.2");
301 lsa2->AddLinkRecord(lr4);
302 lsa2->AddLinkRecord(lr5);
303 lsa2->AddLinkRecord(lr6);
304 lsa2->AddLinkRecord(lr7);
305 lsa2->AddLinkRecord(lr8);
306 lsa2->AddLinkRecord(lr9);
307 lsa2->SetNode(
nodes.Get(2));
325 lsa3->SetLinkStateId(
"0.0.0.3");
326 lsa3->SetAdvertisingRouter(
"0.0.0.3");
327 lsa3->AddLinkRecord(lr10);
328 lsa3->AddLinkRecord(lr11);
329 lsa3->SetNode(
nodes.Get(3));
343 "2001:1::200:ff:fe00:1",
344 "fe80::200:ff:fe00:1",
350 prefix.GetBytes(buf);
354 "2001:1::200:ff:fe00:2",
361 lsa0->SetLinkStateId(
"::ffff:0.0.0.0");
362 lsa0->SetAdvertisingRouter(
"::ffff:0.0.0.0");
363 lsa0->SetNode(
nodes.Get(0));
364 lsa0->AddLinkRecord(lr0);
365 lsa0->AddLinkRecord(lr1);
372 "2001:2::200:ff:fe00:3",
373 "fe80::200:ff:fe00:3",
378 "2001:2::200:ff:fe00:4",
385 lsa1->SetLinkStateId(
"::ffff:0.0.0.1");
386 lsa1->SetAdvertisingRouter(
"::ffff:0.0.0.1");
387 lsa1->AddLinkRecord(lr2);
388 lsa1->AddLinkRecord(lr3);
389 lsa1->SetNode(
nodes.Get(1));
396 "2001:1::200:ff:fe00:2",
397 "fe80::200:ff:fe00:2",
402 "2001:1::200:ff:fe00:1",
410 "2001:2::200:ff:fe00:4",
411 "fe80::200:ff:fe00:4",
416 "2001:2::200:ff:fe00:3",
423 "2001:3::200:ff:fe00:5",
424 "fe80::200:ff:fe00:5",
429 "2001:3::200:ff:fe00:6",
435 lsa2->SetLinkStateId(
"::ffff:0.0.0.2");
436 lsa2->SetAdvertisingRouter(
"::ffff:0.0.0.2");
437 lsa2->AddLinkRecord(lr4);
438 lsa2->AddLinkRecord(lr5);
439 lsa2->AddLinkRecord(lr6);
440 lsa2->AddLinkRecord(lr7);
441 lsa2->AddLinkRecord(lr8);
442 lsa2->AddLinkRecord(lr9);
443 lsa2->SetNode(
nodes.Get(2));
450 "2001:3::200:ff:fe00:6",
451 "fe80::200:ff:fe00:6",
456 "2001:3::200:ff:fe00:5",
462 lsa3->SetLinkStateId(
"::ffff:0.0.0.3");
463 lsa3->SetAdvertisingRouter(
"::ffff:0.0.0.3");
464 lsa3->AddLinkRecord(lr10);
465 lsa3->AddLinkRecord(lr11);
466 lsa3->SetNode(
nodes.Get(3));
492 srmlsdb->GetLSA(
m_lsasv4[2]->GetLinkStateId()),
493 "The Ipv4Address is not stored as the link state ID");
500 srm->DebugUseLsdb(srmlsdb);
502 srm->DebugSPFCalculate(
m_lsasv4[0]->GetLinkStateId());
504 srm->DebugSPFCalculate(
m_lsasv4[1]->GetLinkStateId());
506 srm->DebugSPFCalculate(
m_lsasv4[2]->GetLinkStateId());
508 srm->DebugSPFCalculate(
m_lsasv4[3]->GetLinkStateId());
521 srmlsdbv6->GetLSA(
m_lsasv6[2]->GetLinkStateId()),
522 "The Ipv6Address is not stored as the link state ID");
529 srmv6->DebugUseLsdb(srmlsdbv6);
531 srmv6->DebugSPFCalculate(
m_lsasv6[0]->GetLinkStateId());
533 srmv6->DebugSPFCalculate(
m_lsasv6[1]->GetLinkStateId());
535 srmv6->DebugSPFCalculate(
m_lsasv6[2]->GetLinkStateId());
537 srmv6->DebugSPFCalculate(
m_lsasv6[3]->GetLinkStateId());
549 uint32_t nRoutes0 = globalRouting0->GetNRoutes();
553 route = globalRouting0->GetRoute(0);
557 "Error-- wrong destination for default route");
569 uint32_t nRoutes2 = globalRouting2->GetNRoutes();
574 std::vector<Ipv4Address> expecteddests;
575 std::vector<Ipv4Address> expectedgws;
576 expecteddests.emplace_back(
"10.1.1.1");
577 expecteddests.emplace_back(
"10.1.2.1");
578 expecteddests.emplace_back(
"10.1.3.2");
579 expecteddests.emplace_back(
"10.1.1.0");
580 expecteddests.emplace_back(
"10.1.2.0");
581 expecteddests.emplace_back(
"10.1.3.0");
583 expectedgws.emplace_back(
"10.1.1.1");
584 expectedgws.emplace_back(
"10.1.2.1");
585 expectedgws.emplace_back(
"10.1.3.2");
586 expectedgws.emplace_back(
"10.1.1.1");
587 expectedgws.emplace_back(
"10.1.2.1");
588 expectedgws.emplace_back(
"10.1.3.2");
601 "Error-- no Ipv6GlobalRouting object at node 0");
604 uint32_t nRoutes0v6 = globalRouting0v6->GetNRoutes();
608 routev6 = globalRouting0v6->GetRoute(0);
612 "Error-- wrong destination for default route");
615 "Error-- wrong gateway");
625 "Error-- no Ipv6GlobalRouting object at node 2");
628 uint32_t nRoutes2v6 = globalRouting2v6->GetNRoutes();
633 std::vector<Ipv6Address> expecteddestsv6;
634 std::vector<Ipv6Address> expectedgwsv6;
635 expecteddestsv6.emplace_back(
"2001:1::200:ff:fe00:1");
636 expecteddestsv6.emplace_back(
"2001:2::200:ff:fe00:3");
637 expecteddestsv6.emplace_back(
"2001:3::200:ff:fe00:6");
638 expecteddestsv6.emplace_back(
"2001:1::");
639 expecteddestsv6.emplace_back(
"2001:2::");
640 expecteddestsv6.emplace_back(
"2001:3::");
642 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:1");
643 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:3");
644 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:6");
645 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:1");
646 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:3");
647 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:6");
649 CheckRoutesv6(globalRouting2v6, expecteddestsv6, expectedgwsv6);
677 void DoRun()
override;
695 std::vector<GlobalRoutingLSA<Ipv4Manager>*>
m_lsasv4;
696 std::vector<GlobalRoutingLSA<Ipv6Manager>*>
m_lsasv6;
722 stack.SetRoutingHelper(globalhelperv4);
723 stack.SetRoutingHelper(globalhelperv6);
724 stack.Install(
nodes);
733 address.SetBase(
"10.1.1.0",
"255.255.255.248");
756 lsa0->AddLinkRecord(lr0);
757 lsa0->SetLinkStateId(
"0.0.0.0");
758 lsa0->SetAdvertisingRouter(
"0.0.0.0");
759 lsa0->SetNode(
nodes.Get(0));
770 lsa1->AddLinkRecord(lr1);
771 lsa1->SetLinkStateId(
"0.0.0.1");
772 lsa1->SetAdvertisingRouter(
"0.0.0.1");
773 lsa1->SetNode(
nodes.Get(1));
784 lsa2->AddLinkRecord(lr2);
785 lsa2->SetLinkStateId(
"0.0.0.2");
786 lsa2->SetAdvertisingRouter(
"0.0.0.2");
787 lsa2->SetNode(
nodes.Get(2));
793 lsa0network->SetLinkStateId(
"10.1.1.1");
794 lsa0network->SetAdvertisingRouter(
"0.0.0.0");
795 lsa0network->AddAttachedRouter(
"10.1.1.1");
796 lsa0network->AddAttachedRouter(
"10.1.1.2");
797 lsa0network->AddAttachedRouter(
"10.1.1.3");
798 lsa0network->SetNetworkLSANetworkMask(
"255.255.255.248");
812 "2001:1::200:ff:fe00:1",
813 "2001:1::200:ff:fe00:1",
814 "fe80::200:ff:fe00:1",
819 lsa0->AddLinkRecord(lr0);
820 lsa0->SetLinkStateId(
"::ffff:0.0.0.0");
821 lsa0->SetAdvertisingRouter(
"::ffff:0.0.0.0");
822 lsa0->SetNode(
nodes.Get(0));
828 "2001:1::200:ff:fe00:1",
829 "2001:1::200:ff:fe00:2",
830 "fe80::200:ff:fe00:2",
835 lsa1->AddLinkRecord(lr1);
836 lsa1->SetLinkStateId(
"::ffff:0.0.0.1");
837 lsa1->SetAdvertisingRouter(
"::ffff:0.0.0.1");
838 lsa1->SetNode(
nodes.Get(1));
844 "2001:1::200:ff:fe00:1",
845 "2001:1::200:ff:fe00:3",
846 "fe80::200:ff:fe00:3",
850 lsa2->AddLinkRecord(lr2);
851 lsa2->SetLinkStateId(
"::ffff:0.0.0.2");
852 lsa2->SetAdvertisingRouter(
"::ffff:0.0.0.2");
853 lsa2->SetNode(
nodes.Get(2));
859 lsa0network->SetLinkStateId(
"2001:1::200:ff:fe00:1");
860 lsa0network->SetAdvertisingRouter(
"::ffff:0.0.0.0");
861 lsa0network->AddAttachedRouter(
"2001:1::200:ff:fe00:1");
862 lsa0network->AddAttachedRouter(
"2001:1::200:ff:fe00:2");
863 lsa0network->AddAttachedRouter(
"2001:1::200:ff:fe00:3");
865 lsa0network->SetNetworkLSANetworkMask(
Ipv6Prefix(64));
883 srmv4->DebugUseLsdb(srmlsdb);
885 srmv4->DebugSPFCalculate(
m_lsasv4[0]->GetLinkStateId());
899 srmv6->DebugUseLsdb(srmlsdbv6);
901 srmv6->DebugSPFCalculate(
m_lsasv6[0]->GetLinkStateId());
913 uint32_t nRoutes0 = globalRouting0->GetNRoutes();
918 "Error-- wrong destination for network route");
921 "Error-- wrong gateway for network route");
932 "Error-- no Ipv6GlobalRouting object at node 0");
935 uint32_t nRoutes0v6 = globalRouting0v6->GetNRoutes();
940 "Error-- wrong destination for network route");
943 "Error-- wrong gateway for network route");
969 void DoRun()
override;
1005 std::vector<Ipv4Address>& dests,
1006 std::vector<Ipv4Address>& gws);
1016 std::vector<Ipv6Address>& dests,
1017 std::vector<Ipv6Address>& gws);
1061 stack.SetRoutingHelper(globalhelper);
1062 stack.SetRoutingHelper(globalhelperv6);
1063 stack.Install(
nodes);
1081 address.SetBase(
"10.1.1.0",
"255.255.255.252");
1084 address.SetBase(
"10.1.2.0",
"255.255.255.252");
1087 address.SetBase(
"10.1.3.0",
"255.255.255.252");
1090 address.SetBase(
"10.1.4.0",
"255.255.255.252");
1106 std::vector<Ipv4Address>& dests,
1107 std::vector<Ipv4Address>& gws)
1110 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
1121 std::vector<Ipv6Address>& dests,
1122 std::vector<Ipv6Address>& gws)
1125 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
1137 if (route->GetGateway() ==
Ipv4Address(
"10.1.1.2"))
1141 else if (route->GetGateway() ==
Ipv4Address(
"10.1.2.2"))
1150 if (route->GetGateway() ==
Ipv6Address(
"fe80::200:ff:fe00:2"))
1154 else if (route->GetGateway() ==
Ipv6Address(
"fe80::200:ff:fe00:6"))
1193 lsa0->SetLinkStateId(
"0.0.0.0");
1194 lsa0->SetAdvertisingRouter(
"0.0.0.0");
1195 lsa0->SetNode(
nodes.Get(0));
1196 lsa0->AddLinkRecord(lr0);
1197 lsa0->AddLinkRecord(lr1);
1198 lsa0->AddLinkRecord(lr2);
1199 lsa0->AddLinkRecord(lr3);
1228 lsa1->SetLinkStateId(
"0.0.0.1");
1229 lsa1->SetAdvertisingRouter(
"0.0.0.1");
1230 lsa1->SetNode(
nodes.Get(1));
1231 lsa1->AddLinkRecord(lr4);
1232 lsa1->AddLinkRecord(lr5);
1233 lsa1->AddLinkRecord(lr6);
1234 lsa1->AddLinkRecord(lr7);
1262 lsa2->SetLinkStateId(
"0.0.0.2");
1263 lsa2->SetAdvertisingRouter(
"0.0.0.2");
1264 lsa2->SetNode(
nodes.Get(2));
1265 lsa2->AddLinkRecord(lr8);
1266 lsa2->AddLinkRecord(lr9);
1267 lsa2->AddLinkRecord(lr10);
1268 lsa2->AddLinkRecord(lr11);
1296 lsa3->SetLinkStateId(
"0.0.0.3");
1297 lsa3->SetAdvertisingRouter(
"0.0.0.3");
1298 lsa3->SetNode(
nodes.Get(3));
1299 lsa3->AddLinkRecord(lr12);
1300 lsa3->AddLinkRecord(lr13);
1301 lsa3->AddLinkRecord(lr14);
1302 lsa3->AddLinkRecord(lr15);
1317 "2001:1::200:ff:fe00:1",
1318 "fe80::200:ff:fe00:1",
1323 prefix.GetBytes(buf);
1327 "2001:1::200:ff:fe00:2",
1333 "2001:2::200:ff:fe00:5",
1334 "fe80::200:ff:fe00:5",
1338 "2001:2::200:ff:fe00:6",
1345 lsa0->SetLinkStateId(
"::ffff:0.0.0.0");
1346 lsa0->SetAdvertisingRouter(
"::ffff:0.0.0.0");
1347 lsa0->SetNode(
nodes.Get(0));
1348 lsa0->AddLinkRecord(lr0);
1349 lsa0->AddLinkRecord(lr1);
1350 lsa0->AddLinkRecord(lr2);
1351 lsa0->AddLinkRecord(lr3);
1358 "2001:1::200:ff:fe00:2",
1359 "fe80::200:ff:fe00:2",
1363 "2001:1::200:ff:fe00:1",
1370 "2001:3::200:ff:fe00:7",
1371 "fe80::200:ff:fe00:7",
1375 "2001:3::200:ff:fe00:8",
1382 lsa1->SetLinkStateId(
"::ffff:0.0.0.1");
1383 lsa1->SetAdvertisingRouter(
"::ffff:0.0.0.1");
1384 lsa1->SetNode(
nodes.Get(1));
1385 lsa1->AddLinkRecord(lr4);
1386 lsa1->AddLinkRecord(lr5);
1387 lsa1->AddLinkRecord(lr6);
1388 lsa1->AddLinkRecord(lr7);
1395 "2001:2::200:ff:fe00:6",
1396 "fe80::200:ff:fe00:6",
1400 "2001:2::200:ff:fe00:5",
1406 "2001:4::200:ff:fe00:3",
1407 "fe80::200:ff:fe00:3",
1411 "2001:4::200:ff:fe00:4",
1418 lsa2->SetLinkStateId(
"::ffff:0.0.0.2");
1419 lsa2->SetAdvertisingRouter(
"::ffff:0.0.0.2");
1420 lsa2->SetNode(
nodes.Get(2));
1421 lsa2->AddLinkRecord(lr8);
1422 lsa2->AddLinkRecord(lr9);
1423 lsa2->AddLinkRecord(lr10);
1424 lsa2->AddLinkRecord(lr11);
1431 "2001:3::200:ff:fe00:8",
1432 "fe80::200:ff:fe00:8",
1436 "2001:3::200:ff:fe00:7",
1442 "2001:4::200:ff:fe00:4",
1443 "fe80::200:ff:fe00:4",
1447 "2001:4::200:ff:fe00:3",
1454 lsa3->SetLinkStateId(
"::ffff:0.0.0.3");
1455 lsa3->SetAdvertisingRouter(
"::ffff:0.0.0.3");
1456 lsa3->SetNode(
nodes.Get(3));
1457 lsa3->AddLinkRecord(lr12);
1458 lsa3->AddLinkRecord(lr13);
1459 lsa3->AddLinkRecord(lr14);
1460 lsa3->AddLinkRecord(lr15);
1485 srmv4->DebugUseLsdb(srmlsdbv4);
1488 srmv4->DebugSPFCalculate(
m_lsasv4[0]->GetLinkStateId());
1502 srmv6->DebugUseLsdb(srmlsdbv6);
1504 srmv6->DebugSPFCalculate(
m_lsasv6[0]->GetLinkStateId());
1516 globalRouting0->AssignStreams(0);
1519 uint32_t nRoutes0 = globalRouting0->GetNRoutes();
1523 std::vector<Ipv4Address> expectedDests;
1524 std::vector<Ipv4Address> expectedNextHops;
1531 expectedDests.emplace_back(
"10.1.1.2");
1532 expectedDests.emplace_back(
"10.1.3.1");
1533 expectedDests.emplace_back(
"10.1.2.2");
1534 expectedDests.emplace_back(
"10.1.4.1");
1535 expectedDests.emplace_back(
"10.1.3.2");
1536 expectedDests.emplace_back(
"10.1.3.2");
1537 expectedDests.emplace_back(
"10.1.4.2");
1538 expectedDests.emplace_back(
"10.1.4.2");
1539 expectedDests.emplace_back(
"10.1.1.0");
1540 expectedDests.emplace_back(
"10.1.3.0");
1541 expectedDests.emplace_back(
"10.1.3.0");
1542 expectedDests.emplace_back(
"10.1.4.0");
1543 expectedDests.emplace_back(
"10.1.4.0");
1544 expectedDests.emplace_back(
"10.1.2.0");
1546 expectedNextHops.emplace_back(
"10.1.1.2");
1547 expectedNextHops.emplace_back(
"10.1.1.2");
1548 expectedNextHops.emplace_back(
"10.1.2.2");
1549 expectedNextHops.emplace_back(
"10.1.2.2");
1550 expectedNextHops.emplace_back(
"10.1.1.2");
1551 expectedNextHops.emplace_back(
"10.1.2.2");
1552 expectedNextHops.emplace_back(
"10.1.1.2");
1553 expectedNextHops.emplace_back(
"10.1.2.2");
1554 expectedNextHops.emplace_back(
"10.1.1.2");
1555 expectedNextHops.emplace_back(
"10.1.1.2");
1556 expectedNextHops.emplace_back(
"10.1.2.2");
1557 expectedNextHops.emplace_back(
"10.1.1.2");
1558 expectedNextHops.emplace_back(
"10.1.2.2");
1559 expectedNextHops.emplace_back(
"10.1.2.2");
1562 CheckRoutesv4(globalRouting0, expectedDests, expectedNextHops);
1578 Ptr<Ipv4Route> route = globalRouting0->RouteOutput(packetv6, ipHeader, oif, errno_);
1591 "Error-- no Ipv6GlobalRouting object at node 0");
1594 globalRouting0v6->AssignStreams(0);
1596 uint32_t nRoutes0v6 = globalRouting0v6->GetNRoutes();
1600 std::vector<Ipv6Address> expectedDestsv6;
1601 std::vector<Ipv6Address> expectedNextHopsv6;
1608 expectedDestsv6.emplace_back(
"2001:1::200:ff:fe00:2");
1609 expectedDestsv6.emplace_back(
"2001:3::200:ff:fe00:7");
1610 expectedDestsv6.emplace_back(
"2001:2::200:ff:fe00:6");
1611 expectedDestsv6.emplace_back(
"2001:4::200:ff:fe00:3");
1612 expectedDestsv6.emplace_back(
"2001:3::200:ff:fe00:8");
1613 expectedDestsv6.emplace_back(
"2001:3::200:ff:fe00:8");
1614 expectedDestsv6.emplace_back(
"2001:4::200:ff:fe00:4");
1615 expectedDestsv6.emplace_back(
"2001:4::200:ff:fe00:4");
1616 expectedDestsv6.emplace_back(
"2001:1::");
1617 expectedDestsv6.emplace_back(
"2001:3::");
1618 expectedDestsv6.emplace_back(
"2001:3::");
1619 expectedDestsv6.emplace_back(
"2001:4::");
1620 expectedDestsv6.emplace_back(
"2001:4::");
1621 expectedDestsv6.emplace_back(
"2001:2::");
1623 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1624 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1625 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1626 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1627 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1628 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1629 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1630 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1631 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1632 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1633 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1634 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1635 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1636 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1638 CheckRoutesv6(globalRouting0v6, expectedDestsv6, expectedNextHopsv6);
1652 Ptr<Ipv6Route> route = globalRouting0v6->RouteOutput(packet, ipHeaderv6, oif, errno_);
1661 "The routing path for node 0 to node 3 does not match the expected output, "
1662 "Equal Cost MultiPath (ECMP) routes are not being used correctly for ipv4");
1666 "The routing path for node 0 to node 3 does not match the expected output, "
1667 "Equal Cost MultiPath (ECMP) routes are not being used correctly for ipv4");
1672 "The routing path for node 0 to node 3 does not match the expected output, "
1673 "Equal Cost MultiPath (ECMP) routes are not being used correctly for ipv6");
1677 "The routing path for node 0 to node 3 does not match the expected output, "
1678 "Equal Cost MultiPath (ECMP) routes are not being used correctly for ipv6");
Global Route Manager TestSuite.
GlobalRouteManagerImplTestSuite()
This test case is to check if NetworkRoutes are being built correctly, i.e if route computation works...
std::vector< GlobalRoutingLSA< Ipv6Manager > * > m_lsasv6
The ipv6 LSAs for the topology.
void DoRun() override
Implementation to actually run this TestCase.
void BuildLsav6()
Builds the ipv6 LSAs for the topology.
NodeContainer nodes
NodeContainer to hold the nodes in the topology.
std::vector< GlobalRoutingLSA< Ipv4Manager > * > m_lsasv4
The ipv4 LSAs for the topology.
void BuildLsav4()
Builds the ipv4 LSAs for the topology.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
Global Route Manager Test.
NodeContainer nodes
NodeContainer to hold the nodes in the topology.
void BuildLsav6()
Builds the LSAs for the topology.
std::vector< GlobalRoutingLSA< Ipv4Manager > * > m_lsasv4
The LSAs for the topology.
void CheckRoutesv6(Ptr< Ipv6GlobalRouting > &globalroutingprotocol, std::vector< Ipv6Address > &dests, std::vector< Ipv6Address > &gws)
Checks the Routing Table Entries for the expected output.
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void CheckRoutesv4(Ptr< Ipv4GlobalRouting > &globalroutingprotocol, std::vector< Ipv4Address > &dests, std::vector< Ipv4Address > &gws)
Checks the Routing Table Entries for the expected output.
std::vector< GlobalRoutingLSA< Ipv6Manager > * > m_lsasv6
The LSAs for the topology.
void DoRun() override
Implementation to actually run this TestCase.
void BuildLsav4()
Builds the LSAs for the topology.
The purpose of this test is to check if Equal Cost MultiPath (ECMP) Routes are being built and used c...
void DoSetup() override
Implementation to do any local setup required for this TestCase.
void IncrementCountv4(Ptr< Ipv4Route > &route)
Helper function that checks the output of the routing path and increments the corresponding route cou...
std::vector< GlobalRoutingLSA< Ipv6Manager > * > m_lsasv6
The LSAs for the topology.
void IncrementCountv6(Ptr< Ipv6Route > &route)
Helper function that checks the output of the routing path and increments the corresponding route cou...
uint32_t route2v6
Counter to keep track of the number of times route2 is used for ipv6.
void CheckRoutesv4(Ptr< Ipv4GlobalRouting > &globalroutingprotocol, std::vector< Ipv4Address > &dests, std::vector< Ipv4Address > &gws)
function that checks the routing table entries for the expected output.
NodeContainer nodes
NodeContainer to hold the nodes in the topology.
std::vector< GlobalRoutingLSA< Ipv4Manager > * > m_lsasv4
The LSAs for the topology.
uint32_t route1v6
Counter to keep track of the number of times route1 is used for ipv6.
void DoRun() override
Implementation to actually run this TestCase.
uint32_t route2v4
Counter to keep track of the number of times route2 is used for ipv4.
void BuildLsav4()
Builds the LSAs for the topology.
void CheckRoutesv6(Ptr< Ipv6GlobalRouting > &globalroutingprotocol, std::vector< Ipv6Address > &dests, std::vector< Ipv6Address > &gws)
function that checks the routing table entries for the expected output.
uint32_t route1v4
Counter to keep track of the number of times route1 is used for ipv4.
void BuildLsav6()
Builds the LSAs for the topology.
AttributeValue implementation for Boolean.
static void ResetRouterId()
Reset the router ID counter to zero.
A global router implementation.
The Link State DataBase (LSDB) of the Global Route Manager.
a Link State Advertisement (LSA) for a router, used in global routing.
@ LSA_SPF_NOT_EXPLORED
New vertex not yet considered.
A single link record for a link state advertisement.
@ StubNetwork
Record represents a leaf node network.
@ PointToPoint
Record representing a point to point channel.
@ TransitNetwork
Unused – for future OSPF compatibility.
aggregate IP/TCP/UDP functionality to existing Nodes.
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
Ipv4 addresses are stored in host order in this class.
Helper class that adds ns3::Ipv4GlobalRouting objects.
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Implement the IPv4 layer.
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
Ipv4Address GetDest() const
Ipv4Address GetGateway() const
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.
Ipv6InterfaceContainer Assign(const NetDeviceContainer &c)
Allocate an Ipv6InterfaceContainer with auto-assigned addresses.
Describes an IPv6 address.
Helper class that adds ns3::Ipv4GlobalRouting objects.
Keep track of a set of IPv6 interfaces.
IPv6 layer implementation.
Describes an IPv6 prefix.
A record of an IPv6 route.
Ipv6Address GetDest() const
Get the destination.
Ipv6Address GetGateway() const
Get the gateway.
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.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static uint64_t GetRun()
Get the current run number.
static uint32_t GetSeed()
Get the current seed value which will be used by all subsequently instantiated RandomVariableStream o...
build a set of SimpleNetDevice objects
void SetNetDevicePointToPointMode(bool pointToPointMode)
SimpleNetDevice is Broadcast capable and ARP needing.
NetDeviceContainer Install(Ptr< Node > node) const
This method creates an ns3::SimpleChannel with the attributes configured by SimpleNetDeviceHelper::Se...
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
SocketErrno
Enumeration of the possible errors returned by a socket.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
TestCase(const TestCase &)=delete
Caller graph was not generated because of its size.
TestSuite(std::string name, Type type=Type::UNIT)
Construct a new test suite.
static GlobalRouteManagerImplTestSuite g_globalRoutingManagerImplTestSuite
Static variable for test initialization.
void SetDefault(std::string name, const AttributeValue &value)
GlobalRouting< Ipv4RoutingProtocol > Ipv4GlobalRouting
Create the typedef Ipv4GlobalRouting with T as Ipv4RoutingProtocol.
GlobalRouting< Ipv6RoutingProtocol > Ipv6GlobalRouting
Create the typedef Ipv6GlobalRouting with T as Ipv6RoutingProtocol.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
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_ASSERT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_GT_OR_EQ(actual, limit, msg)
Test that an actual value is greater than or equal to a limit and report and abort 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.