mgmt: merge ManagerBase with NfdManagerBase

Refs: #4528
Change-Id: I2ecb4af68927157a9eafc269399855cff192bb54
This commit is contained in:
Davide Pesavento committed 2019-02-28 23:37:02 -05:00
1 parent 8a05c7fd2a
commit 78ddcabcd0
31 files changed
+277 -463

No files matched your search

+9 -6
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,17 +24,20 @@
*/
#include "cs-manager.hpp"
#include "fw/forwarder-counters.hpp"
#include "table/cs.hpp"
#include <ndn-cxx/mgmt/nfd/cs-info.hpp>
namespace nfd {
constexpr size_t CsManager::ERASE_LIMIT;
CsManager::CsManager(Cs& cs, const ForwarderCounters& fwCnt,
CsManager::CsManager(Cs& cs, const ForwarderCounters& fwCounters,
Dispatcher& dispatcher, CommandAuthenticator& authenticator)
: NfdManagerBase(dispatcher, authenticator, "cs")
: ManagerBase("cs", dispatcher, authenticator)
, m_cs(cs)
, m_fwCnt(fwCnt)
, m_fwCounters(fwCounters)
{
registerCommandHandler<ndn::nfd::CsConfigCommand>("config",
bind(&CsManager::changeConfig, this, _4, _5));
@@ -106,8 +109,8 @@ CsManager::serveInfo(const Name& topPrefix, const Interest& interest,
info.setEnableAdmit(m_cs.shouldAdmit());
info.setEnableServe(m_cs.shouldServe());
info.setNEntries(m_cs.size());
info.setNHits(m_fwCnt.nCsHits);
info.setNMisses(m_fwCnt.nCsMisses);
info.setNHits(m_fwCounters.nCsHits);
info.setNMisses(m_fwCounters.nCsMisses);
context.append(info.wireEncode());
context.end();
+15 -10
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,19 +26,24 @@
#ifndef NFD_DAEMON_MGMT_CS_MANAGER_HPP
#define NFD_DAEMON_MGMT_CS_MANAGER_HPP
#include "nfd-manager-base.hpp"
#include "table/cs.hpp"
#include "fw/forwarder-counters.hpp"
#include "manager-base.hpp"
namespace nfd {
/** \brief Implement the CS Management of NFD Management Protocol.
* \sa https://redmine.named-data.net/projects/nfd/wiki/CsMgmt
namespace cs {
class Cs;
} // namespace cs
class ForwarderCounters;
/**
* \brief Implements the CS Management of NFD Management Protocol.
* \sa https://redmine.named-data.net/projects/nfd/wiki/CsMgmt
*/
class CsManager : public NfdManagerBase
class CsManager : public ManagerBase
{
public:
CsManager(Cs& cs, const ForwarderCounters& fwCnt,
CsManager(cs::Cs& cs, const ForwarderCounters& fwCounters,
Dispatcher& dispatcher, CommandAuthenticator& authenticator);
private:
@@ -64,8 +69,8 @@ public:
static constexpr size_t ERASE_LIMIT = 256;
private:
Cs& m_cs;
const ForwarderCounters& m_fwCnt;
cs::Cs& m_cs;
const ForwarderCounters& m_fwCounters;
};
} // namespace nfd
+3 -4
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -41,9 +41,8 @@ namespace nfd {
NFD_LOG_INIT(FaceManager);
FaceManager::FaceManager(FaceSystem& faceSystem,
Dispatcher& dispatcher,
CommandAuthenticator& authenticator)
: NfdManagerBase(dispatcher, authenticator, "faces")
Dispatcher& dispatcher, CommandAuthenticator& authenticator)
: ManagerBase("faces", dispatcher, authenticator)
, m_faceSystem(faceSystem)
, m_faceTable(faceSystem.getFaceTable())
{
+5 -6
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,21 +26,20 @@
#ifndef NFD_DAEMON_MGMT_FACE_MANAGER_HPP
#define NFD_DAEMON_MGMT_FACE_MANAGER_HPP
#include "nfd-manager-base.hpp"
#include "manager-base.hpp"
#include "face/face-system.hpp"
namespace nfd {
/**
* @brief implement the Face Management of NFD Management Protocol.
* @brief Implements the Face Management of NFD Management Protocol.
* @sa https://redmine.named-data.net/projects/nfd/wiki/FaceMgmt
*/
class FaceManager : public NfdManagerBase
class FaceManager : public ManagerBase
{
public:
FaceManager(FaceSystem& faceSystem,
Dispatcher& dispatcher,
CommandAuthenticator& authenticator);
Dispatcher& dispatcher, CommandAuthenticator& authenticator);
private: // ControlCommand
void
+4 -5
View File
@@ -27,6 +27,7 @@
#include "core/logger.hpp"
#include "fw/face-table.hpp"
#include "table/fib.hpp"
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/fib-entry.hpp>
@@ -37,11 +38,9 @@ namespace nfd {
NFD_LOG_INIT(FibManager);
FibManager::FibManager(Fib& fib,
const FaceTable& faceTable,
Dispatcher& dispatcher,
CommandAuthenticator& authenticator)
: NfdManagerBase(dispatcher, authenticator, "fib")
FibManager::FibManager(Fib& fib, const FaceTable& faceTable,
Dispatcher& dispatcher, CommandAuthenticator& authenticator)
: ManagerBase("fib", dispatcher, authenticator)
, m_fib(fib)
, m_faceTable(faceTable)
{
+11 -11
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,25 +26,25 @@
#ifndef NFD_DAEMON_MGMT_FIB_MANAGER_HPP
#define NFD_DAEMON_MGMT_FIB_MANAGER_HPP
#include "nfd-manager-base.hpp"
#include "fw/forwarder.hpp"
#include "table/fib.hpp"
#include "manager-base.hpp"
namespace nfd {
namespace fib {
class Fib;
} // namespace fib
class FaceTable;
/**
* @brief implement the FIB Management of NFD Management Protocol.
* @brief Implements the FIB Management of NFD Management Protocol.
* @sa https://redmine.named-data.net/projects/nfd/wiki/FibMgmt
*/
class FibManager : public NfdManagerBase
class FibManager : public ManagerBase
{
public:
FibManager(Fib& fib,
const FaceTable& faceTable,
Dispatcher& dispatcher,
CommandAuthenticator& authenticator);
FibManager(fib::Fib& fib, const FaceTable& faceTable,
Dispatcher& dispatcher, CommandAuthenticator& authenticator);
private:
void
@@ -66,7 +66,7 @@ private:
setFaceForSelfRegistration(const Interest& request, ControlParameters& parameters);
private:
Fib& m_fib;
fib::Fib& m_fib;
const FaceTable& m_faceTable;
};
+7 -6
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2016, Regents of the University of California,
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,8 @@
#ifndef NFD_DAEMON_MGMT_FORWARDER_STATUS_MANAGER_HPP
#define NFD_DAEMON_MGMT_FORWARDER_STATUS_MANAGER_HPP
#include "core/manager-base.hpp"
#include "manager-base.hpp"
#include <ndn-cxx/mgmt/nfd/forwarder-status.hpp>
namespace nfd {
@@ -34,8 +35,8 @@ namespace nfd {
class Forwarder;
/**
* @brief implement the Forwarder Status of NFD Management Protocol.
* @sa http://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus
* @brief Implements the Forwarder Status of NFD Management Protocol.
* @sa https://redmine.named-data.net/projects/nfd/wiki/ForwarderStatus
*/
class ForwarderStatusManager : noncopyable
{
@@ -53,7 +54,7 @@ private:
ndn::mgmt::StatusDatasetContext& context);
private:
Forwarder& m_forwarder;
Forwarder& m_forwarder;
Dispatcher& m_dispatcher;
time::system_clock::TimePoint m_startTimestamp;
};
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, Regents of the University of California,
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -27,12 +27,17 @@
namespace nfd {
using ndn::mgmt::ValidateParameters;
using ndn::mgmt::Authorization;
ManagerBase::ManagerBase(const std::string& module, Dispatcher& dispatcher)
: m_module(module)
, m_dispatcher(dispatcher)
{
}
ManagerBase::ManagerBase(Dispatcher& dispatcher, const std::string& module)
: m_dispatcher(dispatcher)
, m_module(module)
ManagerBase::ManagerBase(const std::string& module, Dispatcher& dispatcher,
CommandAuthenticator& authenticator)
: m_module(module)
, m_dispatcher(dispatcher)
, m_authenticator(&authenticator)
{
}
@@ -73,8 +78,16 @@ ManagerBase::extractRequester(const Interest& interest,
}
}
ndn::mgmt::Authorization
ManagerBase::makeAuthorization(const std::string& verb)
{
BOOST_ASSERT(m_authenticator != nullptr);
return m_authenticator->makeAuthorization(m_module, verb);
}
bool
ManagerBase::validateParameters(const nfd::ControlCommand& command, const ndn::mgmt::ControlParameters& parameters)
ManagerBase::validateParameters(const ControlCommand& command,
const ndn::mgmt::ControlParameters& parameters)
{
BOOST_ASSERT(dynamic_cast<const ControlParameters*>(&parameters) != nullptr);
@@ -88,13 +101,14 @@ ManagerBase::validateParameters(const nfd::ControlCommand& command, const ndn::m
}
void
ManagerBase::handleCommand(shared_ptr<nfd::ControlCommand> command,
ManagerBase::handleCommand(shared_ptr<ControlCommand> command,
const ControlCommandHandler& handler,
const Name& prefix, const Interest& interest,
const ndn::mgmt::ControlParameters& params,
ndn::mgmt::CommandContinuation done)
{
BOOST_ASSERT(dynamic_cast<const ControlParameters*>(&params) != nullptr);
ControlParameters parameters = static_cast<const ControlParameters&>(params);
command->applyDefaultsToRequest(parameters);
handler(*command, prefix, interest, parameters, done);
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -23,26 +23,25 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NFD_CORE_MANAGER_BASE_HPP
#define NFD_CORE_MANAGER_BASE_HPP
#ifndef NFD_DAEMON_MGMT_MANAGER_BASE_HPP
#define NFD_DAEMON_MGMT_MANAGER_BASE_HPP
#include "common.hpp"
#include "command-authenticator.hpp"
#include <ndn-cxx/mgmt/dispatcher.hpp>
#include <ndn-cxx/mgmt/nfd/control-command.hpp>
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
namespace nfd {
using ndn::mgmt::Dispatcher;
using ndn::nfd::ControlCommand;
using ndn::nfd::ControlResponse;
using ndn::nfd::ControlParameters;
using ndn::nfd::ControlResponse;
/**
* @brief a collection of common functions shared by all NFD managers and RIB manager,
* @brief A collection of common functions shared by all NFD managers,
* such as communicating with the dispatcher and command validator.
*/
class ManagerBase : noncopyable
@@ -51,16 +50,9 @@ public:
class Error : public std::runtime_error
{
public:
explicit
Error(const std::string& what)
: std::runtime_error(what)
{
}
using std::runtime_error::runtime_error;
};
public:
ManagerBase(Dispatcher& dispatcher, const std::string& module);
virtual
~ManagerBase();
@@ -70,6 +62,15 @@ public:
return m_module;
}
protected:
/**
* @warning if you use this constructor, you MUST override makeAuthorization()
*/
ManagerBase(const std::string& module, Dispatcher& dispatcher);
ManagerBase(const std::string& module, Dispatcher& dispatcher,
CommandAuthenticator& authenticator);
PUBLIC_WITH_TESTS_ELSE_PROTECTED: // registrations to the dispatcher
// difference from mgmt::ControlCommand: accepts nfd::ControlParameters
using ControlCommandHandler = std::function<void(const ControlCommand& command,
@@ -89,68 +90,63 @@ PUBLIC_WITH_TESTS_ELSE_PROTECTED: // registrations to the dispatcher
ndn::mgmt::PostNotification
registerNotificationStream(const std::string& verb);
PUBLIC_WITH_TESTS_ELSE_PROTECTED:
PUBLIC_WITH_TESTS_ELSE_PROTECTED: // helpers
/**
* @brief extract a requester from a ControlCommand request
* @brief Extracts the requester from a ControlCommand request.
*
* This is called after the signature is validated.
* This is called after the signature has been validated.
*
* @param interest a request for ControlCommand
* @param accept callback of successful validation, take the requester string as a argument
* @param accept callback of successful validation, takes the requester string as a argument
*/
void
extractRequester(const Interest& interest,
ndn::mgmt::AcceptContinuation accept);
extractRequester(const Interest& interest, ndn::mgmt::AcceptContinuation accept);
PUBLIC_WITH_TESTS_ELSE_PRIVATE:
/**
* @return an authorization function for specified management module and verb
* @brief Returns an authorization function for a specific management module and verb.
*/
virtual ndn::mgmt::Authorization
makeAuthorization(const std::string& verb) = 0;
makeAuthorization(const std::string& verb);
/**
* @brief validate the @p parameters for a given @p command
* @brief Validates the @p parameters for a given @p command.
*
* @param parameters the original ControlParameters
*
* @return whether the original ControlParameters can be validated
*/
static bool
validateParameters(const nfd::ControlCommand& command,
validateParameters(const ControlCommand& command,
const ndn::mgmt::ControlParameters& parameters);
/** @brief Handle control command
/**
* @brief Handles a control command.
*/
static void
handleCommand(shared_ptr<nfd::ControlCommand> command,
handleCommand(shared_ptr<ControlCommand> command,
const ControlCommandHandler& handler,
const Name& prefix, const Interest& interest,
const ndn::mgmt::ControlParameters& params,
ndn::mgmt::CommandContinuation done);
/**
* @brief generate the relative prefix for a handler,
* by appending the verb name to the module name.
* @brief Generates the relative prefix for a handler by appending the verb name to the module name.
*
* @param verb the verb name
*
* @return the generated relative prefix
*/
PartialName
makeRelPrefix(const std::string& verb);
makeRelPrefix(const std::string& verb)
{
return PartialName(m_module).append(verb);
}
private:
Dispatcher& m_dispatcher;
std::string m_module;
Dispatcher& m_dispatcher;
CommandAuthenticator* m_authenticator = nullptr;
};
inline PartialName
ManagerBase::makeRelPrefix(const std::string& verb)
{
return PartialName(m_module).append(verb);
}
template<typename Command>
inline void
ManagerBase::registerCommandHandler(const std::string& verb,
@@ -167,4 +163,4 @@ ManagerBase::registerCommandHandler(const std::string& verb,
} // namespace nfd
#endif // NFD_CORE_MANAGER_BASE_HPP
#endif // NFD_DAEMON_MGMT_MANAGER_BASE_HPP
-44
View File
@@ -1,44 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
* Washington University in St. Louis,
* Beijing Institute of Technology,
* The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
*
* NFD is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nfd-manager-base.hpp"
namespace nfd {
NfdManagerBase::NfdManagerBase(Dispatcher& dispatcher,
CommandAuthenticator& authenticator,
const std::string& module)
: ManagerBase(dispatcher, module)
, m_authenticator(authenticator)
{
}
ndn::mgmt::Authorization
NfdManagerBase::makeAuthorization(const std::string& verb)
{
return m_authenticator.makeAuthorization(this->getModule(), verb);
}
} // namespace nfd
-58
View File
@@ -1,58 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
* Washington University in St. Louis,
* Beijing Institute of Technology,
* The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
*
* NFD is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NFD_DAEMON_MGMT_NFD_MANAGER_BASE_HPP
#define NFD_DAEMON_MGMT_NFD_MANAGER_BASE_HPP
#include "core/manager-base.hpp"
#include "command-authenticator.hpp"
namespace nfd {
using ndn::mgmt::Dispatcher;
using ndn::nfd::ControlParameters;
/**
* @brief a collection of common functions shared by all NFD managers,
* such as communicating with the dispatcher and command validator.
*/
class NfdManagerBase : public ManagerBase
{
public:
NfdManagerBase(Dispatcher& dispatcher,
CommandAuthenticator& authenticator,
const std::string& module);
PUBLIC_WITH_TESTS_ELSE_PRIVATE: // command validation
virtual ndn::mgmt::Authorization
makeAuthorization(const std::string& verb) override;
private:
CommandAuthenticator& m_authenticator;
};
} // namespace nfd
#endif // NFD_DAEMON_MGMT_NFD_MANAGER_BASE_HPP
+2 -4
View File
@@ -27,11 +27,9 @@
#include "core/fib-max-depth.hpp"
#include "core/logger.hpp"
#include "rib/rib.hpp"
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/control-command.hpp>
#include <ndn-cxx/mgmt/nfd/control-parameters.hpp>
#include <ndn-cxx/mgmt/nfd/control-response.hpp>
#include <ndn-cxx/mgmt/nfd/face-status.hpp>
#include <ndn-cxx/mgmt/nfd/rib-entry.hpp>
@@ -51,7 +49,7 @@ const Name RibManager::LOCALHOP_TOP_PREFIX = "/localhop/nfd";
RibManager::RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
ndn::util::Scheduler& scheduler)
: ManagerBase(dispatcher, MGMT_MODULE_NAME)
: ManagerBase(MGMT_MODULE_NAME, dispatcher)
, m_rib(rib)
, m_keyChain(keyChain)
, m_nfdController(nfdController)
+8 -9
View File
@@ -26,9 +26,9 @@
#ifndef NFD_DAEMON_MGMT_RIB_MANAGER_HPP
#define NFD_DAEMON_MGMT_RIB_MANAGER_HPP
#include "manager-base.hpp"
#include "core/config-file.hpp"
#include "core/manager-base.hpp"
#include "rib/rib.hpp"
#include "rib/route.hpp"
#include <ndn-cxx/mgmt/nfd/controller.hpp>
#include <ndn-cxx/mgmt/nfd/face-event-notification.hpp>
@@ -38,19 +38,18 @@
namespace nfd {
namespace rib {
class Rib;
class RibUpdate;
} // namespace rib
/**
* @brief Serve commands and datasets of NFD RIB management protocol.
* @brief Implements the RIB Management of NFD Management Protocol.
* @sa https://redmine.named-data.net/projects/nfd/wiki/RibMgmt
*/
class RibManager : public ManagerBase
{
public:
class Error : public std::runtime_error
{
public:
using std::runtime_error::runtime_error;
};
RibManager(rib::Rib& rib, ndn::Face& face, ndn::KeyChain& keyChain,
ndn::nfd::Controller& nfdController, Dispatcher& dispatcher,
ndn::util::Scheduler& scheduler);
+2 -2
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -37,7 +37,7 @@ NFD_LOG_INIT(StrategyChoiceManager);
StrategyChoiceManager::StrategyChoiceManager(StrategyChoice& strategyChoice,
Dispatcher& dispatcher,
CommandAuthenticator& authenticator)
: NfdManagerBase(dispatcher, authenticator, "strategy-choice")
: ManagerBase("strategy-choice", dispatcher, authenticator)
, m_table(strategyChoice)
{
registerCommandHandler<ndn::nfd::StrategyChoiceSetCommand>("set",
+7 -8
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2016, Regents of the University of California,
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,7 @@
#ifndef NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP
#define NFD_DAEMON_MGMT_STRATEGY_CHOICE_MANAGER_HPP
#include "nfd-manager-base.hpp"
#include "manager-base.hpp"
namespace nfd {
@@ -35,15 +35,14 @@ class StrategyChoice;
} // namespace strategy_choice
/**
* @brief implement the Strategy Choice Management of NFD Management Protocol.
* @sa http://redmine.named-data.net/projects/nfd/wiki/StrategyChoice
* @brief Implements the Strategy Choice Management of NFD Management Protocol.
* @sa https://redmine.named-data.net/projects/nfd/wiki/StrategyChoice
*/
class StrategyChoiceManager : public NfdManagerBase
class StrategyChoiceManager : public ManagerBase
{
public:
StrategyChoiceManager(strategy_choice::StrategyChoice& table,
Dispatcher& dispatcher,
CommandAuthenticator& authenticator);
Dispatcher& dispatcher, CommandAuthenticator& authenticator);
private:
void
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,8 +25,7 @@
#include "mgmt/command-authenticator.hpp"
#include "tests/test-common.hpp"
#include "tests/manager-common-fixture.hpp"
#include "manager-common-fixture.hpp"
#include <boost/filesystem.hpp>
+3 -3
View File
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -25,14 +25,14 @@
#include "mgmt/cs-manager.hpp"
#include "nfd-manager-common-fixture.hpp"
#include "manager-common-fixture.hpp"
#include <ndn-cxx/mgmt/nfd/cs-info.hpp>
namespace nfd {
namespace tests {
class CsManagerFixture : public NfdManagerCommonFixture
class CsManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
CsManagerFixture()
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, Regents of the University of California,
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,7 +29,7 @@
#include "mgmt/face-manager.hpp"
#include "fw/face-table.hpp"
#include "tests/manager-common-fixture.hpp"
#include "manager-common-fixture.hpp"
namespace nfd {
namespace tests {
@@ -50,7 +50,7 @@ public:
public:
ndn::util::DummyClientFace face;
ndn::mgmt::Dispatcher dispatcher;
Dispatcher dispatcher;
shared_ptr<CommandAuthenticator> authenticator;
FaceTable faceTable;
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -29,7 +29,6 @@
#include "mgmt/face-manager.hpp"
#include "face/generic-link-service.hpp"
#include "face-manager-command-fixture.hpp"
#include "nfd-manager-common-fixture.hpp"
namespace nfd {
namespace tests {
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,7 +26,6 @@
#include "mgmt/face-manager.hpp"
#include "face/generic-link-service.hpp"
#include "face-manager-command-fixture.hpp"
#include "nfd-manager-common-fixture.hpp"
#include <ndn-cxx/lp/tags.hpp>
+4 -4
View File
@@ -26,9 +26,9 @@
#include "mgmt/face-manager.hpp"
#include "face/protocol-factory.hpp"
#include "nfd-manager-common-fixture.hpp"
#include "../face/dummy-face.hpp"
#include "../face/dummy-transport.hpp"
#include "manager-common-fixture.hpp"
#include "tests/daemon/face/dummy-face.hpp"
#include "tests/daemon/face/dummy-transport.hpp"
#include <ndn-cxx/encoding/tlv.hpp>
#include <ndn-cxx/encoding/tlv-nfd.hpp>
@@ -42,7 +42,7 @@
namespace nfd {
namespace tests {
class FaceManagerFixture : public NfdManagerCommonFixture
class FaceManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
FaceManagerFixture()
+3 -3
View File
@@ -26,8 +26,8 @@
#include "mgmt/fib-manager.hpp"
#include "table/fib-nexthop.hpp"
#include "nfd-manager-common-fixture.hpp"
#include "../face/dummy-face.hpp"
#include "manager-common-fixture.hpp"
#include "tests/daemon/face/dummy-face.hpp"
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/fib-entry.hpp>
@@ -35,7 +35,7 @@
namespace nfd {
namespace tests {
class FibManagerFixture : public NfdManagerCommonFixture
class FibManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
FibManagerFixture()
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,24 +26,25 @@
#include "mgmt/forwarder-status-manager.hpp"
#include "core/version.hpp"
#include "nfd-manager-common-fixture.hpp"
#include "manager-common-fixture.hpp"
namespace nfd {
namespace tests {
class ForwarderStatusManagerFixture : public NfdManagerCommonFixture
class ForwarderStatusManagerFixture : public ManagerCommonFixture
{
protected:
ForwarderStatusManagerFixture()
: manager(m_forwarder, m_dispatcher)
, startTime(time::system_clock::now())
: m_manager(m_forwarder, m_dispatcher)
, m_startTime(time::system_clock::now())
{
setTopPrefix();
}
protected:
ForwarderStatusManager manager;
time::system_clock::TimePoint startTime;
Forwarder m_forwarder;
ForwarderStatusManager m_manager;
time::system_clock::TimePoint m_startTime;
};
BOOST_AUTO_TEST_SUITE(Mgmt)
@@ -78,11 +79,9 @@ BOOST_AUTO_TEST_CASE(GeneralStatusDataset)
BOOST_CHECK_EQUAL(m_forwarder.getCounters().nUnsatisfiedInterests, 1);
// request
time::system_clock::TimePoint beforeRequest = time::system_clock::now();
Interest request("/localhost/nfd/status/general");
request.setMustBeFresh(true).setChildSelector(1);
this->receiveInterest(request);
time::system_clock::TimePoint afterRequest = time::system_clock::now();
auto beforeRequest = time::system_clock::now();
receiveInterest(Interest("/localhost/nfd/status/general").setCanBePrefix(true));
auto afterRequest = time::system_clock::now();
// verify
Block response = this->concatenateResponses(0, m_responses.size());
@@ -90,7 +89,7 @@ BOOST_AUTO_TEST_CASE(GeneralStatusDataset)
BOOST_REQUIRE_NO_THROW(status.wireDecode(response));
BOOST_CHECK_EQUAL(status.getNfdVersion(), NFD_VERSION_BUILD_STRING);
BOOST_CHECK_EQUAL(time::toUnixTimestamp(status.getStartTimestamp()), time::toUnixTimestamp(startTime));
BOOST_CHECK_EQUAL(time::toUnixTimestamp(status.getStartTimestamp()), time::toUnixTimestamp(m_startTime));
BOOST_CHECK_GE(time::toUnixTimestamp(status.getCurrentTimestamp()), time::toUnixTimestamp(beforeRequest));
BOOST_CHECK_LE(time::toUnixTimestamp(status.getCurrentTimestamp()), time::toUnixTimestamp(afterRequest));
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -23,10 +23,10 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#include "core/manager-base.hpp"
#include "tests/manager-common-fixture.hpp"
#include "mgmt/manager-base.hpp"
#include "manager-common-fixture.hpp"
#include <ndn-cxx/mgmt/nfd/control-command.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/security/pib/identity.hpp>
#include <ndn-cxx/security/pib/key.hpp>
@@ -35,30 +35,35 @@
namespace nfd {
namespace tests {
class TestCommandVoidParameters : public ndn::nfd::ControlCommand
class TestCommandVoidParameters : public ControlCommand
{
public:
TestCommandVoidParameters()
: ndn::nfd::ControlCommand("test-module", "test-void-parameters")
: ControlCommand("test-module", "test-void-parameters")
{
}
};
class TestCommandRequireName : public ndn::nfd::ControlCommand
class TestCommandRequireName : public ControlCommand
{
public:
TestCommandRequireName()
: ndn::nfd::ControlCommand("test-module", "test-require-name")
: ControlCommand("test-module", "test-require-name")
{
m_requestValidator.required(ndn::nfd::CONTROL_PARAMETER_NAME);
}
};
class ManagerTester : public ManagerBase
class DummyManager : public ManagerBase
{
public:
using ManagerBase::ManagerBase;
explicit
DummyManager(Dispatcher& dispatcher)
: ManagerBase("test-module", dispatcher)
{
}
private:
ndn::mgmt::Authorization
makeAuthorization(const std::string& verb) override
{
@@ -73,16 +78,11 @@ public:
class ManagerBaseFixture : public ManagerCommonFixture
{
public:
ManagerBaseFixture()
: m_manager(m_dispatcher, "test-module")
{
}
protected:
ManagerTester m_manager;
DummyManager m_manager{m_dispatcher};
};
BOOST_AUTO_TEST_SUITE(Mgmt)
BOOST_FIXTURE_TEST_SUITE(TestManagerBase, ManagerBaseFixture)
BOOST_AUTO_TEST_CASE(RegisterCommandHandler)
@@ -92,7 +92,7 @@ BOOST_AUTO_TEST_CASE(RegisterCommandHandler)
m_manager.registerCommandHandler<TestCommandVoidParameters>("test-void", handler);
m_manager.registerCommandHandler<TestCommandRequireName>("test-require-name", handler);
setTopPrefix("/localhost/nfd");
setTopPrefix();
auto testRegisterCommandHandler = [&wasCommandHandlerCalled, this] (const Name& commandName) {
wasCommandHandlerCalled = false;
@@ -112,7 +112,7 @@ BOOST_AUTO_TEST_CASE(RegisterStatusDataset)
auto handler = bind([&] { isStatusDatasetCalled = true; });
m_manager.registerStatusDatasetHandler("test-status", handler);
setTopPrefix("/localhost/nfd");
setTopPrefix();
receiveInterest(Interest("/localhost/nfd/test-module/test-status"));
BOOST_CHECK(isStatusDatasetCalled);
@@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(RegisterStatusDataset)
BOOST_AUTO_TEST_CASE(RegisterNotificationStream)
{
auto post = m_manager.registerNotificationStream("test-notification");
setTopPrefix("/localhost/nfd");
setTopPrefix();
const uint8_t buf[] = {0x82, 0x01, 0x02};
post(Block(buf, sizeof(buf)));
@@ -166,6 +166,7 @@ BOOST_AUTO_TEST_CASE(MakeRelPrefix)
}
BOOST_AUTO_TEST_SUITE_END() // TestManagerBase
BOOST_AUTO_TEST_SUITE_END() // Mgmt
} // namespace tests
} // namespace nfd
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -24,6 +24,7 @@
*/
#include "manager-common-fixture.hpp"
#include <ndn-cxx/security/signing-helpers.hpp>
namespace nfd {
@@ -60,10 +61,10 @@ ManagerCommonFixture::ManagerCommonFixture()
}
void
ManagerCommonFixture::setTopPrefix(const Name& topPrefix)
ManagerCommonFixture::setTopPrefix()
{
m_dispatcher.addTopPrefix(topPrefix); // so that all filters are added
advanceClocks(1_ms);
m_dispatcher.addTopPrefix("/localhost/nfd");
advanceClocks(1_ms); // so that all filters are added
}
void
@@ -167,7 +168,7 @@ ManagerCommonFixture::concatenateResponses(size_t startIndex, size_t nResponses)
}
std::ostream&
operator<<(std::ostream& os, const ManagerCommonFixture::CheckResponseResult& result)
operator<<(std::ostream& os, ManagerCommonFixture::CheckResponseResult result)
{
switch (result) {
case ManagerCommonFixture::CheckResponseResult::OK:
@@ -192,5 +193,29 @@ operator<<(std::ostream& os, const ManagerCommonFixture::CheckResponseResult& re
return os << static_cast<int>(result);
}
void
ManagerFixtureWithAuthenticator::setPrivilege(const std::string& privilege)
{
saveIdentityCertificate(DEFAULT_COMMAND_SIGNER_IDENTITY, "ManagerCommonFixture.ndncert");
const std::string& config = R"CONFIG(
authorizations
{
authorize
{
certfile "ManagerCommonFixture.ndncert"
privileges
{
)CONFIG" + privilege + R"CONFIG(
}
}
}
)CONFIG";
ConfigFile cf;
m_authenticator->setConfigFile(cf);
cf.parse(config, false, "ManagerCommonFixture.authenticator.conf");
}
} // namespace tests
} // namespace nfd
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, Regents of the University of California,
/*
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -23,21 +23,21 @@
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NFD_TESTS_MANAGER_COMMON_FIXTURE_HPP
#define NFD_TESTS_MANAGER_COMMON_FIXTURE_HPP
#ifndef NFD_TESTS_DAEMON_MGMT_MANAGER_COMMON_FIXTURE_HPP
#define NFD_TESTS_DAEMON_MGMT_MANAGER_COMMON_FIXTURE_HPP
#include "mgmt/manager-base.hpp"
#include "fw/forwarder.hpp"
#include "tests/test-common.hpp"
#include "tests/identity-management-fixture.hpp"
#include "core/manager-base.hpp"
#include <ndn-cxx/mgmt/dispatcher.hpp>
#include <ndn-cxx/security/command-interest-signer.hpp>
#include <ndn-cxx/util/dummy-client-face.hpp>
namespace nfd {
namespace tests {
/** \brief a fixture that provides a CommandInterestSigner
/** \brief A fixture that provides a CommandInterestSigner.
*/
class CommandInterestSignerFixture : public IdentityManagementTimeFixture
{
@@ -70,7 +70,7 @@ private:
};
/**
* @brief a collection of common functions shared by all manager's testing fixtures.
* @brief A collection of common functions shared by all manager's test fixtures.
*/
class ManagerCommonFixture : public CommandInterestSignerFixture
{
@@ -78,14 +78,12 @@ public: // initialize
ManagerCommonFixture();
/**
* @brief set topPrefix to the dispatcher.
* @brief Add `/localhost/nfd` as a top prefix to the dispatcher.
*
* after setting @param topPrefix, call advanceClocks to ensure all added filters take effects.
*
* @param topPrefix top prefix for the dispatcher
* Afterwards, advanceClocks() is called to ensure all added filters take effect.
*/
void
setTopPrefix(const Name& topPrefix);
setTopPrefix();
public: // test
/**
@@ -101,8 +99,7 @@ public: // test
public: // verify
ControlResponse
makeResponse(uint32_t code, const std::string& text,
const ControlParameters& parameters);
makeResponse(uint32_t code, const std::string& text, const ControlParameters& parameters);
enum class CheckResponseResult
{
@@ -156,14 +153,52 @@ public: // verify
protected:
ndn::util::DummyClientFace m_face;
ndn::mgmt::Dispatcher m_dispatcher;
std::vector<Data>& m_responses; ///< a reference of m_face->sentData
Dispatcher m_dispatcher;
std::vector<Data>& m_responses; ///< a reference to m_face.sentData
};
std::ostream&
operator<<(std::ostream& os, const ManagerCommonFixture::CheckResponseResult& result);
operator<<(std::ostream& os, ManagerCommonFixture::CheckResponseResult result);
class ManagerFixtureWithAuthenticator : public ManagerCommonFixture
{
public:
/** \brief grant m_identityName privilege to sign commands for the management module
*/
void
setPrivilege(const std::string& privilege);
protected:
Forwarder m_forwarder;
shared_ptr<CommandAuthenticator> m_authenticator = CommandAuthenticator::create();
};
class CommandSuccess
{
public:
static ControlResponse
getExpected()
{
return ControlResponse()
.setCode(200)
.setText("OK");
}
};
template<int CODE>
class CommandFailure
{
public:
static ControlResponse
getExpected()
{
return ControlResponse()
.setCode(CODE);
// error description should not be checked
}
};
} // namespace tests
} // namespace nfd
#endif // NFD_TESTS_MANAGER_COMMON_FIXTURE_HPP
#endif // NFD_TESTS_DAEMON_MGMT_MANAGER_COMMON_FIXTURE_HPP
@@ -1,67 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
* Washington University in St. Louis,
* Beijing Institute of Technology,
* The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
*
* NFD is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#include "nfd-manager-common-fixture.hpp"
namespace nfd {
namespace tests {
NfdManagerCommonFixture::NfdManagerCommonFixture()
: m_authenticator(CommandAuthenticator::create())
{
}
void
NfdManagerCommonFixture::setTopPrefix()
{
this->ManagerCommonFixture::setTopPrefix("/localhost/nfd");
}
void
NfdManagerCommonFixture::setPrivilege(const std::string& privilege)
{
this->saveIdentityCertificate(DEFAULT_COMMAND_SIGNER_IDENTITY, "ManagerCommonFixture.ndncert");
const std::string& config = R"CONFIG(
authorizations
{
authorize
{
certfile "ManagerCommonFixture.ndncert"
privileges
{
)CONFIG" + privilege + R"CONFIG(
}
}
}
)CONFIG";
ConfigFile cf;
m_authenticator->setConfigFile(cf);
cf.parse(config, false, "ManagerCommonFixture.authenticator.conf");
}
} // namespace tests
} // namespace nfd
@@ -1,86 +0,0 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
* Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
* Washington University in St. Louis,
* Beijing Institute of Technology,
* The University of Memphis.
*
* This file is part of NFD (Named Data Networking Forwarding Daemon).
* See AUTHORS.md for complete list of NFD authors and contributors.
*
* NFD is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Foundation,
* either version 3 of the License, or (at your option) any later version.
*
* NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
#define NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
#include "tests/manager-common-fixture.hpp"
#include "fw/forwarder.hpp"
#include "mgmt/command-authenticator.hpp"
namespace nfd {
namespace tests {
/** \brief base fixture for testing an NFD Manager
*/
class NfdManagerCommonFixture : public ManagerCommonFixture
{
public:
NfdManagerCommonFixture();
/** \brief add /localhost/nfd as a top prefix to the dispatcher
*/
void
setTopPrefix();
/** \brief grant m_identityName privilege to sign commands for the management module
*/
void
setPrivilege(const std::string& privilege);
protected:
Forwarder m_forwarder;
shared_ptr<CommandAuthenticator> m_authenticator;
};
class CommandSuccess
{
public:
static ControlResponse
getExpected()
{
return ControlResponse()
.setCode(200)
.setText("OK");
}
};
template<int CODE>
class CommandFailure
{
public:
static ControlResponse
getExpected()
{
return ControlResponse()
.setCode(CODE);
// error description should not be checked
}
};
} // namespace tests
} // namespace nfd
#endif // NFD_TESTS_DAEMON_MGMT_NFD_MANAGER_COMMON_FIXTURE_HPP
@@ -165,7 +165,7 @@ private:
ndn::util::DummyClientFace m_face;
ndn::util::Scheduler m_scheduler;
ndn::nfd::Controller m_nfdController;
ndn::mgmt::Dispatcher m_dispatcher;
Dispatcher m_dispatcher;
rib::FibUpdater m_fibUpdater;
ndn::security::SigningInfo m_trustedSigner;
+3 -3
View File
@@ -27,7 +27,7 @@
#include "core/fib-max-depth.hpp"
#include "rib/fib-updater.hpp"
#include "tests/manager-common-fixture.hpp"
#include "manager-common-fixture.hpp"
#include <ndn-cxx/lp/tags.hpp>
#include <ndn-cxx/mgmt/nfd/face-status.hpp>
@@ -93,10 +93,10 @@ private:
advanceClocks(1_ms);
auto replyFibAddCommand = [this] (const Interest& interest) {
nfd::ControlParameters params(interest.getName().get(-5).blockFromValue());
ControlParameters params(interest.getName().get(-5).blockFromValue());
BOOST_CHECK(params.getName() == "/localhost/nfd/rib" || params.getName() == "/localhop/nfd/rib");
params.setFaceId(1).setCost(0);
nfd::ControlResponse resp;
ControlResponse resp;
resp.setCode(200).setBody(params.wireEncode());
shared_ptr<Data> data = make_shared<Data>(interest.getName());
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2014-2018, Regents of the University of California,
* Copyright (c) 2014-2019, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -26,15 +26,15 @@
#include "mgmt/strategy-choice-manager.hpp"
#include "table/strategy-choice.hpp"
#include "nfd-manager-common-fixture.hpp"
#include "../fw/dummy-strategy.hpp"
#include "manager-common-fixture.hpp"
#include "tests/daemon/fw/dummy-strategy.hpp"
#include <ndn-cxx/mgmt/nfd/strategy-choice.hpp>
namespace nfd {
namespace tests {
class StrategyChoiceManagerFixture : public NfdManagerCommonFixture
class StrategyChoiceManagerFixture : public ManagerFixtureWithAuthenticator
{
public:
StrategyChoiceManagerFixture()