lsa: Accept LSA type argument in LSA base constructor

refs: #2788

Change-Id: I12d9b26fb9087b037134988f1594576ed7ba90f3
diff --git a/src/lsa.cpp b/src/lsa.cpp
index 8830951..db516b7 100644
--- a/src/lsa.cpp
+++ b/src/lsa.cpp
@@ -53,12 +53,12 @@
   return key;
 }
 
-NameLsa::NameLsa(const ndn::Name& origR, const string& lst, uint32_t lsn,
+NameLsa::NameLsa(const ndn::Name& origR, uint32_t lsn,
                  const ndn::time::system_clock::TimePoint& lt,
                  NamePrefixList& npl)
+  : Lsa(NameLsa::TYPE_STRING)
 {
   m_origRouter = origR;
-  m_lsType = lst;
   m_lsSeqNo = lsn;
   m_expirationTimePoint = lt;
   std::list<ndn::Name>& nl = npl.getNameList();
@@ -97,12 +97,16 @@
     return false;
   }
   try {
-    m_lsType = *tok_iter++;
+    if (*tok_iter++ != NameLsa::TYPE_STRING) {
+      return false;
+    }
+
     m_lsSeqNo = boost::lexical_cast<uint32_t>(*tok_iter++);
     m_expirationTimePoint = ndn::time::fromIsoString(*tok_iter++);
     numName = boost::lexical_cast<uint32_t>(*tok_iter++);
   }
   catch (std::exception& e) {
+    _LOG_ERROR(e.what());
     return false;
   }
   for (uint32_t i = 0; i < numName; i++) {
@@ -130,13 +134,12 @@
   _LOG_DEBUG("name_lsa_end");
 }
 
-CoordinateLsa::CoordinateLsa(const ndn::Name& origR, const string lst,
-                             uint32_t lsn,
+CoordinateLsa::CoordinateLsa(const ndn::Name& origR, uint32_t lsn,
                              const ndn::time::system_clock::TimePoint& lt,
                              double r, double theta)
+  : Lsa(CoordinateLsa::TYPE_STRING)
 {
   m_origRouter = origR;
-  m_lsType = lst;
   m_lsSeqNo = lsn;
   m_expirationTimePoint = lt;
   m_corRad = r;
@@ -186,13 +189,17 @@
     return false;
   }
   try {
-    m_lsType   = *tok_iter++;
+    if (*tok_iter++ != CoordinateLsa::TYPE_STRING) {
+      return false;
+    }
+
     m_lsSeqNo  = boost::lexical_cast<uint32_t>(*tok_iter++);
     m_expirationTimePoint = ndn::time::fromIsoString(*tok_iter++);
     m_corRad   = boost::lexical_cast<double>(*tok_iter++);
     m_corTheta = boost::lexical_cast<double>(*tok_iter++);
   }
   catch (std::exception& e) {
+    _LOG_ERROR(e.what());
     return false;
   }
   return true;
@@ -210,12 +217,12 @@
   _LOG_DEBUG("    Hyperbolic Theta: " << m_corTheta);
 }
 
-AdjLsa::AdjLsa(const ndn::Name& origR, const string& lst, uint32_t lsn,
+AdjLsa::AdjLsa(const ndn::Name& origR, uint32_t lsn,
                const ndn::time::system_clock::TimePoint& lt,
                uint32_t nl , AdjacencyList& adl)
+  : Lsa(AdjLsa::TYPE_STRING)
 {
   m_origRouter = origR;
-  m_lsType = lst;
   m_lsSeqNo = lsn;
   m_expirationTimePoint = lt;
   m_noLink = nl;
@@ -276,12 +283,16 @@
     return false;
   }
   try {
-    m_lsType   = *tok_iter++;
+    if (*tok_iter++ != AdjLsa::TYPE_STRING) {
+      return false;
+    }
+
     m_lsSeqNo  = boost::lexical_cast<uint32_t>(*tok_iter++);
     m_expirationTimePoint = ndn::time::fromIsoString(*tok_iter++);
     numLink    = boost::lexical_cast<uint32_t>(*tok_iter++);
   }
   catch (std::exception& e) {
+    _LOG_ERROR(e.what());
     return false;
   }
   for (uint32_t i = 0; i < numLink; i++) {
@@ -293,6 +304,7 @@
       addAdjacent(adjacent);
     }
     catch (std::exception& e) {
+      _LOG_ERROR(e.what());
       return false;
     }
   }
diff --git a/src/lsa.hpp b/src/lsa.hpp
index 544f01d..c797815 100644
--- a/src/lsa.hpp
+++ b/src/lsa.hpp
@@ -35,21 +35,15 @@
 class Lsa
 {
 public:
-  Lsa()
+  Lsa(const std::string& lsaType)
     : m_origRouter()
+    , m_lsType(lsaType)
     , m_lsSeqNo()
     , m_expirationTimePoint()
     , m_expiringEventId()
   {
   }
 
-
-  void
-  setLsType(const std::string& lst)
-  {
-    m_lsType = lst;
-  }
-
   const std::string&
   getLsType() const
   {
@@ -106,7 +100,7 @@
 
 protected:
   ndn::Name m_origRouter;
-  std::string m_lsType;
+  const std::string m_lsType;
   uint32_t m_lsSeqNo;
   ndn::time::system_clock::TimePoint m_expirationTimePoint;
   ndn::EventId m_expiringEventId;
@@ -116,13 +110,12 @@
 {
 public:
   NameLsa()
-    : Lsa()
+    : Lsa(NameLsa::TYPE_STRING)
     , m_npl()
   {
-    setLsType(NameLsa::TYPE_STRING);
   }
 
-  NameLsa(const ndn::Name& origR, const std::string& lst, uint32_t lsn,
+  NameLsa(const ndn::Name& origR, uint32_t lsn,
           const ndn::time::system_clock::TimePoint& lt,
           NamePrefixList& npl);
 
@@ -168,13 +161,12 @@
   typedef AdjacencyList::const_iterator const_iterator;
 
   AdjLsa()
-    : Lsa()
+    : Lsa(AdjLsa::TYPE_STRING)
     , m_adl()
   {
-    setLsType(AdjLsa::TYPE_STRING);
   }
 
-  AdjLsa(const ndn::Name& origR, const std::string& lst, uint32_t lsn,
+  AdjLsa(const ndn::Name& origR, uint32_t lsn,
          const ndn::time::system_clock::TimePoint& lt,
          uint32_t nl , AdjacencyList& adl);
 
@@ -242,14 +234,13 @@
 {
 public:
   CoordinateLsa()
-    : Lsa()
+    : Lsa(CoordinateLsa::TYPE_STRING)
     , m_corRad(0)
     , m_corTheta(0)
   {
-    setLsType(CoordinateLsa::TYPE_STRING);
   }
 
-  CoordinateLsa(const ndn::Name& origR, const std::string lst, uint32_t lsn,
+  CoordinateLsa(const ndn::Name& origR, uint32_t lsn,
                 const ndn::time::system_clock::TimePoint& lt,
                 double r, double theta);
 
diff --git a/src/lsdb.cpp b/src/lsdb.cpp
index c0fb765..d4b7193 100644
--- a/src/lsdb.cpp
+++ b/src/lsdb.cpp
@@ -55,7 +55,6 @@
 Lsdb::buildAndInstallOwnNameLsa()
 {
   NameLsa nameLsa(m_nlsr.getConfParameter().getRouterPrefix(),
-                  NameLsa::TYPE_STRING,
                   m_nlsr.getSequencingManager().getNameLsaSeq() + 1,
                   getLsaExpirationTimePoint(),
                   m_nlsr.getNamePrefixList());
@@ -267,7 +266,6 @@
 Lsdb::buildAndInstallOwnCoordinateLsa()
 {
   CoordinateLsa corLsa(m_nlsr.getConfParameter().getRouterPrefix(),
-                       CoordinateLsa::TYPE_STRING,
                        m_nlsr.getSequencingManager().getCorLsaSeq() + 1,
                        getLsaExpirationTimePoint(),
                        m_nlsr.getConfParameter().getCorR(),
@@ -589,7 +587,6 @@
 Lsdb::buildAndInstallOwnAdjLsa()
 {
   AdjLsa adjLsa(m_nlsr.getConfParameter().getRouterPrefix(),
-                AdjLsa::TYPE_STRING,
                 m_nlsr.getSequencingManager().getAdjLsaSeq() + 1,
                 getLsaExpirationTimePoint(),
                 m_nlsr.getAdjacencyList().getNumOfActiveNeighbor(),
diff --git a/tests/publisher/publisher-fixture.hpp b/tests/publisher/publisher-fixture.hpp
index df299e3..6b6e698 100644
--- a/tests/publisher/publisher-fixture.hpp
+++ b/tests/publisher/publisher-fixture.hpp
@@ -83,7 +83,7 @@
   CoordinateLsa
   createCoordinateLsa(const std::string& origin, double radius, double angle)
   {
-    CoordinateLsa lsa(origin, CoordinateLsa::TYPE_STRING, 1, ndn::time::system_clock::now(),
+    CoordinateLsa lsa(origin, 1, ndn::time::system_clock::now(),
                       radius, angle);
 
     return lsa;
diff --git a/tests/test-hyperbolic-calculator.cpp b/tests/test-hyperbolic-calculator.cpp
index 9bf354c..0d569f5 100644
--- a/tests/test-hyperbolic-calculator.cpp
+++ b/tests/test-hyperbolic-calculator.cpp
@@ -67,10 +67,10 @@
     adjacencies.insert(b);
     adjacencies.insert(c);
 
-    AdjLsa adjA(a.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencies);
+    AdjLsa adjA(a.getName(), 1, MAX_TIME, 2, adjacencies);
     lsdb.installAdjLsa(adjA);
 
-    CoordinateLsa coordA(adjA.getOrigRouter(), CoordinateLsa::TYPE_STRING, 1, MAX_TIME, 16.23, 2.97);
+    CoordinateLsa coordA(adjA.getOrigRouter(), 1, MAX_TIME, 16.23, 2.97);
     lsdb.installCoordinateLsa(coordA);
 
     // Router B
@@ -81,10 +81,10 @@
     adjacencyListB.insert(a);
     adjacencyListB.insert(c);
 
-    AdjLsa adjB(b.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencyListB);
+    AdjLsa adjB(b.getName(), 1, MAX_TIME, 2, adjacencyListB);
     lsdb.installAdjLsa(adjB);
 
-    CoordinateLsa coordB(adjB.getOrigRouter(), CoordinateLsa::TYPE_STRING, 1, MAX_TIME, 16.59, 3.0);
+    CoordinateLsa coordB(adjB.getOrigRouter(), 1, MAX_TIME, 16.59, 3.0);
     lsdb.installCoordinateLsa(coordB);
 
     // Router C
@@ -95,10 +95,10 @@
     adjacencyListC.insert(a);
     adjacencyListC.insert(b);
 
-    AdjLsa adjC(c.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencyListC);
+    AdjLsa adjC(c.getName(), 1, MAX_TIME, 2, adjacencyListC);
     lsdb.installAdjLsa(adjC);
 
-    CoordinateLsa coordC(adjC.getOrigRouter(), CoordinateLsa::TYPE_STRING, 1, MAX_TIME, 14.11, 2.99);
+    CoordinateLsa coordC(adjC.getOrigRouter(), 1, MAX_TIME, 14.11, 2.99);
     lsdb.installCoordinateLsa(coordC);
 
     map.createFromAdjLsdb(nlsr);
diff --git a/tests/test-link-state-calculator.cpp b/tests/test-link-state-calculator.cpp
index f50001e..7ed38e5 100644
--- a/tests/test-link-state-calculator.cpp
+++ b/tests/test-link-state-calculator.cpp
@@ -72,7 +72,7 @@
     adjacencyListA.insert(b);
     adjacencyListA.insert(c);
 
-    AdjLsa adjA(a.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencyListA);
+    AdjLsa adjA(a.getName(), 1, MAX_TIME, 2, adjacencyListA);
     lsdb.installAdjLsa(adjA);
 
     // Router B
@@ -83,7 +83,7 @@
     adjacencyListB.insert(a);
     adjacencyListB.insert(c);
 
-    AdjLsa adjB(b.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencyListB);
+    AdjLsa adjB(b.getName(), 1, MAX_TIME, 2, adjacencyListB);
     lsdb.installAdjLsa(adjB);
 
     // Router C
@@ -94,7 +94,7 @@
     adjacencyListC.insert(a);
     adjacencyListC.insert(b);
 
-    AdjLsa adjC(c.getName(), AdjLsa::TYPE_STRING, 1, MAX_TIME, 2, adjacencyListC);
+    AdjLsa adjC(c.getName(), 1, MAX_TIME, 2, adjacencyListC);
     lsdb.installAdjLsa(adjC);
 
     map.createFromAdjLsdb(nlsr);
diff --git a/tests/test-lsa.cpp b/tests/test-lsa.cpp
index 0d8c942..562014c 100644
--- a/tests/test-lsa.cpp
+++ b/tests/test-lsa.cpp
@@ -44,9 +44,10 @@
   npl1.insert(s1);
   npl1.insert(s2);
   ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
-//lsType is 1 for NameLsa, 3rd arg is seqNo. which will be a random number I just put in 12.
-  NameLsa nlsa1("router1", NameLsa::TYPE_STRING, 12, testTimePoint, npl1);
-  NameLsa nlsa2("router2", NameLsa::TYPE_STRING, 12, testTimePoint, npl1);
+
+  //3rd arg is seqNo. which will be a random number I just put in 12.
+  NameLsa nlsa1("router1", 12, testTimePoint, npl1);
+  NameLsa nlsa2("router2", 12, testTimePoint, npl1);
 
   BOOST_CHECK_EQUAL(nlsa1.getLsType(), NameLsa::TYPE_STRING);
 
@@ -68,7 +69,7 @@
   activeAdjacency.setStatus(Adjacent::STATUS_ACTIVE);
   activeAdjacencies.insert(activeAdjacency);
 
-  AdjLsa alsa1(routerName, AdjLsa::TYPE_STRING, seqNo, testTimePoint,
+  AdjLsa alsa1(routerName, seqNo, testTimePoint,
                activeAdjacencies.getSize(), activeAdjacencies);
   BOOST_CHECK_EQUAL(alsa1.getAdl().getSize(), 1);
   BOOST_CHECK_EQUAL(alsa1.getLsType(), AdjLsa::TYPE_STRING);
@@ -83,7 +84,7 @@
   inactiveAdjacency.setStatus(Adjacent::STATUS_INACTIVE);
   inactiveAdjacencies.insert(inactiveAdjacency);
 
-  AdjLsa alsa2(routerName, AdjLsa::TYPE_STRING, seqNo, testTimePoint,
+  AdjLsa alsa2(routerName, seqNo, testTimePoint,
                inactiveAdjacencies.getSize(), inactiveAdjacencies);
   BOOST_CHECK_EQUAL(alsa2.getAdl().getSize(), 0);
 
@@ -91,7 +92,7 @@
   BOOST_CHECK_EQUAL(alsa1.isEqualContent(alsa2), false);
 
   // Create a duplicate of alsa1 which should have equal content
-  AdjLsa alsa3(routerName, AdjLsa::TYPE_STRING, seqNo, testTimePoint,
+  AdjLsa alsa3(routerName, seqNo, testTimePoint,
                activeAdjacencies.getSize(), activeAdjacencies);
   BOOST_CHECK(alsa1.isEqualContent(alsa3));
 }
@@ -99,9 +100,8 @@
 BOOST_AUTO_TEST_CASE(CoordinateLsaConstructorAndGetters)
 {
   ndn::time::system_clock::TimePoint testTimePoint =  ndn::time::system_clock::now();
-//For CoordinateLsa, lsType is 3.
-  CoordinateLsa clsa1("router1", CoordinateLsa::TYPE_STRING, 12, testTimePoint, 2.5, 30.0);
-  CoordinateLsa clsa2("router1", CoordinateLsa::TYPE_STRING, 12, testTimePoint, 2.5, 30.0);
+  CoordinateLsa clsa1("router1", 12, testTimePoint, 2.5, 30.0);
+  CoordinateLsa clsa2("router1", 12, testTimePoint, 2.5, 30.0);
 
   BOOST_CHECK_CLOSE(clsa1.getCorRadius(), 2.5, 0.0001);
   BOOST_CHECK_CLOSE(clsa1.getCorTheta(), 30.0, 0.0001);
@@ -130,7 +130,7 @@
 
   const std::string TEST_TIME_POINT_STRING = ss.str();
 
-  AdjLsa lsa("router1", AdjLsa::TYPE_STRING, 12, testTimePoint, 1, adjList);
+  AdjLsa lsa("router1", 12, testTimePoint, adjList.getSize(), adjList);
 
   std::string EXPECTED_OUTPUT =
     "Adj Lsa:\n"
@@ -155,6 +155,59 @@
   BOOST_CHECK_EQUAL(os.str(), EXPECTED_OUTPUT);
 }
 
+BOOST_AUTO_TEST_CASE(TestInitializeFromContent)
+{
+  //Adj LSA
+  Adjacent adj1("adjacent1");
+  Adjacent adj2("adjacent2");
+
+  adj1.setStatus(Adjacent::STATUS_ACTIVE);
+  adj2.setStatus(Adjacent::STATUS_ACTIVE);
+
+  //If we don't do this the test will fail
+  //Adjacent has default cost of 10 but no default
+  //connecting face URI, so initializeFromContent fails
+  adj1.setConnectingFaceUri("10.0.0.1");
+  adj2.setConnectingFaceUri("10.0.0.2");
+
+  AdjacencyList adjList;
+  adjList.insert(adj1);
+  adjList.insert(adj2);
+
+  ndn::time::system_clock::TimePoint testTimePoint = ndn::time::system_clock::now();
+
+  AdjLsa adjlsa1("router1", 1, testTimePoint, adjList.getSize(), adjList);
+  AdjLsa adjlsa2;
+
+  BOOST_CHECK(adjlsa2.initializeFromContent(adjlsa1.getData()));
+
+  BOOST_CHECK(adjlsa1.isEqualContent(adjlsa2));
+
+  //Name LSA
+  NamePrefixList npl1;
+
+  std::string s1 = "name1";
+  std::string s2 = "name2";
+
+  npl1.insert(s1);
+  npl1.insert(s2);
+
+  NameLsa nlsa1("router1", 1, testTimePoint, npl1);
+  NameLsa nlsa2;
+
+  BOOST_CHECK(nlsa2.initializeFromContent(nlsa1.getData()));
+
+  BOOST_CHECK_EQUAL(nlsa1.getData(), nlsa2.getData());
+
+  //Coordinate LSA
+  CoordinateLsa clsa1("router1", 12, testTimePoint, 2.5, 30.0);
+  CoordinateLsa clsa2;
+
+  BOOST_CHECK(clsa2.initializeFromContent(clsa1.getData()));
+
+  BOOST_CHECK_EQUAL(clsa1.getData(), clsa2.getData());
+}
+
 BOOST_AUTO_TEST_SUITE_END()
 
 } // namespace test
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index c44b4a7..7111620 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -171,7 +171,7 @@
   //For NameLsa lsType is name.
   //12 is seqNo, randomly generated.
   //1800 is the default life time.
-  NameLsa nlsa1(ndn::Name("/router1/1"), NameLsa::TYPE_STRING, 12, testTimePoint, npl1);
+  NameLsa nlsa1(ndn::Name("/router1/1"), 12, testTimePoint, npl1);
 
   Lsdb lsdb1(nlsr, g_scheduler, nlsr.getSyncLogicHandler());
 
@@ -198,7 +198,7 @@
   std::string otherRouter("/ndn/site/%C1.router/other-router");
   ndn::time::system_clock::TimePoint MAX_TIME = ndn::time::system_clock::TimePoint::max();
 
-  NameLsa lsa(otherRouter, NameLsa::TYPE_STRING, 1, MAX_TIME, prefixes);
+  NameLsa lsa(otherRouter, 1, MAX_TIME, prefixes);
   lsdb.installNameLsa(lsa);
 
   BOOST_REQUIRE_EQUAL(lsdb.doesLsaExist(otherRouter + "/name", NameLsa::TYPE_STRING), true);
@@ -210,7 +210,7 @@
   ndn::Name name3("/ndn/name3");
   prefixes.insert(name3);
 
-  NameLsa addLsa(otherRouter, NameLsa::TYPE_STRING, 2, MAX_TIME, prefixes);
+  NameLsa addLsa(otherRouter, 2, MAX_TIME, prefixes);
   lsdb.installNameLsa(addLsa);
 
   // Lsa should include name1, name2, and name3
@@ -219,7 +219,7 @@
   // Remove a prefix: name2
   prefixes.remove(name2);
 
-  NameLsa removeLsa(otherRouter, NameLsa::TYPE_STRING, 3, MAX_TIME, prefixes);
+  NameLsa removeLsa(otherRouter, 3, MAX_TIME, prefixes);
   lsdb.installNameLsa(removeLsa);
 
   // Lsa should include name1 and name3
@@ -229,7 +229,7 @@
   prefixes.insert(name2);
   prefixes.remove(name3);
 
-  NameLsa addAndRemoveLsa(otherRouter, NameLsa::TYPE_STRING, 4, MAX_TIME, prefixes);
+  NameLsa addAndRemoveLsa(otherRouter, 4, MAX_TIME, prefixes);
   lsdb.installNameLsa(addAndRemoveLsa);
 
   // Lsa should include name1 and name2
@@ -243,7 +243,7 @@
   newPrefixes.insert(name4);
   newPrefixes.insert(name5);
 
-  NameLsa newLsa(otherRouter, NameLsa::TYPE_STRING, 5, MAX_TIME, newPrefixes);
+  NameLsa newLsa(otherRouter, 5, MAX_TIME, newPrefixes);
   lsdb.installNameLsa(newLsa);
 
   // Lsa should include name4 and name5
diff --git a/tests/test-name-prefix-table.cpp b/tests/test-name-prefix-table.cpp
index 8392102..989db19 100644
--- a/tests/test-name-prefix-table.cpp
+++ b/tests/test-name-prefix-table.cpp
@@ -69,9 +69,7 @@
 
   // This router's Adjacency LSA
   nlsr.getAdjacencyList().insert(bupt);
-  AdjLsa thisRouterAdjLsa(thisRouter.getName(),
-                          AdjLsa::TYPE_STRING,
-                          1,
+  AdjLsa thisRouterAdjLsa(thisRouter.getName(), 1,
                           ndn::time::system_clock::now() + ndn::time::seconds::max(),
                           2,
                           nlsr.getAdjacencyList());
@@ -81,9 +79,7 @@
   // BUPT Adjacency LSA
   AdjacencyList buptAdjacencies;
   buptAdjacencies.insert(thisRouter);
-  AdjLsa buptAdjLsa(buptRouterName,
-                    AdjLsa::TYPE_STRING,
-                    1,
+  AdjLsa buptAdjLsa(buptRouterName, 1,
                     ndn::time::system_clock::now() + ndn::time::seconds(5),
                     0 , buptAdjacencies);
 
@@ -95,10 +91,7 @@
   NamePrefixList buptNames;
   buptNames.insert(buptAdvertisedName);
 
-  NameLsa buptNameLsa(buptRouterName,
-                      NameLsa::TYPE_STRING,
-                      1,
-                      ndn::time::system_clock::now(),
+  NameLsa buptNameLsa(buptRouterName, 1, ndn::time::system_clock::now(),
                       buptNames);
 
   lsdb.installNameLsa(buptNameLsa);
@@ -111,8 +104,7 @@
   BOOST_REQUIRE(it == npt.end());
 
   // Install new name LSA
-  NameLsa buptNewNameLsa(buptRouterName, NameLsa::TYPE_STRING,
-                         12,
+  NameLsa buptNewNameLsa(buptRouterName, 12,
                          ndn::time::system_clock::now() + ndn::time::seconds(3600),
                          buptNames);
 
@@ -121,8 +113,7 @@
   this->advanceClocks(ndn::time::seconds(1));
 
   // Install new adjacency LSA
-  AdjLsa buptNewAdjLsa(buptRouterName, AdjLsa::TYPE_STRING,
-                       12,
+  AdjLsa buptNewAdjLsa(buptRouterName, 12,
                        ndn::time::system_clock::now() + ndn::time::seconds(3600),
                        0, buptAdjacencies);
   lsdb.installAdjLsa(buptNewAdjLsa);
diff --git a/tests/test-nlsr.cpp b/tests/test-nlsr.cpp
index d24e512..5ad6efd 100644
--- a/tests/test-nlsr.cpp
+++ b/tests/test-nlsr.cpp
@@ -144,15 +144,14 @@
   // This router
   Adjacent thisRouter(conf.getRouterPrefix(), "uri://faceB", 10, Adjacent::STATUS_ACTIVE, 0, 256);
 
-  AdjLsa ownAdjLsa(conf.getRouterPrefix(), AdjLsa::TYPE_STRING, 10, ndn::time::system_clock::now(),
-                   1, neighbors);
+  AdjLsa ownAdjLsa(conf.getRouterPrefix(), 10, ndn::time::system_clock::now(), 1, neighbors);
   lsdb.installAdjLsa(ownAdjLsa);
 
   // Router that will fail
   AdjacencyList failAdjacencies;
   failAdjacencies.insert(thisRouter);
 
-  AdjLsa failAdjLsa("/ndn/neighborA", AdjLsa::TYPE_STRING, 10,
+  AdjLsa failAdjLsa("/ndn/neighborA", 10,
                      ndn::time::system_clock::now() + ndn::time::seconds(3600), 1, failAdjacencies);
 
   lsdb.installAdjLsa(failAdjLsa);
@@ -161,7 +160,7 @@
   AdjacencyList otherAdjacencies;
   otherAdjacencies.insert(thisRouter);
 
-  AdjLsa otherAdjLsa("/ndn/neighborB", AdjLsa::TYPE_STRING, 10,
+  AdjLsa otherAdjLsa("/ndn/neighborB", 10,
                      ndn::time::system_clock::now() + ndn::time::seconds(3600), 1, otherAdjacencies);
 
   lsdb.installAdjLsa(otherAdjLsa);
@@ -254,7 +253,7 @@
   ndn::Name nameToAdvertise("/ndn/neighborB/name");
   nameList.insert(nameToAdvertise);
 
-  NameLsa nameLsa("/ndn/neighborB", "name", 25, ndn::time::system_clock::now(), nameList);
+  NameLsa nameLsa("/ndn/neighborB", 25, ndn::time::system_clock::now(), nameList);
   lsdb.installNameLsa(nameLsa);
 
   nlsr.initialize();
@@ -266,15 +265,14 @@
   // This router
   Adjacent thisRouter(conf.getRouterPrefix(), "uri://faceB", 25, Adjacent::STATUS_ACTIVE, 0, 256);
 
-  AdjLsa ownAdjLsa(conf.getRouterPrefix(), AdjLsa::TYPE_STRING, 10, ndn::time::system_clock::now(),
-                   1, neighbors);
+  AdjLsa ownAdjLsa(conf.getRouterPrefix(), 10, ndn::time::system_clock::now(), 1, neighbors);
   lsdb.installAdjLsa(ownAdjLsa);
 
   // Other ACTIVE router
   AdjacencyList otherAdjacencies;
   otherAdjacencies.insert(thisRouter);
 
-  AdjLsa otherAdjLsa("/ndn/neighborB", AdjLsa::TYPE_STRING, 10,
+  AdjLsa otherAdjLsa("/ndn/neighborB", 10,
                      ndn::time::system_clock::now() + ndn::time::seconds(3600), 1, otherAdjacencies);
 
   lsdb.installAdjLsa(otherAdjLsa);
diff --git a/tests/test-sync-logic-handler.cpp b/tests/test-sync-logic-handler.cpp
index 56a990f..c2e092d 100644
--- a/tests/test-sync-logic-handler.cpp
+++ b/tests/test-sync-logic-handler.cpp
@@ -124,17 +124,17 @@
 
   // Install Name LSA
   NamePrefixList nameList;
-  NameLsa lsa(originRouter, NameLsa::TYPE_STRING, 999, ndn::time::system_clock::TimePoint::max(), nameList);
+  NameLsa lsa(originRouter, 999, ndn::time::system_clock::TimePoint::max(), nameList);
   lsdb.installNameLsa(lsa);
 
   // Install Adj LSA
   AdjacencyList adjList;
-  AdjLsa adjLsa(originRouter, AdjLsa::TYPE_STRING, 1000, ndn::time::system_clock::TimePoint::max(),
+  AdjLsa adjLsa(originRouter, 1000, ndn::time::system_clock::TimePoint::max(),
                 3 , adjList);
   lsdb.installAdjLsa(adjLsa);
 
   // Install Cor LSA
-  CoordinateLsa corLsa(originRouter, CoordinateLsa::TYPE_STRING, 1000, ndn::time::system_clock::TimePoint::max(),
+  CoordinateLsa corLsa(originRouter, 1000, ndn::time::system_clock::TimePoint::max(),
                        0,0);
   lsdb.installCoordinateLsa(corLsa);
 
diff --git a/tests/tlv/test-lsa-info.cpp b/tests/tlv/test-lsa-info.cpp
index 0e6d906..e8cd5db 100644
--- a/tests/tlv/test-lsa-info.cpp
+++ b/tests/tlv/test-lsa-info.cpp
@@ -125,7 +125,7 @@
 
 BOOST_AUTO_TEST_CASE(LsaInfoMake)
 {
-  Lsa lsa;
+  Lsa lsa("lsa-type");
   lsa.setOrigRouter("/test/lsa/info/tlv");
   lsa.setLsSeqNo(128);
   lsa.setExpirationTimePoint(ndn::time::system_clock::now());