lsdb: rebuild using boost::multi_index to replace 3 LSA lists

refs: #4127

Co-authored-by: Nick Gordon <nmgordon@memphis.edu>

Change-Id: Ic179f90019e472157b0d61c6db02a4afaf4843b6
diff --git a/tests/test-statistics.cpp b/tests/test-statistics.cpp
index cfd82b6..016d51e 100644
--- a/tests/test-statistics.cpp
+++ b/tests/test-statistics.cpp
@@ -1,5 +1,5 @@
- /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/*
  * Copyright (c) 2014-2020,  The University of Memphis,
  *                           Regents of the University of California,
  *                           Arizona Board of Regents.
@@ -17,7 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License along with
  * NLSR, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
- **/
+ */
 
 #include "statistics.hpp"
 #include "test-common.hpp"
@@ -225,10 +225,7 @@
   // Adjacency LSA
   lsdb.buildAndInstallOwnAdjLsa();
 
-  ndn::Name adjLsaKey = conf.getRouterPrefix();
-  adjLsaKey.append(boost::lexical_cast<std::string>(Lsa::Type::ADJACENCY));
-
-  AdjLsa* adjLsa = lsdb.findAdjLsa(adjLsaKey);
+  auto adjLsa = lsdb.findLsa<AdjLsa>(conf.getRouterPrefix());
   uint32_t seqNo = adjLsa->getSeqNo();
 
   Adjacent adjacency("adjacency");
@@ -236,7 +233,7 @@
 
   adjLsa->addAdjacent(adjacency);
 
-  lsdb.installAdjLsa(*adjLsa);
+  lsdb.installLsa(adjLsa);
 
   const std::string interestPrefix("/localhop/ndn/nlsr/LSA/site/%C1.Router/this-router/");
 
@@ -248,16 +245,13 @@
                                    Statistics::PacketType::SENT_ADJ_LSA_DATA);
 
   // Name LSA
-  ndn::Name nameLsaKey = conf.getRouterPrefix();
-  nameLsaKey.append(boost::lexical_cast<std::string>(Lsa::Type::NAME));
-
-  NameLsa* nameLsa = lsdb.findNameLsa(nameLsaKey);
+  auto nameLsa = std::static_pointer_cast<NameLsa>(lsdb.findLsa(conf.getRouterPrefix(), Lsa::Type::NAME));
   BOOST_ASSERT(nameLsa != nullptr);
 
   seqNo = nameLsa->getSeqNo();
 
   nameLsa->addName(ndn::Name("/ndn/name"));
-  lsdb.installNameLsa(*nameLsa);
+  lsdb.installLsa(nameLsa);
 
   // Receive Name LSA Interest
   receiveInterestAndCheckSentStats(interestPrefix,
@@ -271,10 +265,11 @@
   ndn::Name coorLsaKey = conf.getRouterPrefix();
   coorLsaKey.append(boost::lexical_cast<std::string>(Lsa::Type::COORDINATE));
 
-  CoordinateLsa* coorLsa = lsdb.findCoordinateLsa(coorLsaKey);
+  auto coorLsa = lsdb.findLsa<CoordinateLsa>(conf.getRouterPrefix());
+
   seqNo = coorLsa->getSeqNo();
   coorLsa->setCorTheta({20.0, 30.0});
-  lsdb.installCoordinateLsa(*coorLsa);
+  lsdb.installLsa(coorLsa);
 
   // Receive Adjacency LSA Interest
   receiveInterestAndCheckSentStats(interestPrefix,
@@ -304,7 +299,7 @@
   ndn::Name adjInterest("/localhop/ndn/nlsr/LSA/cs/%C1.Router/router1/ADJACENCY/");
   adjInterest.appendNumber(seqNo);
   AdjLsa aLsa(routerName, seqNo, MAX_TIME, 1, conf.getAdjacencyList());
-  lsdb.installAdjLsa(aLsa);
+  lsdb.installLsa(std::make_shared<AdjLsa>(aLsa));
 
   lsdb.afterFetchLsa(aLsa.wireEncode().getBuffer(), adjInterest);
   BOOST_CHECK_EQUAL(collector.getStatistics().get(Statistics::PacketType::RCV_ADJ_LSA_DATA), 1);
@@ -314,7 +309,7 @@
   coordInterest.appendNumber(seqNo);
   std::vector<double> angles = {20.0, 30.0};
   CoordinateLsa cLsa(routerName, seqNo, MAX_TIME, 2.5, angles);
-  lsdb.installCoordinateLsa(cLsa);
+  lsdb.installLsa(std::make_shared<CoordinateLsa>(cLsa));
 
   lsdb.afterFetchLsa(cLsa.wireEncode().getBuffer(), coordInterest);
   BOOST_CHECK_EQUAL(collector.getStatistics().get(Statistics::PacketType::RCV_COORD_LSA_DATA), 1);
@@ -323,7 +318,7 @@
   ndn::Name interestName("/localhop/ndn/nlsr/LSA/cs/%C1.Router/router1/NAME/");
   interestName.appendNumber(seqNo);
   NameLsa nlsa(routerName, seqNo, MAX_TIME, conf.getNamePrefixList());
-  lsdb.installNameLsa(nlsa);
+  lsdb.installLsa(std::make_shared<NameLsa>(nlsa));
 
   lsdb.afterFetchLsa(nlsa.wireEncode().getBuffer(), interestName);
   BOOST_CHECK_EQUAL(collector.getStatistics().get(Statistics::PacketType::RCV_NAME_LSA_DATA), 1);