**breaking** Change NLSR to nlsr for various prefixes
src: register router prefix to fix remote requests
refs: #4543
Change-Id: I698484318bf8e641f955ea40e6c51c6865cad8bf
diff --git a/tests/publisher/publisher-fixture.hpp b/tests/publisher/publisher-fixture.hpp
index dd733fa..05e5a0f 100644
--- a/tests/publisher/publisher-fixture.hpp
+++ b/tests/publisher/publisher-fixture.hpp
@@ -60,6 +60,23 @@
}
void
+ checkPrefixRegistered(const Name& prefix)
+ {
+ bool registerCommandEmitted = false;
+ for (const auto& interest : face.sentInterests) {
+ if (interest.getName().size() > 4 && interest.getName().get(3) == name::Component("register")) {
+ name::Component test = interest.getName().get(4);
+ ndn::nfd::ControlParameters params(test.blockFromValue());
+ if (params.getName() == prefix) {
+ registerCommandEmitted = true;
+ break;
+ }
+ }
+ }
+ BOOST_CHECK(registerCommandEmitted);
+ }
+
+ void
addAdjacency(AdjLsa& lsa, const std::string& name, const std::string& faceUri, double cost)
{
Adjacent adjacency(name, ndn::FaceUri(faceUri), cost, Adjacent::STATUS_ACTIVE, 0, 0);
diff --git a/tests/publisher/test-dataset-interest-handler.cpp b/tests/publisher/test-dataset-interest-handler.cpp
index 7cc4a84..bbb37a7 100644
--- a/tests/publisher/test-dataset-interest-handler.cpp
+++ b/tests/publisher/test-dataset-interest-handler.cpp
@@ -57,6 +57,8 @@
BOOST_AUTO_TEST_CASE(Localhost)
{
+ checkPrefixRegistered(Nlsr::LOCALHOST_PREFIX);
+
// Install adjacency LSA
AdjLsa adjLsa;
adjLsa.setOrigRouter("/RouterA");
@@ -108,6 +110,13 @@
BOOST_AUTO_TEST_CASE(Routername)
{
+ ndn::Name regRouterPrefix(nlsr.getConfParameter().getRouterPrefix());
+ regRouterPrefix.append("nlsr");
+ // Should already be added to dispatcher
+ BOOST_CHECK_THROW(nlsr.getDispatcher().addTopPrefix(regRouterPrefix), std::out_of_range);
+
+ checkPrefixRegistered(regRouterPrefix);
+
//Install adjacencies LSA
AdjLsa adjLsa;
adjLsa.setOrigRouter("/RouterA");
@@ -129,22 +138,22 @@
rt1.addNextHop(DEST_ROUTER, nh);
// Request adjacency LSAs
- face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/lsdb").append("adjacencies")));
+ face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/lsdb").append("adjacencies")));
processDatasetInterest(face,
[] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::AdjacencyLsa; });
// Request coordinate LSAs
- face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/lsdb").append("coordinates")));
+ face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/lsdb").append("coordinates")));
processDatasetInterest(face,
[] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::CoordinateLsa; });
// Request Name LSAs
- face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/lsdb").append("names")));
+ face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/lsdb").append("names")));
processDatasetInterest(face,
[] (const ndn::Block& block) { return block.type() == ndn::tlv::nlsr::NameLsa; });
// Request Routing Table
- face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/routing-table")));
+ face.receive(ndn::Interest(ndn::Name("/ndn/This/Router/nlsr/routing-table")));
processDatasetInterest(face,
[] (const ndn::Block& block) {
return block.type() == ndn::tlv::nlsr::RoutingTable; });
diff --git a/tests/test-conf-file-processor.cpp b/tests/test-conf-file-processor.cpp
index a5c8005..14fce9a 100644
--- a/tests/test-conf-file-processor.cpp
+++ b/tests/test-conf-file-processor.cpp
@@ -172,8 +172,8 @@
BOOST_CHECK_EQUAL(conf.getSiteName(), "/memphis.edu/");
BOOST_CHECK_EQUAL(conf.getRouterName(), "/cs/pollux/");
BOOST_CHECK_EQUAL(conf.getRouterPrefix(), "/ndn/memphis.edu/cs/pollux/");
- BOOST_CHECK_EQUAL(conf.getChronosyncPrefix(), ndn::Name("/localhop/ndn/NLSR/sync").appendVersion(ConfParameter::SYNC_VERSION));
- BOOST_CHECK_EQUAL(conf.getLsaPrefix(), "/localhop/ndn/NLSR/LSA");
+ BOOST_CHECK_EQUAL(conf.getChronosyncPrefix(), ndn::Name("/localhop/ndn/nlsr/sync").appendVersion(ConfParameter::SYNC_VERSION));
+ BOOST_CHECK_EQUAL(conf.getLsaPrefix(), "/localhop/ndn/nlsr/LSA");
BOOST_CHECK_EQUAL(conf.getLsaRefreshTime(), 1800);
BOOST_CHECK_EQUAL(conf.getLsaInterestLifetime(), ndn::time::seconds(3));
BOOST_CHECK_EQUAL(conf.getRouterDeadInterval(), 86400);
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 0709e43..b6645d2 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -73,7 +73,7 @@
// Need to send an interest now since ChronoSync
// no longer does face->put(*data) in publishData.
// Instead it does it in onInterest
- ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA/This/router");
+ ndn::Name lsaInterestName("/localhop/ndn/nlsr/LSA/This/router");
lsaInterestName.append(std::to_string(Lsa::Type::NAME));
lsaInterestName.appendNumber(nlsr.getLsdb().getSequencingManager().getNameLsaSeq());