mgmt: ForwarderStatusManager answers only status/general
GeneralStatus dataset at /localhost/nfd/status prefix was deprecated
and is now removed.
refs #3379
Change-Id: I9ce8bba9b11823b6a1a159703cc9f8050656ab53
diff --git a/daemon/mgmt/forwarder-status-manager.cpp b/daemon/mgmt/forwarder-status-manager.cpp
index 27cf4e2..025f3f6 100644
--- a/daemon/mgmt/forwarder-status-manager.cpp
+++ b/daemon/mgmt/forwarder-status-manager.cpp
@@ -29,14 +29,14 @@
namespace nfd {
-const time::milliseconds STATUS_SERVER_DEFAULT_FRESHNESS = time::milliseconds(5000);
+static const time::milliseconds STATUS_FRESHNESS(5000);
ForwarderStatusManager::ForwarderStatusManager(Forwarder& forwarder, Dispatcher& dispatcher)
: m_forwarder(forwarder)
, m_dispatcher(dispatcher)
, m_startTimestamp(time::system_clock::now())
{
- m_dispatcher.addStatusDataset("status", ndn::mgmt::makeAcceptAllAuthorization(),
+ m_dispatcher.addStatusDataset("status/general", ndn::mgmt::makeAcceptAllAuthorization(),
bind(&ForwarderStatusManager::listGeneralStatus, this, _1, _2, _3));
}
@@ -70,24 +70,12 @@
ForwarderStatusManager::listGeneralStatus(const Name& topPrefix, const Interest& interest,
ndn::mgmt::StatusDatasetContext& context)
{
- static const PartialName PREFIX_STATUS("status");
- static const PartialName PREFIX_STATUS_GENERAL("status/general");
-
- PartialName subPrefix = interest.getName().getSubName(topPrefix.size());
- if (subPrefix == PREFIX_STATUS_GENERAL || subPrefix == PREFIX_STATUS) {
- context.setPrefix(Name(topPrefix).append(PREFIX_STATUS_GENERAL));
- }
- else {
- context.reject(ndn::mgmt::ControlResponse().setCode(404));
- return;
- }
- // TODO#3379 register the dataset at status/general, and delete these conditions
-
- context.setExpiry(STATUS_SERVER_DEFAULT_FRESHNESS);
+ context.setExpiry(STATUS_FRESHNESS);
auto status = this->collectGeneralStatus();
- status.wireEncode().parse();
- for (const auto& subblock : status.wireEncode().elements()) {
+ const Block& wire = status.wireEncode();
+ wire.parse();
+ for (const auto& subblock : wire.elements()) {
context.append(subblock);
}
context.end();
diff --git a/tests/daemon/mgmt/forwarder-status-manager.t.cpp b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
index 3bd8127..ec73af1 100644
--- a/tests/daemon/mgmt/forwarder-status-manager.t.cpp
+++ b/tests/daemon/mgmt/forwarder-status-manager.t.cpp
@@ -97,20 +97,6 @@
// TODO#3325 check packet counter values
}
-BOOST_AUTO_TEST_CASE(GeneralStatusLegacy) // request GeneralStatus with legacy name
-{
- auto request = makeInterest("ndn:/localhost/nfd/status");
- request->setMustBeFresh(true);
- request->setChildSelector(1);
- this->receiveInterest(request);
-
- BOOST_REQUIRE_GE(m_responses.size(), 1);
- BOOST_CHECK(Name("ndn:/localhost/nfd/status/general").isPrefixOf(m_responses.front().getName()));
-
- Block response = this->concatenateResponses(0, m_responses.size());
- BOOST_REQUIRE_NO_THROW(ndn::nfd::ForwarderStatus(response));
-}
-
BOOST_AUTO_TEST_SUITE_END() // TestForwarderStatusManager
BOOST_AUTO_TEST_SUITE_END() // Mgmt