model+helper+ndn-cxx: Adjust ndn::L3Protocol and ndn::StackHelper for NFD 0.4+ model

This commit also restores ndn-cxx Face emulation, which is now necessary
for all NFD's management operations.

Change-Id: Id04cf69a2b0c81972248b6d80055e7c743fa869d
Refs: #3560
diff --git a/helper/ndn-face-container.hpp b/helper/ndn-face-container.hpp
index e55cc2a..545ff4d 100644
--- a/helper/ndn-face-container.hpp
+++ b/helper/ndn-face-container.hpp
@@ -27,7 +27,6 @@
 
 #include "ns3/ptr.h"
 #include "ns3/simple-ref-count.h"
-#include "ns3/ndnSIM/model/ndn-face.hpp"
 
 namespace ns3 {
 namespace ndn {
diff --git a/helper/ndn-fib-helper.hpp b/helper/ndn-fib-helper.hpp
index 76695f6..c231be9 100644
--- a/helper/ndn-fib-helper.hpp
+++ b/helper/ndn-fib-helper.hpp
@@ -21,7 +21,6 @@
 #define NDN_FIB_HELPER_H
 
 #include "ns3/ndnSIM/model/ndn-common.hpp"
-#include "ns3/ndnSIM/model/ndn-face.hpp"
 
 #include "ns3/node.h"
 #include "ns3/object-vector.h"
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index 7211639..06dd368 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -25,7 +25,8 @@
 #include "ns3/point-to-point-net-device.h"
 
 #include "model/ndn-l3-protocol.hpp"
-#include "model/ndn-net-device-face.hpp"
+#include "model/ndn-net-device-link-service.hpp"
+#include "model/null-transport.hpp"
 #include "utils/ndn-time.hpp"
 #include "utils/dummy-keychain.hpp"
 #include "model/cs/ndn-content-store.hpp"
@@ -40,12 +41,12 @@
 namespace ndn {
 
 StackHelper::StackHelper()
-  : m_needSetDefaultRoutes(false)
-  , m_maxCsSize(100)
-  , m_isRibManagerDisabled(false)
-  , m_isFaceManagerDisabled(false)
-  , m_isStatusServerDisabled(false)
+  : m_isRibManagerDisabled(false)
+  // , m_isFaceManagerDisabled(false)
+  , m_isForwarderStatusManagerDisabled(false)
   , m_isStrategyChoiceManagerDisabled(false)
+  , m_needSetDefaultRoutes(false)
+  , m_maxCsSize(100)
 {
   setCustomNdnCxxClocks();
 
@@ -158,12 +159,12 @@
     ndn->getConfig().put("ndnSIM.disable_rib_manager", true);
   }
 
-  if (m_isFaceManagerDisabled) {
-    ndn->getConfig().put("ndnSIM.disable_face_manager", true);
-  }
+  // if (m_isFaceManagerDisabled) {
+  //   ndn->getConfig().put("ndnSIM.disable_face_manager", true);
+  // }
 
-  if (m_isStatusServerDisabled) {
-    ndn->getConfig().put("ndnSIM.disable_status_server", true);
+  if (m_isForwarderStatusManagerDisabled) {
+    ndn->getConfig().put("ndnSIM.disable_forwarder_status_manager", true);
   }
 
   if (m_isStrategyChoiceManagerDisabled) {
@@ -194,15 +195,15 @@
 }
 
 void
-StackHelper::AddNetDeviceFaceCreateCallback(TypeId netDeviceType,
-                                            StackHelper::NetDeviceFaceCreateCallback callback)
+StackHelper::AddFaceCreateCallback(TypeId netDeviceType,
+                                   StackHelper::FaceCreateCallback callback)
 {
   m_netDeviceCallbacks.push_back(std::make_pair(netDeviceType, callback));
 }
 
 void
-StackHelper::UpdateNetDeviceFaceCreateCallback(TypeId netDeviceType,
-                                               NetDeviceFaceCreateCallback callback)
+StackHelper::UpdateFaceCreateCallback(TypeId netDeviceType,
+                                      FaceCreateCallback callback)
 {
   for (auto& i : m_netDeviceCallbacks) {
     if (i.first == netDeviceType) {
@@ -213,39 +214,49 @@
 }
 
 void
-StackHelper::RemoveNetDeviceFaceCreateCallback(TypeId netDeviceType,
-                                               NetDeviceFaceCreateCallback callback)
+StackHelper::RemoveFaceCreateCallback(TypeId netDeviceType,
+                                      FaceCreateCallback callback)
 {
-  m_netDeviceCallbacks.remove_if([&] (const std::pair<TypeId, NetDeviceFaceCreateCallback>& i) {
+  m_netDeviceCallbacks.remove_if([&] (const std::pair<TypeId, FaceCreateCallback>& i) {
       return (i.first == netDeviceType);
     });
 }
 
-shared_ptr<NetDeviceFace>
+shared_ptr<Face>
 StackHelper::DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
                                       Ptr<NetDevice> netDevice) const
 {
-  NS_LOG_DEBUG("Creating default NetDeviceFace on node " << node->GetId());
+  NS_LOG_DEBUG("Creating default Face on node " << node->GetId());
 
-  shared_ptr<NetDeviceFace> face = std::make_shared<NetDeviceFace>(node, netDevice);
+  auto netDeviceLink = make_unique<NetDeviceLinkService>(node, netDevice);
+  auto transport = make_unique<NullTransport>("netDevice://", "netDevice://");
+  auto face = std::make_shared<Face>(std::move(netDeviceLink), std::move(transport));
+  face->setMetric(1);
+
+  // @TODO add netDevice ID
 
   ndn->addFace(face);
-  NS_LOG_LOGIC("Node " << node->GetId() << ": added NetDeviceFace as face #"
+  NS_LOG_LOGIC("Node " << node->GetId() << ": added Face as face #"
                        << face->getLocalUri());
 
   return face;
 }
 
-shared_ptr<NetDeviceFace>
+shared_ptr<Face>
 StackHelper::PointToPointNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
                                            Ptr<NetDevice> device) const
 {
-  NS_LOG_DEBUG("Creating point-to-point NetDeviceFace on node " << node->GetId());
+  NS_LOG_DEBUG("Creating point-to-point Face on node " << node->GetId());
 
-  shared_ptr<NetDeviceFace> face = std::make_shared<NetDeviceFace>(node, device);
+  auto netDeviceLink = make_unique<NetDeviceLinkService>(node, device);
+  auto transport = make_unique<NullTransport>("netDevice://", "netDevice://");
+  auto face = std::make_shared<Face>(std::move(netDeviceLink), std::move(transport));
+  face->setMetric(1);
+
+  // @TODO add netDevice ID
 
   ndn->addFace(face);
-  NS_LOG_LOGIC("Node " << node->GetId() << ": added NetDeviceFace as face #"
+  NS_LOG_LOGIC("Node " << node->GetId() << ": added Face as face #"
                        << face->getLocalUri());
 
   return face;
@@ -299,10 +310,10 @@
   Update(NodeContainer::GetGlobal());
 }
 
-shared_ptr<NetDeviceFace>
+shared_ptr<Face>
 StackHelper::createAndRegisterFace(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> device) const
 {
-  shared_ptr<NetDeviceFace> face;
+  shared_ptr<Face> face;
 
   for (const auto& item : m_netDeviceCallbacks) {
     if (device->GetInstanceTypeId() == item.first ||
@@ -319,7 +330,9 @@
 
   if (m_needSetDefaultRoutes) {
     // default route with lowest priority possible
-    FibHelper::AddRoute(node, "/", face, std::numeric_limits<int32_t>::max());
+
+    // TODO: Restore when FibHelper is available
+    // FibHelper::AddRoute(node, "/", face, std::numeric_limits<int32_t>::max());
   }
   return face;
 }
@@ -330,11 +343,11 @@
   m_isRibManagerDisabled = true;
 }
 
-void
-StackHelper::disableFaceManager()
-{
-  m_isFaceManagerDisabled = true;
-}
+// void
+// StackHelper::disableFaceManager()
+// {
+//   m_isFaceManagerDisabled = true;
+// }
 
 void
 StackHelper::disableStrategyChoiceManager()
@@ -343,9 +356,9 @@
 }
 
 void
-StackHelper::disableStatusServer()
+StackHelper::disableForwarderStatusManager()
 {
-  m_isStatusServerDisabled = true;
+  m_isForwarderStatusManagerDisabled = true;
 }
 
 } // namespace ndn
diff --git a/helper/ndn-stack-helper.hpp b/helper/ndn-stack-helper.hpp
index 4b6f38b..0cb3413 100644
--- a/helper/ndn-stack-helper.hpp
+++ b/helper/ndn-stack-helper.hpp
@@ -17,8 +17,8 @@
  * ndnSIM, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  **/
 
-#ifndef NDN_STACK_HELPER_H
-#define NDN_STACK_HELPER_H
+#ifndef NDNSIM_HELPER_NDN_STACK_HELPER_HPP
+#define NDNSIM_HELPER_NDN_STACK_HELPER_HPP
 
 #include "ns3/ndnSIM/model/ndn-common.hpp"
 
@@ -37,7 +37,6 @@
 
 namespace ndn {
 
-class NetDeviceFace;
 class L3Protocol;
 
 /**
@@ -88,8 +87,8 @@
                   const std::string& value3 = "", const std::string& attr4 = "",
                   const std::string& value4 = "");
 
-  typedef Callback<shared_ptr<NetDeviceFace>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice>>
-    NetDeviceFaceCreateCallback;
+  typedef Callback<shared_ptr<Face>, Ptr<Node>, Ptr<L3Protocol>, Ptr<NetDevice>>
+    FaceCreateCallback;
 
   /**
    * @brief Add callback to create and configure instance of the face, based on supplied Ptr<Node>
@@ -101,7 +100,7 @@
    *(DefaultNetDeviceCallback)
    */
   void
-  AddNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
+  AddFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback);
 
   /**
    * @brief Update callback to create and configure instance of the face, based on supplied
@@ -112,14 +111,14 @@
    * Using this method, it is possible to override Face creation for PointToPointNetDevices
    */
   void
-  UpdateNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
+  UpdateFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback);
 
   /**
    * @brief Remove callback to create and configure instance of the face, based on supplied
    * Ptr<Node> and Ptr<NetDevice>
    */
   void
-  RemoveNetDeviceFaceCreateCallback(TypeId netDeviceType, NetDeviceFaceCreateCallback callback);
+  RemoveFaceCreateCallback(TypeId netDeviceType, FaceCreateCallback callback);
 
   /**
   * \brief Install Ndn stack on the node
@@ -218,11 +217,12 @@
   void
   disableRibManager();
 
-  /**
-   * \brief Disable Face Manager
-   */
-  void
-  disableFaceManager();
+  // Cannot be disabled for now
+  // /**
+  //  * \brief Disable Face Manager
+  //  */
+  // void
+  // disableFaceManager();
 
   /**
    * \brief Disable Strategy Choice Manager
@@ -231,24 +231,24 @@
   disableStrategyChoiceManager();
 
   /**
-   * \brief Disable Status Server
+   * \brief Disable Forwarder Status Manager
    */
   void
-  disableStatusServer();
+  disableForwarderStatusManager();
 
 private:
-  shared_ptr<NetDeviceFace>
+  shared_ptr<Face>
   DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
 
-  shared_ptr<NetDeviceFace>
+  shared_ptr<Face>
   PointToPointNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn,
                                 Ptr<NetDevice> netDevice) const;
-  shared_ptr<NetDeviceFace>
+  shared_ptr<Face>
   createAndRegisterFace(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> device) const;
 
   bool m_isRibManagerDisabled;
-  bool m_isFaceManagerDisabled;
-  bool m_isStatusServerDisabled;
+  // bool m_isFaceManagerDisabled;
+  bool m_isForwarderStatusManagerDisabled;
   bool m_isStrategyChoiceManagerDisabled;
 
 public:
@@ -262,11 +262,11 @@
   bool m_needSetDefaultRoutes;
   size_t m_maxCsSize;
 
-  typedef std::list<std::pair<TypeId, NetDeviceFaceCreateCallback>> NetDeviceCallbackList;
+  typedef std::list<std::pair<TypeId, FaceCreateCallback>> NetDeviceCallbackList;
   NetDeviceCallbackList m_netDeviceCallbacks;
 };
 
 } // namespace ndn
 } // namespace ns3
 
-#endif /* NDN_STACK_HELPER_H */
+#endif // NDNSIM_HELPER_NDN_STACK_HELPER_HPP
diff --git a/model/ndn-global-router.cpp b/model/ndn-global-router.cpp
index de853b7..7b92d1b 100644
--- a/model/ndn-global-router.cpp
+++ b/model/ndn-global-router.cpp
@@ -20,7 +20,6 @@
 #include "ndn-global-router.hpp"
 
 #include "model/ndn-l3-protocol.hpp"
-#include "model/ndn-face.hpp"
 
 #include "ns3/channel.h"
 
diff --git a/model/ndn-global-router.hpp b/model/ndn-global-router.hpp
index f19e8f4..fe6f308 100644
--- a/model/ndn-global-router.hpp
+++ b/model/ndn-global-router.hpp
@@ -21,7 +21,6 @@
 #define NDN_GLOBAL_ROUTER_H
 
 #include "ns3/ndnSIM/model/ndn-common.hpp"
-#include "ns3/ndnSIM/model/ndn-face.hpp"
 
 #include "ns3/object.h"
 #include "ns3/ptr.h"
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index 8f77b72..a3263f4 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -29,26 +29,32 @@
 #include "ns3/pointer.h"
 #include "ns3/simulator.h"
 
-#include "ndn-face.hpp"
+#include "ndn-net-device-link-service.hpp"
 
-#include "ndn-net-device-face.hpp"
 #include "../helper/ndn-stack-helper.hpp"
 #include "cs/ndn-content-store.hpp"
 
 #include <boost/property_tree/info_parser.hpp>
 
 #include "ns3/ndnSIM/NFD/daemon/fw/forwarder.hpp"
-#include "ns3/ndnSIM/NFD/daemon/mgmt/internal-face.hpp"
+#include "ns3/ndnSIM/NFD/daemon/face/internal-face.hpp"
+#include "ns3/ndnSIM/NFD/daemon/face/internal-transport.hpp"
 #include "ns3/ndnSIM/NFD/daemon/mgmt/fib-manager.hpp"
 #include "ns3/ndnSIM/NFD/daemon/mgmt/face-manager.hpp"
 #include "ns3/ndnSIM/NFD/daemon/mgmt/strategy-choice-manager.hpp"
-#include "ns3/ndnSIM/NFD/daemon/mgmt/status-server.hpp"
+#include "ns3/ndnSIM/NFD/daemon/mgmt/forwarder-status-manager.hpp"
+// #include "ns3/ndnSIM/NFD/daemon/mgmt/general-config-section.hpp"
+#include "ns3/ndnSIM/NFD/daemon/mgmt/tables-config-section.hpp"
+#include "ns3/ndnSIM/NFD/daemon/mgmt/command-validator.hpp"
+
 #include "ns3/ndnSIM/NFD/rib/rib-manager.hpp"
 
 #include "ns3/ndnSIM/NFD/daemon/face/null-face.hpp"
+#include "ns3/ndnSIM/NFD/daemon/face/internal-face.hpp"
+
 #include "ns3/ndnSIM/NFD/core/config-file.hpp"
-#include "ns3/ndnSIM/NFD/daemon/mgmt/general-config-section.hpp"
-#include "ns3/ndnSIM/NFD/daemon/mgmt/tables-config-section.hpp"
+
+#include <ndn-cxx/mgmt/dispatcher.hpp>
 
 NS_LOG_COMPONENT_DEFINE("ndn.L3Protocol");
 
@@ -154,15 +160,21 @@
 
   friend class L3Protocol;
 
-  shared_ptr<nfd::Forwarder> m_forwarder;
+  std::shared_ptr<nfd::Forwarder> m_forwarder;
 
-  shared_ptr<nfd::InternalFace> m_internalFace;
-  shared_ptr<nfd::FibManager> m_fibManager;
-  shared_ptr<nfd::FaceManager> m_faceManager;
-  shared_ptr<nfd::StrategyChoiceManager> m_strategyChoiceManager;
-  shared_ptr<nfd::StatusServer> m_statusServer;
-  shared_ptr<nfd::rib::RibManager> m_ribManager;
-  shared_ptr< ::ndn::Face> m_face;
+  std::shared_ptr<nfd::Face> m_internalFace;
+  std::shared_ptr<::ndn::Face> m_internalClientFace;
+  std::unique_ptr<nfd::CommandValidator> m_validator;
+
+  std::shared_ptr<nfd::Face> m_internalRibFace;
+  std::shared_ptr<::ndn::Face> m_internalRibClientFace;
+
+  std::unique_ptr<::ndn::mgmt::Dispatcher> m_dispatcher;
+  std::shared_ptr<nfd::FibManager> m_fibManager;
+  std::shared_ptr<nfd::FaceManager> m_faceManager;
+  std::shared_ptr<nfd::StrategyChoiceManager> m_strategyChoiceManager;
+  std::shared_ptr<nfd::ForwarderStatusManager> m_forwarderStatusManager;
+  std::shared_ptr<nfd::rib::RibManager> m_ribManager;
 
   nfd::ConfigSection m_config;
 
@@ -187,12 +199,14 @@
 
   initializeManagement();
 
+  nfd::FaceTable& faceTable = m_impl->m_forwarder->getFaceTable();
+  faceTable.addReserved(nfd::face::makeNullFace(), nfd::face::FACEID_NULL);
+  faceTable.addReserved(nfd::face::makeNullFace(FaceUri("contentstore://")), nfd::face::FACEID_CONTENT_STORE);
+
   if (!this->getConfig().get<bool>("ndnSIM.disable_rib_manager", false)) {
     Simulator::ScheduleWithContext(m_node->GetId(), Seconds(0), &L3Protocol::initializeRibManager, this);
   }
 
-  m_impl->m_forwarder->getFaceTable().addReserved(make_shared<nfd::NullFace>(), nfd::FACEID_NULL);
-
   m_impl->m_forwarder->beforeSatisfyInterest.connect(std::ref(m_satisfiedInterests));
   m_impl->m_forwarder->beforeExpirePendingInterest.connect(std::ref(m_timedOutInterests));
 }
@@ -221,55 +235,58 @@
 void
 L3Protocol::initializeManagement()
 {
-  auto& keyChain = StackHelper::getKeyChain();
   auto& forwarder = m_impl->m_forwarder;
   using namespace nfd;
 
-  m_impl->m_internalFace = make_shared<InternalFace>();
+  std::tie(m_impl->m_internalFace, m_impl->m_internalClientFace) = face::makeInternalFace(StackHelper::getKeyChain());
+  forwarder->getFaceTable().addReserved(m_impl->m_internalFace, face::FACEID_INTERNAL_FACE);
+  m_impl->m_dispatcher.reset(new ::ndn::mgmt::Dispatcher(*m_impl->m_internalClientFace, StackHelper::getKeyChain()));
 
-  m_impl->m_fibManager = make_shared<FibManager>(std::ref(forwarder->getFib()),
-                                                 bind(&Forwarder::getFace, forwarder.get(), _1),
-                                                 m_impl->m_internalFace, keyChain);
+  m_impl->m_validator.reset(new CommandValidator());
 
-  if (!this->getConfig().get<bool>("ndnSIM.disable_face_manager", false)) {
-    m_impl->m_faceManager = make_shared<FaceManager>(std::ref(forwarder->getFaceTable()),
-                                                     m_impl->m_internalFace,
-                                                     keyChain);
-  }
-  else {
-    this->getConfig().get_child("authorizations").get_child("authorize").get_child("privileges").erase("faces");
-  }
+  m_impl->m_fibManager.reset(new FibManager(forwarder->getFib(),
+                                            bind(&Forwarder::getFace, forwarder.get(), _1),
+                                            *m_impl->m_dispatcher,
+                                            *m_impl->m_validator));
+
+  // Cannot be disabled for now
+  // if (!this->getConfig().get<bool>("ndnSIM.disable_face_manager", false)) {
+  m_impl->m_faceManager.reset(new FaceManager(forwarder->getFaceTable(),
+                                              *m_impl->m_dispatcher,
+                                              *m_impl->m_validator));
+  // }
+  // else {
+  //   this->getConfig().get_child("authorizations").get_child("authorize").get_child("privileges").erase("faces");
+  // }
 
   if (!this->getConfig().get<bool>("ndnSIM.disable_strategy_choice_manager", false)) {
-    m_impl->m_strategyChoiceManager =
-      make_shared<StrategyChoiceManager>(std::ref(forwarder->getStrategyChoice()),
-                                         m_impl->m_internalFace,
-                                         keyChain);
+    m_impl->m_strategyChoiceManager.reset(new StrategyChoiceManager(forwarder->getStrategyChoice(),
+                                                                    *m_impl->m_dispatcher,
+                                                                    *m_impl->m_validator));
   }
   else {
     this->getConfig().get_child("authorizations").get_child("authorize").get_child("privileges").erase("strategy-choice");
   }
 
-  if (!this->getConfig().get<bool>("ndnSIM.disable_status_server", false)) {
-    m_impl->m_statusServer = make_shared<StatusServer>(m_impl->m_internalFace,
-                                                       ref(*forwarder),
-                                                       keyChain);
+  if (!this->getConfig().get<bool>("ndnSIM.disable_forwarder_status_manager", false)) {
+    m_impl->m_forwarderStatusManager.reset(new ForwarderStatusManager(*forwarder, *m_impl->m_dispatcher));
   }
 
-  ConfigFile config((IgnoreSections({"general", "log", "rib", "ndnSIM"})));
+  ConfigFile config(&ConfigFile::ignoreUnknownSection);
 
   TablesConfigSection tablesConfig(forwarder->getCs(),
                                    forwarder->getPit(),
                                    forwarder->getFib(),
                                    forwarder->getStrategyChoice(),
-                                   forwarder->getMeasurements());
+                                   forwarder->getMeasurements(),
+                                   forwarder->getNetworkRegionTable());
   tablesConfig.setConfigFile(config);
 
-  m_impl->m_internalFace->getValidator().setConfigFile(config);
+  m_impl->m_validator->setConfigFile(config);
 
-  forwarder->getFaceTable().addReserved(m_impl->m_internalFace, FACEID_INTERNAL_FACE);
-
+  // if (!this->getConfig().get<bool>("ndnSIM.disable_face_manager", false)) {
   m_impl->m_faceManager->setConfigFile(config);
+  // }
 
   // apply config
   config.parse(m_impl->m_config, false, "ndnSIM.conf");
@@ -277,8 +294,10 @@
   tablesConfig.ensureTablesAreConfigured();
 
   // add FIB entry for NFD Management Protocol
-  shared_ptr<fib::Entry> entry = forwarder->getFib().insert("/localhost/nfd").first;
+  Name topPrefix("/localhost/nfd");
+  auto entry = forwarder->getFib().insert(topPrefix).first;
   entry->addNextHop(m_impl->m_internalFace, 0);
+  m_impl->m_dispatcher->addTopPrefix(topPrefix, false);
 }
 
 void
@@ -286,8 +305,9 @@
 {
   using namespace nfd;
 
-  m_impl->m_face = make_shared< ::ndn::Face>();
-  m_impl->m_ribManager = make_shared<rib::RibManager>(*(m_impl->m_face),
+  std::tie(m_impl->m_internalRibFace, m_impl->m_internalRibClientFace) = face::makeInternalFace(StackHelper::getKeyChain());
+  m_impl->m_forwarder->getFaceTable().add(m_impl->m_internalRibFace);
+  m_impl->m_ribManager = make_shared<rib::RibManager>(*(m_impl->m_internalRibClientFace),
                                                       StackHelper::getKeyChain());
 
   ConfigFile config([] (const std::string& filename, const std::string& sectionName,
@@ -298,7 +318,7 @@
         // do nothing
       }
       else {
-        // missing NRD section
+        // missing RIB section
         ConfigFile::throwErrorOnUnknownSection(filename, sectionName, section, isDryRun);
       }
     });
@@ -365,6 +385,11 @@
 {
   NS_LOG_FUNCTION(this);
 
+  // MUST HAPPEN BEFORE Simulator IS DESTROYED
+  m_impl.reset();
+
+  nfd::scheduler::getGlobalScheduler().cancelAllEvents();
+
   m_node = 0;
 
   Object::DoDispose();
@@ -377,26 +402,33 @@
 
   m_impl->m_forwarder->addFace(face);
 
-  // Connect Signals to TraceSource
-  face->onReceiveInterest.connect
-    ([this, face](const Interest& interest) { this->m_inInterests(interest, *face); });
+  std::weak_ptr<Face> weakFace = face;
 
-  face->onSendInterest.connect
-    ([this, face](const Interest& interest) { this->m_outInterests(interest, *face); });
+  // // Connect Signals to TraceSource
+  face->afterReceiveInterest.connect([this, weakFace](const Interest& interest) {
+      shared_ptr<Face> face = weakFace.lock();
+      if (face != nullptr) {
+        this->m_inInterests(interest, *face);
+      }
+    });
 
-  face->onReceiveData.connect([this, face](const Data& data) { this->m_inData(data, *face); });
+  face->afterReceiveData.connect([this, weakFace](const Data& data) {
+      shared_ptr<Face> face = weakFace.lock();
+      if (face != nullptr) {
+        this->m_inData(data, *face);
+      }
+    });
 
-  face->onSendData.connect([this, face](const Data& data) { this->m_outData(data, *face); });
+  // TODO: Discover why these signal were removed and fix it
+
+  // face->afterSendInterest.connect
+  //   ([this, weakFace](const Interest& interest) { this->m_outInterests(interest, *face); });
+
+  // face->afterSendData.connect([this, weakFace](const Data& data) { this->m_outData(data, *face); });
 
   return face->getId();
 }
 
-// void
-// L3Protocol::removeFace(shared_ptr<Face> face)
-// {
-//   NS_LOG_FUNCTION(this << std::cref(*face));
-// }
-
 shared_ptr<Face>
 L3Protocol::getFaceById(nfd::FaceId id) const
 {
@@ -407,11 +439,11 @@
 L3Protocol::getFaceByNetDevice(Ptr<NetDevice> netDevice) const
 {
   for (const auto& i : m_impl->m_forwarder->getFaceTable()) {
-    shared_ptr<NetDeviceFace> netDeviceFace = std::dynamic_pointer_cast<NetDeviceFace>(i);
-    if (netDeviceFace == nullptr)
+    auto linkService = dynamic_cast<NetDeviceLinkService*>(i->getLinkService());
+    if (linkService == nullptr)
       continue;
 
-    if (netDeviceFace->GetNetDevice() == netDevice)
+    if (linkService->GetNetDevice() == netDevice)
       return i;
   }
   return nullptr;
diff --git a/model/ndn-net-device-link-service.cpp b/model/ndn-net-device-link-service.cpp
index ecb262a..09a03a0 100644
--- a/model/ndn-net-device-link-service.cpp
+++ b/model/ndn-net-device-link-service.cpp
@@ -39,10 +39,6 @@
 namespace ns3 {
 namespace ndn {
 
-// TODO: remove as soon as L3Protocol is back
-const uint16_t L3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
-const uint16_t L3Protocol::IP_STACK_PORT = 9695;
-
 NetDeviceLinkService::NetDeviceLinkService(Ptr<Node> node, const Ptr<NetDevice>& netDevice)
   : m_node(node)
   , m_netDevice(netDevice)
diff --git a/ndn-cxx b/ndn-cxx
index a47ed4f..787be41 160000
--- a/ndn-cxx
+++ b/ndn-cxx
@@ -1 +1 @@
-Subproject commit a47ed4f3a0245ad0c44659905c8271e27af6124d
+Subproject commit 787be4185c1fd41bc6a5f418974b4c9ca9ae7f46
diff --git a/tests/unit-tests/model/ndn-l3-protocol.t.cpp b/tests/unit-tests/model/ndn-l3-protocol.t.cpp
index c594139..2863de1 100644
--- a/tests/unit-tests/model/ndn-l3-protocol.t.cpp
+++ b/tests/unit-tests/model/ndn-l3-protocol.t.cpp
@@ -55,7 +55,7 @@
       "/localhost/nfd/rib/list",
       "/localhost/nfd/faces/list",
       "/localhost/nfd/strategy-choice/list",
-      "/localhost/nfd/status"
+      "/localhost/nfd/status/general"
     };
 
     FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
@@ -105,19 +105,19 @@
                                 receivedDatasets.begin(), receivedDatasets.end());
 }
 
-BOOST_AUTO_TEST_CASE(DisabledFaceManager)
-{
-  // Disable Face manager
-  disableFaceManager();
+// BOOST_AUTO_TEST_CASE(DisabledFaceManager)
+// {
+//   // Disable Face manager
+//   disableFaceManager();
 
-  setupAndRun();
+//   setupAndRun();
 
-  BOOST_CHECK_EQUAL(requestedDatasets.size(), receivedDatasets.size() + 1);
+//   BOOST_CHECK_EQUAL(requestedDatasets.size(), receivedDatasets.size() + 1);
 
-  requestedDatasets.erase("/localhost/nfd/faces/list");
-  BOOST_CHECK_EQUAL_COLLECTIONS(requestedDatasets.begin(), requestedDatasets.end(),
-                                receivedDatasets.begin(), receivedDatasets.end());
-}
+//   requestedDatasets.erase("/localhost/nfd/faces/list");
+//   BOOST_CHECK_EQUAL_COLLECTIONS(requestedDatasets.begin(), requestedDatasets.end(),
+//                                 receivedDatasets.begin(), receivedDatasets.end());
+// }
 
 BOOST_AUTO_TEST_CASE(DisabledStrategyChoiceManager)
 {
@@ -142,7 +142,7 @@
 
   BOOST_CHECK_EQUAL(requestedDatasets.size(), receivedDatasets.size() + 1);
 
-  requestedDatasets.erase("/localhost/nfd/status");
+  requestedDatasets.erase("/localhost/nfd/status/general");
   BOOST_CHECK_EQUAL_COLLECTIONS(requestedDatasets.begin(), requestedDatasets.end(),
                                 receivedDatasets.begin(), receivedDatasets.end());
 }
diff --git a/wscript b/wscript
index 51ab7f4..734d0f5 100644
--- a/wscript
+++ b/wscript
@@ -139,11 +139,14 @@
     module.source = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in module_dirs],
                                       excl=[
                                           'apps/*',
-                                          'model/ndn-global-router.cpp',
                                           'model/ndn-app-face.cpp',
                                           'model/ndn-app-link-service.cpp',
-                                          'model/ndn-l3-protocol.cpp',
-                                          'helper/*',
+                                          'helper/ndn-app-helper.cpp',
+                                          'helper/ndn-fib-helper.cpp',
+                                          'helper/ndn-global-routing-helper.cpp',
+                                          'helper/ndn-link-control-helper.cpp',
+                                          'helper/ndn-scenario-helper.cpp',
+                                          'helper/ndn-strategy-choice-helper.cpp',
                                           'utils/topology/*',
                                           'utils/tracers/*',
                                           'model/ip-faces/*']) + ndnCxxSrc + nfdSrc