void AdjLsa::removeNptEntries(Nlsr& pnlsr) { if (getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix()) { pnlsr.getNamePrefixTable().removeEntry(getOrigRouter(), getOrigRouter()); } }
void AdjLsa::addNptEntries(Nlsr& pnlsr) { // Only add NPT entries if this is an adj LSA from another router. if (getOrigRouter() != pnlsr.getConfParameter().getRouterPrefix()) { // Pass the originating router as both the name to register and // where it came from. pnlsr.getNamePrefixTable().addEntry(getOrigRouter(), getOrigRouter()); } }
void RoutingTable::calculate(Nlsr& pnlsr) { pnlsr.getLsdb().writeCorLsdbLog(); pnlsr.getLsdb().writeNameLsdbLog(); pnlsr.getLsdb().writeAdjLsdbLog(); pnlsr.getNamePrefixTable().writeLog(); if (pnlsr.getIsRoutingTableCalculating() == false) { //setting routing table calculation pnlsr.setIsRoutingTableCalculating(true); bool isHrEnabled = pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_ON; if ((!isHrEnabled && pnlsr.getLsdb().doesLsaExist(pnlsr.getConfParameter().getRouterPrefix().toUri() + "/" + "adjacency", std::string("adjacency"))) || (isHrEnabled && pnlsr.getLsdb().doesLsaExist(pnlsr.getConfParameter().getRouterPrefix().toUri() + "/" + "coordinate", std::string("coordinate")))) { if (pnlsr.getIsBuildAdjLsaSheduled() != 1) { _LOG_TRACE("Clearing old routing table"); clearRoutingTable(); // for dry run options clearDryRoutingTable(); _LOG_DEBUG("Calculating routing table"); // calculate Link State routing if ((pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_OFF) || (pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN)) { calculateLsRoutingTable(pnlsr); } //calculate hyperbolic routing if (pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_ON) { calculateHypRoutingTable(pnlsr); } //calculate dry hyperbolic routing if (pnlsr.getConfParameter().getHyperbolicState() == HYPERBOLIC_STATE_DRY_RUN) { calculateHypDryRoutingTable(pnlsr); } //need to update NPT here _LOG_DEBUG("Calling Update NPT With new Route"); pnlsr.getNamePrefixTable().updateWithNewRoute(); writeLog(pnlsr.getConfParameter().getHyperbolicState()); pnlsr.getNamePrefixTable().writeLog(); pnlsr.getFib().writeLog(); } else { _LOG_DEBUG("Adjacency building is scheduled, so" " routing table can not be calculated :("); } } else { _LOG_DEBUG("No Adj LSA of router itself," " so Routing table can not be calculated :("); clearRoutingTable(); clearDryRoutingTable(); // for dry run options // need to update NPT here _LOG_DEBUG("Calling Update NPT With new Route"); pnlsr.getNamePrefixTable().updateWithNewRoute(); writeLog(pnlsr.getConfParameter().getHyperbolicState()); pnlsr.getNamePrefixTable().writeLog(); pnlsr.getFib().writeLog(); //debugging purpose end } pnlsr.setIsRouteCalculationScheduled(false); //clear scheduled flag pnlsr.setIsRoutingTableCalculating(false); //unsetting routing table calculation } else { scheduleRoutingTableCalculation(pnlsr); } }