publisher: fix encoding bug in routing table publisher

refs: #4453

Change-Id: I03e819e963f0957f3d40ff25e378f2b9b17357b7
diff --git a/tools/nlsrc.cpp b/tools/nlsrc.cpp
index db2de6a..3db6215 100644
--- a/tools/nlsrc.cpp
+++ b/tools/nlsrc.cpp
@@ -240,8 +240,8 @@
 void
 Nlsrc::fetchRtables()
 {
-  fetchFromRt<nlsr::tlv::RoutingTable>(
-    [this] (const nlsr::tlv::RoutingTable& rts) {
+  fetchFromRt<nlsr::tlv::RoutingTableStatus>(
+    [this] (const nlsr::tlv::RoutingTableStatus& rts) {
       recordRtable(rts);
     });
 }
@@ -322,15 +322,6 @@
   return os.str();
 }
 
-std::string
-Nlsrc::getDesString(const nlsr::tlv::Destination& des)
-{
-  std::ostringstream os;
-  os << "    " << des;
-
-  return os.str();
-}
-
 void
 Nlsrc::recordAdjacencyLsa(const nlsr::tlv::AdjacencyLsa& lsa)
 {
@@ -385,20 +376,13 @@
 }
 
 void
-Nlsrc::recordRtable(const nlsr::tlv::RoutingTable& rt)
+Nlsrc::recordRtable(const nlsr::tlv::RoutingTableStatus& rts)
 {
-  Router& router = getRouterRT(rt.getDestination());
-
   std::ostringstream os;
-
-  os << getDesString(rt.getDestination()) << std::endl;
-
-  os << "    NextHopList: " <<std::endl;
-  for (const auto& nhs : rt.getNextHops()) {
-    os << "      " << nhs;
+  for (const auto& rt : rts.getRoutingtable()) {
+    os << rt << std::endl;
   }
-
-  router.rtString = os.str();
+  m_rtString = os.str();
 }
 
 void
@@ -429,15 +413,12 @@
 void
 Nlsrc::printRT()
 {
-  std::cout << "Routing Table Status:" << std::endl;
-
-  for (const auto& item : m_routers) {
-
-    const Router& router = item.second;
-
-    if (!router.rtString.empty()) {
-      std::cout << router.rtString << std::endl;
-    }
+  if (!m_rtString.empty()) {
+    std::cout << "Routing Table" << std::endl;
+    std::cout << m_rtString << std::endl;
+  }
+  else {
+    std::cout << "Routing Table is not calculated yet" << std::endl;
   }
 }
 
@@ -460,17 +441,6 @@
   return pair.first->second;
 }
 
-Nlsrc::Router&
-Nlsrc::getRouterRT(const nlsr::tlv::Destination& des)
-{
-  const ndn::Name& desName = des.getName();
-
-  const auto& pair =
-    m_routers.insert(std::make_pair(desName, Router()));
-
-  return pair.first->second;
-}
-
 } // namespace nlsrc
 
 ////////////////////////////////////////////////////////////////////////////////