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-stack-helper.h"
20#include "ns3/ipv4-address-helper.h"
21#include "ns3/ipv4-global-routing-helper.h"
22#include "ns3/ipv6-address-helper.h"
23#include "ns3/ipv6-global-routing-helper.h"
24#include "ns3/ipv6-route.h"
25#include "ns3/node-container.h"
26#include "ns3/rng-seed-manager.h"
27#include "ns3/simple-net-device-helper.h"
28#include "ns3/simulator.h"
74 void DoRun()
override;
97 std::vector<Ipv4Address>& dests,
98 std::vector<Ipv4Address>& gws);
108 std::vector<Ipv6Address>& dests,
109 std::vector<Ipv6Address>& gws);
112 std::vector<GlobalRoutingLSA<Ipv4Manager>*>
m_lsasv4;
113 std::vector<GlobalRoutingLSA<Ipv6Manager>*>
m_lsasv6;
123 std::vector<Ipv4Address>& dests,
124 std::vector<Ipv4Address>& gws)
127 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
138 std::vector<Ipv6Address>& dests,
139 std::vector<Ipv6Address>& gws)
142 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
177 stack.SetRoutingHelper(globalhelperv4);
178 stack.SetRoutingHelper(globalhelperv6);
179 stack.Install(
nodes);
195 address.SetBase(
"10.1.1.0",
"255.255.255.252");
197 address.SetBase(
"10.1.2.0",
"255.255.255.252");
199 address.SetBase(
"10.1.3.0",
"255.255.255.252");
232 lsa0->SetLinkStateId(
"0.0.0.0");
233 lsa0->SetAdvertisingRouter(
"0.0.0.0");
234 lsa0->SetNode(
nodes.Get(0));
235 lsa0->AddLinkRecord(lr0);
236 lsa0->AddLinkRecord(lr1);
254 lsa1->SetLinkStateId(
"0.0.0.1");
255 lsa1->SetAdvertisingRouter(
"0.0.0.1");
256 lsa1->AddLinkRecord(lr2);
257 lsa1->AddLinkRecord(lr3);
258 lsa1->SetNode(
nodes.Get(1));
300 lsa2->SetLinkStateId(
"0.0.0.2");
301 lsa2->SetAdvertisingRouter(
"0.0.0.2");
302 lsa2->AddLinkRecord(lr4);
303 lsa2->AddLinkRecord(lr5);
304 lsa2->AddLinkRecord(lr6);
305 lsa2->AddLinkRecord(lr7);
306 lsa2->AddLinkRecord(lr8);
307 lsa2->AddLinkRecord(lr9);
308 lsa2->SetNode(
nodes.Get(2));
326 lsa3->SetLinkStateId(
"0.0.0.3");
327 lsa3->SetAdvertisingRouter(
"0.0.0.3");
328 lsa3->AddLinkRecord(lr10);
329 lsa3->AddLinkRecord(lr11);
330 lsa3->SetNode(
nodes.Get(3));
344 "2001:1::200:ff:fe00:1",
345 "fe80::200:ff:fe00:1",
351 prefix.GetBytes(buf);
355 "2001:1::200:ff:fe00:2",
362 lsa0->SetLinkStateId(
"::ffff:0.0.0.0");
363 lsa0->SetAdvertisingRouter(
"::ffff:0.0.0.0");
364 lsa0->SetNode(
nodes.Get(0));
365 lsa0->AddLinkRecord(lr0);
366 lsa0->AddLinkRecord(lr1);
373 "2001:2::200:ff:fe00:3",
374 "fe80::200:ff:fe00:3",
379 "2001:2::200:ff:fe00:4",
386 lsa1->SetLinkStateId(
"::ffff:0.0.0.1");
387 lsa1->SetAdvertisingRouter(
"::ffff:0.0.0.1");
388 lsa1->AddLinkRecord(lr2);
389 lsa1->AddLinkRecord(lr3);
390 lsa1->SetNode(
nodes.Get(1));
397 "2001:1::200:ff:fe00:2",
398 "fe80::200:ff:fe00:2",
403 "2001:1::200:ff:fe00:1",
411 "2001:2::200:ff:fe00:4",
412 "fe80::200:ff:fe00:4",
417 "2001:2::200:ff:fe00:3",
424 "2001:3::200:ff:fe00:5",
425 "fe80::200:ff:fe00:5",
430 "2001:3::200:ff:fe00:6",
436 lsa2->SetLinkStateId(
"::ffff:0.0.0.2");
437 lsa2->SetAdvertisingRouter(
"::ffff:0.0.0.2");
438 lsa2->AddLinkRecord(lr4);
439 lsa2->AddLinkRecord(lr5);
440 lsa2->AddLinkRecord(lr6);
441 lsa2->AddLinkRecord(lr7);
442 lsa2->AddLinkRecord(lr8);
443 lsa2->AddLinkRecord(lr9);
444 lsa2->SetNode(
nodes.Get(2));
451 "2001:3::200:ff:fe00:6",
452 "fe80::200:ff:fe00:6",
457 "2001:3::200:ff:fe00:5",
463 lsa3->SetLinkStateId(
"::ffff:0.0.0.3");
464 lsa3->SetAdvertisingRouter(
"::ffff:0.0.0.3");
465 lsa3->AddLinkRecord(lr10);
466 lsa3->AddLinkRecord(lr11);
467 lsa3->SetNode(
nodes.Get(3));
493 srmlsdb->GetLSA(
m_lsasv4[2]->GetLinkStateId()),
494 "The Ipv4Address is not stored as the link state ID");
501 srm->DebugUseLsdb(srmlsdb);
503 srm->DebugSPFCalculate(
m_lsasv4[0]->GetLinkStateId());
505 srm->DebugSPFCalculate(
m_lsasv4[1]->GetLinkStateId());
507 srm->DebugSPFCalculate(
m_lsasv4[2]->GetLinkStateId());
509 srm->DebugSPFCalculate(
m_lsasv4[3]->GetLinkStateId());
522 srmlsdbv6->GetLSA(
m_lsasv6[2]->GetLinkStateId()),
523 "The Ipv6Address is not stored as the link state ID");
530 srmv6->DebugUseLsdb(srmlsdbv6);
532 srmv6->DebugSPFCalculate(
m_lsasv6[0]->GetLinkStateId());
534 srmv6->DebugSPFCalculate(
m_lsasv6[1]->GetLinkStateId());
536 srmv6->DebugSPFCalculate(
m_lsasv6[2]->GetLinkStateId());
538 srmv6->DebugSPFCalculate(
m_lsasv6[3]->GetLinkStateId());
550 uint32_t nRoutes0 = globalRouting0->GetNRoutes();
554 route = globalRouting0->GetRoute(0);
558 "Error-- wrong destination for default route");
570 uint32_t nRoutes2 = globalRouting2->GetNRoutes();
575 std::vector<Ipv4Address> expecteddests;
576 std::vector<Ipv4Address> expectedgws;
577 expecteddests.emplace_back(
"10.1.1.1");
578 expecteddests.emplace_back(
"10.1.2.1");
579 expecteddests.emplace_back(
"10.1.3.2");
580 expecteddests.emplace_back(
"10.1.1.0");
581 expecteddests.emplace_back(
"10.1.2.0");
582 expecteddests.emplace_back(
"10.1.3.0");
584 expectedgws.emplace_back(
"10.1.1.1");
585 expectedgws.emplace_back(
"10.1.2.1");
586 expectedgws.emplace_back(
"10.1.3.2");
587 expectedgws.emplace_back(
"10.1.1.1");
588 expectedgws.emplace_back(
"10.1.2.1");
589 expectedgws.emplace_back(
"10.1.3.2");
602 "Error-- no Ipv6GlobalRouting object at node 0");
605 uint32_t nRoutes0v6 = globalRouting0v6->GetNRoutes();
609 routev6 = globalRouting0v6->GetRoute(0);
613 "Error-- wrong destination for default route");
616 "Error-- wrong gateway");
626 "Error-- no Ipv6GlobalRouting object at node 2");
629 uint32_t nRoutes2v6 = globalRouting2v6->GetNRoutes();
634 std::vector<Ipv6Address> expecteddestsv6;
635 std::vector<Ipv6Address> expectedgwsv6;
636 expecteddestsv6.emplace_back(
"2001:1::200:ff:fe00:1");
637 expecteddestsv6.emplace_back(
"2001:2::200:ff:fe00:3");
638 expecteddestsv6.emplace_back(
"2001:3::200:ff:fe00:6");
639 expecteddestsv6.emplace_back(
"2001:1::");
640 expecteddestsv6.emplace_back(
"2001:2::");
641 expecteddestsv6.emplace_back(
"2001:3::");
643 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:1");
644 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:3");
645 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:6");
646 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:1");
647 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:3");
648 expectedgwsv6.emplace_back(
"fe80::200:ff:fe00:6");
650 CheckRoutesv6(globalRouting2v6, expecteddestsv6, expectedgwsv6);
678 void DoRun()
override;
696 std::vector<GlobalRoutingLSA<Ipv4Manager>*>
m_lsasv4;
697 std::vector<GlobalRoutingLSA<Ipv6Manager>*>
m_lsasv6;
723 stack.SetRoutingHelper(globalhelperv4);
724 stack.SetRoutingHelper(globalhelperv6);
725 stack.Install(
nodes);
734 address.SetBase(
"10.1.1.0",
"255.255.255.248");
757 lsa0->AddLinkRecord(lr0);
758 lsa0->SetLinkStateId(
"0.0.0.0");
759 lsa0->SetAdvertisingRouter(
"0.0.0.0");
760 lsa0->SetNode(
nodes.Get(0));
771 lsa1->AddLinkRecord(lr1);
772 lsa1->SetLinkStateId(
"0.0.0.1");
773 lsa1->SetAdvertisingRouter(
"0.0.0.1");
774 lsa1->SetNode(
nodes.Get(1));
785 lsa2->AddLinkRecord(lr2);
786 lsa2->SetLinkStateId(
"0.0.0.2");
787 lsa2->SetAdvertisingRouter(
"0.0.0.2");
788 lsa2->SetNode(
nodes.Get(2));
794 lsa0network->SetLinkStateId(
"10.1.1.1");
795 lsa0network->SetAdvertisingRouter(
"0.0.0.0");
796 lsa0network->AddAttachedRouter(
"10.1.1.1");
797 lsa0network->AddAttachedRouter(
"10.1.1.2");
798 lsa0network->AddAttachedRouter(
"10.1.1.3");
799 lsa0network->SetNetworkLSANetworkMask(
"255.255.255.248");
813 "2001:1::200:ff:fe00:1",
814 "2001:1::200:ff:fe00:1",
815 "fe80::200:ff:fe00:1",
820 lsa0->AddLinkRecord(lr0);
821 lsa0->SetLinkStateId(
"::ffff:0.0.0.0");
822 lsa0->SetAdvertisingRouter(
"::ffff:0.0.0.0");
823 lsa0->SetNode(
nodes.Get(0));
829 "2001:1::200:ff:fe00:1",
830 "2001:1::200:ff:fe00:2",
831 "fe80::200:ff:fe00:2",
836 lsa1->AddLinkRecord(lr1);
837 lsa1->SetLinkStateId(
"::ffff:0.0.0.1");
838 lsa1->SetAdvertisingRouter(
"::ffff:0.0.0.1");
839 lsa1->SetNode(
nodes.Get(1));
845 "2001:1::200:ff:fe00:1",
846 "2001:1::200:ff:fe00:3",
847 "fe80::200:ff:fe00:3",
851 lsa2->AddLinkRecord(lr2);
852 lsa2->SetLinkStateId(
"::ffff:0.0.0.2");
853 lsa2->SetAdvertisingRouter(
"::ffff:0.0.0.2");
854 lsa2->SetNode(
nodes.Get(2));
860 lsa0network->SetLinkStateId(
"2001:1::200:ff:fe00:1");
861 lsa0network->SetAdvertisingRouter(
"::ffff:0.0.0.0");
862 lsa0network->AddAttachedRouter(
"2001:1::200:ff:fe00:1");
863 lsa0network->AddAttachedRouter(
"2001:1::200:ff:fe00:2");
864 lsa0network->AddAttachedRouter(
"2001:1::200:ff:fe00:3");
866 lsa0network->SetNetworkLSANetworkMask(
Ipv6Prefix(64));
884 srmv4->DebugUseLsdb(srmlsdb);
886 srmv4->DebugSPFCalculate(
m_lsasv4[0]->GetLinkStateId());
900 srmv6->DebugUseLsdb(srmlsdbv6);
902 srmv6->DebugSPFCalculate(
m_lsasv6[0]->GetLinkStateId());
914 uint32_t nRoutes0 = globalRouting0->GetNRoutes();
919 "Error-- wrong destination for network route");
922 "Error-- wrong gateway for network route");
933 "Error-- no Ipv6GlobalRouting object at node 0");
936 uint32_t nRoutes0v6 = globalRouting0v6->GetNRoutes();
941 "Error-- wrong destination for network route");
944 "Error-- wrong gateway for network route");
970 void DoRun()
override;
1006 std::vector<Ipv4Address>& dests,
1007 std::vector<Ipv4Address>& gws);
1017 std::vector<Ipv6Address>& dests,
1018 std::vector<Ipv6Address>& gws);
1062 stack.SetRoutingHelper(globalhelper);
1063 stack.SetRoutingHelper(globalhelperv6);
1064 stack.Install(
nodes);
1082 address.SetBase(
"10.1.1.0",
"255.255.255.252");
1085 address.SetBase(
"10.1.2.0",
"255.255.255.252");
1088 address.SetBase(
"10.1.3.0",
"255.255.255.252");
1091 address.SetBase(
"10.1.4.0",
"255.255.255.252");
1107 std::vector<Ipv4Address>& dests,
1108 std::vector<Ipv4Address>& gws)
1111 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
1122 std::vector<Ipv6Address>& dests,
1123 std::vector<Ipv6Address>& gws)
1126 for (
uint32_t i = 0; i < globalroutingprotocol->GetNRoutes(); i++)
1138 if (route->GetGateway() ==
Ipv4Address(
"10.1.1.2"))
1142 else if (route->GetGateway() ==
Ipv4Address(
"10.1.2.2"))
1151 if (route->GetGateway() ==
Ipv6Address(
"fe80::200:ff:fe00:2"))
1155 else if (route->GetGateway() ==
Ipv6Address(
"fe80::200:ff:fe00:6"))
1194 lsa0->SetLinkStateId(
"0.0.0.0");
1195 lsa0->SetAdvertisingRouter(
"0.0.0.0");
1196 lsa0->SetNode(
nodes.Get(0));
1197 lsa0->AddLinkRecord(lr0);
1198 lsa0->AddLinkRecord(lr1);
1199 lsa0->AddLinkRecord(lr2);
1200 lsa0->AddLinkRecord(lr3);
1229 lsa1->SetLinkStateId(
"0.0.0.1");
1230 lsa1->SetAdvertisingRouter(
"0.0.0.1");
1231 lsa1->SetNode(
nodes.Get(1));
1232 lsa1->AddLinkRecord(lr4);
1233 lsa1->AddLinkRecord(lr5);
1234 lsa1->AddLinkRecord(lr6);
1235 lsa1->AddLinkRecord(lr7);
1263 lsa2->SetLinkStateId(
"0.0.0.2");
1264 lsa2->SetAdvertisingRouter(
"0.0.0.2");
1265 lsa2->SetNode(
nodes.Get(2));
1266 lsa2->AddLinkRecord(lr8);
1267 lsa2->AddLinkRecord(lr9);
1268 lsa2->AddLinkRecord(lr10);
1269 lsa2->AddLinkRecord(lr11);
1297 lsa3->SetLinkStateId(
"0.0.0.3");
1298 lsa3->SetAdvertisingRouter(
"0.0.0.3");
1299 lsa3->SetNode(
nodes.Get(3));
1300 lsa3->AddLinkRecord(lr12);
1301 lsa3->AddLinkRecord(lr13);
1302 lsa3->AddLinkRecord(lr14);
1303 lsa3->AddLinkRecord(lr15);
1318 "2001:1::200:ff:fe00:1",
1319 "fe80::200:ff:fe00:1",
1324 prefix.GetBytes(buf);
1328 "2001:1::200:ff:fe00:2",
1334 "2001:2::200:ff:fe00:5",
1335 "fe80::200:ff:fe00:5",
1339 "2001:2::200:ff:fe00:6",
1346 lsa0->SetLinkStateId(
"::ffff:0.0.0.0");
1347 lsa0->SetAdvertisingRouter(
"::ffff:0.0.0.0");
1348 lsa0->SetNode(
nodes.Get(0));
1349 lsa0->AddLinkRecord(lr0);
1350 lsa0->AddLinkRecord(lr1);
1351 lsa0->AddLinkRecord(lr2);
1352 lsa0->AddLinkRecord(lr3);
1359 "2001:1::200:ff:fe00:2",
1360 "fe80::200:ff:fe00:2",
1364 "2001:1::200:ff:fe00:1",
1371 "2001:3::200:ff:fe00:7",
1372 "fe80::200:ff:fe00:7",
1376 "2001:3::200:ff:fe00:8",
1383 lsa1->SetLinkStateId(
"::ffff:0.0.0.1");
1384 lsa1->SetAdvertisingRouter(
"::ffff:0.0.0.1");
1385 lsa1->SetNode(
nodes.Get(1));
1386 lsa1->AddLinkRecord(lr4);
1387 lsa1->AddLinkRecord(lr5);
1388 lsa1->AddLinkRecord(lr6);
1389 lsa1->AddLinkRecord(lr7);
1396 "2001:2::200:ff:fe00:6",
1397 "fe80::200:ff:fe00:6",
1401 "2001:2::200:ff:fe00:5",
1407 "2001:4::200:ff:fe00:3",
1408 "fe80::200:ff:fe00:3",
1412 "2001:4::200:ff:fe00:4",
1419 lsa2->SetLinkStateId(
"::ffff:0.0.0.2");
1420 lsa2->SetAdvertisingRouter(
"::ffff:0.0.0.2");
1421 lsa2->SetNode(
nodes.Get(2));
1422 lsa2->AddLinkRecord(lr8);
1423 lsa2->AddLinkRecord(lr9);
1424 lsa2->AddLinkRecord(lr10);
1425 lsa2->AddLinkRecord(lr11);
1432 "2001:3::200:ff:fe00:8",
1433 "fe80::200:ff:fe00:8",
1437 "2001:3::200:ff:fe00:7",
1443 "2001:4::200:ff:fe00:4",
1444 "fe80::200:ff:fe00:4",
1448 "2001:4::200:ff:fe00:3",
1455 lsa3->SetLinkStateId(
"::ffff:0.0.0.3");
1456 lsa3->SetAdvertisingRouter(
"::ffff:0.0.0.3");
1457 lsa3->SetNode(
nodes.Get(3));
1458 lsa3->AddLinkRecord(lr12);
1459 lsa3->AddLinkRecord(lr13);
1460 lsa3->AddLinkRecord(lr14);
1461 lsa3->AddLinkRecord(lr15);
1486 srmv4->DebugUseLsdb(srmlsdbv4);
1489 srmv4->DebugSPFCalculate(
m_lsasv4[0]->GetLinkStateId());
1503 srmv6->DebugUseLsdb(srmlsdbv6);
1505 srmv6->DebugSPFCalculate(
m_lsasv6[0]->GetLinkStateId());
1517 globalRouting0->AssignStreams(0);
1520 uint32_t nRoutes0 = globalRouting0->GetNRoutes();
1524 std::vector<Ipv4Address> expectedDests;
1525 std::vector<Ipv4Address> expectedNextHops;
1532 expectedDests.emplace_back(
"10.1.1.2");
1533 expectedDests.emplace_back(
"10.1.3.1");
1534 expectedDests.emplace_back(
"10.1.2.2");
1535 expectedDests.emplace_back(
"10.1.4.1");
1536 expectedDests.emplace_back(
"10.1.3.2");
1537 expectedDests.emplace_back(
"10.1.3.2");
1538 expectedDests.emplace_back(
"10.1.4.2");
1539 expectedDests.emplace_back(
"10.1.4.2");
1540 expectedDests.emplace_back(
"10.1.1.0");
1541 expectedDests.emplace_back(
"10.1.3.0");
1542 expectedDests.emplace_back(
"10.1.3.0");
1543 expectedDests.emplace_back(
"10.1.4.0");
1544 expectedDests.emplace_back(
"10.1.4.0");
1545 expectedDests.emplace_back(
"10.1.2.0");
1547 expectedNextHops.emplace_back(
"10.1.1.2");
1548 expectedNextHops.emplace_back(
"10.1.1.2");
1549 expectedNextHops.emplace_back(
"10.1.2.2");
1550 expectedNextHops.emplace_back(
"10.1.2.2");
1551 expectedNextHops.emplace_back(
"10.1.1.2");
1552 expectedNextHops.emplace_back(
"10.1.2.2");
1553 expectedNextHops.emplace_back(
"10.1.1.2");
1554 expectedNextHops.emplace_back(
"10.1.2.2");
1555 expectedNextHops.emplace_back(
"10.1.1.2");
1556 expectedNextHops.emplace_back(
"10.1.1.2");
1557 expectedNextHops.emplace_back(
"10.1.2.2");
1558 expectedNextHops.emplace_back(
"10.1.1.2");
1559 expectedNextHops.emplace_back(
"10.1.2.2");
1560 expectedNextHops.emplace_back(
"10.1.2.2");
1563 CheckRoutesv4(globalRouting0, expectedDests, expectedNextHops);
1579 Ptr<Ipv4Route> route = globalRouting0->RouteOutput(packetv6, ipHeader, oif, errno_);
1592 "Error-- no Ipv6GlobalRouting object at node 0");
1595 globalRouting0v6->AssignStreams(0);
1597 uint32_t nRoutes0v6 = globalRouting0v6->GetNRoutes();
1601 std::vector<Ipv6Address> expectedDestsv6;
1602 std::vector<Ipv6Address> expectedNextHopsv6;
1609 expectedDestsv6.emplace_back(
"2001:1::200:ff:fe00:2");
1610 expectedDestsv6.emplace_back(
"2001:3::200:ff:fe00:7");
1611 expectedDestsv6.emplace_back(
"2001:2::200:ff:fe00:6");
1612 expectedDestsv6.emplace_back(
"2001:4::200:ff:fe00:3");
1613 expectedDestsv6.emplace_back(
"2001:3::200:ff:fe00:8");
1614 expectedDestsv6.emplace_back(
"2001:3::200:ff:fe00:8");
1615 expectedDestsv6.emplace_back(
"2001:4::200:ff:fe00:4");
1616 expectedDestsv6.emplace_back(
"2001:4::200:ff:fe00:4");
1617 expectedDestsv6.emplace_back(
"2001:1::");
1618 expectedDestsv6.emplace_back(
"2001:3::");
1619 expectedDestsv6.emplace_back(
"2001:3::");
1620 expectedDestsv6.emplace_back(
"2001:4::");
1621 expectedDestsv6.emplace_back(
"2001:4::");
1622 expectedDestsv6.emplace_back(
"2001:2::");
1624 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1625 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1626 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1627 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1628 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1629 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1630 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1631 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1632 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1633 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1634 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1635 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:2");
1636 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1637 expectedNextHopsv6.emplace_back(
"fe80::200:ff:fe00:6");
1639 CheckRoutesv6(globalRouting0v6, expectedDestsv6, expectedNextHopsv6);
1653 Ptr<Ipv6Route> route = globalRouting0v6->RouteOutput(packet, ipHeaderv6, oif, errno_);
1662 "The routing path for node 0 to node 3 does not match the expected output, "
1663 "Equal Cost MultiPath (ECMP) routes are not being used correctly for ipv4");
1667 "The routing path for node 0 to node 3 does not match the expected output, "
1668 "Equal Cost MultiPath (ECMP) routes are not being used correctly for ipv4");
1673 "The routing path for node 0 to node 3 does not match the expected output, "
1674 "Equal Cost MultiPath (ECMP) routes are not being used correctly for ipv6");
1678 "The routing path for node 0 to node 3 does not match the expected output, "
1679 "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.
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.