|
WSF
|
#include <WsfCommProtocolOSPF.hpp>
Public Types | |
| using | ProtocolVector = std::vector<ProtocolOSPF*> |
| ProtocolVector provides a vector of OSPF protocols. | |
| using | ProtocolMapDR = std::map<std::string, ProtocolOSPF*> |
| ProtocolMapDR provides a mapping of networks to their DR/BDR. | |
| using | RemovedNetworkInterfaces = std::map<std::string, std::vector<Address>> |
Public Member Functions | |
| OSPF_Area ()=default | |
| virtual | ~OSPF_Area ()=default |
| void | SetAddress (const Address &aAddress) |
| void | SetBackbone (bool aIsBackbone) |
| const Address & | GetAddress () const |
| bool | IsBackbone () const |
| RemovedNetworkInterfaces & | GetRemovedInterfacesDR () |
| void | AddRemovedInterfaceDR (Comm *aInterfacePtr) |
| RemovedNetworkInterfaces & | GetRemovedInterfacesBDR () |
| void | AddRemovedInterfaceBDR (Comm *aInterfacePtr) |
| const ProtocolMapDR & | GetDRs () const |
| const ProtocolMapDR & | GetBDRs () const |
| ProtocolVector & | GetProtocols () |
| ProtocolVector | GetProtocols (const std::string &aNetwork) |
| std::set< std::string > & | GetNetworks () |
| void | SetDRs () |
| Sets the DRs and BDRs for this area. Used during framework initialization only. | |
| void | PlatformDeleted (double aSimTime, WsfPlatform *aPlatformPtr) |
| void | InitializeGraphData (graph::Graph &aGraph) |
| std::vector< std::pair< Comm *, ProtocolOSPF * > > | GetInterfaces () |
| void | ElectionDR (double aSimTime, const std::string aNetwork, const Address &aArea, bool aElectionDR) |
| void | InitializeCallbacks (WsfSimulation &aSim) |
| void | SetNetworks () |
The OSPF protocol defines an area as a logical grouping of routers and their interfaces. What makes OSPF useful in large networks is the ability to divide these networks into multiple areas that typically only retain information and conduct protocol communication within that area to avoid flooding the network and streamline communications using assumptions held constant across all OSPF enabled areas.
This object is a representation of an OSPF area. Each area has a unique ID set by user input (we simply use the existing address schema to provide this). Every network within the area has a single router that collects the network state knowledge for the area, the designated router (DR). It may have a secondary router with a copy of this data (to account for loss of routers) known as a backup designated router (BDR). Since an area may represent a single network or many networks, each area should have at least one DR, but may have many DR's, and potentially as many BDRs given at least two routers for each network in an area.
All areas must connect to a specially designated area, referred to as the backbone area. Loss of connectivity with the backbone typically limits the range of communications to within the the same area.
Note that routers may exist in multiple areas. Such routers are referred to as an area border router (ABR), and such routers will be members of the areas in which they border. Thus, developers should be aware that a router may be repeated in multiple areas, and may have the same or different roles in each of these areas (e.g. router 'foo' may be a DR in two areas, a BDR in another area, and have no specific roles in other areas - each area manages itself).
| using wsf::comm::router::OSPF_Area::ProtocolMapDR = std::map<std::string, ProtocolOSPF*> |
ProtocolMapDR provides a mapping of networks to their DR/BDR.
| using wsf::comm::router::OSPF_Area::ProtocolVector = std::vector<ProtocolOSPF*> |
ProtocolVector provides a vector of OSPF protocols.
| using wsf::comm::router::OSPF_Area::RemovedNetworkInterfaces = std::map<std::string, std::vector<Address>> |
RemovedNetworkInterfaces provides a mapping of networks to removed interface addresses. This aids book-keeping by allowing the removal of protocol pointers during runtime, but delaying the actual removal of the associated OSPF constructs with their associated timeouts. Only applies to DR/BDRs.
|
default |
|
virtualdefault |
| void wsf::comm::router::OSPF_Area::AddRemovedInterfaceBDR | ( | Comm * | aInterfacePtr | ) |
References wsf::comm::Comm::GetAddress(), and wsf::comm::Comm::GetNetwork().
Referenced by PlatformDeleted().
| void wsf::comm::router::OSPF_Area::AddRemovedInterfaceDR | ( | Comm * | aInterfacePtr | ) |
References wsf::comm::Comm::GetAddress(), and wsf::comm::Comm::GetNetwork().
Referenced by PlatformDeleted().
| void wsf::comm::router::OSPF_Area::ElectionDR | ( | double | aSimTime, |
| const std::string | aNetwork, | ||
| const Address & | aArea, | ||
| bool | aElectionDR ) |
The election event is the process of 'electing' DRs. This occurs initially at simulation start, then again whenever there is a change affecting the area such that a new election is required to ensure each network within the area has a DR and, if possible, a BDR.
This method is intended for usage during runtime. The 'SetDRs' method calls this method for each network in the area during initialization.
The boolean 'aElectionDR' indicates if this is a DR/BDR election if true, or just a BDR election if false. Regardless, this method will update the appropriate map entries for DRs and BDRs.
References wsf::comm::NetworkManager::AddMulticastMember(), ElectionDR(), wsf::comm::Comm::GetAddress(), GetAddress(), wsf::comm::Address::GetBinaryInteger(), WsfSimulation::GetCommNetworkManager(), wsf::comm::router::ProtocolOSPF::GetPriorityInterface(), GetProtocols(), wsf::comm::router::RouterComponent::GetSimulation(), and wsf::comm::router::ProtocolOSPF::SetGraph().
Referenced by ElectionDR(), and SetDRs().
|
inline |
Referenced by ElectionDR(), InitializeGraphData(), wsf::comm::router::ProtocolOSPF::Routing(), and SetDRs().
|
inline |
|
inline |
| std::vector< std::pair< Comm *, ProtocolOSPF * > > wsf::comm::router::OSPF_Area::GetInterfaces | ( | ) |
Returns all the interfaces in this area with functional routers (i.e. turned on). The OSPF protocol associated with the interface is also provided for convenience.
References GetProtocols().
|
inline |
|
inline |
Referenced by ElectionDR(), and GetInterfaces().
| OSPF_Area::ProtocolVector wsf::comm::router::OSPF_Area::GetProtocols | ( | const std::string & | aNetwork | ) |
This version of 'GetProtocols' only returns area protocols/routers with an interface in the specified network.
|
inline |
|
inline |
| void wsf::comm::router::OSPF_Area::InitializeCallbacks | ( | WsfSimulation & | aSim | ) |
| void wsf::comm::router::OSPF_Area::InitializeGraphData | ( | graph::Graph & | aGraph | ) |
Sets initial network knowledge graph data for this area. Based off of the provided graph knowledge. Only used for OSPF protocol areas defined via user input and initialized at the start of the simulation. All other areas and members have their knowledge collected organically via typical OSPF mechanisms.
Assumes DR/BDR election has already been completed.
Now that the graph is completed with all connections available in an area, distribute this graph to all DR/BDRs in the area.
References wsf::comm::graph::Graph::CreateNode(), wsf::comm::graph::Graph::FindEdge(), wsf::comm::graph::Graph::FindNode(), GetAddress(), wsf::comm::graph::Graph::InsertEdge(), and wsf::comm::graph::Edge::SetWeight().
|
inline |
| void wsf::comm::router::OSPF_Area::PlatformDeleted | ( | double | aSimTime, |
| WsfPlatform * | aPlatformPtr ) |
Handles the removal of a platform during runtime. Ensures cleanup of dangling pointers that may be stored, and also provides indication of loss of DR/BDR.
References AddRemovedInterfaceBDR(), AddRemovedInterfaceDR(), WsfComponentList::RoleIterator< T >::AtEnd(), WsfPlatform::GetComponents(), and SetNetworks().
Referenced by InitializeCallbacks().
|
inline |
|
inline |
| void wsf::comm::router::OSPF_Area::SetDRs | ( | ) |
Sets the DRs and BDRs for this area. Used during framework initialization only.
References ElectionDR(), GetAddress(), and SetNetworks().
| void wsf::comm::router::OSPF_Area::SetNetworks | ( | ) |
The set networks method should be called anytime there is a change to any router or interface within the area to ensure the listed networks this area represents is correct.
Referenced by PlatformDeleted(), and SetDRs().