mgmt: add support for FIB enumeration protocol
refs: #1192
Change-Id: If9198c7d90d8882e9590ce93165667923df59a03
diff --git a/daemon/mgmt/command-validator.hpp b/daemon/mgmt/command-validator.hpp
index 97c7c18..290cabd 100644
--- a/daemon/mgmt/command-validator.hpp
+++ b/daemon/mgmt/command-validator.hpp
@@ -36,6 +36,7 @@
/**
* \param section "authorizations" section to parse
* \param isDryRun true if performing a dry run of configuration, false otherwise
+ * \param filename filename of configuration file
* \throws ConfigFile::Error on parse error
*/
void
diff --git a/daemon/mgmt/fib-enumeration-publisher.cpp b/daemon/mgmt/fib-enumeration-publisher.cpp
new file mode 100644
index 0000000..89f0956
--- /dev/null
+++ b/daemon/mgmt/fib-enumeration-publisher.cpp
@@ -0,0 +1,69 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "fib-enumeration-publisher.hpp"
+
+#include "common.hpp"
+
+#include <ndn-cpp-dev/management/nfd-fib-entry.hpp>
+
+namespace nfd {
+
+NFD_LOG_INIT("FibEnumerationPublisher");
+
+FibEnumerationPublisher::FibEnumerationPublisher(const Fib& fib,
+ shared_ptr<AppFace> face,
+ const Name& prefix)
+ : SegmentPublisher(face, prefix)
+ , m_fib(fib)
+{
+
+}
+
+FibEnumerationPublisher::~FibEnumerationPublisher()
+{
+
+}
+
+size_t
+FibEnumerationPublisher::generate(ndn::EncodingBuffer& outBuffer)
+{
+
+ size_t totalLength = 0;
+ for (Fib::const_iterator i = m_fib.begin(); i != m_fib.end(); ++i)
+ {
+ const fib::Entry& entry = *i;
+ const Name& prefix = entry.getPrefix();
+ size_t fibEntryLength = 0;
+
+ ndn::nfd::FibEntry tlvEntry;
+ const fib::NextHopList& nextHops = entry.getNextHops();
+
+ for (fib::NextHopList::const_iterator j = nextHops.begin();
+ j != nextHops.end();
+ ++j)
+ {
+ const fib::NextHop& next = *j;
+ ndn::nfd::NextHopRecord nextHopRecord;
+ nextHopRecord.setFaceId(next.getFace()->getId());
+ nextHopRecord.setCost(next.getCost());
+
+ tlvEntry.addNextHopRecord(nextHopRecord);
+ }
+
+ tlvEntry.setPrefix(prefix);
+ fibEntryLength += tlvEntry.wireEncode(outBuffer);
+
+ NFD_LOG_DEBUG("generate: fib entry length = " << fibEntryLength);
+
+ totalLength += fibEntryLength;
+ }
+ NFD_LOG_DEBUG("generate: Total length = " << totalLength);
+ return totalLength;
+}
+
+
+} // namespace nfd
diff --git a/daemon/mgmt/fib-enumeration-publisher.hpp b/daemon/mgmt/fib-enumeration-publisher.hpp
new file mode 100644
index 0000000..d9cb5c9
--- /dev/null
+++ b/daemon/mgmt/fib-enumeration-publisher.hpp
@@ -0,0 +1,36 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
+#define NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
+
+#include "table/fib.hpp"
+#include "mgmt/segment-publisher.hpp"
+
+namespace nfd {
+
+class FibEnumerationPublisher : public SegmentPublisher
+{
+public:
+ FibEnumerationPublisher(const Fib& fib,
+ shared_ptr<AppFace> face,
+ const Name& prefix);
+
+ virtual
+ ~FibEnumerationPublisher();
+
+protected:
+
+ virtual size_t
+ generate(ndn::EncodingBuffer& outBuffer);
+
+private:
+ const Fib& m_fib;
+};
+
+} // namespace nfd
+
+#endif // NFD_MGMT_FIB_ENUMERATION_PUBLISHER_HPP
diff --git a/daemon/mgmt/fib-manager.cpp b/daemon/mgmt/fib-manager.cpp
index 0ffe333..9ce7a6f 100644
--- a/daemon/mgmt/fib-manager.cpp
+++ b/daemon/mgmt/fib-manager.cpp
@@ -28,30 +28,46 @@
FibManager::COMMAND_UNSIGNED_NCOMPS +
4; // (timestamp, nonce, signed info tlv, signature tlv)
-const FibManager::VerbAndProcessor FibManager::COMMAND_VERBS[] =
+const FibManager::SignedVerbAndProcessor FibManager::SIGNED_COMMAND_VERBS[] =
{
- VerbAndProcessor(
- Name::Component("add-nexthop"),
- &FibManager::addNextHop
- ),
+ SignedVerbAndProcessor(
+ Name::Component("add-nexthop"),
+ &FibManager::addNextHop
+ ),
- VerbAndProcessor(
- Name::Component("remove-nexthop"),
- &FibManager::removeNextHop
- ),
+ SignedVerbAndProcessor(
+ Name::Component("remove-nexthop"),
+ &FibManager::removeNextHop
+ ),
};
+const FibManager::UnsignedVerbAndProcessor FibManager::UNSIGNED_COMMAND_VERBS[] =
+ {
+ UnsignedVerbAndProcessor(
+ Name::Component("list"),
+ &FibManager::listEntries
+ ),
+ };
+
+const Name FibManager::LIST_COMMAND_PREFIX("/localhost/nfd/fib/list");
+const size_t FibManager::LIST_COMMAND_NCOMPS = LIST_COMMAND_PREFIX.size();
+
+
FibManager::FibManager(Fib& fib,
function<shared_ptr<Face>(FaceId)> getFace,
shared_ptr<InternalFace> face)
- : ManagerBase(face, FIB_PRIVILEGE),
- m_managedFib(fib),
- m_getFace(getFace),
- m_verbDispatch(COMMAND_VERBS,
- COMMAND_VERBS +
- (sizeof(COMMAND_VERBS) / sizeof(VerbAndProcessor)))
+ : ManagerBase(face, FIB_PRIVILEGE)
+ , m_managedFib(fib)
+ , m_getFace(getFace)
+ , m_fibEnumerationPublisher(fib, face, LIST_COMMAND_PREFIX)
+ , m_signedVerbDispatch(SIGNED_COMMAND_VERBS,
+ SIGNED_COMMAND_VERBS +
+ (sizeof(SIGNED_COMMAND_VERBS) / sizeof(SignedVerbAndProcessor)))
+ , m_unsignedVerbDispatch(UNSIGNED_COMMAND_VERBS,
+ UNSIGNED_COMMAND_VERBS +
+ (sizeof(UNSIGNED_COMMAND_VERBS) / sizeof(UnsignedVerbAndProcessor)))
{
face->setInterestFilter("/localhost/nfd/fib",
bind(&FibManager::onFibRequest, this, _2));
@@ -67,28 +83,32 @@
{
const Name& command = request.getName();
const size_t commandNComps = command.size();
+ const Name::Component& verb = command.get(COMMAND_PREFIX.size());
- if (COMMAND_UNSIGNED_NCOMPS <= commandNComps &&
+ UnsignedVerbDispatchTable::const_iterator unsignedVerbProcessor = m_unsignedVerbDispatch.find(verb);
+ if (unsignedVerbProcessor != m_unsignedVerbDispatch.end())
+ {
+ NFD_LOG_INFO("command result: processing verb: " << verb);
+ (unsignedVerbProcessor->second)(this, boost::cref(request));
+ }
+ else if (COMMAND_UNSIGNED_NCOMPS <= commandNComps &&
commandNComps < COMMAND_SIGNED_NCOMPS)
{
NFD_LOG_INFO("command result: unsigned verb: " << command);
sendResponse(command, 401, "Signature required");
-
- return;
}
else if (commandNComps < COMMAND_SIGNED_NCOMPS ||
!COMMAND_PREFIX.isPrefixOf(command))
{
NFD_LOG_INFO("command result: malformed");
sendResponse(command, 400, "Malformed command");
- return;
}
-
- validate(request,
- bind(&FibManager::onValidatedFibRequest,
- this, _1),
- bind(&ManagerBase::onCommandValidationFailed,
- this, _1, _2));
+ else
+ {
+ validate(request,
+ bind(&FibManager::onValidatedFibRequest, this, _1),
+ bind(&ManagerBase::onCommandValidationFailed, this, _1, _2));
+ }
}
void
@@ -97,8 +117,8 @@
const Name& command = request->getName();
const Name::Component& verb = command.get(COMMAND_PREFIX.size());
- VerbDispatchTable::const_iterator verbProcessor = m_verbDispatch.find (verb);
- if (verbProcessor != m_verbDispatch.end())
+ SignedVerbDispatchTable::const_iterator signedVerbProcessor = m_signedVerbDispatch.find (verb);
+ if (signedVerbProcessor != m_signedVerbDispatch.end())
{
FibManagementOptions options;
if (!extractOptions(*request, options))
@@ -110,7 +130,7 @@
NFD_LOG_INFO("command result: processing verb: " << verb);
ControlResponse response;
- (verbProcessor->second)(this, options, response);
+ (signedVerbProcessor->second)(this, options, response);
sendResponse(command, response);
}
else
@@ -214,4 +234,21 @@
}
}
+void
+FibManager::listEntries(const Interest& request)
+{
+ const Name& command = request.getName();
+ const size_t commandNComps = command.size();
+
+ if (commandNComps < LIST_COMMAND_NCOMPS ||
+ !LIST_COMMAND_PREFIX.isPrefixOf(command))
+ {
+ NFD_LOG_INFO("command result: malformed");
+ sendResponse(command, 400, "Malformed command");
+ return;
+ }
+
+ m_fibEnumerationPublisher.publish();
+}
+
} // namespace nfd
diff --git a/daemon/mgmt/fib-manager.hpp b/daemon/mgmt/fib-manager.hpp
index 1cbc49c..10b4fb2 100644
--- a/daemon/mgmt/fib-manager.hpp
+++ b/daemon/mgmt/fib-manager.hpp
@@ -12,6 +12,7 @@
#include "mgmt/app-face.hpp"
#include "fw/strategy.hpp"
#include "mgmt/manager-base.hpp"
+#include "mgmt/fib-enumeration-publisher.hpp"
#include <ndn-cpp-dev/management/nfd-fib-management-options.hpp>
@@ -60,6 +61,9 @@
removeNextHop(const FibManagementOptions& options,
ControlResponse& response);
+ void
+ listEntries(const Interest& request);
+
bool
extractOptions(const Interest& request,
FibManagementOptions& extractedOptions);
@@ -68,18 +72,24 @@
Fib& m_managedFib;
function<shared_ptr<Face>(FaceId)> m_getFace;
- std::map<Name, shared_ptr<fw::Strategy> > m_namespaceToStrategyMap;
+ FibEnumerationPublisher m_fibEnumerationPublisher;
typedef function<void(FibManager*,
const FibManagementOptions&,
- ControlResponse&)> VerbProcessor;
+ ControlResponse&)> SignedVerbProcessor;
- typedef std::map<Name::Component, VerbProcessor> VerbDispatchTable;
+ typedef std::map<Name::Component, SignedVerbProcessor> SignedVerbDispatchTable;
- typedef std::pair<Name::Component, VerbProcessor> VerbAndProcessor;
+ typedef std::pair<Name::Component, SignedVerbProcessor> SignedVerbAndProcessor;
+
+ typedef function<void(FibManager*, const Interest&)> UnsignedVerbProcessor;
+
+ typedef std::map<Name::Component, UnsignedVerbProcessor> UnsignedVerbDispatchTable;
+ typedef std::pair<Name::Component, UnsignedVerbProcessor> UnsignedVerbAndProcessor;
- const VerbDispatchTable m_verbDispatch;
+ const SignedVerbDispatchTable m_signedVerbDispatch;
+ const UnsignedVerbDispatchTable m_unsignedVerbDispatch;
static const Name COMMAND_PREFIX; // /localhost/nfd/fib
@@ -91,8 +101,11 @@
// UNSIGNED_NCOMPS + 4 command Interest components = 9
static const size_t COMMAND_SIGNED_NCOMPS;
- static const VerbAndProcessor COMMAND_VERBS[];
+ static const SignedVerbAndProcessor SIGNED_COMMAND_VERBS[];
+ static const UnsignedVerbAndProcessor UNSIGNED_COMMAND_VERBS[];
+ static const Name LIST_COMMAND_PREFIX;
+ static const size_t LIST_COMMAND_NCOMPS;
};
} // namespace nfd
diff --git a/tests/mgmt/fib-enumeration-publisher-common.hpp b/tests/mgmt/fib-enumeration-publisher-common.hpp
new file mode 100644
index 0000000..076a036
--- /dev/null
+++ b/tests/mgmt/fib-enumeration-publisher-common.hpp
@@ -0,0 +1,202 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NFD_TESTS_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
+#define NFD_TESTS_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
+
+#include "mgmt/fib-enumeration-publisher.hpp"
+
+#include "mgmt/app-face.hpp"
+#include "mgmt/internal-face.hpp"
+
+#include "tests/test-common.hpp"
+#include "../face/dummy-face.hpp"
+
+#include <ndn-cpp-dev/encoding/tlv.hpp>
+
+namespace nfd {
+namespace tests {
+
+static inline uint64_t
+readNonNegativeIntegerType(const Block& block,
+ uint32_t type)
+{
+ if (block.type() == type)
+ {
+ return readNonNegativeInteger(block);
+ }
+ std::stringstream error;
+ error << "Expected type " << type << " got " << block.type();
+ throw ndn::Tlv::Error(error.str());
+}
+
+static inline uint64_t
+checkedReadNonNegativeIntegerType(Block::element_const_iterator& i,
+ Block::element_const_iterator end,
+ uint32_t type)
+{
+ if (i != end)
+ {
+ const Block& block = *i;
+ ++i;
+ return readNonNegativeIntegerType(block, type);
+ }
+ std::stringstream error;
+ error << "Unexpected end of Block while attempting to read type #"
+ << type;
+ throw ndn::Tlv::Error(error.str());
+}
+
+class FibEnumerationPublisherFixture : public BaseFixture
+{
+public:
+
+ FibEnumerationPublisherFixture()
+ : m_nameTree(1024)
+ , m_fib(m_nameTree)
+ , m_face(make_shared<InternalFace>())
+ , m_publisher(m_fib, m_face, "/localhost/nfd/FibEnumerationPublisherFixture")
+ , m_finished(false)
+ {
+
+ }
+
+ virtual
+ ~FibEnumerationPublisherFixture()
+ {
+
+ }
+
+ bool
+ hasNextHopWithCost(const fib::NextHopList& nextHops,
+ FaceId faceId,
+ uint64_t cost)
+ {
+ for (fib::NextHopList::const_iterator i = nextHops.begin();
+ i != nextHops.end();
+ ++i)
+ {
+ if (i->getFace()->getId() == faceId && i->getCost() == cost)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool
+ entryHasPrefix(const shared_ptr<fib::Entry> entry, const Name& prefix)
+ {
+ return entry->getPrefix() == prefix;
+ }
+
+ void
+ validateFibEntry(const Block& entry)
+ {
+ entry.parse();
+
+ Block::element_const_iterator i = entry.elements_begin();
+ BOOST_REQUIRE(i != entry.elements_end());
+
+
+ BOOST_REQUIRE(i->type() == ndn::Tlv::Name);
+ Name prefix(*i);
+ ++i;
+
+ std::set<shared_ptr<fib::Entry> >::const_iterator referenceIter =
+ std::find_if(m_referenceEntries.begin(), m_referenceEntries.end(),
+ boost::bind(&FibEnumerationPublisherFixture::entryHasPrefix,
+ this, _1, prefix));
+
+ BOOST_REQUIRE(referenceIter != m_referenceEntries.end());
+
+ const shared_ptr<fib::Entry>& reference = *referenceIter;
+ BOOST_REQUIRE_EQUAL(prefix, reference->getPrefix());
+
+ // 0 or more next hop records
+ size_t nRecords = 0;
+ const fib::NextHopList& referenceNextHops = reference->getNextHops();
+ for (; i != entry.elements_end(); ++i)
+ {
+ const ndn::Block& nextHopRecord = *i;
+ BOOST_REQUIRE(nextHopRecord.type() == ndn::tlv::nfd::NextHopRecord);
+ nextHopRecord.parse();
+
+ Block::element_const_iterator j = nextHopRecord.elements_begin();
+
+ FaceId faceId =
+ checkedReadNonNegativeIntegerType(j,
+ entry.elements_end(),
+ ndn::tlv::nfd::FaceId);
+
+ uint64_t cost =
+ checkedReadNonNegativeIntegerType(j,
+ entry.elements_end(),
+ ndn::tlv::nfd::Cost);
+
+ BOOST_REQUIRE(hasNextHopWithCost(referenceNextHops, faceId, cost));
+
+ BOOST_REQUIRE(j == nextHopRecord.elements_end());
+ nRecords++;
+ }
+ BOOST_REQUIRE_EQUAL(nRecords, referenceNextHops.size());
+
+ BOOST_REQUIRE(i == entry.elements_end());
+ m_referenceEntries.erase(referenceIter);
+ }
+
+ void
+ decodeFibEntryBlock(const Data& data)
+ {
+ Block payload = data.getContent();
+
+ m_buffer.appendByteArray(payload.value(), payload.value_size());
+
+ uint64_t segmentNo = data.getName()[-1].toSegment();
+ if (data.getFinalBlockId() != data.getName()[-1])
+ {
+ return;
+ }
+
+ // wrap the FIB Entry blocks in a single Content TLV for easy parsing
+ m_buffer.prependVarNumber(m_buffer.size());
+ m_buffer.prependVarNumber(ndn::Tlv::Content);
+
+ ndn::Block parser(m_buffer.buf(), m_buffer.size());
+ parser.parse();
+
+ BOOST_REQUIRE_EQUAL(parser.elements_size(), m_referenceEntries.size());
+
+ for (Block::element_const_iterator i = parser.elements_begin();
+ i != parser.elements_end();
+ ++i)
+ {
+ if (i->type() != ndn::tlv::nfd::FibEntry)
+ {
+ BOOST_FAIL("expected fib entry, got type #" << i->type());
+ }
+
+ validateFibEntry(*i);
+ }
+ m_finished = true;
+ }
+
+protected:
+ NameTree m_nameTree;
+ Fib m_fib;
+ shared_ptr<InternalFace> m_face;
+ FibEnumerationPublisher m_publisher;
+ ndn::EncodingBuffer m_buffer;
+ std::set<shared_ptr<fib::Entry> > m_referenceEntries;
+
+protected:
+ bool m_finished;
+};
+
+} // namespace tests
+} // namespace nfd
+
+#endif // NFD_TESTS_MGMT_FIB_ENUMERATION_PUBLISHER_COMMON_HPP
diff --git a/tests/mgmt/fib-enumeration-publisher.cpp b/tests/mgmt/fib-enumeration-publisher.cpp
new file mode 100644
index 0000000..2ba673c
--- /dev/null
+++ b/tests/mgmt/fib-enumeration-publisher.cpp
@@ -0,0 +1,71 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (C) 2014 Named Data Networking Project
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "mgmt/fib-enumeration-publisher.hpp"
+
+#include "mgmt/app-face.hpp"
+#include "mgmt/internal-face.hpp"
+
+#include "tests/test-common.hpp"
+#include "../face/dummy-face.hpp"
+
+#include "fib-enumeration-publisher-common.hpp"
+
+#include <ndn-cpp-dev/encoding/tlv.hpp>
+
+namespace nfd {
+namespace tests {
+
+NFD_LOG_INIT("TestFibEnumerationPublisher");
+
+
+
+BOOST_FIXTURE_TEST_SUITE(MgmtFibEnumeration, FibEnumerationPublisherFixture)
+
+BOOST_AUTO_TEST_CASE(TestFibEnumerationPublisher)
+{
+ for (int i = 0; i < 87; i++)
+ {
+ Name prefix("/test");
+ prefix.appendSegment(i);
+
+ shared_ptr<DummyFace> dummy1(make_shared<DummyFace>());
+ shared_ptr<DummyFace> dummy2(make_shared<DummyFace>());
+
+ shared_ptr<fib::Entry> entry = m_fib.insert(prefix).first;
+ entry->addNextHop(dummy1, std::numeric_limits<uint64_t>::max() - 1);
+ entry->addNextHop(dummy2, std::numeric_limits<uint64_t>::max() - 2);
+
+ m_referenceEntries.insert(entry);
+ }
+ for (int i = 0; i < 2; i++)
+ {
+ Name prefix("/test2");
+ prefix.appendSegment(i);
+
+ shared_ptr<DummyFace> dummy1(make_shared<DummyFace>());
+ shared_ptr<DummyFace> dummy2(make_shared<DummyFace>());
+
+ shared_ptr<fib::Entry> entry = m_fib.insert(prefix).first;
+ entry->addNextHop(dummy1, std::numeric_limits<uint8_t>::max() - 1);
+ entry->addNextHop(dummy2, std::numeric_limits<uint8_t>::max() - 2);
+
+ m_referenceEntries.insert(entry);
+ }
+
+ ndn::EncodingBuffer buffer;
+
+ m_face->onReceiveData +=
+ bind(&FibEnumerationPublisherFixture::decodeFibEntryBlock, this, _1);
+
+ m_publisher.publish();
+ BOOST_REQUIRE(m_finished);
+}
+
+BOOST_AUTO_TEST_SUITE_END()
+
+} // namespace tests
+} // namespace nfd
diff --git a/tests/mgmt/fib-manager.cpp b/tests/mgmt/fib-manager.cpp
index 66ed32b..c230497 100644
--- a/tests/mgmt/fib-manager.cpp
+++ b/tests/mgmt/fib-manager.cpp
@@ -14,12 +14,14 @@
#include "validation-common.hpp"
#include "tests/test-common.hpp"
+#include "fib-enumeration-publisher-common.hpp"
+
namespace nfd {
namespace tests {
NFD_LOG_INIT("FibManagerTest");
-class FibManagerFixture : protected BaseFixture
+class FibManagerFixture : protected BaseFixture, public FibEnumerationPublisherFixture
{
public:
@@ -141,20 +143,14 @@
protected:
FibManagerFixture()
- : m_face(make_shared<InternalFace>())
- , m_nameTree(1024)
- , m_fib(m_nameTree)
- , m_manager(boost::ref(m_fib),
- bind(&FibManagerFixture::getFace, this, _1),
- m_face)
+ : m_manager(boost::ref(m_fib),
+ bind(&FibManagerFixture::getFace, this, _1),
+ m_face)
, m_callbackFired(false)
{
}
-private:
- shared_ptr<InternalFace> m_face;
- NameTree m_nameTree;
- Fib m_fib;
+protected:
FibManager m_manager;
std::vector<shared_ptr<Face> > m_faces;
@@ -861,6 +857,48 @@
BOOST_REQUIRE(didCallbackFire());
}
+BOOST_FIXTURE_TEST_CASE(TestFibEnumerationRequest, FibManagerFixture)
+{
+ for (int i = 0; i < 87; i++)
+ {
+ Name prefix("/test");
+ prefix.appendSegment(i);
+
+ shared_ptr<DummyFace> dummy1(make_shared<DummyFace>());
+ shared_ptr<DummyFace> dummy2(make_shared<DummyFace>());
+
+ shared_ptr<fib::Entry> entry = m_fib.insert(prefix).first;
+ entry->addNextHop(dummy1, std::numeric_limits<uint64_t>::max() - 1);
+ entry->addNextHop(dummy2, std::numeric_limits<uint64_t>::max() - 2);
+
+ m_referenceEntries.insert(entry);
+ }
+ for (int i = 0; i < 2; i++)
+ {
+ Name prefix("/test2");
+ prefix.appendSegment(i);
+
+ shared_ptr<DummyFace> dummy1(make_shared<DummyFace>());
+ shared_ptr<DummyFace> dummy2(make_shared<DummyFace>());
+
+ shared_ptr<fib::Entry> entry = m_fib.insert(prefix).first;
+ entry->addNextHop(dummy1, std::numeric_limits<uint8_t>::max() - 1);
+ entry->addNextHop(dummy2, std::numeric_limits<uint8_t>::max() - 2);
+
+ m_referenceEntries.insert(entry);
+ }
+
+ ndn::EncodingBuffer buffer;
+
+ m_face->onReceiveData +=
+ bind(&FibEnumerationPublisherFixture::decodeFibEntryBlock, this, _1);
+
+ shared_ptr<Interest> command(make_shared<Interest>("/localhost/nfd/fib/list"));
+
+ m_manager.onFibRequest(*command);
+ BOOST_REQUIRE(m_finished);
+}
+
BOOST_AUTO_TEST_SUITE_END()
} // namespace tests