config+lsdb: Retry retrieve each LSA for `lsa-refresh-time`
This commit also includes extension of the config file
(`lsa-interest-lifetime` parameter in general section)
Change-Id: Ifd01af8cc98d41f7bdc953799a280e4b4269a358
Refs: #1873, #1874
diff --git a/tests/test-adjacent.cpp b/tests/test-adjacent.cpp
index 0dc7af0..d7eef1b 100644
--- a/tests/test-adjacent.cpp
+++ b/tests/test-adjacent.cpp
@@ -40,8 +40,8 @@
Adjacent adjacent2(ADJ_NAME_2);
BOOST_CHECK(adjacent1 == adjacent2);
- adjacent1.setLinkCost(10.5);
- BOOST_CHECK_CLOSE(adjacent1.getLinkCost(), 10.5, 0.0001);
+ adjacent1.setLinkCost(10.1);
+ BOOST_CHECK_EQUAL(adjacent1.getLinkCost(), 11);
BOOST_CHECK_EQUAL(adjacent1.getName(), "testname");
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index a786ec9..7025914 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -38,27 +38,30 @@
const std::string CONFIG =
"general\n"
"{\n"
- " network /ndn/\n"
+ " network /ndn/\n"
" site /memphis.edu/\n"
" router /cs/pollux/\n"
" lsa-refresh-time 1800\n"
+ " lsa-interest-lifetime 3\n"
" log-level INFO\n"
+ " log-dir /tmp\n"
+ " seq-dir /tmp\n"
"}\n\n"
"neighbors\n"
"{\n"
" hello-retries 3\n"
- " hello-time-out 1\n"
+ " hello-timeout 1\n"
" hello-interval 60\n\n"
" neighbor\n"
" {\n"
" name /ndn/memphis.edu/cs/castor\n"
- " face-id 15\n"
+ " face-uri udp4://localhost\n"
" link-cost 20\n"
" }\n\n"
" neighbor\n"
" {\n"
" name /ndn/memphis.edu/cs/mira\n"
- " face-id 17\n"
+ " face-uri udp4://localhost\n"
" link-cost 30\n"
" }\n"
"}\n\n"
@@ -99,6 +102,9 @@
BOOST_CHECK_EQUAL(nlsr1.getNamePrefixList().getSize(), 2);
+ BOOST_CHECK_EQUAL(nlsr1.getConfParameter().getLsaInterestLifetime(),
+ ndn::time::seconds(3));
+
remove("unit-test-nlsr.conf");
}
diff --git a/tests/test-conf-parameter.cpp b/tests/test-conf-parameter.cpp
index 31cbf71..18eebdc 100644
--- a/tests/test-conf-parameter.cpp
+++ b/tests/test-conf-parameter.cpp
@@ -51,6 +51,8 @@
cp1.setLsaRefreshTime(1500);
+ cp1.setLsaInterestLifetime(ndn::time::seconds(1));
+
cp1.setRouterDeadInterval(10);
cp1.setMaxFacesPerPrefix(50);
@@ -79,6 +81,8 @@
BOOST_CHECK_EQUAL(cp1.getLsaRefreshTime(), 1500);
+ BOOST_CHECK_EQUAL(cp1.getLsaInterestLifetime(), ndn::time::seconds(1));
+
BOOST_CHECK_EQUAL(cp1.getRouterDeadInterval(), 10);
BOOST_CHECK_EQUAL(cp1.getMaxFacesPerPrefix(), 50);
diff --git a/tests/test-lsdb.cpp b/tests/test-lsdb.cpp
index 1691468..b6305b9 100644
--- a/tests/test-lsdb.cpp
+++ b/tests/test-lsdb.cpp
@@ -35,6 +35,8 @@
BOOST_AUTO_TEST_CASE(LsdbRemoveAndExists)
{
+ INIT_LOGGERS("/tmp");
+
Nlsr nlsr1;
ndn::time::system_clock::TimePoint testTimePoint = ndn::time::system_clock::now();
NamePrefixList npl1;
@@ -49,17 +51,18 @@
//For NameLsa lsType is name.
//12 is seqNo, randomly generated.
//1800 is the default life time.
- NameLsa nlsa1("router1", std::string("name"), 12, testTimePoint, npl1);
+ NameLsa nlsa1(ndn::Name("/router1/1"), std::string("name"), 12, testTimePoint, npl1);
Lsdb lsdb1(nlsr1);
lsdb1.installNameLsa(nlsa1);
+ lsdb1.writeNameLsdbLog();
- BOOST_CHECK(lsdb1.doesLsaExist("router1/1", std::string("name")));
+ BOOST_CHECK(lsdb1.doesLsaExist(ndn::Name("/router1/1/name"), std::string("name")));
lsdb1.removeNameLsa(router1);
- BOOST_CHECK_EQUAL(lsdb1.doesLsaExist("router1/1", std::string("name")), false);
+ BOOST_CHECK_EQUAL(lsdb1.doesLsaExist(ndn::Name("/router1/1"), std::string("name")), false);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/test-nexthop.cpp b/tests/test-nexthop.cpp
index c0707cc..7c30069 100644
--- a/tests/test-nexthop.cpp
+++ b/tests/test-nexthop.cpp
@@ -35,10 +35,10 @@
np1.setConnectingFaceUri("udp://test/uri");
- np1.setRouteCost(10.5);
+ np1.setRouteCost(10.1);
BOOST_CHECK_EQUAL(np1.getConnectingFaceUri(), "udp://test/uri");
- BOOST_CHECK_CLOSE(np1.getRouteCost(), 10.5, 0.0001);
+ BOOST_CHECK_EQUAL(np1.getRouteCost(), 11);
}
BOOST_AUTO_TEST_SUITE_END()