diff --git a/tools/nfd-status.sh b/tools/nfd-status.sh
index 6b9336e..f306b9d 100755
--- a/tools/nfd-status.sh
+++ b/tools/nfd-status.sh
@@ -1,9 +1,2 @@
 #!@BASH@
-if [[ $# -gt 0 ]]; then
-  echo 'nfd-status command line options are deprecated.' >&2
-  echo 'Use the `nfdc` subcommands instead. See `nfdc help` for details.' >&2
-  exec "$(dirname "$0")/nfdc" legacy-nfd-status "$@"
-else
-  # nfd-status is an alias of `nfdc status report`
-  exec "$(dirname "$0")/nfdc" status report
-fi
+exec "$(dirname "$0")/nfdc" status report
diff --git a/tools/nfdc/available-commands.cpp b/tools/nfdc/available-commands.cpp
index 0d4847f..272c13d 100644
--- a/tools/nfdc/available-commands.cpp
+++ b/tools/nfdc/available-commands.cpp
@@ -1,5 +1,5 @@
 /* -*- 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,
@@ -26,8 +26,6 @@
 #include "available-commands.hpp"
 #include "face-module.hpp"
 #include "help.hpp"
-#include "legacy-nfdc.hpp"
-#include "legacy-status.hpp"
 #include "rib-module.hpp"
 #include "status.hpp"
 #include "strategy-choice-module.hpp"
@@ -44,35 +42,6 @@
   FaceModule::registerCommands(parser);
   RibModule::registerCommands(parser);
   StrategyChoiceModule::registerCommands(parser);
-
-  registerLegacyStatusCommand(parser);
-
-  struct LegacyNfdcCommandDefinition
-  {
-    std::string subcommand;
-    std::string title;
-    std::string replacementCommand; ///< replacement for deprecated legacy subcommand
-  };
-  const std::vector<LegacyNfdcCommandDefinition> legacyNfdcSubcommands{
-    {"register", "register a prefix", "route add"},
-    {"unregister", "unregister a prefix", "route remove"},
-    {"create", "create a face", "face create"},
-    {"destroy", "destroy a face", "face destroy"},
-    {"set-strategy", "set strategy choice on namespace", "strategy set"},
-    {"unset-strategy", "unset strategy choice on namespace", "strategy unset"},
-    {"add-nexthop", "add FIB nexthop", "route add"},
-    {"remove-nexthop", "remove FIB nexthop", "route remove"}
-  };
-  for (const LegacyNfdcCommandDefinition& lncd : legacyNfdcSubcommands) {
-    CommandDefinition def(lncd.subcommand, "");
-    def.setTitle(lncd.title);
-    def.addArg("args", ArgValueType::ANY, Required::NO, Positional::YES);
-    auto modes = AVAILABLE_IN_ONE_SHOT | AVAILABLE_IN_HELP;
-    if (!lncd.replacementCommand.empty()) {
-      modes = modes & ~AVAILABLE_IN_HELP;
-    }
-    parser.addCommand(def, bind(&legacyNfdcMain, _1, lncd.replacementCommand), modes);
-  }
 }
 
 } // namespace nfdc
diff --git a/tools/nfdc/command-parser.cpp b/tools/nfdc/command-parser.cpp
index b4c4558..74c5202 100644
--- a/tools/nfdc/command-parser.cpp
+++ b/tools/nfdc/command-parser.cpp
@@ -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-2017,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -120,7 +120,7 @@
       i = m_commands.find({noun, "list"});
     }
     else {
-      // help, exit, quit, legacy nfdc commands
+      // help, exit, quit commands
       i = m_commands.find({noun, ""});
     }
     nameLen = std::min<size_t>(1, tokens.size());
diff --git a/tools/nfdc/face-id-fetcher.cpp b/tools/nfdc/face-id-fetcher.cpp
deleted file mode 100644
index f0bf841..0000000
--- a/tools/nfdc/face-id-fetcher.cpp
+++ /dev/null
@@ -1,203 +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 "face-id-fetcher.hpp"
-
-#include <boost/lexical_cast.hpp>
-#include <boost/regex.hpp>
-
-#include <ndn-cxx/mgmt/nfd/face-query-filter.hpp>
-#include <ndn-cxx/mgmt/nfd/face-status.hpp>
-#include <ndn-cxx/security/validator-null.hpp>
-#include <ndn-cxx/util/segment-fetcher.hpp>
-
-namespace nfd {
-namespace tools {
-namespace nfdc {
-
-FaceIdFetcher::FaceIdFetcher(ndn::Face& face,
-                             ndn::nfd::Controller& controller,
-                             bool allowCreate,
-                             const SuccessCallback& onSucceed,
-                             const FailureCallback& onFail)
-  : m_face(face)
-  , m_controller(controller)
-  , m_allowCreate(allowCreate)
-  , m_onSucceed(onSucceed)
-  , m_onFail(onFail)
-{
-}
-
-void
-FaceIdFetcher::start(ndn::Face& face,
-                     ndn::nfd::Controller& controller,
-                     const std::string& input,
-                     bool allowCreate,
-                     const SuccessCallback& onSucceed,
-                     const FailureCallback& onFail)
-{
-  // 1. Try parse input as FaceId, if input is FaceId, succeed with parsed FaceId
-  // 2. Try parse input as FaceUri, if input is not FaceUri, fail
-  // 3. Canonize faceUri
-  // 4. If canonization fails, fail
-  // 5. Query for face
-  // 6. If query succeeds and finds a face, succeed with found FaceId
-  // 7. Create face
-  // 8. If face creation succeeds, succeed with created FaceId
-  // 9. Fail
-
-  boost::regex e("^[a-z0-9]+\\:.*");
-  if (!boost::regex_match(input, e)) {
-    try {
-      uint32_t faceId = boost::lexical_cast<uint32_t>(input);
-      onSucceed(faceId);
-      return;
-    }
-    catch (const boost::bad_lexical_cast&) {
-      onFail("No valid faceId or faceUri is provided");
-      return;
-    }
-  }
-  else {
-    FaceUri faceUri;
-    if (!faceUri.parse(input)) {
-      onFail("FaceUri parse failed");
-      return;
-    }
-
-    auto fetcher = new FaceIdFetcher(std::ref(face), std::ref(controller),
-                                     allowCreate, onSucceed, onFail);
-    fetcher->startGetFaceId(faceUri);
-  }
-}
-
-void
-FaceIdFetcher::startGetFaceId(const FaceUri& faceUri)
-{
-  faceUri.canonize(bind(&FaceIdFetcher::onCanonizeSuccess, this, _1),
-                   bind(&FaceIdFetcher::onCanonizeFailure, this, _1),
-                   m_face.getIoService(), time::seconds(4));
-}
-
-void
-FaceIdFetcher::onCanonizeSuccess(const FaceUri& canonicalUri)
-{
-  ndn::Name queryName("/localhost/nfd/faces/query");
-  ndn::nfd::FaceQueryFilter queryFilter;
-  queryFilter.setRemoteUri(canonicalUri.toString());
-  queryName.append(queryFilter.wireEncode());
-
-  ndn::Interest interestPacket(queryName);
-  interestPacket.setMustBeFresh(true);
-  interestPacket.setInterestLifetime(time::milliseconds(4000));
-  auto interest = std::make_shared<ndn::Interest>(interestPacket);
-
-  ndn::util::SegmentFetcher::fetch(
-    m_face, *interest, ndn::security::v2::getAcceptAllValidator(),
-    bind(&FaceIdFetcher::onQuerySuccess, this, _1, canonicalUri),
-    bind(&FaceIdFetcher::onQueryFailure, this, _1, canonicalUri));
-}
-
-void
-FaceIdFetcher::onCanonizeFailure(const std::string& reason)
-{
-  fail("Canonize faceUri failed : " + reason);
-}
-
-void
-FaceIdFetcher::onQuerySuccess(const ndn::ConstBufferPtr& data,
-                              const FaceUri& canonicalUri)
-{
-  size_t offset = 0;
-  bool isOk = false;
-  ndn::Block block;
-  std::tie(isOk, block) = ndn::Block::fromBuffer(data, offset);
-
-  if (!isOk) {
-    if (m_allowCreate) {
-      startFaceCreate(canonicalUri);
-    }
-    else {
-      fail("Fail to find faceId");
-    }
-  }
-  else {
-    try {
-      ndn::nfd::FaceStatus status(block);
-      succeed(status.getFaceId());
-    }
-    catch (const ndn::tlv::Error& e) {
-      std::string errorMessage(e.what());
-      fail("ERROR: " + errorMessage);
-    }
-  }
-}
-
-void
-FaceIdFetcher::onQueryFailure(uint32_t errorCode,
-                              const FaceUri& canonicalUri)
-{
-  std::stringstream ss;
-  ss << "Cannot fetch data (code " << errorCode << ")";
-  fail(ss.str());
-}
-
-void
-FaceIdFetcher::onFaceCreateError(const ndn::nfd::ControlResponse& response,
-                                 const std::string& message)
-{
-  std::stringstream ss;
-  ss << message << " : " << response.getText() << " (code " << response.getCode() << ")";
-  fail(ss.str());
-}
-
-void
-FaceIdFetcher::startFaceCreate(const FaceUri& canonicalUri)
-{
-  ndn::nfd::ControlParameters parameters;
-  parameters.setUri(canonicalUri.toString());
-
-  m_controller.start<ndn::nfd::FaceCreateCommand>(parameters,
-    [this] (const ndn::nfd::ControlParameters& result) { succeed(result.getFaceId()); },
-    bind(&FaceIdFetcher::onFaceCreateError, this, _1, "Face creation failed"));
-}
-
-void
-FaceIdFetcher::succeed(uint32_t faceId)
-{
-  m_onSucceed(faceId);
-  delete this;
-}
-
-void
-FaceIdFetcher::fail(const std::string& reason)
-{
-  m_onFail(reason);
-  delete this;
-}
-
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
diff --git a/tools/nfdc/face-id-fetcher.hpp b/tools/nfdc/face-id-fetcher.hpp
deleted file mode 100644
index 5e45b7b..0000000
--- a/tools/nfdc/face-id-fetcher.hpp
+++ /dev/null
@@ -1,108 +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/>.
- */
-
-#ifndef NFD_TOOLS_NFDC_FACE_ID_FETCHER_HPP
-#define NFD_TOOLS_NFDC_FACE_ID_FETCHER_HPP
-
-#include "core/common.hpp"
-#include <ndn-cxx/face.hpp>
-#include <ndn-cxx/mgmt/nfd/controller.hpp>
-
-namespace nfd {
-namespace tools {
-namespace nfdc {
-
-class FaceIdFetcher
-{
-public:
-  typedef std::function<void(uint32_t)> SuccessCallback;
-  typedef std::function<void(const std::string&)> FailureCallback;
-
-  /** \brief obtain FaceId from input
-   *  \param face Reference to the Face that should be used to fetch data
-   *  \param controller Reference to the controller that should be used to sign the Interest
-   *  \param input User input, either FaceId or FaceUri
-   *  \param allowCreate Whether creating face is allowed
-   *  \param onSucceed Callback to be fired when faceId is obtained
-   *  \param onFail Callback to be fired when an error occurs
-   */
-  static void
-  start(ndn::Face& face,
-        ndn::nfd::Controller& controller,
-        const std::string& input,
-        bool allowCreate,
-        const SuccessCallback& onSucceed,
-        const FailureCallback& onFail);
-
-private:
-  FaceIdFetcher(ndn::Face& face,
-                ndn::nfd::Controller& controller,
-                bool allowCreate,
-                const SuccessCallback& onSucceed,
-                const FailureCallback& onFail);
-
-  void
-  onQuerySuccess(const ndn::ConstBufferPtr& data,
-                 const FaceUri& canonicalUri);
-
-  void
-  onQueryFailure(uint32_t errorCode,
-                 const FaceUri& canonicalUri);
-
-  void
-  onCanonizeSuccess(const FaceUri& canonicalUri);
-
-  void
-  onCanonizeFailure(const std::string& reason);
-
-  void
-  startGetFaceId(const FaceUri& faceUri);
-
-  void
-  startFaceCreate(const FaceUri& canonicalUri);
-
-  void
-  onFaceCreateError(const ndn::nfd::ControlResponse& response,
-                    const std::string& message);
-
-  void
-  succeed(uint32_t faceId);
-
-  void
-  fail(const std::string& reason);
-
-private:
-  ndn::Face& m_face;
-  ndn::nfd::Controller& m_controller;
-  bool m_allowCreate;
-  SuccessCallback m_onSucceed;
-  FailureCallback m_onFail;
-};
-
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
-
-#endif // NFD_TOOLS_NFDC_FACE_ID_FETCHER_HPP
diff --git a/tools/nfdc/legacy-nfdc.cpp b/tools/nfdc/legacy-nfdc.cpp
deleted file mode 100644
index e0e6bcd..0000000
--- a/tools/nfdc/legacy-nfdc.cpp
+++ /dev/null
@@ -1,405 +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 "legacy-nfdc.hpp"
-#include "face-id-fetcher.hpp"
-
-#include <boost/program_options.hpp>
-#include <boost/regex.hpp>
-
-namespace nfd {
-namespace tools {
-namespace nfdc {
-
-using ndn::nfd::ControlParameters;
-
-const time::milliseconds LegacyNfdc::DEFAULT_EXPIRATION_PERIOD = time::milliseconds::max();
-const uint64_t LegacyNfdc::DEFAULT_COST = 0;
-
-LegacyNfdc::LegacyNfdc(Face& face, KeyChain& keyChain)
-  : m_flags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT)
-  , m_cost(DEFAULT_COST)
-  , m_origin(ndn::nfd::ROUTE_ORIGIN_STATIC)
-  , m_expires(DEFAULT_EXPIRATION_PERIOD)
-  , m_facePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
-  , m_face(face)
-  , m_controller(face, keyChain)
-{
-}
-
-bool
-LegacyNfdc::dispatch(const std::string& command)
-{
-  if (command == "add-nexthop") {
-    if (m_commandLineArguments.size() != 2)
-      return false;
-    fibAddNextHop();
-  }
-  else if (command == "remove-nexthop") {
-    if (m_commandLineArguments.size() != 2)
-      return false;
-    fibRemoveNextHop();
-  }
-  else if (command == "register") {
-    if (m_commandLineArguments.size() != 2)
-      return false;
-    ribRegisterPrefix();
-  }
-  else if (command == "unregister") {
-    if (m_commandLineArguments.size() != 2)
-      return false;
-    ribUnregisterPrefix();
-  }
-  else if (command == "create") {
-    if (m_commandLineArguments.size() != 1)
-      return false;
-    faceCreate();
-  }
-  else if (command == "destroy") {
-    if (m_commandLineArguments.size() != 1)
-      return false;
-    faceDestroy();
-  }
-  else if (command == "set-strategy") {
-    if (m_commandLineArguments.size() != 2)
-      return false;
-    strategyChoiceSet();
-  }
-  else if (command == "unset-strategy") {
-    if (m_commandLineArguments.size() != 1)
-      return false;
-    strategyChoiceUnset();
-  }
-  else
-    return false;
-
-  return true;
-}
-
-void
-LegacyNfdc::fibAddNextHop()
-{
-  m_name = m_commandLineArguments[0];
-  const std::string& faceName = m_commandLineArguments[1];
-
-  FaceIdFetcher::start(m_face, m_controller, faceName, true,
-    [this] (const uint32_t faceId) {
-      ControlParameters parameters;
-      parameters
-        .setName(m_name)
-        .setCost(m_cost)
-        .setFaceId(faceId);
-
-      m_controller.start<ndn::nfd::FibAddNextHopCommand>(parameters,
-        bind(&LegacyNfdc::onSuccess, this, _1, "Nexthop insertion succeeded"),
-        bind(&LegacyNfdc::onError, this, _1, "Nexthop insertion failed"));
-    },
-    bind(&LegacyNfdc::onObtainFaceIdFailure, this, _1));
-}
-
-void
-LegacyNfdc::fibRemoveNextHop()
-{
-  m_name = m_commandLineArguments[0];
-  const std::string& faceName = m_commandLineArguments[1];
-
-  FaceIdFetcher::start(m_face, m_controller, faceName, false,
-    [this] (const uint32_t faceId) {
-      ControlParameters parameters;
-      parameters
-        .setName(m_name)
-        .setFaceId(faceId);
-
-      m_controller.start<ndn::nfd::FibRemoveNextHopCommand>(parameters,
-        bind(&LegacyNfdc::onSuccess, this, _1, "Nexthop removal succeeded"),
-        bind(&LegacyNfdc::onError, this, _1, "Nexthop removal failed"));
-    },
-    bind(&LegacyNfdc::onObtainFaceIdFailure, this, _1));
-}
-
-void
-LegacyNfdc::ribRegisterPrefix()
-{
-  m_name = m_commandLineArguments[0];
-  const std::string& faceName = m_commandLineArguments[1];
-
-  FaceIdFetcher::start(m_face, m_controller, faceName, true,
-    [this] (const uint32_t faceId) {
-      ControlParameters parameters;
-      parameters
-        .setName(m_name)
-        .setCost(m_cost)
-        .setFlags(m_flags)
-        .setOrigin(m_origin)
-        .setFaceId(faceId);
-
-      if (m_expires != DEFAULT_EXPIRATION_PERIOD)
-        parameters.setExpirationPeriod(m_expires);
-
-      m_controller.start<ndn::nfd::RibRegisterCommand>(parameters,
-        bind(&LegacyNfdc::onSuccess, this, _1, "Successful in name registration"),
-        bind(&LegacyNfdc::onError, this, _1, "Failed in name registration"));
-    },
-    bind(&LegacyNfdc::onObtainFaceIdFailure, this, _1));
-}
-
-void
-LegacyNfdc::ribUnregisterPrefix()
-{
-  m_name = m_commandLineArguments[0];
-  const std::string& faceName = m_commandLineArguments[1];
-
-  FaceIdFetcher::start(m_face, m_controller, faceName, false,
-    [this] (const uint32_t faceId) {
-      ControlParameters parameters;
-      parameters
-        .setName(m_name)
-        .setFaceId(faceId)
-        .setOrigin(m_origin);
-
-      m_controller.start<ndn::nfd::RibUnregisterCommand>(parameters,
-        bind(&LegacyNfdc::onSuccess, this, _1, "Successful in unregistering name"),
-        bind(&LegacyNfdc::onError, this, _1, "Failed in unregistering name"));
-    },
-    bind(&LegacyNfdc::onObtainFaceIdFailure, this, _1));
-}
-
-void
-LegacyNfdc::onCanonizeFailure(const std::string& reason)
-{
-  BOOST_THROW_EXCEPTION(Error(reason));
-}
-
-void
-LegacyNfdc::onObtainFaceIdFailure(const std::string& message)
-{
-  BOOST_THROW_EXCEPTION(Error(message));
-}
-
-void
-LegacyNfdc::faceCreate()
-{
-  boost::regex e("^[a-z0-9]+\\:.*");
-  if (!boost::regex_match(m_commandLineArguments[0], e))
-    BOOST_THROW_EXCEPTION(Error("invalid uri format"));
-
-  FaceUri faceUri;
-  faceUri.parse(m_commandLineArguments[0]);
-
-  faceUri.canonize(bind(&LegacyNfdc::startFaceCreate, this, _1),
-                   bind(&LegacyNfdc::onCanonizeFailure, this, _1),
-                   m_face.getIoService(), time::seconds(4));
-}
-
-void
-LegacyNfdc::startFaceCreate(const FaceUri& canonicalUri)
-{
-  ControlParameters parameters;
-  parameters.setUri(canonicalUri.toString());
-  parameters.setFacePersistency(m_facePersistency);
-
-  m_controller.start<ndn::nfd::FaceCreateCommand>(parameters,
-    bind(&LegacyNfdc::onSuccess, this, _1, "Face creation succeeded"),
-    bind(&LegacyNfdc::onError, this, _1, "Face creation failed"));
-}
-
-void
-LegacyNfdc::faceDestroy()
-{
-  ControlParameters parameters;
-  const std::string& faceName = m_commandLineArguments[0];
-
-  FaceIdFetcher::start(m_face, m_controller, faceName, false,
-    [this] (const uint32_t faceId) {
-      ControlParameters faceParameters;
-      faceParameters.setFaceId(faceId);
-
-      m_controller.start<ndn::nfd::FaceDestroyCommand>(faceParameters,
-        bind(&LegacyNfdc::onSuccess, this, _1, "Face destroy succeeded"),
-        bind(&LegacyNfdc::onError, this, _1, "Face destroy failed"));
-    },
-    bind(&LegacyNfdc::onObtainFaceIdFailure, this, _1));
-}
-
-void
-LegacyNfdc::strategyChoiceSet()
-{
-  const std::string& name = m_commandLineArguments[0];
-  const std::string& strategy = m_commandLineArguments[1];
-
-  ControlParameters parameters;
-  parameters
-    .setName(name)
-    .setStrategy(strategy);
-
-  m_controller.start<ndn::nfd::StrategyChoiceSetCommand>(parameters,
-    bind(&LegacyNfdc::onSuccess, this, _1, "Successfully set strategy choice"),
-    bind(&LegacyNfdc::onError, this, _1, "Failed to set strategy choice"));
-}
-
-void
-LegacyNfdc::strategyChoiceUnset()
-{
-  const std::string& name = m_commandLineArguments[0];
-
-  ControlParameters parameters;
-  parameters.setName(name);
-
-  m_controller.start<ndn::nfd::StrategyChoiceUnsetCommand>(parameters,
-    bind(&LegacyNfdc::onSuccess, this, _1, "Successfully unset strategy choice"),
-    bind(&LegacyNfdc::onError, this, _1, "Failed to unset strategy choice"));
-}
-
-void
-LegacyNfdc::onSuccess(const ControlParameters& commandSuccessResult, const std::string& message)
-{
-  std::cout << message << ": " << commandSuccessResult << std::endl;
-}
-
-void
-LegacyNfdc::onError(const ndn::nfd::ControlResponse& response, const std::string& message)
-{
-  std::ostringstream os;
-  os << message << ": " << response.getText() << " (code: " << response.getCode() << ")";
-  BOOST_THROW_EXCEPTION(Error(os.str()));
-}
-
-void
-legacyNfdcUsage()
-{
-  std::cout << "Usage:\n"
-    "nfdc [-h] [-V] COMMAND [<Command Options>]\n"
-    "       -h print usage and exit\n"
-    "       -V print version and exit\n"
-    "\n"
-    "   COMMAND can be one of the following:\n"
-    "       register [-I] [-C] [-c cost] [-e expiration time] [-o origin] name <faceId | faceUri>\n"
-    "           register name to the given faceId or faceUri\n"
-    "           -I: unset CHILD_INHERIT flag\n"
-    "           -C: set CAPTURE flag\n"
-    "           -c: specify cost (default 0)\n"
-    "           -e: specify expiration time in ms\n"
-    "               (by default the entry remains in FIB for the lifetime of the associated face)\n"
-    "           -o: specify origin\n"
-    "               0 for Local producer applications, 128 for NLSR, 255(default) for static routes\n"
-    "       unregister [-o origin] name <faceId | faceUri>\n"
-    "           unregister name from the given faceId\n"
-    "       create [-P] <faceUri> \n"
-    "           Create a face in one of the following formats:\n"
-    "           UDP unicast:    udp[4|6]://<remote-IP-or-host>[:<remote-port>]\n"
-    "           TCP:            tcp[4|6]://<remote-IP-or-host>[:<remote-port>] \n"
-    "           -P: create permanent (instead of persistent) face\n"
-    "       destroy <faceId | faceUri> \n"
-    "           Destroy a face\n"
-    "       set-strategy <name> <strategy> \n"
-    "           Set the strategy for a namespace \n"
-    "       unset-strategy <name> \n"
-    "           Unset the strategy for a namespace \n"
-    "       add-nexthop [-c <cost>] <name> <faceId | faceUri>\n"
-    "           Add a nexthop to a FIB entry\n"
-    "           -c: specify cost (default 0)\n"
-    "       remove-nexthop <name> <faceId | faceUri> \n"
-    "           Remove a nexthop from a FIB entry\n"
-    << std::endl;
-}
-
-void
-legacyNfdcMain(ExecuteContext& ctx, const std::string& replacementCommand)
-{
-  if (!replacementCommand.empty()) {
-    std::cerr << "'nfdc " << ctx.noun << "' command is deprecated. "
-              << "Use 'nfdc " << replacementCommand << "' instead.\n";
-  }
-
-  LegacyNfdc p(ctx.face, ctx.keyChain);
-
-  const std::string& subcommand = ctx.noun;
-  auto args = ctx.args.get<std::vector<std::string>>("args");
-  bool wantUnsetChildInherit = false;
-  bool wantCapture = false;
-  bool wantPermanentFace = false;
-  int64_t expires = -1;
-  std::underlying_type<ndn::nfd::RouteOrigin>::type origin = ndn::nfd::ROUTE_ORIGIN_STATIC;
-
-  namespace po = boost::program_options;
-  po::options_description options;
-  options.add_options()
-    (",I", po::bool_switch(&wantUnsetChildInherit))
-    (",C", po::bool_switch(&wantCapture))
-    (",c", po::value<uint64_t>(&p.m_cost))
-    (",e", po::value<int64_t>(&expires))
-    (",o", po::value<std::underlying_type<ndn::nfd::RouteOrigin>::type>(&origin))
-    (",P", po::bool_switch(&wantPermanentFace));
-  po::variables_map vm;
-  std::vector<std::string> unparsed;
-  try {
-    po::parsed_options parsed = po::command_line_parser(args).options(options).allow_unregistered().run();
-    unparsed = po::collect_unrecognized(parsed.options, po::include_positional);
-    po::store(parsed, vm);
-    po::notify(vm);
-  }
-  catch (const po::error& e) {
-    std::cerr << e.what() << std::endl;
-    legacyNfdcUsage();
-    ctx.exitCode = 2;
-    return;
-  }
-
-  if (wantUnsetChildInherit) {
-    p.m_flags &= ~(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT);
-  }
-  if (wantCapture) {
-    p.m_flags |= ndn::nfd::ROUTE_FLAG_CAPTURE;
-  }
-  if (expires >= 0) {
-    // accept negative values as no expiration
-    p.m_expires = time::milliseconds(expires);
-  }
-  p.m_origin = static_cast<ndn::nfd::RouteOrigin>(origin);
-  if (wantPermanentFace) {
-    p.m_facePersistency = ndn::nfd::FACE_PERSISTENCY_PERMANENT;
-  }
-
-  if (std::any_of(unparsed.begin(), unparsed.end(),
-      [] (const std::string& s) { return s.empty() || s[0] == '-'; })) {
-    // unrecognized -option
-    legacyNfdcUsage();
-    ctx.exitCode = 2;
-    return;
-  }
-  p.m_commandLineArguments = unparsed;
-
-  bool isOk = p.dispatch(subcommand);
-  if (!isOk) {
-    legacyNfdcUsage();
-    ctx.exitCode = 2;
-    return;
-  }
-  ctx.face.processEvents();
-}
-
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
diff --git a/tools/nfdc/legacy-nfdc.hpp b/tools/nfdc/legacy-nfdc.hpp
deleted file mode 100644
index 782c255..0000000
--- a/tools/nfdc/legacy-nfdc.hpp
+++ /dev/null
@@ -1,185 +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/>.
- */
-
-#ifndef NFD_TOOLS_NFDC_LEGACY_NFDC_HPP
-#define NFD_TOOLS_NFDC_LEGACY_NFDC_HPP
-
-#include "execute-command.hpp"
-
-#include <ndn-cxx/encoding/nfd-constants.hpp>
-#include <ndn-cxx/mgmt/nfd/controller.hpp>
-
-namespace nfd {
-namespace tools {
-namespace nfdc {
-
-class LegacyNfdc : noncopyable
-{
-public:
-  static const time::milliseconds DEFAULT_EXPIRATION_PERIOD;
-  static const uint64_t DEFAULT_COST;
-
-  class Error : public std::runtime_error
-  {
-  public:
-    explicit
-    Error(const std::string& what)
-      : std::runtime_error(what)
-    {
-    }
-  };
-
-  LegacyNfdc(Face& face, KeyChain& keyChain);
-
-  bool
-  dispatch(const std::string& cmd);
-
-  /**
-   * \brief Adds a nexthop to a FIB entry
-   *
-   * If the FIB entry does not exist, it is inserted automatically
-   *
-   * cmd format:
-   *  [-c cost]  name faceId|faceUri
-   *
-   */
-  void
-  fibAddNextHop();
-
-  /**
-   * \brief Removes a nexthop from an existing FIB entry
-   *
-   * If the last nexthop record in a FIB entry is removed, the FIB entry is also deleted
-   *
-   * cmd format:
-   *  name faceId
-   *
-   */
-  void
-  fibRemoveNextHop();
-
-  /**
-   * \brief Registers name to the given faceId or faceUri
-   *
-   * cmd format:
-   *  [-I] [-C] [-c cost] name faceId|faceUri
-   */
-  void
-  ribRegisterPrefix();
-
-  /**
-   * \brief Unregisters name from the given faceId/faceUri
-   *
-   * cmd format:
-   *  name faceId/faceUri
-   */
-  void
-  ribUnregisterPrefix();
-
-  /**
-   * \brief Creates new face
-   *
-   * This command allows creation of UDP unicast and TCP faces only
-   *
-   * cmd format:
-   *  uri
-   *
-   */
-  void
-  faceCreate();
-
-  /**
-   * \brief Destroys face
-   *
-   * cmd format:
-   *  faceId|faceUri
-   *
-   */
-  void
-  faceDestroy();
-
-  /**
-   * \brief Sets the strategy for a namespace
-   *
-   * cmd format:
-   *  name strategy
-   *
-   */
-  void
-  strategyChoiceSet();
-
-  /**
-   * \brief Unset the strategy for a namespace
-   *
-   * cmd format:
-   *  name strategy
-   *
-   */
-  void
-  strategyChoiceUnset();
-
-private:
-  void
-  onSuccess(const ndn::nfd::ControlParameters& commandSuccessResult,
-            const std::string& message);
-
-  void
-  onError(const ndn::nfd::ControlResponse& response, const std::string& message);
-
-  void
-  onCanonizeFailure(const std::string& reason);
-
-  void
-  startFaceCreate(const FaceUri& canonicalUri);
-
-  void
-  onObtainFaceIdFailure(const std::string& message);
-
-public:
-  std::vector<std::string> m_commandLineArguments; // positional arguments
-  uint64_t m_flags;
-  uint64_t m_cost;
-  uint64_t m_faceId;
-  ndn::nfd::RouteOrigin m_origin;
-  time::milliseconds m_expires;
-  std::string m_name;
-  ndn::nfd::FacePersistency m_facePersistency;
-
-private:
-  Face& m_face;
-  ndn::nfd::Controller m_controller;
-};
-
-void
-legacyNfdcUsage();
-
-void
-legacyNfdcMain(ExecuteContext& ctx, const std::string& replacementCommand);
-
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
-
-#endif // NFD_TOOLS_NFDC_LEGACY_NFDC_HPP
diff --git a/tools/nfdc/legacy-status.cpp b/tools/nfdc/legacy-status.cpp
deleted file mode 100644
index a61defd..0000000
--- a/tools/nfdc/legacy-status.cpp
+++ /dev/null
@@ -1,126 +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 "legacy-status.hpp"
-#include "core/version.hpp"
-
-#include <boost/program_options.hpp>
-
-namespace nfd {
-namespace tools {
-namespace nfdc {
-
-static void
-showUsage(std::ostream& os, const boost::program_options::options_description& cmdOptions)
-{
-  os << "Usage: nfd-status [options]\n\n"
-     << "Show NFD version and status information.\n\n"
-     << cmdOptions;
-}
-
-/** \brief parse legacy nfd-status command line, and show usage if necessary
- *  \return if first item is -1, caller should retrieve and display StatusReport;
- *          otherwise, caller should immediately exit with the specified exit code
- */
-static std::tuple<int, StatusReportOptions>
-parseCommandLine(ExecuteContext& ctx, const std::vector<std::string>& args)
-{
-  StatusReportOptions options;
-
-  namespace po = boost::program_options;
-  po::options_description cmdOptions("StatusReportOptions");
-  cmdOptions.add_options()
-    ("help,h", "print this help message")
-    ("version,V", "show program version")
-    ("general,v", po::bool_switch(&options.wantForwarderGeneral), "show general status")
-    ("channels,c", po::bool_switch(&options.wantChannels), "show channels")
-    ("faces,f", po::bool_switch(&options.wantFaces), "show faces")
-    ("fib,b", po::bool_switch(&options.wantFib), "show FIB entries")
-    ("rib,r", po::bool_switch(&options.wantRib), "show RIB routes")
-    ("sc,s", po::bool_switch(&options.wantStrategyChoice), "show strategy choice entries")
-    ("xml,x", "output as XML instead of text (implies -vcfbrs)");
-  po::variables_map vm;
-  try {
-    po::store(po::command_line_parser(args).options(cmdOptions).run(), vm);
-    po::notify(vm);
-  }
-  catch (const po::error& e) {
-    ctx.err << e.what() << "\n";
-    showUsage(ctx.err, cmdOptions);
-    return std::make_tuple(2, options);
-  }
-
-  if (vm.count("help") > 0) {
-    showUsage(ctx.out, cmdOptions);
-    return std::make_tuple(0, options);
-  }
-  if (vm.count("version") > 0) {
-    ctx.out << "nfd-status " << NFD_VERSION_BUILD_STRING << "\n";
-    return std::make_tuple(0, options);
-  }
-
-  if (vm.count("xml") > 0) {
-    options.output = ReportFormat::XML;
-  }
-  if (options.output == ReportFormat::XML ||
-      (!options.wantForwarderGeneral && !options.wantChannels && !options.wantFaces &&
-       !options.wantFib && !options.wantRib && !options.wantStrategyChoice)) {
-    options.wantForwarderGeneral = options.wantChannels = options.wantFaces =
-      options.wantFib = options.wantRib = options.wantStrategyChoice = true;
-  }
-
-  return std::make_tuple(-1, options);
-}
-
-/** \brief the 'legacy-nfd-status' command
- */
-static void
-legacyNfdStatus(ExecuteContext& ctx)
-{
-  auto args = ctx.args.get<std::vector<std::string>>("args");
-
-  int exitCode = -1;
-  StatusReportOptions options;
-  std::tie(exitCode, options) = parseCommandLine(ctx, args);
-  if (exitCode >= 0) {
-    ctx.exitCode = exitCode;
-    return;
-  }
-
-  reportStatus(ctx, options);
-}
-
-void
-registerLegacyStatusCommand(CommandParser& parser)
-{
-  CommandDefinition defLegacyNfdStatus("legacy-nfd-status", "");
-  defLegacyNfdStatus
-    .addArg("args", ArgValueType::ANY, Required::NO, Positional::YES);
-  parser.addCommand(defLegacyNfdStatus, &legacyNfdStatus, AVAILABLE_IN_ALL & ~AVAILABLE_IN_HELP);
-}
-
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
diff --git a/tools/nfdc/legacy-status.hpp b/tools/nfdc/legacy-status.hpp
deleted file mode 100644
index e200292..0000000
--- a/tools/nfdc/legacy-status.hpp
+++ /dev/null
@@ -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/>.
- */
-
-#ifndef NFD_TOOLS_NFDC_LEGACY_STATUS_HPP
-#define NFD_TOOLS_NFDC_LEGACY_STATUS_HPP
-
-#include "status.hpp"
-
-namespace nfd {
-namespace tools {
-namespace nfdc {
-
-/** \brief registers 'legacy-nfd-status' command
- */
-void
-registerLegacyStatusCommand(CommandParser& parser);
-
-} // namespace nfdc
-} // namespace tools
-} // namespace nfd
-
-#endif // NFD_TOOLS_NFDC_LEGACY_STATUS_HPP
