helper+model: Fix helpers to work with NFD/ndn-cxx 0.4+
Change-Id: I7ed2893acbda1458383603c0e3c154d3e841405e
Refs: #3560
diff --git a/tests/unit-tests/helper/ndn-face-container.t.cpp b/tests/unit-tests/helper/ndn-face-container.t.cpp
index 5d0800d..4129cbc 100644
--- a/tests/unit-tests/helper/ndn-face-container.t.cpp
+++ b/tests/unit-tests/helper/ndn-face-container.t.cpp
@@ -41,10 +41,10 @@
FaceContainer c1;
BOOST_CHECK_EQUAL(c1.GetN(), 0);
- c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://1")));
+ c1.Add(nfd::face::makeNullFace(FaceUri("null://1")));
BOOST_CHECK_EQUAL(c1.GetN(), 1);
- c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://2")));
+ c1.Add(nfd::face::makeNullFace(FaceUri("null://2")));
BOOST_CHECK_EQUAL(c1.GetN(), 2);
FaceContainer c2(c1);
@@ -71,8 +71,8 @@
BOOST_AUTO_TEST_CASE(AddAll)
{
FaceContainer c1;
- c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://1")));
- c1.Add(std::make_shared<nfd::NullFace>(FaceUri("null://2")));
+ c1.Add(nfd::face::makeNullFace(FaceUri("null://1")));
+ c1.Add(nfd::face::makeNullFace(FaceUri("null://2")));
FaceContainer c2(c1);
c2.AddAll(c1);
diff --git a/tests/unit-tests/helper/ndn-fib-helper.t.cpp b/tests/unit-tests/helper/ndn-fib-helper.t.cpp
index 59f4876..60a5967 100644
--- a/tests/unit-tests/helper/ndn-fib-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-fib-helper.t.cpp
@@ -50,11 +50,11 @@
Simulator::Stop(Seconds(20.001));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("1", "2")->getFaceStatus().getNOutInterests(), 10);
- BOOST_CHECK_EQUAL(getFace("1", "2")->getFaceStatus().getNInDatas(), 10);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nOutInterests, 10);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 10);
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 10);
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNOutDatas(), 10);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 10);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nOutData, 10);
}
};
diff --git a/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp b/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp
index d37c747..4cd6a04 100644
--- a/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-global-routing-helper.t.cpp
@@ -21,8 +21,7 @@
#include "model/ndn-global-router.hpp"
#include "model/ndn-l3-protocol.hpp"
-#include "model/ndn-face.hpp"
-#include "model/ndn-net-device-face.hpp"
+#include "model/ndn-net-device-link-service.hpp"
#include "ns3/channel.h"
#include "ns3/net-device.h"
@@ -93,10 +92,11 @@
for (const auto& entry : ndn->getForwarder()->getFib()) {
bool isFirst = true;
for (auto& nextHop : entry.getNextHops()) {
- auto face = dynamic_pointer_cast<ndn::NetDeviceFace>(nextHop.getFace());
- if (face == nullptr)
+ auto face = nextHop.getFace();
+ auto linkService = dynamic_cast<NetDeviceLinkService*>(face->getLinkService());
+ if (linkService == nullptr)
continue;
- BOOST_CHECK_EQUAL(Names::FindName(face->GetNetDevice()->GetChannel()->GetDevice(1)->GetNode()), "C1");
+ BOOST_CHECK_EQUAL(Names::FindName(linkService->GetNetDevice()->GetChannel()->GetDevice(1)->GetNode()), "C1");
isFirst = false;
}
}
@@ -137,10 +137,11 @@
for (const auto& entry : ndn->getForwarder()->getFib()) {
bool isFirst = true;
for (auto& nextHop : entry.getNextHops()) {
- auto face = dynamic_pointer_cast<ndn::NetDeviceFace>(nextHop.getFace());
- if (face == nullptr)
+ auto face = nextHop.getFace();
+ auto linkService = dynamic_cast<NetDeviceLinkService*>(face->getLinkService());
+ if (linkService == nullptr)
continue;
- BOOST_CHECK_EQUAL(Names::FindName(face->GetNetDevice()->GetChannel()->GetDevice(1)->GetNode()), "B2");
+ BOOST_CHECK_EQUAL(Names::FindName(linkService->GetNetDevice()->GetChannel()->GetDevice(1)->GetNode()), "B2");
isFirst = false;
}
}
diff --git a/tests/unit-tests/helper/ndn-link-control-helper.t.cpp b/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
index 92ceefb..a88b9e3 100644
--- a/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-link-control-helper.t.cpp
@@ -55,17 +55,17 @@
Simulator::Schedule(Seconds(10.1), ndn::LinkControlHelper::UpLink, getNode("1"), getNode("2"));
nfd::scheduler::schedule(time::milliseconds(5200), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 6);
- BOOST_CHECK_EQUAL(getFace("1", "2")->getFaceStatus().getNInDatas(), 6);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 6);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 6);
});
nfd::scheduler::schedule(time::milliseconds(10200), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 6);
- BOOST_CHECK_EQUAL(getFace("1", "2")->getFaceStatus().getNInDatas(), 6);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 6);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 6);
});
nfd::scheduler::schedule(time::milliseconds(15100), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 11);
- BOOST_CHECK_EQUAL(getFace("1", "2")->getFaceStatus().getNInDatas(), 11);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 11);
+ BOOST_CHECK_EQUAL(getFace("1", "2")->getCounters().nInData, 11);
});
Simulator::Stop(Seconds(15.2));
@@ -125,14 +125,14 @@
// just before link failure
nfd::scheduler::schedule(time::milliseconds(10050), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 11);
- BOOST_CHECK_EQUAL(getFace("3", "1")->getFaceStatus().getNInInterests(), 11);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 11);
+ BOOST_CHECK_EQUAL(getFace("3", "1")->getCounters().nInInterests, 11);
});
// just before link recovery
nfd::scheduler::schedule(time::milliseconds(20050), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 11);
- BOOST_CHECK_EQUAL(getFace("3", "1")->getFaceStatus().getNInInterests(), 21);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 11);
+ BOOST_CHECK_EQUAL(getFace("3", "1")->getCounters().nInInterests, 21);
});
nfd::scheduler::schedule(time::milliseconds(20100), [&] {
@@ -140,8 +140,8 @@
});
nfd::scheduler::schedule(time::milliseconds(30050), [&] {
- BOOST_CHECK_EQUAL(getFace("2", "1")->getFaceStatus().getNInInterests(), 21);
- BOOST_CHECK_EQUAL(getFace("3", "1")->getFaceStatus().getNInInterests(), 31);
+ BOOST_CHECK_EQUAL(getFace("2", "1")->getCounters().nInInterests, 21);
+ BOOST_CHECK_EQUAL(getFace("3", "1")->getCounters().nInInterests, 31);
});
Simulator::Stop(Seconds(30.1));
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 ed60016..0b92fa7 100644
--- a/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
+++ b/tests/unit-tests/helper/ndn-strategy-choice-helper.t.cpp
@@ -81,11 +81,11 @@
Simulator::Stop(Seconds(5.0));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("A1", "B1")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A1", "C1")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A1", "C1")->getCounters().nOutInterests, 5);
- BOOST_CHECK_EQUAL(getFace("A2", "B2")->getFaceStatus().getNOutInterests(), 5);
- BOOST_CHECK_EQUAL(getFace("A2", "C2")->getFaceStatus().getNOutInterests(), 0);
+ BOOST_CHECK_EQUAL(getFace("A2", "B2")->getCounters().nOutInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("A2", "C2")->getCounters().nOutInterests, 0);
}
// static void
@@ -97,11 +97,11 @@
Simulator::Stop(Seconds(5.0));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("A1", "B1")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A1", "C1")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A1", "C1")->getCounters().nOutInterests, 5);
- BOOST_CHECK_EQUAL(getFace("A2", "B2")->getFaceStatus().getNOutInterests(), 5);
- BOOST_CHECK_EQUAL(getFace("A2", "C2")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A2", "B2")->getCounters().nOutInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("A2", "C2")->getCounters().nOutInterests, 5);
}
// static void
@@ -117,11 +117,11 @@
Simulator::Stop(Seconds(5.0));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("A1", "B1")->getFaceStatus().getNOutInterests(), 5);
- BOOST_CHECK_EQUAL(getFace("A1", "C1")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("A1", "C1")->getCounters().nOutInterests, 5);
- BOOST_CHECK_EQUAL(getFace("A2", "B2")->getFaceStatus().getNOutInterests(), 5);
- BOOST_CHECK_EQUAL(getFace("A2", "C2")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A2", "B2")->getCounters().nOutInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("A2", "C2")->getCounters().nOutInterests, 5);
}
// static void
@@ -133,11 +133,11 @@
Simulator::Stop(Seconds(5.0));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("A1", "B1")->getFaceStatus().getNOutInterests(), 5);
- BOOST_CHECK_EQUAL(getFace("A1", "C1")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("A1", "C1")->getCounters().nOutInterests, 5);
- BOOST_CHECK_EQUAL(getFace("A2", "B2")->getFaceStatus().getNOutInterests(), 5);
- BOOST_CHECK_EQUAL(getFace("A2", "C2")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A2", "B2")->getCounters().nOutInterests, 5);
+ BOOST_CHECK_EQUAL(getFace("A2", "C2")->getCounters().nOutInterests, 5);
}
@@ -171,11 +171,11 @@
Simulator::Stop(Seconds(5.0));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("A1", "B1")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A1", "C1")->getFaceStatus().getNOutInterests(), 5);
+ BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A1", "C1")->getCounters().nOutInterests, 5);
- BOOST_CHECK_EQUAL(getFace("A2", "B2")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A2", "C2")->getFaceStatus().getNOutInterests(), 0);
+ BOOST_CHECK_EQUAL(getFace("A2", "B2")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A2", "C2")->getCounters().nOutInterests, 0);
}
// template<class Strategy>
@@ -192,11 +192,11 @@
Simulator::Stop(Seconds(5.0));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("A1", "B1")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A1", "C1")->getFaceStatus().getNOutInterests(), 0);
+ BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A1", "C1")->getCounters().nOutInterests, 0);
- BOOST_CHECK_EQUAL(getFace("A2", "B2")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A2", "C2")->getFaceStatus().getNOutInterests(), 0);
+ BOOST_CHECK_EQUAL(getFace("A2", "B2")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A2", "C2")->getCounters().nOutInterests, 0);
}
// template<class Strategy>
@@ -209,11 +209,11 @@
Simulator::Stop(Seconds(5.0));
Simulator::Run();
- BOOST_CHECK_EQUAL(getFace("A1", "B1")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A1", "C1")->getFaceStatus().getNOutInterests(), 0);
+ BOOST_CHECK_EQUAL(getFace("A1", "B1")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A1", "C1")->getCounters().nOutInterests, 0);
- BOOST_CHECK_EQUAL(getFace("A2", "B2")->getFaceStatus().getNOutInterests(), 0);
- BOOST_CHECK_EQUAL(getFace("A2", "C2")->getFaceStatus().getNOutInterests(), 0);
+ BOOST_CHECK_EQUAL(getFace("A2", "B2")->getCounters().nOutInterests, 0);
+ BOOST_CHECK_EQUAL(getFace("A2", "C2")->getCounters().nOutInterests, 0);
}
BOOST_AUTO_TEST_SUITE_END()