Upgrade the underlying NFD and ndn-cxx to version 0.6.0
Compilation is currently broken and is fixed in the following commit
Change-Id: Ic0dba06a9afd66a810172d4a512f35f6df6b25a2
Refs: #4306
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 c683ae4..41f2057 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
@@ -19,12 +19,16 @@
#include "helper/ndn-network-region-table-helper.hpp"
#include "helper/ndn-app-helper.hpp"
+#include <ndn-cxx/link.hpp>
#include "../tests-common.hpp"
namespace ns3 {
namespace ndn {
+using ::ndn::Delegation;
+using ::ndn::DelegationList;
+
BOOST_AUTO_TEST_SUITE(HelperNdnNetworkRegionTableHelper)
class BasicFixture : public ScenarioHelperWithCleanupFixture
@@ -91,13 +95,14 @@
::ndn::Face m_face;
};
-Block
-makeLink(const Name& delegation)
+DelegationList
+makeHint(const Name& delegation)
{
- ::ndn::Link link("/LINK");
- link.addDelegation(1, delegation);
- ndn::StackHelper::getKeyChain().sign(link, ::ndn::security::SigningInfo(::ndn::security::SigningInfo::SIGNER_TYPE_SHA256));
- return link.wireEncode();
+ Delegation del;
+ del.name = Name(delegation);
+ del.preference = 1;
+ DelegationList list({del});
+ return list;
}
class MultiNodeWithAppFixture : public ScenarioHelperWithCleanupFixture
@@ -136,10 +141,10 @@
++fixture->m_nData;
}),
std::bind([fixture] {
- ++fixture->m_nTimeouts;
+ ++fixture->m_nNacks;
}),
std::bind([fixture] {
- ++fixture->m_nNacks;
+ ++fixture->m_nTimeouts;
}));
}
@@ -150,7 +155,7 @@
{
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
- i.setLink(makeLink("/otherPrefix"));
+ i.setForwardingHint(makeHint(Name("/otherPrefix")));
return make_shared<TesterApp>(i, this);
})
.Start(Seconds(0.01));
@@ -169,7 +174,7 @@
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
- i.setLink(makeLink("/otherPrefix"));
+ i.setForwardingHint(makeHint(Name("/otherPrefix")));
return make_shared<TesterApp>(i, this);
})
.Start(Seconds(0.01));
@@ -188,7 +193,7 @@
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
- i.setLink(makeLink("/otherPrefix"));
+ i.setForwardingHint(makeHint(Name("/otherPrefix")));
return make_shared<TesterApp>(i, this);
})
.Start(Seconds(0.01));
@@ -207,7 +212,7 @@
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
Interest i("/prefix/someData");
- i.setLink(makeLink("/otherPrefix/moreSpecific"));
+ i.setForwardingHint(makeHint(Name("/otherPrefix/moreSpecific")));
return make_shared<TesterApp>(i, this);
})
.Start(Seconds(0.01));
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 d8f9f4e..e06a93d 100644
--- a/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
@@ -143,9 +143,10 @@
class NullStrategy : public nfd::fw::Strategy {
public:
- NullStrategy(nfd::Forwarder& forwarder)
- : Strategy(forwarder, STRATEGY_NAME)
+ NullStrategy(nfd::Forwarder& forwarder, const Name& name = getStrategyName())
+ : Strategy(forwarder)
{
+ this->setInstanceName(name);
}
virtual void
@@ -156,11 +157,13 @@
}
public:
- static const Name STRATEGY_NAME;
+ static const Name& getStrategyName()
+ {
+ static Name strategyName("ndn:/localhost/nfd/strategy/unit-tests/null-strategy/%FD%00");
+ return strategyName;
+ }
};
-const Name NullStrategy::STRATEGY_NAME = "ndn:/localhost/nfd/strategy/unit-tests/null-strategy";
-
// template<class Strategy>
// static void
// Install(Ptr<Node> node, const Name& namePrefix);
diff --git a/tests/unit-tests/model/ndn-block-header.t.cpp b/tests/unit-tests/model/ndn-block-header.t.cpp
index 2027d41..a8e10a9 100644
--- a/tests/unit-tests/model/ndn-block-header.t.cpp
+++ b/tests/unit-tests/model/ndn-block-header.t.cpp
@@ -76,7 +76,7 @@
nfd::face::Transport::Packet packet(lpPacket.wireEncode());
BlockHeader header(packet);
- BOOST_CHECK_EQUAL(header.GetSerializedSize(), 1369);
+ BOOST_CHECK_EQUAL(header.GetSerializedSize(), 1350);
{
Ptr<Packet> packet = Create<Packet>();
diff --git a/tests/unit-tests/model/ndn-l3-protocol.t.cpp b/tests/unit-tests/model/ndn-l3-protocol.t.cpp
index b2d77ca..b8e51b8 100644
--- a/tests/unit-tests/model/ndn-l3-protocol.t.cpp
+++ b/tests/unit-tests/model/ndn-l3-protocol.t.cpp
@@ -61,10 +61,12 @@
FactoryCallbackApp::Install(getNode("1"), [this] () -> shared_ptr<void> {
return make_shared<TesterApp>([this] (::ndn::Face& face) {
for (const Name& dataset : requestedDatasets) {
- face.expressInterest(dataset, [&] (const Interest& i, Data& data) {
+ Interest i(dataset);
+ face.expressInterest(i, [&] (const Interest& i, const Data& data) {
BOOST_TEST_MESSAGE(data.getName());
receivedDatasets.insert(data.getName().getPrefix(-2));
},
+ std::bind([]{}),
std::bind([]{}));
}
});
diff --git a/tests/unit-tests/ndn-cxx/face.t.cpp b/tests/unit-tests/ndn-cxx/face.t.cpp
index 324043d..67f3333 100644
--- a/tests/unit-tests/ndn-cxx/face.t.cpp
+++ b/tests/unit-tests/ndn-cxx/face.t.cpp
@@ -109,11 +109,13 @@
class SingleInterest : public BaseTesterApp
{
public:
- SingleInterest(const Name& name, const std::function<void(const Data&)>& onData, const VoidCallback& onTimeout)
+ SingleInterest(const Name& name, const std::function<void(const Data&)>& onData,
+ const VoidCallback& onNack, const VoidCallback& onTimeout)
{
- m_face.expressInterest(name, std::bind([onData] (const Data& data) {
+ m_face.expressInterest(Interest(name), std::bind([onData] (const Data& data) {
onData(data);
}, _2),
+ std::bind(onNack),
std::bind(onTimeout));
}
};
@@ -128,6 +130,9 @@
BOOST_CHECK_LE(Simulator::Now().ToDouble(Time::S), 1.01);
},
[] {
+ BOOST_ERROR("Unexpected NACK");
+ },
+ [] {
BOOST_ERROR("Unexpected timeout");
});
})
@@ -153,6 +158,9 @@
BOOST_CHECK_LE(Simulator::Now().ToDouble(Time::S), 2.0);
},
[] {
+ BOOST_ERROR("Unexpected NACK");
+ },
+ [] {
BOOST_ERROR("Unexpected timeout");
});
})
@@ -167,9 +175,12 @@
BOOST_AUTO_TEST_CASE(ExpressInterestTimeout)
{
FactoryCallbackApp::Install(getNode("A"), [this] () -> shared_ptr<void> {
- return make_shared<SingleInterest>("/test/prefix", [] (const Data&) {
+ return make_shared<SingleInterest>(Name("/test/prefix"), [] (const Data&) {
BOOST_ERROR("Unexpected data");
},
+ [] {
+ BOOST_ERROR("Unexpected NACK");
+ },
[this] {
BOOST_CHECK_GT(Simulator::Now().ToDouble(Time::S), 6.0);
this->hasFired = true;
@@ -188,31 +199,6 @@
BOOST_CHECK(hasFired);
}
-// Expected failure until issue #3121 is resolved
-BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES(ExpressInterestWithRib, 2);
-BOOST_AUTO_TEST_CASE(ExpressInterestWithRib)
-{
- addApps({{"A", "ns3::ndn::Producer", {{"Prefix", "/"}}, "0s", "100s"}});
-
- // Retrieve data from remote
- FactoryCallbackApp::Install(getNode("A"), [this] () -> shared_ptr<void> {
- return make_shared<SingleInterest>("/test/prefix", [this] (const Data& data) {
- BOOST_CHECK_EQUAL(data.getName(), "/test/prefix");
- this->hasFired = true;
- BOOST_CHECK_LE(Simulator::Now().ToDouble(Time::S), 2.0);
- },
- [] {
- BOOST_ERROR("Unexpected timeout");
- });
- })
- .Start(Seconds(1.01));
-
- Simulator::Stop(Seconds(20));
- Simulator::Run();
-
- BOOST_CHECK(hasFired);
-}
-
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
@@ -220,24 +206,27 @@
class MultipleInterest : public BaseTesterApp
{
public:
- MultipleInterest(const Name& name, const NameCallback& onData, const VoidCallback& onTimeout)
+ 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);
+ expressNextInterest(name, 0, onData, onTimeout, onNack);
}
private:
void
- expressNextInterest(const Name& name, uint32_t seqNo, const NameCallback& onData, const VoidCallback& onTimeout)
+ expressNextInterest(const Name& name, uint32_t seqNo, const NameCallback& onData,
+ const VoidCallback& onTimeout, const VoidCallback& onNack)
{
- m_face.expressInterest(Name(name).appendSegment(seqNo), std::bind([=] (const Data& data) {
+ m_face.expressInterest(Interest(Name(name).appendSegment(seqNo)), std::bind([=] (const Data& data) {
onData(data.getName());
m_event = m_scheduler.scheduleEvent(time::seconds(1),
std::bind(&MultipleInterest::expressNextInterest, this,
- name, seqNo + 1, onData, onTimeout));
+ name, seqNo + 1, onData, onTimeout, onNack));
}, _2),
+ std::bind(onNack),
std::bind(onTimeout));
}
@@ -260,6 +249,9 @@
},
[] {
BOOST_ERROR("Unexpected timeout");
+ },
+ [] {
+ BOOST_ERROR("Unexpected NACK");
});
})
.Start(Seconds(1.01));
@@ -275,12 +267,15 @@
public:
SingleInterestWithFaceShutdown()
{
- m_face.expressInterest(Name("/interest/to/timeout"),
+ m_face.expressInterest(Interest(Name("/interest/to/timeout")),
std::bind([] {
BOOST_ERROR("Unexpected response");
}),
std::bind([this] {
m_face.shutdown();
+ }),
+ std::bind([this] {
+ m_face.shutdown();
}));
}
};
@@ -288,7 +283,6 @@
BOOST_AUTO_TEST_CASE(FaceShutdownFromTimeoutCallback)
{
// This test case to check if Face.shutdown from an onTimeout callback doesn't cause segfaults
-
FactoryCallbackApp::Install(getNode("A"), [this] () -> shared_ptr<void> {
return make_shared<SingleInterestWithFaceShutdown>();
})
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 0f24b80..9336fd8 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(),
"Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount\n"
- "0.0417712 1 0 0 LastDelay 0.0417712 41771.2 1 2\n"
- "0.0417712 1 0 0 FullDelay 0.0417712 41771.2 1 2\n"
+ "0.0417664 1 0 0 LastDelay 0.0417664 41766.4 1 2\n"
+ "0.0417664 1 0 0 FullDelay 0.0417664 41766.4 1 2\n"
"2 2 0 0 LastDelay 0 0 1 0\n"
"2 2 0 0 FullDelay 0 0 1 0\n"
- "3.02089 2 0 1 LastDelay 0.0208856 20885.6 1 1\n"
- "3.02089 2 0 1 FullDelay 0.0208856 20885.6 1 1\n");
+ "3.02088 2 0 1 LastDelay 0.0208832 20883.2 1 1\n"
+ "3.02088 2 0 1 FullDelay 0.0208832 20883.2 1 1\n");
}
BOOST_AUTO_TEST_CASE(InstallNodeContainer)
@@ -115,8 +115,8 @@
BOOST_CHECK_EQUAL(buffer.str(),
"Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount\n"
- "0.0417712 1 0 0 LastDelay 0.0417712 41771.2 1 2\n"
- "0.0417712 1 0 0 FullDelay 0.0417712 41771.2 1 2\n");
+ "0.0417664 1 0 0 LastDelay 0.0417664 41766.4 1 2\n"
+ "0.0417664 1 0 0 FullDelay 0.0417664 41766.4 1 2\n");
}
BOOST_AUTO_TEST_CASE(InstallNode)
@@ -136,8 +136,8 @@
"Time Node AppId SeqNo Type DelayS DelayUS RetxCount HopCount\n"
"2 2 0 0 LastDelay 0 0 1 0\n"
"2 2 0 0 FullDelay 0 0 1 0\n"
- "3.02089 2 0 1 LastDelay 0.0208856 20885.6 1 1\n"
- "3.02089 2 0 1 FullDelay 0.0208856 20885.6 1 1\n");
+ "3.02088 2 0 1 LastDelay 0.0208832 20883.2 1 1\n"
+ "3.02088 2 0 1 FullDelay 0.0208832 20883.2 1 1\n");
}
BOOST_AUTO_TEST_CASE(InstallNodeDumpStream)
@@ -153,8 +153,8 @@
BOOST_CHECK(output->is_equal(
"2 2 0 0 LastDelay 0 0 1 0\n"
"2 2 0 0 FullDelay 0 0 1 0\n"
- "3.02089 2 0 1 LastDelay 0.0208856 20885.6 1 1\n"
- "3.02089 2 0 1 FullDelay 0.0208856 20885.6 1 1\n"));
+ "3.02088 2 0 1 LastDelay 0.0208832 20883.2 1 1\n"
+ "3.02088 2 0 1 FullDelay 0.0208832 20883.2 1 1\n"));
}
BOOST_AUTO_TEST_SUITE_END()