**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; });