src: Replace std::cout with log message
Change-Id: Idf49992711b4bb4a45d8f9665963feebf3b0a887
diff --git a/src/route/routing-table.cpp b/src/route/routing-table.cpp
index 6d632f4..613371f 100644
--- a/src/route/routing-table.cpp
+++ b/src/route/routing-table.cpp
@@ -42,11 +42,9 @@
void
RoutingTable::calculate(Nlsr& pnlsr)
{
- //debugging purpose
- pnlsr.getNamePrefixTable().print();
- pnlsr.getLsdb().printAdjLsdb();
- pnlsr.getLsdb().printCorLsdb();
- pnlsr.getLsdb().printNameLsdb();
+ pnlsr.getLsdb().writeCorLsdbLog();
+ pnlsr.getLsdb().writeNameLsdbLog();
+ pnlsr.getLsdb().writeAdjLsdbLog();
pnlsr.getNamePrefixTable().writeLog();
if (pnlsr.getIsRoutingTableCalculating() == false) {
//setting routing table calculation
@@ -55,7 +53,6 @@
pnlsr.getConfParameter().getRouterPrefix().toUri() + "/" + "adjacency",
std::string("adjacency"))) {
if (pnlsr.getIsBuildAdjLsaSheduled() != 1) {
- std::cout << "CLearing old routing table ....." << std::endl;
_LOG_DEBUG("CLearing old routing table .....");
clearRoutingTable();
// for dry run options
@@ -74,37 +71,25 @@
calculateHypDryRoutingTable(pnlsr);
}
//need to update NPT here
+ _LOG_DEBUG("Calling Update NPT With new Route");
pnlsr.getNamePrefixTable().updateWithNewRoute();
- //debugging purpose
- printRoutingTable();
- pnlsr.getNamePrefixTable().print();
- pnlsr.getFib().print();
writeLog();
pnlsr.getNamePrefixTable().writeLog();
pnlsr.getFib().writeLog();
- //debugging purpose end
}
else {
- std::cout << "Adjacency building is scheduled, so ";
- std::cout << "routing table can not be calculated :(" << std::endl;
_LOG_DEBUG("Adjacency building is scheduled, so"
" routing table can not be calculated :(");
}
}
else {
- std::cout << "No Adj LSA of router itself,";
- std::cout << " so Routing table can not be calculated :(" << std::endl;
_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
- std::cout << "Calling Update NPT With new Route" << std::endl;
+ _LOG_DEBUG("Calling Update NPT With new Route");
pnlsr.getNamePrefixTable().updateWithNewRoute();
- //debugging purpose
- printRoutingTable();
- pnlsr.getNamePrefixTable().print();
- pnlsr.getFib().print();
writeLog();
pnlsr.getNamePrefixTable().writeLog();
pnlsr.getFib().writeLog();
@@ -122,9 +107,10 @@
void
RoutingTable::calculateLsRoutingTable(Nlsr& pnlsr)
{
- std::cout << "RoutingTable::calculateLsRoutingTable Called" << std::endl;
+ _LOG_DEBUG("RoutingTable::calculateLsRoutingTable Called");
Map vMap;
vMap.createFromAdjLsdb(pnlsr);
+ vMap.writeLog();
int numOfRouter = vMap.getMapSize();
LinkStateRoutingTableCalculator lsrtc(numOfRouter);
lsrtc.calculatePath(vMap, ndn::ref(*this), pnlsr);
@@ -135,6 +121,7 @@
{
Map vMap;
vMap.createFromAdjLsdb(pnlsr);
+ vMap.writeLog();
int numOfRouter = vMap.getMapSize();
HypRoutingTableCalculator hrtc(numOfRouter, 0);
hrtc.calculatePath(vMap, ndn::ref(*this), pnlsr);
@@ -145,6 +132,7 @@
{
Map vMap;
vMap.createFromAdjLsdb(pnlsr);
+ vMap.writeLog();
int numOfRouter = vMap.getMapSize();
HypRoutingTableCalculator hrtc(numOfRouter, 1);
hrtc.calculatePath(vMap, ndn::ref(*this), pnlsr);
@@ -207,17 +195,6 @@
}
}
-void
-RoutingTable::printRoutingTable()
-{
- std::cout << "---------------Routing Table------------------" << std::endl;
- for (std::list<RoutingTableEntry>::iterator it = m_rTable.begin() ;
- it != m_rTable.end(); ++it) {
- std::cout << (*it) << std::endl;
- }
-}
-
-
//function related to manipulation of dry routing table
void
RoutingTable::addNextHopToDryTable(const ndn::Name& destRouter, NextHop& nh)
@@ -237,17 +214,6 @@
}
void
-RoutingTable::printDryRoutingTable()
-{
- std::cout << "--------Dry Run's Routing Table--------------" << std::endl;
- for (std::list<RoutingTableEntry>::iterator it = m_dryTable.begin() ;
- it != m_dryTable.end(); ++it) {
- cout << (*it) << endl;
- }
-}
-
-
-void
RoutingTable::clearRoutingTable()
{
if (m_rTable.size() > 0) {