Use separate name prefix and sequence number for each LSA type
refs: #1523
Change-Id: I9db6b3a3ea9ce5e17e132d2a4e2ae9f30dd4f591
diff --git a/tests/update/test-nfd-rib-command-processor.cpp b/tests/update/test-nfd-rib-command-processor.cpp
index 3c0ae47..81b66ce 100644
--- a/tests/update/test-nfd-rib-command-processor.cpp
+++ b/tests/update/test-nfd-rib-command-processor.cpp
@@ -56,6 +56,8 @@
this->advanceClocks(ndn::time::milliseconds(10));
face.sentInterests.clear();
+
+ nameLsaSeqNoBeforeInterest = nlsr.getLsdb().getSequencingManager().getNameLsaSeq();
}
std::shared_ptr<ndn::Interest>
@@ -73,9 +75,11 @@
// no longer does face->put(*data) in publishData.
// Instead it does it in onInterest
ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA");
+ lsaInterestName.append(NameLsa::TYPE_STRING);
+
// The part after LSA is Chronosync getSession
lsaInterestName.append(sessionTime);
- lsaInterestName.appendNumber(nlsr.getSequencingManager().getCombinedSeqNo());
+ lsaInterestName.appendNumber(nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
shared_ptr<ndn::Interest> lsaInterest = make_shared<ndn::Interest>(lsaInterestName);
face.receive(*lsaInterest);
@@ -89,7 +93,7 @@
const ndn::Name& lsaPrefix = nlsr.getConfParameter().getLsaPrefix();
const auto& it = std::find_if(face.sentData.begin(), face.sentData.end(),
- [lsaPrefix] (const ndn::Data& data) {
+ [&] (const ndn::Data& data) {
return lsaPrefix.isPrefixOf(data.getName());
});
@@ -104,6 +108,7 @@
NamePrefixList& namePrefixes;
NfdRibCommandProcessor& processor;
ndn::Name sessionTime;
+ uint64_t nameLsaSeqNoBeforeInterest;
};
typedef boost::mpl::vector<NfdRibRegisterCommand, NfdRibUnregisterCommand> Commands;
@@ -150,6 +155,7 @@
}
BOOST_CHECK_EQUAL((*itr), parameters.getName());
BOOST_CHECK(wasRoutingUpdatePublished());
+ BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
}
BOOST_AUTO_TEST_CASE(RemovePrefix)
@@ -170,6 +176,7 @@
BOOST_FAIL("Prefix was not removed!");
}
BOOST_CHECK(wasRoutingUpdatePublished());
+ BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
}
BOOST_AUTO_TEST_CASE(onReceiveInterestRegisterCommand)
@@ -192,6 +199,7 @@
}
BOOST_CHECK_EQUAL((*itr), prefixName);
BOOST_CHECK(wasRoutingUpdatePublished());
+ BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
}
BOOST_AUTO_TEST_CASE(onReceiveInterestUnregisterCommand)
@@ -210,6 +218,7 @@
BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 0);
BOOST_CHECK(wasRoutingUpdatePublished());
+ BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
}
BOOST_AUTO_TEST_CASE(onReceiveInterestInvalidPrefix)
@@ -225,7 +234,10 @@
this->advanceClocks(ndn::time::milliseconds(10));
BOOST_CHECK_EQUAL(namePrefixes.getNameList().size(), 0);
- BOOST_CHECK(!wasRoutingUpdatePublished());
+
+ // Cannot use routingUpdatePublish test now since in
+ // initialize nlsr calls buildOwnNameLsa which publishes the routing update
+ BOOST_CHECK(nameLsaSeqNoBeforeInterest == nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/update/test-prefix-update-processor.cpp b/tests/update/test-prefix-update-processor.cpp
index 169fc48..efb24a0 100644
--- a/tests/update/test-prefix-update-processor.cpp
+++ b/tests/update/test-prefix-update-processor.cpp
@@ -161,9 +161,12 @@
// no longer does face->put(*data) in publishData.
// Instead it does it in onInterest
ndn::Name lsaInterestName("/localhop/ndn/NLSR/LSA");
+ lsaInterestName.append(NameLsa::TYPE_STRING);
+
// The part after LSA is Chronosync getSession
lsaInterestName.append(sessionTime);
- lsaInterestName.appendNumber(nlsr.getSequencingManager().getCombinedSeqNo());
+ lsaInterestName.appendNumber(nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
+
shared_ptr<Interest> lsaInterest = make_shared<Interest>(lsaInterestName);
face.receive(*lsaInterest);
@@ -231,6 +234,7 @@
BOOST_AUTO_TEST_CASE(Basic)
{
+ uint64_t nameLsaSeqNoBeforeInterest = nlsr.getLsdb().getSequencingManager().getNameLsaSeq();
updateProcessor.enable();
// Advertise
@@ -252,8 +256,10 @@
BOOST_CHECK_EQUAL(namePrefixList.getNameList().front(), parameters.getName());
BOOST_CHECK(wasRoutingUpdatePublished());
+ BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
face.sentData.clear();
+ nameLsaSeqNoBeforeInterest = nlsr.getLsdb().getSequencingManager().getNameLsaSeq();
// Withdraw
ndn::Name withdrawCommand("/localhost/nlsr/prefix-update/withdraw");
@@ -268,6 +274,7 @@
BOOST_CHECK_EQUAL(namePrefixList.getSize(), 0);
BOOST_CHECK(wasRoutingUpdatePublished());
+ BOOST_CHECK(nameLsaSeqNoBeforeInterest < nlsr.getLsdb().getSequencingManager().getNameLsaSeq());
}
BOOST_AUTO_TEST_CASE(DisabledAndEnabled)