Loads the configuration of the OSPF data structure from the config XML.
Returns true if the configuration was successfully loaded.
429 if (strcmp(asConfig->getTagName(),
"OSPFASConfig"))
430 throw cRuntimeError(
"Cannot read OSPF configuration, unexpected element '%s' at %s", asConfig->getTagName(), asConfig->getSourceLocation());
435 std::string nodeFullPath = myNode->getFullPath();
436 std::string nodeShortenedFullPath = nodeFullPath.substr(nodeFullPath.find(
'.') + 1);
439 cXMLElementList routers = asConfig->getElementsByTagName(
"Router");
440 cXMLElement *routerNode =
nullptr;
441 for (
auto & router : routers) {
444 if (pattern.matches(nodeFullPath.c_str()) || pattern.matches(nodeShortenedFullPath.c_str())) {
449 if (routerNode ==
nullptr) {
450 throw cRuntimeError(
"No configuration for Router '%s' at '%s'", nodeFullPath.c_str(), asConfig->getSourceLocation());
453 EV_DEBUG <<
"OSPFConfigReader: Loading info for Router " << nodeFullPath <<
"\n";
455 bool rfc1583Compatible =
getBoolAttrOrPar(*routerNode,
"RFC1583Compatible");
458 std::set<AreaID> areaList;
462 if ((areaList.size() > 1) && (areaList.find(
BACKBONE_AREAID) == areaList.end())) {
466 for (
const auto & elem : areaList) {
471 cXMLElementList routerConfig = routerNode->getChildren();
472 for (
auto & elem : routerConfig) {
473 std::string nodeName = (elem)->getTagName();
474 if ((nodeName ==
"PointToPointInterface") ||
475 (nodeName ==
"BroadcastInterface") ||
476 (nodeName ==
"NBMAInterface") ||
477 (nodeName ==
"PointToMultiPointInterface"))
481 else if (nodeName ==
"ExternalInterface") {
484 else if (nodeName ==
"HostInterface") {
487 else if (nodeName ==
"VirtualLink") {
491 throw cRuntimeError(
"Invalid '%s' node in Router '%s' at %s",
492 nodeName.c_str(), nodeFullPath.c_str(), (elem)->getSourceLocation());
cModule * ospfModule
Definition: OSPFConfigReader.h:40
void setRFC1583Compatibility(bool compatibility)
Definition: OSPFRouter.h:73
void loadHostRoute(const cXMLElement &hostRouteConfig)
Loads the configuration of a host route (a host directly connected to the router).
Definition: OSPFConfigReader.cc:360
void loadAreaFromXML(const cXMLElement &asConfig, AreaID areaID)
Loads basic configuration information for a given area from the config XML.
Definition: OSPFConfigReader.cc:106
const char * getRequiredAttribute(const cXMLElement &node, const char *attr)
Definition: XMLUtils.cc:150
void loadVirtualLink(const cXMLElement &virtualLinkConfig)
Loads the configuration of an OSPf virtual link (virtual connection between two backbone routers)...
Definition: OSPFConfigReader.cc:388
const AreaID BACKBONE_AREAID(0, 0, 0, 0)
void loadExternalRoute(const cXMLElement &externalRouteConfig)
Loads the configuration information of a route outside of the Autonomous System (external route)...
Definition: OSPFConfigReader.cc:308
void loadInterfaceParameters(const cXMLElement &ifConfig)
Loads OSPF configuration information for a router interface.
Definition: OSPFConfigReader.cc:216
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:56
bool getBoolAttrOrPar(const cXMLElement &ifConfig, const char *name) const
Definition: OSPFConfigReader.cc:153
Router * ospfRouter
Definition: OSPFConfigReader.h:42
Glob-style pattern matching class, adopted to special OMNeT++ requirements.
Definition: PatternMatcher.h:78
void getAreaListFromXML(const cXMLElement &routerNode, std::set< AreaID > &areaList) const
Loads a list of OSPF Areas connected to this router from the config XML.
Definition: OSPFConfigReader.cc:89