Upgrade underlying NFD/ndn-cxx to version 0.6.5
Change-Id: If83629472f737c017bbd9109fe814a5d5ecc44d4
diff --git a/.gitmodules b/.gitmodules
index fb3347b..e250871 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,8 +1,8 @@
[submodule "NFD"]
path = NFD
url = https://github.com/named-data-ndnSIM/NFD
- branch = NFD-0.6.1-ndnSIM
+ branch = NFD-0.6.5-ndnSIM
[submodule "ndn-cxx"]
path = ndn-cxx
url = https://github.com/named-data-ndnSIM/ndn-cxx
- branch = ndn-cxx-0.6.1-ndnSIM
+ branch = ndn-cxx-0.6.5-ndnSIM
diff --git a/NFD b/NFD
index 0a30676..49f22b0 160000
--- a/NFD
+++ b/NFD
@@ -1 +1 @@
-Subproject commit 0a30676920b9d3f2b2c8bc68e583befc415210cc
+Subproject commit 49f22b05e1a57b0a88d90cc0111f9a1d7a5cbd21
diff --git a/README.md b/README.md
index 883b7ae..b667af9 100644
--- a/README.md
+++ b/README.md
@@ -7,22 +7,22 @@
went through extensive refactoring and rewriting. The key new features of the new
version:
-- Packet format changed to [NDN Packet Specification](http://named-data.net/doc/ndn-tlv/)
+- [NDN Packet Specification](http://named-data.net/doc/NDN-packet-spec/current/)
- ndnSIM uses implementation of basic NDN primitives from
[ndn-cxx library (NDN C++ library with eXperimental eXtensions)](http://named-data.net/doc/ndn-cxx/)
- Based on version `0.6.0`
+ Based on version `0.6.5`
- All NDN forwarding and management is implemented directly using source code of
[Named Data Networking Forwarding Daemon (NFD)](http://named-data.net/doc/NFD/)
- Based on version `0.6.0`
+ Based on version `0.6.5`
- Allows [simulation of real applications](http://ndnsim.net/guide-to-simulate-real-apps.html)
written against ndn-cxx library
-- Requires a modified version of NS-3 based on version `ns-3.27-22-g90fb309d5`
+- Requires a modified version of NS-3 based on version `ns-3.29`
[ndnSIM documentation](http://ndnsim.net)
---------------------------------------------
diff --git a/apps/ndn-consumer.cpp b/apps/ndn-consumer.cpp
index a174fb3..c1dc44e 100644
--- a/apps/ndn-consumer.cpp
+++ b/apps/ndn-consumer.cpp
@@ -190,6 +190,7 @@
shared_ptr<Interest> interest = make_shared<Interest>();
interest->setNonce(m_rand->GetValue(0, std::numeric_limits<uint32_t>::max()));
interest->setName(*nameWithSequence);
+ interest->setCanBePrefix(false);
time::milliseconds interestLifeTime(m_interestLifeTime.GetMilliSeconds());
interest->setInterestLifetime(interestLifeTime);
diff --git a/bindings/modulegen__gcc_ILP32.py b/bindings/modulegen__gcc_ILP32.py
index 6d139d2..7e539ef 100644
--- a/bindings/modulegen__gcc_ILP32.py
+++ b/bindings/modulegen__gcc_ILP32.py
@@ -41,7 +41,6 @@
module.add_class('Interest')
module.add_class('Data')
module.add_class('Face', memory_policy=StdSharedPtr('ns3::ndn::Face'))
- module.add_class('FaceContainer', memory_policy=Ns3PtrMemoryPolicy('::ns3::ndn::FaceContainer'))
def reg_name(module):
module.add_class('Component')
@@ -52,6 +51,8 @@
module.add_class('Fib')
module.add_class('Pit')
module.add_class('Cs')
+ module.add_class('FaceTable')
+ module.add_class('Face')
def reg_fib(module):
module.add_class('Entry')#, memory_policy=StdSharedPtr('ns3::ndn::nfd::fib::Entry'))
@@ -76,10 +77,10 @@
def reg_stackhelper(cls):
cls.add_constructor([])
- cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('ns3::Ptr<ns3::Node>', 'node')], is_const=True)
- cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('std::string const&', 'nodeName')], is_const=True)
- cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('const ns3::NodeContainer&', 'c')], is_const=True)
- cls.add_method('InstallAll', 'ns3::Ptr<ns3::ndn::FaceContainer>', [], is_const=True)
+ cls.add_method('Install', retval('void'), [param('ns3::Ptr<ns3::Node>', 'node')], is_const=True)
+ cls.add_method('Install', retval('void'), [param('std::string const&', 'nodeName')], is_const=True)
+ cls.add_method('Install', retval('void'), [param('const ns3::NodeContainer&', 'c')], is_const=True)
+ cls.add_method('InstallAll', retval('void'), [], is_const=True)
cls.add_method('SetDefaultRoutes', retval('void'), [param('bool', 'isEnabled', default_value='true')], is_const=True)
cls.add_method('SetStackAttributes',
@@ -210,15 +211,23 @@
cls.add_method('getForwarder', 'std::shared_ptr<ns3::ndn::nfd::Forwarder>', [])
register_L3Protocol(root_module['ns3::ndn::L3Protocol'])
+ # shared_ptr<Face>
def reg_Face(cls):
cls.add_output_stream_operator()
cls.add_method('getId', retval('int64_t'), [], is_const=True)
reg_Face(root_module['ns3::ndn::Face'])
+ # without shared_ptr
+ def reg_nfdFace(cls):
+ cls.add_output_stream_operator()
+ cls.add_method('getId', retval('int64_t'), [], is_const=True)
+ reg_nfdFace(root_module['ns3::ndn::nfd::Face'])
+
def reg_NfdForwarder(cls):
cls.add_method('getFib', retval('const ns3::ndn::nfd::Fib&', caller_manages_return=False), [], is_const=True)
cls.add_method('getPit', retval('const ns3::ndn::nfd::Pit&', caller_manages_return=False), [], is_const=True)
cls.add_method('getCs', retval('const ns3::ndn::nfd::Cs&', caller_manages_return=False), [], is_const=True)
+ cls.add_method('getFaceTable', retval('const ns3::ndn::nfd::FaceTable&', caller_manages_return=False), [], is_const=True)
reg_NfdForwarder(root_module['ns3::ndn::nfd::Forwarder'])
#############
@@ -250,7 +259,7 @@
reg_Entry(root_module['ns3::ndn::nfd::fib::Entry'])
def reg_NextHop(cls):
- cls.add_constructor([param('const ns3::ndn::Face&', 'face')])
+ cls.add_constructor([param('const ns3::ndn::Face&', 'face'), param('uint64_t', 'endpointId')])
cls.add_function_as_method('getFaceFromFibNextHop', 'std::shared_ptr<ns3::ndn::Face>',
[param('const ns3::ndn::nfd::fib::NextHop&', 'obj')],
@@ -297,6 +306,16 @@
#### CS ####
#############
+ ###################
+ #### FaceTable ####
+ def reg_NfdFaceTable(root_module, cls):
+ cls.add_method('size', retval('size_t'), [], is_const=True)
+ cls.add_container_traits(retval('const ns3::ndn::nfd::Face&', caller_manages_return=False),
+ begin_method='begin', end_method='end', iterator_type='const_iterator')
+ reg_NfdFaceTable(root_module, root_module['ns3::ndn::nfd::FaceTable'])
+ #### FaceTable ####
+ ###################
+
def reg_other_modules(root_module):
def reg_ApplicationContainer(cls):
cls.add_constructor([])
diff --git a/bindings/modulegen__gcc_LP64.py b/bindings/modulegen__gcc_LP64.py
index 6d139d2..7e539ef 100644
--- a/bindings/modulegen__gcc_LP64.py
+++ b/bindings/modulegen__gcc_LP64.py
@@ -41,7 +41,6 @@
module.add_class('Interest')
module.add_class('Data')
module.add_class('Face', memory_policy=StdSharedPtr('ns3::ndn::Face'))
- module.add_class('FaceContainer', memory_policy=Ns3PtrMemoryPolicy('::ns3::ndn::FaceContainer'))
def reg_name(module):
module.add_class('Component')
@@ -52,6 +51,8 @@
module.add_class('Fib')
module.add_class('Pit')
module.add_class('Cs')
+ module.add_class('FaceTable')
+ module.add_class('Face')
def reg_fib(module):
module.add_class('Entry')#, memory_policy=StdSharedPtr('ns3::ndn::nfd::fib::Entry'))
@@ -76,10 +77,10 @@
def reg_stackhelper(cls):
cls.add_constructor([])
- cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('ns3::Ptr<ns3::Node>', 'node')], is_const=True)
- cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('std::string const&', 'nodeName')], is_const=True)
- cls.add_method('Install', 'ns3::Ptr<ns3::ndn::FaceContainer>', [param('const ns3::NodeContainer&', 'c')], is_const=True)
- cls.add_method('InstallAll', 'ns3::Ptr<ns3::ndn::FaceContainer>', [], is_const=True)
+ cls.add_method('Install', retval('void'), [param('ns3::Ptr<ns3::Node>', 'node')], is_const=True)
+ cls.add_method('Install', retval('void'), [param('std::string const&', 'nodeName')], is_const=True)
+ cls.add_method('Install', retval('void'), [param('const ns3::NodeContainer&', 'c')], is_const=True)
+ cls.add_method('InstallAll', retval('void'), [], is_const=True)
cls.add_method('SetDefaultRoutes', retval('void'), [param('bool', 'isEnabled', default_value='true')], is_const=True)
cls.add_method('SetStackAttributes',
@@ -210,15 +211,23 @@
cls.add_method('getForwarder', 'std::shared_ptr<ns3::ndn::nfd::Forwarder>', [])
register_L3Protocol(root_module['ns3::ndn::L3Protocol'])
+ # shared_ptr<Face>
def reg_Face(cls):
cls.add_output_stream_operator()
cls.add_method('getId', retval('int64_t'), [], is_const=True)
reg_Face(root_module['ns3::ndn::Face'])
+ # without shared_ptr
+ def reg_nfdFace(cls):
+ cls.add_output_stream_operator()
+ cls.add_method('getId', retval('int64_t'), [], is_const=True)
+ reg_nfdFace(root_module['ns3::ndn::nfd::Face'])
+
def reg_NfdForwarder(cls):
cls.add_method('getFib', retval('const ns3::ndn::nfd::Fib&', caller_manages_return=False), [], is_const=True)
cls.add_method('getPit', retval('const ns3::ndn::nfd::Pit&', caller_manages_return=False), [], is_const=True)
cls.add_method('getCs', retval('const ns3::ndn::nfd::Cs&', caller_manages_return=False), [], is_const=True)
+ cls.add_method('getFaceTable', retval('const ns3::ndn::nfd::FaceTable&', caller_manages_return=False), [], is_const=True)
reg_NfdForwarder(root_module['ns3::ndn::nfd::Forwarder'])
#############
@@ -250,7 +259,7 @@
reg_Entry(root_module['ns3::ndn::nfd::fib::Entry'])
def reg_NextHop(cls):
- cls.add_constructor([param('const ns3::ndn::Face&', 'face')])
+ cls.add_constructor([param('const ns3::ndn::Face&', 'face'), param('uint64_t', 'endpointId')])
cls.add_function_as_method('getFaceFromFibNextHop', 'std::shared_ptr<ns3::ndn::Face>',
[param('const ns3::ndn::nfd::fib::NextHop&', 'obj')],
@@ -297,6 +306,16 @@
#### CS ####
#############
+ ###################
+ #### FaceTable ####
+ def reg_NfdFaceTable(root_module, cls):
+ cls.add_method('size', retval('size_t'), [], is_const=True)
+ cls.add_container_traits(retval('const ns3::ndn::nfd::Face&', caller_manages_return=False),
+ begin_method='begin', end_method='end', iterator_type='const_iterator')
+ reg_NfdFaceTable(root_module, root_module['ns3::ndn::nfd::FaceTable'])
+ #### FaceTable ####
+ ###################
+
def reg_other_modules(root_module):
def reg_ApplicationContainer(cls):
cls.add_constructor([])
diff --git a/examples/ndn-simple.py b/examples/ndn-simple.py
index 7aeebce..447fd9c 100644
--- a/examples/ndn-simple.py
+++ b/examples/ndn-simple.py
@@ -47,7 +47,7 @@
# Set default parameters for PointToPoint links and channels
Config.SetDefault("ns3::PointToPointNetDevice::DataRate", StringValue("10Mbps"))
Config.SetDefault("ns3::PointToPointChannel::Delay", StringValue("10ms"))
-Config::SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"))
+Config.SetDefault("ns3::QueueBase::MaxSize", StringValue("20p"))
# Read optional command-line parameters (e.g., enable visualizer with ./waf --pyrun=<> --visualize
import sys; cmd = CommandLine(); cmd.Parse(sys.argv);
diff --git a/helper/ndn-app-helper.cpp b/helper/ndn-app-helper.cpp
index 2556659..0fe7f5c 100644
--- a/helper/ndn-app-helper.cpp
+++ b/helper/ndn-app-helper.cpp
@@ -84,15 +84,20 @@
Ptr<Application>
AppHelper::InstallPriv(Ptr<Node> node)
{
+ Ptr<Application> app;
+ Simulator::ScheduleWithContext(node->GetId(), Seconds(0), MakeEvent([=, &app] {
#ifdef NS3_MPI
- if (MpiInterface::IsEnabled() && node->GetSystemId() != MpiInterface::GetSystemId()) {
- // don't create an app if MPI is enabled and node is not in the correct partition
- return 0;
- }
+ if (MpiInterface::IsEnabled() && node->GetSystemId() != MpiInterface::GetSystemId()) {
+ // don't create an app if MPI is enabled and node is not in the correct partition
+ return 0;
+ }
#endif
- Ptr<Application> app = m_factory.Create<Application>();
- node->AddApplication(app);
+ app = m_factory.Create<Application>();
+ node->AddApplication(app);
+ }));
+ Simulator::Stop(Seconds(0));
+ Simulator::Run();
return app;
}
diff --git a/helper/ndn-face-container.cpp b/helper/ndn-face-container.cpp
deleted file mode 100644
index 5e9c6e3..0000000
--- a/helper/ndn-face-container.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2011-2015 Regents of the University of California.
- *
- * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
- * contributors.
- *
- * ndnSIM 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.
- *
- * ndnSIM 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
- * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "ndn-face-container.hpp"
-
-#include <algorithm>
-
-namespace ns3 {
-namespace ndn {
-
-FaceContainer::FaceContainer() = default;
-
-FaceContainer::FaceContainer(const FaceContainer& other)
-{
- AddAll(other);
-}
-
-FaceContainer&
-FaceContainer::operator= (const FaceContainer &other)
-{
- m_faces.clear();
- AddAll(other);
-
- return *this;
-}
-
-void
-FaceContainer::AddAll(Ptr<FaceContainer> other)
-{
- AddAll(*other);
-}
-
-void
-FaceContainer::AddAll(const FaceContainer& other)
-{
- if (this == &other) { // adding self to self, need to make a copy
- auto copyOfFaces = other.m_faces;
- m_faces.insert(m_faces.end(), copyOfFaces.begin(), copyOfFaces.end());
- }
- else {
- m_faces.insert(m_faces.end(), other.m_faces.begin(), other.m_faces.end());
- }
-}
-
-FaceContainer::Iterator
-FaceContainer::Begin(void) const
-{
- return m_faces.begin();
-}
-
-FaceContainer::Iterator
-FaceContainer::End(void) const
-{
- return m_faces.end();
-}
-
-uint32_t
-FaceContainer::GetN(void) const
-{
- return m_faces.size();
-}
-
-void
-FaceContainer::Add(shared_ptr<Face> face)
-{
- m_faces.push_back(face);
-}
-
-shared_ptr<Face>
-FaceContainer::Get(size_t i) const
-{
- return m_faces.at(i);
-}
-
-} // namespace ndn
-} // namespace ns3
diff --git a/helper/ndn-face-container.hpp b/helper/ndn-face-container.hpp
deleted file mode 100644
index 545ff4d..0000000
--- a/helper/ndn-face-container.hpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2011-2015 Regents of the University of California.
- *
- * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
- * contributors.
- *
- * ndnSIM 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.
- *
- * ndnSIM 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
- * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#ifndef NDN_FACE_CONTAINER_H
-#define NDN_FACE_CONTAINER_H
-
-#include "ns3/ndnSIM/model/ndn-common.hpp"
-
-#include <stdint.h>
-#include <vector>
-
-#include "ns3/ptr.h"
-#include "ns3/simple-ref-count.h"
-
-namespace ns3 {
-namespace ndn {
-
-/**
- * @ingroup ndn-helpers
- * @brief A pool for Ndn faces
- *
- * Provides tools to perform basic manipulation on faces, such as setting metrics and
- * states on faces
- *
- * @see ndn::StackHelper
- */
-class FaceContainer : public SimpleRefCount<FaceContainer> {
-private:
- typedef std::vector<shared_ptr<Face>> Container;
-
-public:
- typedef Container::const_iterator Iterator; ///< @brief Iterator over FaceContainer
-
- /**
- * @brief Create an empty FaceContainer.
- */
- FaceContainer();
-
- /**
- * @brief Copy constructor for FaceContainer. Calls AddAll method
- *
- * @see FaceContainer::AddAll
- */
- FaceContainer(const FaceContainer& other);
-
- /**
- * @brief Copy operator for FaceContainer. Empties vector and calls AddAll method
- *
- * All previously obtained iterators (Begin() and End()) will be invalidated
- *
- * @see FaceContainer::AddAll
- */
- FaceContainer&
- operator=(const FaceContainer& other);
-
- /**
- * Add an entry to the container
- *
- * @param face a smart pointer to a Face-derived object
- */
- void
- Add(shared_ptr<Face> face);
-
- /**
- * @brief Add all entries from other container
- *
- * @param other smart pointer to a container
- */
- void
- AddAll(Ptr<FaceContainer> other);
-
- /**
- * @brief Add all entries from other container
- *
- * @param other container
- */
- void
- AddAll(const FaceContainer& other);
-
-public: // accessors
- /**
- * @brief Get an iterator which refers to the first pair in the
- * container.
- *
- * @returns an iterator which refers to the first pair in the container.
- */
- Iterator
- Begin() const;
-
- /**
- * @brief Get an iterator which indicates past-the-last Node in the
- * container.
- *
- * @returns an iterator which indicates an ending condition for a loop.
- */
- Iterator
- End() const;
-
- /**
- * @brief Get the number of faces stored in this container
- *
- * @returns the number of faces stored in this container
- */
- uint32_t
- GetN() const;
-
- /**
- * Get a Face stored in the container
- *
- * @param pos index of the Face in the container
- * @throw std::out_of_range if !(pos < GetN()).
- */
- shared_ptr<Face>
- Get(size_t pos) const;
-
-private:
- Container m_faces;
-};
-
-} // namespace ndn
-} // namespace ns3
-
-#endif /* NDN_FACE_CONTAINER_H */
diff --git a/helper/ndn-fib-helper.cpp b/helper/ndn-fib-helper.cpp
index a74ddb2..921c20f 100644
--- a/helper/ndn-fib-helper.cpp
+++ b/helper/ndn-fib-helper.cpp
@@ -50,7 +50,6 @@
void
FibHelper::AddNextHop(const ControlParameters& parameters, Ptr<Node> node)
{
- NS_LOG_DEBUG("Add Next Hop command was initialized");
Block encodedParameters(parameters.wireEncode());
Name commandName("/localhost/nfd/fib");
@@ -58,6 +57,7 @@
commandName.append(encodedParameters);
shared_ptr<Interest> command(make_shared<Interest>(commandName));
+ command->setCanBePrefix(false);
StackHelper::getKeyChain().sign(*command);
Ptr<L3Protocol> l3protocol = node->GetObject<L3Protocol>();
@@ -67,7 +67,6 @@
void
FibHelper::RemoveNextHop(const ControlParameters& parameters, Ptr<Node> node)
{
- NS_LOG_DEBUG("Remove Next Hop command was initialized");
Block encodedParameters(parameters.wireEncode());
Name commandName("/localhost/nfd/fib");
@@ -75,6 +74,7 @@
commandName.append(encodedParameters);
shared_ptr<Interest> command(make_shared<Interest>(commandName));
+ command->setCanBePrefix(false);
StackHelper::getKeyChain().sign(*command);
Ptr<L3Protocol> l3protocol = node->GetObject<L3Protocol>();
@@ -87,11 +87,6 @@
NS_LOG_LOGIC("[" << node->GetId() << "]$ route add " << prefix << " via " << face->getLocalUri()
<< " metric " << metric);
- // Get L3Protocol object
- Ptr<L3Protocol> L3protocol = node->GetObject<L3Protocol>();
- // Get the forwarder instance
- shared_ptr<nfd::Forwarder> m_forwarder = L3protocol->getForwarder();
-
ControlParameters parameters;
parameters.setName(prefix);
parameters.setFaceId(face->getId());
@@ -177,6 +172,8 @@
void
FibHelper::RemoveRoute(Ptr<Node> node, const Name& prefix, shared_ptr<Face> face)
{
+ NS_LOG_LOGIC("[" << node->GetId() << "]$ route del " << prefix << " via " << face->getLocalUri());
+
// Get L3Protocol object
Ptr<L3Protocol> L3protocol = node->GetObject<L3Protocol>();
// Get the forwarder instance
diff --git a/helper/ndn-scenario-helper.cpp b/helper/ndn-scenario-helper.cpp
index af74386..a36a7c7 100644
--- a/helper/ndn-scenario-helper.cpp
+++ b/helper/ndn-scenario-helper.cpp
@@ -65,18 +65,6 @@
}
void
-ScenarioHelper::disableRibManager()
-{
- ndnHelper.disableRibManager();
-}
-
-// void
-// ScenarioHelper::disableFaceManager()
-// {
-// ndnHelper.disableFaceManager();
-// }
-
-void
ScenarioHelper::disableStrategyChoiceManager()
{
ndnHelper.disableStrategyChoiceManager();
diff --git a/helper/ndn-scenario-helper.hpp b/helper/ndn-scenario-helper.hpp
index 292bc85..6a318ac 100644
--- a/helper/ndn-scenario-helper.hpp
+++ b/helper/ndn-scenario-helper.hpp
@@ -166,19 +166,6 @@
getNetDevice(const std::string& node1, const std::string& node2);
/**
- * \brief Disable RIB Manager
- */
- void
- disableRibManager();
-
- // Cannot be disabled for now
- // /**
- // * \brief Disable Face Manager
- // */
- // void
- // disableFaceManager();
-
- /**
* \brief Disable Strategy Choice Manager
*/
void
diff --git a/helper/ndn-stack-helper.cpp b/helper/ndn-stack-helper.cpp
index 8391843..d2b8abb 100644
--- a/helper/ndn-stack-helper.cpp
+++ b/helper/ndn-stack-helper.cpp
@@ -25,6 +25,7 @@
#include "ns3/point-to-point-net-device.h"
#include "ns3/point-to-point-channel.h"
#include "ns3/node-list.h"
+#include "ns3/simulator.h"
#include "model/ndn-l3-protocol.hpp"
#include "model/ndn-net-device-transport.hpp"
@@ -46,9 +47,7 @@
namespace ndn {
StackHelper::StackHelper()
- : m_isRibManagerDisabled(false)
- // , m_isFaceManagerDisabled(false)
- , m_isForwarderStatusManagerDisabled(false)
+ : m_isForwarderStatusManagerDisabled(false)
, m_isStrategyChoiceManagerDisabled(false)
, m_needSetDefaultRoutes(false)
, m_maxCsSize(100)
@@ -152,43 +151,39 @@
}
}
-Ptr<FaceContainer>
+void
StackHelper::Install(const NodeContainer& c) const
{
- Ptr<FaceContainer> faces = Create<FaceContainer>();
for (NodeContainer::Iterator i = c.Begin(); i != c.End(); ++i) {
- faces->AddAll(Install(*i));
+ Install(*i);
}
- return faces;
}
-Ptr<FaceContainer>
+void
StackHelper::InstallAll() const
{
- return Install(NodeContainer::GetGlobal());
+ Install(NodeContainer::GetGlobal());
}
-Ptr<FaceContainer>
+void
StackHelper::Install(Ptr<Node> node) const
{
- Ptr<FaceContainer> faces = Create<FaceContainer>();
-
if (node->GetObject<L3Protocol>() != 0) {
NS_FATAL_ERROR("Cannot re-install NDN stack on node "
<< node->GetId());
- return 0;
+ return;
}
+ Simulator::ScheduleWithContext(node->GetId(), Seconds(0), &StackHelper::doInstall, this, node);
+ Simulator::Stop(Seconds(0));
+ Simulator::Run(); // to automatically dispatch events on proper nodes
+}
+void
+StackHelper::doInstall(Ptr<Node> node) const
+{
+ // async install to ensure proper context
Ptr<L3Protocol> ndn = m_ndnFactory.Create<L3Protocol>();
- if (m_isRibManagerDisabled) {
- ndn->getConfig().put("ndnSIM.disable_rib_manager", true);
- }
-
- // if (m_isFaceManagerDisabled) {
- // ndn->getConfig().put("ndnSIM.disable_face_manager", true);
- // }
-
if (m_isForwarderStatusManagerDisabled) {
ndn->getConfig().put("ndnSIM.disable_forwarder_status_manager", true);
}
@@ -218,10 +213,8 @@
// if (DynamicCast<LoopbackNetDevice> (device) != 0)
// continue; // don't create face for a LoopbackNetDevice
- faces->Add(this->createAndRegisterFace(node, ndn, device));
+ this->createAndRegisterFace(node, ndn, device);
}
-
- return faces;
}
void
@@ -332,11 +325,11 @@
return face;
}
-Ptr<FaceContainer>
+void
StackHelper::Install(const std::string& nodeName) const
{
Ptr<Node> node = Names::Find<Node>(nodeName);
- return Install(node);
+ Install(node);
}
void
@@ -400,24 +393,14 @@
if (m_needSetDefaultRoutes) {
// default route with lowest priority possible
- FibHelper::AddRoute(node, "/", face, std::numeric_limits<int32_t>::max());
+ Simulator::ScheduleWithContext(node->GetId(), Seconds(0), MakeEvent([=] {
+ FibHelper::AddRoute(node, "/", face, std::numeric_limits<int32_t>::max());
+ }));
}
return face;
}
void
-StackHelper::disableRibManager()
-{
- m_isRibManagerDisabled = true;
-}
-
-// void
-// StackHelper::disableFaceManager()
-// {
-// m_isFaceManagerDisabled = true;
-// }
-
-void
StackHelper::disableStrategyChoiceManager()
{
m_isStrategyChoiceManagerDisabled = true;
diff --git a/helper/ndn-stack-helper.hpp b/helper/ndn-stack-helper.hpp
index 2d2b8fb..18ce308 100644
--- a/helper/ndn-stack-helper.hpp
+++ b/helper/ndn-stack-helper.hpp
@@ -27,7 +27,6 @@
#include "ns3/node.h"
#include "ns3/node-container.h"
-#include "ndn-face-container.hpp"
#include "ndn-fib-helper.hpp"
#include "ndn-strategy-choice-helper.hpp"
@@ -143,7 +142,7 @@
* \returns list of installed faces in the form of a smart pointer
* to NdnFaceContainer object
*/
- Ptr<FaceContainer>
+ void
Install(const std::string& nodeName) const;
/**
@@ -157,7 +156,7 @@
* \returns list of installed faces in the form of a smart pointer
* to FaceContainer object
*/
- Ptr<FaceContainer>
+ void
Install(Ptr<Node> node) const;
/**
@@ -172,7 +171,7 @@
* \returns list of installed faces in the form of a smart pointer
* to FaceContainer object
*/
- Ptr<FaceContainer>
+ void
Install(const NodeContainer& c) const;
/**
@@ -181,7 +180,7 @@
* \returns list of installed faces in the form of a smart pointer
* to FaceContainer object
*/
- Ptr<FaceContainer>
+ void
InstallAll() const;
/**
@@ -224,19 +223,6 @@
UpdateAll();
/**
- *\brief Disable the RIB manager of NFD
- */
- void
- disableRibManager();
-
- // Cannot be disabled for now
- // /**
- // * \brief Disable Face Manager
- // */
- // void
- // disableFaceManager();
-
- /**
* \brief Disable Strategy Choice Manager
*/
void
@@ -255,6 +241,10 @@
SetLinkDelayAsFaceMetric();
private:
+ void
+ doInstall(Ptr<Node> node) const;
+
+private:
shared_ptr<Face>
DefaultNetDeviceCallback(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> netDevice) const;
@@ -264,8 +254,6 @@
shared_ptr<Face>
createAndRegisterFace(Ptr<Node> node, Ptr<L3Protocol> ndn, Ptr<NetDevice> device) const;
- bool m_isRibManagerDisabled;
- // bool m_isFaceManagerDisabled;
bool m_isForwarderStatusManagerDisabled;
bool m_isStrategyChoiceManagerDisabled;
diff --git a/helper/ndn-strategy-choice-helper.cpp b/helper/ndn-strategy-choice-helper.cpp
index 6958fce..215d34b 100644
--- a/helper/ndn-strategy-choice-helper.cpp
+++ b/helper/ndn-strategy-choice-helper.cpp
@@ -39,6 +39,7 @@
commandName.append(encodedParameters);
shared_ptr<Interest> command(make_shared<Interest>(commandName));
+ command->setCanBePrefix(false);
StackHelper::getKeyChain().sign(*command);
Ptr<L3Protocol> l3protocol = node->GetObject<L3Protocol>();
@@ -60,7 +61,11 @@
parameters.setName(namePrefix);
NS_LOG_DEBUG("Node ID: " << node->GetId() << " with forwarding strategy " << strategy);
parameters.setStrategy(strategy);
- sendCommand(parameters, node);
+
+ Simulator::ScheduleWithContext(node->GetId(), Seconds(0),
+ &StrategyChoiceHelper::sendCommand, parameters, node);
+ Simulator::Stop(Seconds(0));
+ Simulator::Run();
}
void
diff --git a/model/ndn-l3-protocol.cpp b/model/ndn-l3-protocol.cpp
index efb14f3..c5db46c 100644
--- a/model/ndn-l3-protocol.cpp
+++ b/model/ndn-l3-protocol.cpp
@@ -42,12 +42,13 @@
#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/cs-manager.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-authenticator.hpp"
-#include "ns3/ndnSIM/NFD/rib/rib-manager.hpp"
+#include "ns3/ndnSIM/NFD/rib/service.hpp"
#include "ns3/ndnSIM/NFD/daemon/face/null-face.hpp"
#include "ns3/ndnSIM/NFD/daemon/face/internal-face.hpp"
@@ -167,24 +168,27 @@
friend class L3Protocol;
- std::shared_ptr<nfd::Forwarder> m_forwarder;
+ // note that shared_ptr needed for Python bindings
- std::shared_ptr<nfd::Face> m_internalFace;
+ std::shared_ptr<::nfd::Forwarder> m_forwarder;
+ std::unique_ptr<::nfd::face::FaceSystem> m_faceSystem;
+
+ std::shared_ptr<::nfd::face::Face> m_internalFace;
std::shared_ptr<::ndn::Face> m_internalClientFace;
- std::shared_ptr<nfd::CommandAuthenticator> m_authenticator;
-
- std::shared_ptr<nfd::Face> m_internalRibFace;
- std::shared_ptr<::ndn::Face> m_internalRibClientFace;
-
std::unique_ptr<::ndn::mgmt::Dispatcher> m_dispatcher;
- std::unique_ptr<::ndn::mgmt::Dispatcher> m_dispatcherRib;
- 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;
+ std::shared_ptr<::nfd::CommandAuthenticator> m_authenticator;
+ std::unique_ptr<::nfd::ForwarderStatusManager> m_forwarderStatusManager;
+ std::unique_ptr<::nfd::FaceManager> m_faceManager;
+ std::shared_ptr<::nfd::FibManager> m_fibManager;
+ std::unique_ptr<::nfd::CsManager> m_csManager;
+ std::unique_ptr<::nfd::StrategyChoiceManager> m_strategyChoiceManager;
- std::shared_ptr<nfd::face::FaceSystem> m_faceSystem;
+ std::shared_ptr<::nfd::face::Face> m_internalFaceForInjects;
+ std::shared_ptr<::ndn::Face> m_internalClientFaceForInjects;
+
+ std::shared_ptr<::nfd::Face> m_internalRibFace;
+ std::shared_ptr<::ndn::Face> m_internalRibClientFace;
+ std::unique_ptr<::nfd::rib::Service> m_ribService;
nfd::ConfigSection m_config;
@@ -206,16 +210,15 @@
void
L3Protocol::initialize()
{
- m_impl->m_forwarder = make_shared<nfd::Forwarder>();
+ m_impl->m_forwarder = make_shared<::nfd::Forwarder>();
+
+ ::nfd::FaceTable& faceTable = m_impl->m_forwarder->getFaceTable();
+ faceTable.addReserved(::nfd::face::makeNullFace(), ::nfd::face::FACEID_NULL);
+ // faceTable.addReserved(face::makeNullFace(FaceUri("contentstore://")), face::FACEID_CONTENT_STORE);
+ m_impl->m_faceSystem = make_unique<::nfd::face::FaceSystem>(faceTable, nullptr);
initializeManagement();
-
- nfd::FaceTable& faceTable = m_impl->m_forwarder->getFaceTable();
- faceTable.addReserved(nfd::face::makeNullFace(), nfd::face::FACEID_NULL);
-
- if (!this->getConfig().get<bool>("ndnSIM.disable_rib_manager", false)) {
- Simulator::ScheduleWithContext(m_node->GetId(), Seconds(0), &L3Protocol::initializeRibManager, this);
- }
+ initializeRibManager();
m_impl->m_forwarder->beforeSatisfyInterest.connect(std::ref(m_satisfiedInterests));
m_impl->m_forwarder->beforeExpirePendingInterest.connect(std::ref(m_timedOutInterests));
@@ -245,7 +248,7 @@
void
L3Protocol::injectInterest(const Interest& interest)
{
- m_impl->m_internalFace->sendInterest(interest);
+ m_impl->m_internalClientFaceForInjects->expressInterest(interest, nullptr, nullptr, nullptr);
}
void
@@ -260,43 +263,32 @@
auto& forwarder = m_impl->m_forwarder;
using namespace nfd;
- m_impl->m_faceSystem = make_shared<nfd::face::FaceSystem>(forwarder->getFaceTable(), nullptr);
-
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_authenticator = CommandAuthenticator::create();
+ std::tie(m_impl->m_internalFaceForInjects, m_impl->m_internalClientFaceForInjects) = face::makeInternalFace(StackHelper::getKeyChain());
+ forwarder->getFaceTable().addReserved(m_impl->m_internalFaceForInjects, face::FACEID_INTERNAL_FACE + 1);
- m_impl->m_fibManager.reset(new FibManager(forwarder->getFib(),
- forwarder->getFaceTable(),
- *m_impl->m_dispatcher,
- *m_impl->m_authenticator));
+ m_impl->m_dispatcher = make_unique<::ndn::mgmt::Dispatcher>(*m_impl->m_internalClientFace, StackHelper::getKeyChain());
+ m_impl->m_authenticator = ::nfd::CommandAuthenticator::create();
- // Cannot be disabled for now
- // if (!this->getConfig().get<bool>("ndnSIM.disable_face_manager", false))
-
- m_impl->m_faceManager.reset(new FaceManager(*m_impl->m_faceSystem,
- *m_impl->m_dispatcher,
- *m_impl->m_authenticator));
- // }
- // else {
- // this->getConfig().get_child("authorizations").get_child("authorize").get_child("privileges").erase("faces");
- // }
-
+ if (!this->getConfig().get<bool>("ndnSIM.disable_forwarder_status_manager", false)) {
+ m_impl->m_forwarderStatusManager = make_unique<::nfd::ForwarderStatusManager>(*m_impl->m_forwarder, *m_impl->m_dispatcher);
+ }
+ m_impl->m_faceManager = make_unique<::nfd::FaceManager>(*m_impl->m_faceSystem, *m_impl->m_dispatcher, *m_impl->m_authenticator);
+ m_impl->m_fibManager = make_shared<::nfd::FibManager>(m_impl->m_forwarder->getFib(), m_impl->m_forwarder->getFaceTable(),
+ *m_impl->m_dispatcher, *m_impl->m_authenticator);
+ m_impl->m_csManager = make_unique<::nfd::CsManager>(m_impl->m_forwarder->getCs(), m_impl->m_forwarder->getCounters(),
+ *m_impl->m_dispatcher, *m_impl->m_authenticator);
if (!this->getConfig().get<bool>("ndnSIM.disable_strategy_choice_manager", false)) {
- m_impl->m_strategyChoiceManager.reset(new StrategyChoiceManager(forwarder->getStrategyChoice(),
- *m_impl->m_dispatcher,
- *m_impl->m_authenticator));
+ m_impl->m_strategyChoiceManager = make_unique<::nfd::StrategyChoiceManager>(m_impl->m_forwarder->getStrategyChoice(),
+ *m_impl->m_dispatcher, *m_impl->m_authenticator);
+
}
else {
this->getConfig().get_child("authorizations").get_child("authorize").get_child("privileges").erase("strategy-choice");
}
- 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(&ConfigFile::ignoreUnknownSection);
// if we use NFD's CS, we have to specify a replacement policy
@@ -321,8 +313,7 @@
// add FIB entry for NFD Management Protocol
Name topPrefix("/localhost/nfd");
- auto entry = forwarder->getFib().insert(topPrefix).first;
- entry->addNextHop(*(m_impl->m_internalFace), 0);
+ m_impl->m_forwarder->getFib().insert(topPrefix).first->addOrUpdateNextHop(*m_impl->m_internalFace, 0, 0);
m_impl->m_dispatcher->addTopPrefix(topPrefix, false);
}
@@ -334,30 +325,9 @@
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_dispatcherRib.reset(new ::ndn::mgmt::Dispatcher(*m_impl->m_internalRibClientFace, StackHelper::getKeyChain()));
-
- m_impl->m_ribManager = make_shared<rib::RibManager>(*(m_impl->m_dispatcherRib), *(m_impl->m_internalRibClientFace),
- StackHelper::getKeyChain());
-
- ConfigFile config([] (const std::string& filename, const std::string& sectionName,
- const ConfigSection& section, bool isDryRun) {
- // Ignore "log" and sections belonging to NFD,
- // but raise an error if we're missing a handler for a "rib" section.
- if (sectionName != "rib" || sectionName == "log") {
- // do nothing
- }
- else {
- // missing RIB section
- ConfigFile::throwErrorOnUnknownSection(filename, sectionName, section, isDryRun);
- }
- });
-
- m_impl->m_ribManager->setConfigFile(config);
-
- // apply config
- config.parse(m_impl->m_config, false, "ndnSIM.conf");
-
- m_impl->m_ribManager->registerWithNfd();
+ m_impl->m_ribService = make_unique<rib::Service>(m_impl->m_config,
+ std::ref(*m_impl->m_internalRibClientFace),
+ std::ref(StackHelper::getKeyChain()));
}
shared_ptr<nfd::Forwarder>
@@ -372,10 +342,16 @@
return m_impl->m_fibManager;
}
-shared_ptr<nfd::StrategyChoiceManager>
+nfd::StrategyChoiceManager&
L3Protocol::getStrategyChoiceManager()
{
- return m_impl->m_strategyChoiceManager;
+ return *m_impl->m_strategyChoiceManager;
+}
+
+::nfd::rib::Service&
+L3Protocol::getRibService()
+{
+ return *m_impl->m_ribService;
}
nfd::ConfigSection&
@@ -415,7 +391,7 @@
// MUST HAPPEN BEFORE Simulator IS DESTROYED
m_impl.reset();
- nfd::scheduler::getGlobalScheduler().cancelAllEvents();
+ nfd::scheduler::resetGlobalScheduler();
m_node = 0;
diff --git a/model/ndn-l3-protocol.hpp b/model/ndn-l3-protocol.hpp
index c3619aa..e5169af 100644
--- a/model/ndn-l3-protocol.hpp
+++ b/model/ndn-l3-protocol.hpp
@@ -43,6 +43,9 @@
namespace cs {
class Policy;
} // namespace cs
+namespace rib {
+class Service;
+}
} // namespace nfd
namespace ns3 {
@@ -108,11 +111,14 @@
getFibManager();
/**
- * \brief Get smart pointer to nfd::StrategyChoiceManager, used by node's NFD
+ * \brief Get nfd::StrategyChoiceManager, used by node's NFD
*/
- shared_ptr<nfd::StrategyChoiceManager>
+ nfd::StrategyChoiceManager&
getStrategyChoiceManager();
+ ::nfd::rib::Service&
+ getRibService();
+
/**
* \brief Add face to NDN stack
*
diff --git a/ndn-cxx b/ndn-cxx
index c37bf16..4e37270 160000
--- a/ndn-cxx
+++ b/ndn-cxx
@@ -1 +1 @@
-Subproject commit c37bf1633828ef6b69646a4989a9cef855e08248
+Subproject commit 4e372702cfd09f76d5fa4ea1aea5b9152fc60c43
diff --git a/tests/unit-tests/NFD/ncc.t.cpp b/tests/unit-tests/NFD/ncc.t.cpp
index e53e00e..9884292 100644
--- a/tests/unit-tests/NFD/ncc.t.cpp
+++ b/tests/unit-tests/NFD/ncc.t.cpp
@@ -60,7 +60,7 @@
addApps({
{"A1", "ns3::ndn::ConsumerCbr",
{{"Prefix", "/prefix"}, {"Frequency", "1000"}},
- "0s", "5s"},
+ "0.1s", "1.1s"},
{"A3", "ns3::ndn::Producer",
{{"Prefix", "/prefix"}, {"PayloadSize", "1024"}},
"0s", "10s"},
@@ -79,11 +79,11 @@
Simulator::Stop(Seconds(5.2));
BOOST_CHECK_NO_THROW(Simulator::Run());
- BOOST_CHECK_EQUAL(getFace("A1", "A2")->getCounters().nOutInterests, 5000);
- BOOST_CHECK_EQUAL(getFace("A2", "A3")->getCounters().nOutInterests, 5000);
+ BOOST_CHECK_EQUAL(getFace("A1", "A2")->getCounters().nOutInterests, 1000);
+ BOOST_CHECK_EQUAL(getFace("A2", "A3")->getCounters().nOutInterests, 1000);
- BOOST_CHECK_EQUAL(getFace("A3", "A2")->getCounters().nOutData, 5000);
- BOOST_CHECK_EQUAL(getFace("A2", "A1")->getCounters().nOutData, 5000);
+ BOOST_CHECK_EQUAL(getFace("A3", "A2")->getCounters().nOutData, 1000);
+ BOOST_CHECK_EQUAL(getFace("A2", "A1")->getCounters().nOutData, 1000);
}
BOOST_AUTO_TEST_SUITE_END()
diff --git a/tests/unit-tests/helper/ndn-face-container.t.cpp b/tests/unit-tests/helper/ndn-face-container.t.cpp
deleted file mode 100644
index 4129cbc..0000000
--- a/tests/unit-tests/helper/ndn-face-container.t.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
-/**
- * Copyright (c) 2011-2015 Regents of the University of California.
- *
- * This file is part of ndnSIM. See AUTHORS for complete list of ndnSIM authors and
- * contributors.
- *
- * ndnSIM 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.
- *
- * ndnSIM 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
- * ndnSIM, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
- **/
-
-#include "helper/ndn-face-container.hpp"
-
-#include "ns3/node-container.h"
-#include "ns3/point-to-point-net-device.h"
-#include "ns3/node.h"
-#include "ns3/core-module.h"
-#include "ns3/network-module.h"
-#include "ns3/point-to-point-module.h"
-#include "ns3/ndnSIM-module.h"
-
-#include "NFD/daemon/face/null-face.hpp"
-
-#include "../tests-common.hpp"
-
-namespace ns3 {
-namespace ndn {
-
-BOOST_FIXTURE_TEST_SUITE(HelperNdnFaceContainer, CleanupFixture)
-
-BOOST_AUTO_TEST_CASE(Basic)
-{
- FaceContainer c1;
- BOOST_CHECK_EQUAL(c1.GetN(), 0);
-
- c1.Add(nfd::face::makeNullFace(FaceUri("null://1")));
- BOOST_CHECK_EQUAL(c1.GetN(), 1);
-
- c1.Add(nfd::face::makeNullFace(FaceUri("null://2")));
- BOOST_CHECK_EQUAL(c1.GetN(), 2);
-
- FaceContainer c2(c1);
- BOOST_CHECK_EQUAL(c2.GetN(), c1.GetN());
-
- FaceContainer c3;
- BOOST_CHECK_EQUAL(c3.GetN(), 0);
-
- c3 = c1;
- BOOST_CHECK_EQUAL(c3.GetN(), c1.GetN());
-
- for (size_t i = 0; i < c1.GetN(); ++i) {
- BOOST_CHECK_EQUAL(c1.Get(i)->getLocalUri(), c2.Get(i)->getLocalUri());
- BOOST_CHECK_EQUAL(c1.Get(i)->getLocalUri(), c3.Get(i)->getLocalUri());
- }
-
- size_t pos = 0;
- for (FaceContainer::Iterator i = c1.Begin(); i != c1.End(); ++i, ++pos) {
- BOOST_CHECK_EQUAL((*i)->getLocalUri(), c2.Get(pos)->getLocalUri());
- BOOST_CHECK_EQUAL((*i)->getLocalUri(), c3.Get(pos)->getLocalUri());
- }
-}
-
-BOOST_AUTO_TEST_CASE(AddAll)
-{
- FaceContainer c1;
- c1.Add(nfd::face::makeNullFace(FaceUri("null://1")));
- c1.Add(nfd::face::makeNullFace(FaceUri("null://2")));
-
- FaceContainer c2(c1);
- c2.AddAll(c1);
- BOOST_CHECK_EQUAL(c2.GetN(), 4);
-
- FaceContainer c3(c1);
- c3.AddAll(c3);
- BOOST_CHECK_EQUAL(c3.GetN(), 4);
-
- Ptr<FaceContainer> c4 = Create<FaceContainer>(c1);
- c4->AddAll(c4);
-
- BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin(), c2.Begin() + c1.GetN(),
- c1.Begin(), c1.End());
-
- BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin() + c1.GetN(), c2.End(),
- c1.Begin(), c1.End());
-
- BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin(), c2.End(), c3.Begin(), c3.End());
- BOOST_CHECK_EQUAL_COLLECTIONS(c2.Begin(), c2.End(), c4->Begin(), c4->End());
-}
-
-BOOST_AUTO_TEST_SUITE_END()
-
-} // namespace ndn
-} // namespace ns3
diff --git a/tests/unit-tests/helper/ndn-network-region-table-helper.t.cpp b/tests/unit-tests/helper/ndn-network-region-table-helper.t.cpp
index 41f2057..868b9dc 100644
--- a/tests/unit-tests/helper/ndn-network-region-table-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-network-region-table-helper.t.cpp
@@ -155,6 +155,7 @@
{
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
+ i.setCanBePrefix(false);
i.setForwardingHint(makeHint(Name("/otherPrefix")));
return make_shared<TesterApp>(i, this);
})
@@ -174,6 +175,7 @@
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
+ i.setCanBePrefix(false);
i.setForwardingHint(makeHint(Name("/otherPrefix")));
return make_shared<TesterApp>(i, this);
})
@@ -193,6 +195,7 @@
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
+ i.setCanBePrefix(false);
i.setForwardingHint(makeHint(Name("/otherPrefix")));
return make_shared<TesterApp>(i, this);
})
@@ -212,6 +215,7 @@
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
+ i.setCanBePrefix(false);
i.setForwardingHint(makeHint(Name("/otherPrefix/moreSpecific")));
return make_shared<TesterApp>(i, this);
})
diff --git a/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp b/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
index a539141..cbcec2e 100644
--- a/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
@@ -66,10 +66,10 @@
addApps({
{"A1", "ns3::ndn::ConsumerCbr",
{{"Prefix", "/prefix"}, {"Frequency", "1"}},
- "0s", "100s"},
+ "0.1s", "100s"},
{"A2", "ns3::ndn::ConsumerCbr",
{{"Prefix", "/prefix"}, {"Frequency", "1"}},
- "0s", "100s"},
+ "0.1s", "100s"},
});
}
};
@@ -78,7 +78,7 @@
BOOST_AUTO_TEST_CASE(DefaultStrategies)
{
- Simulator::Stop(Seconds(5.0));
+ Simulator::Stop(Seconds(5));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
@@ -94,7 +94,7 @@
{
StrategyChoiceHelper::Install(getNode("A2"), "/prefix", "/localhost/nfd/strategy/multicast");
- Simulator::Stop(Seconds(5.0));
+ Simulator::Stop(Seconds(5));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
@@ -114,7 +114,7 @@
StrategyChoiceHelper::Install(nodes, "/prefix", "/localhost/nfd/strategy/multicast");
- Simulator::Stop(Seconds(5.0));
+ Simulator::Stop(Seconds(5));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 5);
@@ -130,7 +130,7 @@
{
StrategyChoiceHelper::InstallAll("/prefix", "/localhost/nfd/strategy/multicast");
- Simulator::Stop(Seconds(5.0));
+ Simulator::Stop(Seconds(5));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 5);
@@ -171,7 +171,7 @@
{
StrategyChoiceHelper::Install<NullStrategy>(getNode("A2"), "/prefix");
- Simulator::Stop(Seconds(5.0));
+ Simulator::Stop(Seconds(5));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
@@ -192,7 +192,7 @@
StrategyChoiceHelper::Install<NullStrategy>(nodes, "/prefix");
- Simulator::Stop(Seconds(5.0));
+ Simulator::Stop(Seconds(5));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
@@ -209,7 +209,7 @@
{
StrategyChoiceHelper::InstallAll<NullStrategy>("/prefix");
- Simulator::Stop(Seconds(5.0));
+ Simulator::Stop(Seconds(5));
Simulator::Run();
BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
diff --git a/tests/unit-tests/model/ndn-block-header.t.cpp b/tests/unit-tests/model/ndn-block-header.t.cpp
index a8e10a9..5dc65f1 100644
--- a/tests/unit-tests/model/ndn-block-header.t.cpp
+++ b/tests/unit-tests/model/ndn-block-header.t.cpp
@@ -51,6 +51,7 @@
{
Interest interest("/prefix");
interest.setNonce(10);
+ interest.setCanBePrefix(true);
lp::Packet lpPacket(interest.wireEncode());
nfd::face::Transport::Packet packet(lpPacket.wireEncode());
BlockHeader header(packet);
@@ -91,6 +92,7 @@
{
Interest interest("/prefix");
interest.setNonce(10);
+ interest.setCanBePrefix(true);
lp::Packet lpPacket;
lpPacket.add<::ndn::lp::SequenceField>(0); // to make sure that the NDNLP header is added
diff --git a/tests/unit-tests/model/ndn-l3-protocol.t.cpp b/tests/unit-tests/model/ndn-l3-protocol.t.cpp
index b8e51b8..cbfba58 100644
--- a/tests/unit-tests/model/ndn-l3-protocol.t.cpp
+++ b/tests/unit-tests/model/ndn-l3-protocol.t.cpp
@@ -62,6 +62,7 @@
return make_shared<TesterApp>([this] (::ndn::Face& face) {
for (const Name& dataset : requestedDatasets) {
Interest i(dataset);
+ i.setCanBePrefix(true);
face.expressInterest(i, [&] (const Interest& i, const Data& data) {
BOOST_TEST_MESSAGE(data.getName());
receivedDatasets.insert(data.getName().getPrefix(-2));
@@ -93,34 +94,6 @@
receivedDatasets.begin(), receivedDatasets.end());
}
-BOOST_AUTO_TEST_CASE(DisabledRibManager)
-{
- // Disable RIB manager
- disableRibManager();
-
- setupAndRun();
-
- BOOST_CHECK_EQUAL(requestedDatasets.size(), receivedDatasets.size() + 1);
-
- requestedDatasets.erase("/localhost/nfd/rib/list");
- BOOST_CHECK_EQUAL_COLLECTIONS(requestedDatasets.begin(), requestedDatasets.end(),
- receivedDatasets.begin(), receivedDatasets.end());
-}
-
-// BOOST_AUTO_TEST_CASE(DisabledFaceManager)
-// {
-// // Disable Face manager
-// disableFaceManager();
-
-// setupAndRun();
-
-// 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());
-// }
-
BOOST_AUTO_TEST_CASE(DisabledStrategyChoiceManager)
{
// Disable Strategy Choice Manager manager
diff --git a/tests/unit-tests/ndn-cxx/face.t.cpp b/tests/unit-tests/ndn-cxx/face.t.cpp
index f062728..6eb39c2 100644
--- a/tests/unit-tests/ndn-cxx/face.t.cpp
+++ b/tests/unit-tests/ndn-cxx/face.t.cpp
@@ -19,7 +19,6 @@
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/util/scheduler.hpp>
-#include <ndn-cxx/util/scheduler-scoped-event-id.hpp>
#include <ndn-cxx/lp/tags.hpp>
#include "ns3/ndnSIM/helper/ndn-app-helper.hpp"
@@ -112,7 +111,7 @@
SingleInterest(const Name& name, const std::function<void(const Data&)>& onData,
const VoidCallback& onNack, const VoidCallback& onTimeout)
{
- m_face.expressInterest(Interest(name), std::bind([onData] (const Data& data) {
+ m_face.expressInterest(Interest(name).setCanBePrefix(true), std::bind([onData] (const Data& data) {
onData(data);
}, _2),
std::bind(onNack),
@@ -209,7 +208,6 @@
MultipleInterest(const Name& name, const NameCallback& onData, const VoidCallback& onTimeout,
const VoidCallback& onNack)
: m_scheduler(m_face.getIoService())
- , m_event(m_scheduler)
{
expressNextInterest(name, 0, onData, onTimeout, onNack);
}
@@ -219,7 +217,7 @@
expressNextInterest(const Name& name, uint32_t seqNo, const NameCallback& onData,
const VoidCallback& onTimeout, const VoidCallback& onNack)
{
- m_face.expressInterest(Interest(Name(name).appendSegment(seqNo)), std::bind([=] (const Data& data) {
+ m_face.expressInterest(Interest(Name(name).appendSegment(seqNo)).setCanBePrefix(true), std::bind([=] (const Data& data) {
onData(data.getName());
m_event = m_scheduler.scheduleEvent(time::seconds(1),
@@ -267,7 +265,7 @@
public:
SingleInterestWithFaceShutdown()
{
- m_face.expressInterest(Interest(Name("/interest/to/timeout")),
+ m_face.expressInterest(Interest(Name("/interest/to/timeout")).setCanBePrefix(true),
std::bind([] {
BOOST_ERROR("Unexpected response");
}),
diff --git a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
index 953eec1..7150139 100644
--- a/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
+++ b/tests/unit-tests/utils/tracers/ndn-app-delay-tracer.t.cpp
@@ -89,12 +89,12 @@
BOOST_CHECK_EQUAL(buffer.str(),
R"STR(Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
-0.0417888 1 0 0 LastDelay 0.0417888 41788.8 1 2
-0.0417888 1 0 0 FullDelay 0.0417888 41788.8 1 2
+0.0417968 1 0 0 LastDelay 0.0417968 41796.8 1 2
+0.0417968 1 0 0 FullDelay 0.0417968 41796.8 1 2
2 2 0 0 LastDelay 0 0 1 0
2 2 0 0 FullDelay 0 0 1 0
-3.02089 2 0 1 LastDelay 0.0208944 20894.4 1 1
-3.02089 2 0 1 FullDelay 0.0208944 20894.4 1 1
+3.0209 2 0 1 LastDelay 0.0208984 20898.4 1 1
+3.0209 2 0 1 FullDelay 0.0208984 20898.4 1 1
)STR");
}
@@ -116,8 +116,8 @@
BOOST_CHECK_EQUAL(buffer.str(),
R"STR(Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
-0.0417888 1 0 0 LastDelay 0.0417888 41788.8 1 2
-0.0417888 1 0 0 FullDelay 0.0417888 41788.8 1 2
+0.0417968 1 0 0 LastDelay 0.0417968 41796.8 1 2
+0.0417968 1 0 0 FullDelay 0.0417968 41796.8 1 2
)STR");
}
@@ -138,8 +138,8 @@
R"STR(Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount
2 2 0 0 LastDelay 0 0 1 0
2 2 0 0 FullDelay 0 0 1 0
-3.02089 2 0 1 LastDelay 0.0208944 20894.4 1 1
-3.02089 2 0 1 FullDelay 0.0208944 20894.4 1 1
+3.0209 2 0 1 LastDelay 0.0208984 20898.4 1 1
+3.0209 2 0 1 FullDelay 0.0208984 20898.4 1 1
)STR");
}
@@ -156,8 +156,8 @@
BOOST_CHECK(output->is_equal(
R"STR(2 2 0 0 LastDelay 0 0 1 0
2 2 0 0 FullDelay 0 0 1 0
-3.02089 2 0 1 LastDelay 0.0208944 20894.4 1 1
-3.02089 2 0 1 FullDelay 0.0208944 20894.4 1 1
+3.0209 2 0 1 LastDelay 0.0208984 20898.4 1 1
+3.0209 2 0 1 FullDelay 0.0208984 20898.4 1 1
)STR"));
}
diff --git a/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp b/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp
index ef000de..1a23ae4 100644
--- a/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp
+++ b/tests/unit-tests/utils/tracers/ndn-l3-rate-tracer.t.cpp
@@ -86,7 +86,7 @@
<< "1 1 1 internal:// OutNacks 0 0 0 0\n"
<< "1 1 1 internal:// InSatisfiedInterests 0 0 0 0\n"
<< "1 1 1 internal:// InTimedOutInterests 0 0 0 0\n"
- << "1 1 1 internal:// OutSatisfiedInterests 2.4 0 3 0\n"
+ << "1 1 1 internal:// OutSatisfiedInterests 4 0 5 0\n"
<< "1 1 1 internal:// OutTimedOutInterests 0 0 0 0\n";
BOOST_CHECK(os.match_pattern());
@@ -96,7 +96,7 @@
<< "1 1 256 internal:// OutData 0 0 0 0\n"
<< "1 1 256 internal:// InNacks 0 0 0 0\n"
<< "1 1 256 internal:// OutNacks 0 0 0 0\n"
- << "1 1 256 internal:// InSatisfiedInterests 2.4 0 3 0\n"
+ << "1 1 256 internal:// InSatisfiedInterests 4 0 5 0\n"
<< "1 1 256 internal:// InTimedOutInterests 0 0 0 0\n"
<< "1 1 256 internal:// OutSatisfiedInterests 0 0 0 0\n"
<< "1 1 256 internal:// OutTimedOutInterests 0 0 0 0\n";
@@ -114,7 +114,7 @@
<< "1 1 257 appFace:// OutTimedOutInterests 0 0 0 0\n";
BOOST_CHECK(os.match_pattern());
- os << "1 1 -1 all SatisfiedInterests 2.4 0 3 0\n"
+ os << "1 1 -1 all SatisfiedInterests 4 0 5 0\n"
<< "1 1 -1 all TimedOutInterests 0.8 0 1 0\n";
BOOST_CHECK(os.match_pattern());
}
diff --git a/wscript b/wscript
index 9aab1de..973165e 100644
--- a/wscript
+++ b/wscript
@@ -15,11 +15,11 @@
def options(opt):
opt.load(['version'], tooldir=['%s/.waf-tools' % opt.path.abspath()])
- opt.load(['doxygen', 'sphinx_build', 'type_traits', 'compiler-features', 'sqlite3', 'openssl'],
+ opt.load(['doxygen', 'sphinx_build', 'compiler-features', 'sqlite3', 'openssl'],
tooldir=['%s/ndn-cxx/.waf-tools' % opt.path.abspath()])
def configure(conf):
- conf.load(['doxygen', 'sphinx_build', 'type_traits', 'compiler-features', 'version', 'sqlite3', 'openssl'])
+ conf.load(['doxygen', 'sphinx_build', 'compiler-features', 'version', 'sqlite3', 'openssl'])
conf.env['ENABLE_NDNSIM']=False
@@ -71,7 +71,7 @@
conf.report_optional_feature("ndnSIM", "ndnSIM", True, "")
- conf.write_config_header('../../ns3/ndnSIM/ndn-cxx/ndn-cxx-config.hpp', define_prefix='NDN_CXX_', remove=False)
+ conf.write_config_header('../../ns3/ndnSIM/ndn-cxx/detail/config.hpp', define_prefix='NDN_CXX_', remove=False)
conf.write_config_header('../../ns3/ndnSIM/NFD/core/config.hpp', remove=False)
def build(bld):
@@ -88,7 +88,7 @@
(base, build, split) = bld.getVersion('ndn-cxx')
bld(features="subst",
name="version-ndn-cxx",
- source='ndn-cxx/src/version.hpp.in', target='../../ns3/ndnSIM/ndn-cxx/version.hpp',
+ source='ndn-cxx/ndn-cxx/version.hpp.in', target='../../ns3/ndnSIM/ndn-cxx/version.hpp',
install_path=None,
VERSION_STRING=base,
VERSION_BUILD="%s-ndnSIM" % build,
@@ -102,12 +102,13 @@
if bld.env.ENABLE_EXAMPLES:
deps += ['point-to-point-layout', 'csma', 'applications', 'wifi']
- ndnCxxSrc = bld.path.ant_glob('ndn-cxx/src/**/*.cpp',
- excl=['ndn-cxx/src/net/detail/*.cpp',
- 'ndn-cxx/src/net/network-monitor*.cpp',
- 'ndn-cxx/src/util/dummy-client-face.cpp',
- 'ndn-cxx/src/security/tpm/*osx.cpp',
- 'ndn-cxx/src/net/network-interface.cpp'])
+ ndnCxxSrc = bld.path.ant_glob('ndn-cxx/ndn-cxx/**/*.cpp',
+ excl=['ndn-cxx/ndn-cxx/net/impl/*.cpp',
+ 'ndn-cxx/ndn-cxx/net/network-monitor*.cpp',
+ 'ndn-cxx/ndn-cxx/util/dummy-client-face.cpp',
+ 'ndn-cxx/ndn-cxx/security/tpm/*osx.cpp',
+ 'ndn-cxx/ndn-cxx/detail/*osx.cpp',
+ 'ndn-cxx/ndn-cxx/net/network-interface.cpp'])
nfdSrc = bld.path.ant_glob(['%s/**/*.cpp' % dir for dir in ['NFD/core', 'NFD/daemon', 'NFD/rib']],
excl=['NFD/daemon/main.cpp',
@@ -117,8 +118,7 @@
'NFD/daemon/face/tcp*',
'NFD/daemon/face/*udp*',
'NFD/daemon/face/unix-stream*',
- 'NFD/daemon/face/websocket*',
- 'NFD/rib/service.cpp'])
+ 'NFD/daemon/face/websocket*'])
module = bld.create_ns3_module('ndnSIM', deps)
module.module = 'ndnSIM'
@@ -144,8 +144,8 @@
module.full_headers = bld.path.ant_glob(['%s/**/*.hpp' % dir for dir in module_dirs])
module.full_headers += bld.path.ant_glob('NFD/common.hpp')
- module.ndncxx_headers = bld.path.ant_glob(['ndn-cxx/src/**/*.hpp'],
- excl=['src/**/*-osx.hpp', 'src/detail/**/*'])
+ module.ndncxx_headers = bld.path.ant_glob(['ndn-cxx/ndn-cxx/**/*.hpp'],
+ excl=['src/**/*-osx.hpp', 'src/impl/**/*'])
if bld.env.ENABLE_EXAMPLES:
bld.recurse('examples')
@@ -188,10 +188,10 @@
mode = getattr(self, "mode", "install")
for src_node in set(self.ndncxx_headers):
- dst_node = ndncxx_dir_node.find_or_declare(src_node.path_from(self.bld.path.find_dir('src/ndnSIM/ndn-cxx/src')))
+ dst_node = ndncxx_dir_node.find_or_declare(src_node.path_from(self.bld.path.find_dir('src/ndnSIM/ndn-cxx/ndn-cxx')))
assert dst_node is not None
- relpath = src_node.parent.path_from(self.bld.path.find_dir('src/ndnSIM/ndn-cxx/src'))
+ relpath = src_node.parent.path_from(self.bld.path.find_dir('src/ndnSIM/ndn-cxx/ndn-cxx'))
task = self.create_task('ns3header')
task.mode = getattr(self, 'mode', 'install')