A global router implementation. More...
#include <global-route-manager-impl.h>
Public Member Functions | |
GlobalRouteManagerImpl () | |
virtual | ~GlobalRouteManagerImpl () |
virtual void | BuildGlobalRoutingDatabase () |
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRouter interface. | |
void | DebugSPFCalculate (Ipv4Address root) |
Debugging routine; call the core SPF from the unit tests. | |
void | DebugUseLsdb (GlobalRouteManagerLSDB *) |
Debugging routine; allow client code to supply a pre-built LSDB. | |
virtual void | DeleteGlobalRoutes () |
Delete all static routes on all nodes that have a GlobalRouterInterface. | |
virtual void | InitializeRoutes () |
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables. |
Private Attributes | |
GlobalRouteManagerLSDB * | m_lsdb |
SPFVertex * | m_spfroot |
A global router implementation.
This singleton object can query interface each node in the system for a GlobalRouter interface. For those nodes, it fetches one or more Link State Advertisements and stores them in a local database. Then, it can compute shortest paths on a per-node basis to all routers, and finally configure each of the node's forwarding tables.
The design is guided by OSPFv2 RFC 2328 section 16.1.1 and quagga ospfd.
Definition at line 700 of file global-route-manager-impl.h.
ns3::GlobalRouteManagerImpl::GlobalRouteManagerImpl | ( | ) |
Definition at line 528 of file global-route-manager-impl.cc.
References m_lsdb, and NS_LOG_FUNCTION_NOARGS.
|
virtual |
Definition at line 536 of file global-route-manager-impl.cc.
References m_lsdb, and NS_LOG_FUNCTION_NOARGS.
|
private |
GlobalRouteManagerImpl copy construction is disallowed. There's no need for it and a compiler provided shallow copy would be wrong.
|
virtual |
Build the routing database by gathering Link State Advertisements from each node exporting a GlobalRouter interface.
Definition at line 601 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::Object::GetObject(), ns3::GlobalRouteManagerLSDB::Insert(), m_lsdb, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
|
private |
Definition at line 1245 of file global-route-manager-impl.cc.
References ns3::Ipv4GlobalRouting::AddNetworkRouteTo(), FindOutgoingInterfaceId(), ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::GlobalRoutingLinkRecord::GetLinkId(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::GlobalRoutingLinkRecord::GetLinkType(), ns3::GlobalRouteManagerLSDB::GetLSA(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::GlobalRoutingLSA::GetNode(), ns3::Object::GetObject(), m_lsdb, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, NS_LOG_WARN, ns3::GlobalRoutingLinkRecord::PointToPoint, and ns3::GlobalRoutingLinkRecord::TransitNetwork.
Referenced by SPFCalculate().
void ns3::GlobalRouteManagerImpl::DebugSPFCalculate | ( | Ipv4Address | root | ) |
Debugging routine; call the core SPF from the unit tests.
Definition at line 1232 of file global-route-manager-impl.cc.
References NS_LOG_FUNCTION, and SPFCalculate().
Referenced by GlobalRouteManagerImplTestCase::DoRun().
void ns3::GlobalRouteManagerImpl::DebugUseLsdb | ( | GlobalRouteManagerLSDB * | lsdb | ) |
Debugging routine; allow client code to supply a pre-built LSDB.
Definition at line 546 of file global-route-manager-impl.cc.
References m_lsdb, and NS_LOG_FUNCTION.
Referenced by GlobalRouteManagerImplTestCase::DoRun().
|
virtual |
Delete all static routes on all nodes that have a GlobalRouterInterface.
TODO: separate manually assigned static routes from static routes that the global routing code injects, and only delete the latter
Definition at line 557 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Node::GetId(), ns3::Ipv4GlobalRouting::GetNRoutes(), ns3::Object::GetObject(), m_lsdb, NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, and ns3::Ipv4GlobalRouting::RemoveRoute().
|
private |
Definition at line 1828 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Object::GetObject(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT_MSG, NS_FATAL_ERROR, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by CheckForStubNode(), and SPFNexthopCalculation().
|
virtual |
Compute routes using a Dijkstra SPF computation and populate per-node forwarding tables.
Definition at line 684 of file global-route-manager-impl.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Object::GetObject(), ns3::Node::GetSystemId(), ns3::MpiInterface::GetSystemId(), NS_LOG_FUNCTION_NOARGS, NS_LOG_INFO, and SPFCalculate().
|
private |
Global Route Manager Implementation assignment operator is disallowed. There's no need for it and a compiler provided shallow copy would be hopelessly wrong.
|
private |
Definition at line 1493 of file global-route-manager-impl.cc.
References ns3::GlobalRoutingLSA::GetAdvertisingRouter(), ns3::SPFVertex::GetChild(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetNChildren(), ns3::SPFVertex::GetVertexId(), ns3::SPFVertex::GetVertexType(), ns3::SPFVertex::IsVertexProcessed(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, ns3::SPFVertex::SetVertexProcessed(), SPFAddASExternal(), and ns3::SPFVertex::VertexRouter.
Referenced by SPFCalculate().
|
private |
Definition at line 1527 of file global-route-manager-impl.cc.
References ns3::Ipv4GlobalRouting::AddASExternalRouteTo(), ns3::NodeList::Begin(), ns3::Ipv4Address::CombineMask(), ns3::NodeList::End(), ns3::GlobalRoutingLSA::GetAdvertisingRouter(), ns3::Node::GetId(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::SPFVertex::GetLSA(), ns3::GlobalRoutingLSA::GetNetworkLSANetworkMask(), ns3::SPFVertex::GetNRootExitDirections(), ns3::Object::GetObject(), ns3::SPFVertex::GetRootExitDirection(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by ProcessASExternals().
|
private |
Definition at line 1327 of file global-route-manager-impl.cc.
References CheckForStubNode(), ns3::SPFVertex::ClearVertexProcessed(), ns3::GlobalRouteManagerLSDB::GetExtLSA(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::GlobalRouteManagerLSDB::GetLSA(), ns3::NodeList::GetNNodes(), ns3::GlobalRouteManagerLSDB::GetNumExtLSAs(), ns3::GlobalRouteManagerLSDB::Initialize(), ns3::GlobalRoutingLSA::LSA_SPF_IN_SPFTREE, m_lsdb, m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::CandidateQueue::Pop(), ProcessASExternals(), ns3::SPFVertex::SetDistanceFromRoot(), ns3::CandidateQueue::Size(), SPFIntraAddRouter(), SPFIntraAddTransit(), SPFNext(), SPFProcessStubs(), SPFVertexAddParent(), ns3::SPFVertex::VertexNetwork, and ns3::SPFVertex::VertexRouter.
Referenced by DebugSPFCalculate(), and InitializeRoutes().
|
private |
Definition at line 1154 of file global-route-manager-impl.cc.
References ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::GlobalRoutingLinkRecord::GetLinkId(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::SPFVertex::GetLSA(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::SPFVertex::GetVertexId(), NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by SPFNexthopCalculation().
|
private |
Definition at line 1915 of file global-route-manager-impl.cc.
References ns3::Ipv4GlobalRouting::AddHostRouteTo(), ns3::NodeList::Begin(), ns3::NodeList::End(), ns3::Node::GetId(), ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::GlobalRoutingLinkRecord::GetLinkType(), ns3::SPFVertex::GetLSA(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::SPFVertex::GetNRootExitDirections(), ns3::Object::GetObject(), ns3::SPFVertex::GetRootExitDirection(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, and ns3::GlobalRoutingLinkRecord::PointToPoint.
Referenced by SPFCalculate().
|
private |
Definition at line 1688 of file global-route-manager-impl.cc.
References ns3::Ipv4GlobalRouting::AddNetworkRouteTo(), ns3::NodeList::Begin(), ns3::Ipv4Address::CombineMask(), ns3::NodeList::End(), ns3::Ipv4Address::Get(), ns3::Node::GetId(), ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::GlobalRoutingLinkRecord::GetLinkId(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetNRootExitDirections(), ns3::Object::GetObject(), ns3::SPFVertex::GetRootExitDirection(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION_NOARGS, and NS_LOG_LOGIC.
Referenced by SPFProcessStubs().
|
private |
Definition at line 2060 of file global-route-manager-impl.cc.
References ns3::Ipv4GlobalRouting::AddNetworkRouteTo(), ns3::NodeList::Begin(), ns3::Ipv4Address::CombineMask(), ns3::NodeList::End(), ns3::Node::GetId(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::SPFVertex::GetLSA(), ns3::GlobalRoutingLSA::GetNetworkLSANetworkMask(), ns3::SPFVertex::GetNRootExitDirections(), ns3::Object::GetObject(), ns3::SPFVertex::GetRootExitDirection(), ns3::SPFVertex::GetVertexId(), m_spfroot, NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by SPFCalculate().
|
private |
Definition at line 734 of file global-route-manager-impl.cc.
References ns3::CandidateQueue::Find(), ns3::GlobalRoutingLSA::GetAttachedRouter(), ns3::SPFVertex::GetDistanceFromRoot(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::SPFVertex::GetLSA(), ns3::GlobalRouteManagerLSDB::GetLSA(), ns3::GlobalRouteManagerLSDB::GetLSAByLinkData(), ns3::GlobalRoutingLSA::GetLSType(), ns3::GlobalRoutingLinkRecord::GetMetric(), ns3::GlobalRoutingLSA::GetNAttachedRouters(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::GlobalRoutingLSA::GetStatus(), ns3::SPFVertex::GetVertexId(), ns3::SPFVertex::GetVertexType(), ns3::GlobalRoutingLSA::LSA_SPF_CANDIDATE, ns3::GlobalRoutingLSA::LSA_SPF_IN_SPFTREE, ns3::GlobalRoutingLSA::LSA_SPF_NOT_EXPLORED, m_lsdb, ns3::SPFVertex::MergeParent(), ns3::SPFVertex::MergeRootExitDirections(), NS_ASSERT, NS_ASSERT_MSG, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::GlobalRoutingLinkRecord::PointToPoint, ns3::CandidateQueue::Push(), ns3::CandidateQueue::Reorder(), ns3::GlobalRoutingLSA::RouterLSA, ns3::GlobalRoutingLSA::SetStatus(), SPFNexthopCalculation(), SPFVertexAddParent(), ns3::GlobalRoutingLinkRecord::StubNetwork, ns3::GlobalRoutingLinkRecord::TransitNetwork, ns3::SPFVertex::VertexNetwork, ns3::SPFVertex::VertexRouter, and visualizer.higcontainer::w.
Referenced by SPFCalculate().
|
private |
Definition at line 966 of file global-route-manager-impl.cc.
References FindOutgoingInterfaceId(), ns3::GlobalRoutingLinkRecord::GetLinkData(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetParent(), ns3::SPFVertex::GetRootExitDirection(), ns3::SPFVertex::GetVertexId(), ns3::SPFVertex::GetVertexType(), ns3::Ipv4Address::GetZero(), ns3::SPFVertex::InheritAllRootExitDirections(), m_spfroot, ns3::GlobalRoutingLSA::NetworkLSA, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, ns3::SPFVertex::SetDistanceFromRoot(), ns3::SPFVertex::SetParent(), ns3::SPFVertex::SetRootExitDirection(), SPFGetNextLink(), ns3::SPFVertex::VertexNetwork, and ns3::SPFVertex::VertexRouter.
Referenced by SPFNext().
|
private |
Definition at line 1654 of file global-route-manager-impl.cc.
References ns3::SPFVertex::GetChild(), ns3::GlobalRoutingLSA::GetLinkRecord(), ns3::GlobalRoutingLSA::GetLinkStateId(), ns3::SPFVertex::GetLSA(), ns3::SPFVertex::GetNChildren(), ns3::GlobalRoutingLSA::GetNLinkRecords(), ns3::SPFVertex::GetVertexId(), ns3::SPFVertex::GetVertexType(), ns3::SPFVertex::IsVertexProcessed(), NS_LOG_FUNCTION_NOARGS, NS_LOG_LOGIC, ns3::SPFVertex::SetVertexProcessed(), SPFIntraAddStub(), ns3::GlobalRoutingLinkRecord::StubNetwork, and ns3::SPFVertex::VertexRouter.
Referenced by SPFCalculate().
|
private |
Definition at line 2178 of file global-route-manager-impl.cc.
References ns3::SPFVertex::AddChild(), ns3::SPFVertex::GetParent(), and NS_LOG_FUNCTION.
Referenced by SPFCalculate(), and SPFNext().
|
private |
Definition at line 758 of file global-route-manager-impl.h.
Referenced by BuildGlobalRoutingDatabase(), CheckForStubNode(), DebugUseLsdb(), DeleteGlobalRoutes(), GlobalRouteManagerImpl(), SPFCalculate(), SPFNext(), and ~GlobalRouteManagerImpl().
|
private |
Definition at line 757 of file global-route-manager-impl.h.
Referenced by FindOutgoingInterfaceId(), SPFAddASExternal(), SPFCalculate(), SPFIntraAddRouter(), SPFIntraAddStub(), SPFIntraAddTransit(), and SPFNexthopCalculation().