table: add Fib::afterNewNextHop signal
Refs: #4931
Change-Id: I68915b5f5688ad2f62147069fea86956a22672b6
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index d8008f7..9614a26 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -77,9 +77,9 @@
BOOST_AUTO_TEST_CASE(Forward)
{
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face1, 10);
- fibEntry.addOrUpdateNextHop(*face2, 20);
- fibEntry.addOrUpdateNextHop(*face3, 30);
+ fib.addOrUpdateNextHop(fibEntry, *face1, 10);
+ fib.addOrUpdateNextHop(fibEntry, *face2, 20);
+ fib.addOrUpdateNextHop(fibEntry, *face3, 30);
shared_ptr<Interest> interest = makeInterest("ndn:/BzgFBchqA");
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
@@ -128,7 +128,7 @@
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[4].outFaceId, face1->getId());
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[5].outFaceId, face3->getId());
- fibEntry.removeNextHop(*face1);
+ fib.removeNextHop(fibEntry, *face1);
strategy.sendInterestHistory.clear();
for (int i = 0; i < 3; ++i) {
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index 247821a..9f7d1ce 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -50,7 +50,8 @@
forwarder.addFace(face2);
Fib& fib = forwarder.getFib();
- fib.insert("/A").first->addOrUpdateNextHop(*face2, 0);
+ fib::Entry* entry = fib.insert("/A").first;
+ fib.addOrUpdateNextHop(*entry, *face2, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nInInterests, 0);
BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 0);
@@ -91,7 +92,8 @@
forwarder.addFace(face3);
Fib& fib = forwarder.getFib();
- fib.insert("/A").first->addOrUpdateNextHop(*face2, 0);
+ fib::Entry* entry = fib.insert("/A").first;
+ fib.addOrUpdateNextHop(*entry, *face2, 0);
Pit& pit = forwarder.getPit();
BOOST_CHECK_EQUAL(pit.size(), 0);
@@ -156,7 +158,8 @@
forwarder.addFace(face3);
Fib& fib = forwarder.getFib();
- fib.insert("/A").first->addOrUpdateNextHop(*face3, 0);
+ fib::Entry* entry = fib.insert("/A").first;
+ fib.addOrUpdateNextHop(*entry, *face3, 0);
auto interest = makeInterest("/A/B");
interest->setTag(make_shared<lp::NextHopFaceIdTag>(face2->getId()));
@@ -485,7 +488,8 @@
forwarder.addFace(face4);
Fib& fib = forwarder.getFib();
- fib.insert("/zT4XwK0Hnx").first->addOrUpdateNextHop(*face4, 0);
+ fib::Entry* entry = fib.insert("/zT4XwK0Hnx").first;
+ fib.addOrUpdateNextHop(*entry, *face4, 0);
// receive Interest on face1
face1->sentNacks.clear();
@@ -537,7 +541,8 @@
});
Fib& fib = forwarder.getFib();
- fib.insert("/A").first->addOrUpdateNextHop(*face2, 0);
+ fib::Entry* entry = fib.insert("/A").first;
+ fib.addOrUpdateNextHop(*entry, *face2, 0);
// receive an Interest
auto interest = makeInterest("/A/1", false, 50_ms, 82101183);
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 24027f0..b162926 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -69,9 +69,9 @@
BOOST_AUTO_TEST_CASE(Forward2)
{
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face1, 0);
- fibEntry.addOrUpdateNextHop(*face2, 0);
- fibEntry.addOrUpdateNextHop(*face3, 0);
+ fib.addOrUpdateNextHop(fibEntry, *face1, 0);
+ fib.addOrUpdateNextHop(fibEntry, *face2, 0);
+ fib.addOrUpdateNextHop(fibEntry, *face3, 0);
shared_ptr<Interest> interest = makeInterest("ndn:/H0D6i5fc");
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
@@ -123,7 +123,7 @@
BOOST_AUTO_TEST_CASE(RejectLoopback)
{
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face1, 0);
+ fib.addOrUpdateNextHop(fibEntry, *face1, 0);
shared_ptr<Interest> interest = makeInterest("ndn:/H0D6i5fc");
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index c9a604b..b2f919a 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -59,8 +59,8 @@
Fib& fib = forwarder.getFib();
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face1, 10);
- fibEntry.addOrUpdateNextHop(*face2, 20);
+ fib.addOrUpdateNextHop(fibEntry, *face1, 10);
+ fib.addOrUpdateNextHop(fibEntry, *face2, 20);
Pit& pit = forwarder.getPit();
@@ -118,7 +118,7 @@
Fib& fib = forwarder.getFib();
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face1, 10);
+ fib.addOrUpdateNextHop(fibEntry, *face1, 10);
Pit& pit = forwarder.getPit();
@@ -149,7 +149,7 @@
strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest2, pitEntry2);
// FIB entry is changed before doPropagate executes
- fibEntry.addOrUpdateNextHop(*face2, 20);
+ fib.addOrUpdateNextHop(fibEntry, *face2, 20);
this->advanceClocks(10_ms, 1_s);// should not crash
}
@@ -169,8 +169,8 @@
Fib& fib = forwarder.getFib();
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face1, 10);
- fibEntry.addOrUpdateNextHop(*face2, 20);
+ fib.addOrUpdateNextHop(fibEntry, *face1, 10);
+ fib.addOrUpdateNextHop(fibEntry, *face2, 20);
Pit& pit = forwarder.getPit();
@@ -222,7 +222,7 @@
Fib& fib = forwarder.getFib();
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face2, 10);
+ fib.addOrUpdateNextHop(fibEntry, *face2, 10);
Pit& pit = forwarder.getPit();
@@ -265,8 +265,8 @@
Fib& fib = forwarder.getFib();
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face1, 10); // face1 is top-ranked nexthop
- fibEntry.addOrUpdateNextHop(*face2, 20);
+ fib.addOrUpdateNextHop(fibEntry, *face1, 10); // face1 is top-ranked nexthop
+ fib.addOrUpdateNextHop(fibEntry, *face2, 20);
Pit& pit = forwarder.getPit();
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index df2c1bb..ea2d417 100644
--- a/tests/daemon/fw/strategy-nack-return.t.cpp
+++ b/tests/daemon/fw/strategy-nack-return.t.cpp
@@ -93,9 +93,9 @@
S, Strategies, StrategyNackReturnFixture<S>)
{
fib::Entry& fibEntry = *this->fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*this->face3, 10);
- fibEntry.addOrUpdateNextHop(*this->face4, 20);
- fibEntry.addOrUpdateNextHop(*this->face5, 30);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face3, 10);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face4, 20);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face5, 30);
auto interest1 = makeInterest("/McQYjMbm", false, nullopt, 992);
auto interest2 = makeInterest("/McQYjMbm", false, nullopt, 114);
@@ -132,9 +132,9 @@
S, Strategies, StrategyNackReturnFixture<S>)
{
fib::Entry& fibEntry = *this->fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*this->face3, 10);
- fibEntry.addOrUpdateNextHop(*this->face4, 20);
- fibEntry.addOrUpdateNextHop(*this->face5, 30);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face3, 10);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face4, 20);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face5, 30);
auto interest1 = makeInterest("/aS9FAyUV19", 286);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
@@ -168,9 +168,9 @@
S, Strategies, StrategyNackReturnFixture<S>)
{
fib::Entry& fibEntry = *this->fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*this->face3, 10);
- fibEntry.addOrUpdateNextHop(*this->face4, 20);
- fibEntry.addOrUpdateNextHop(*this->face5, 30);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face3, 10);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face4, 20);
+ this->fib.addOrUpdateNextHop(fibEntry, *this->face5, 30);
auto interest1 = makeInterest("/sIYw0TXWDj", false, 400_ms, 115);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
@@ -320,9 +320,9 @@
StrategyNackReturnFixture<BestRouteStrategy2>)
{
fib::Entry& fibEntry = *fib.insert(Name()).first;
- fibEntry.addOrUpdateNextHop(*face3, 10);
- fibEntry.addOrUpdateNextHop(*face4, 20);
- fibEntry.addOrUpdateNextHop(*face5, 30);
+ fib.addOrUpdateNextHop(fibEntry, *face3, 10);
+ fib.addOrUpdateNextHop(fibEntry, *face4, 20);
+ fib.addOrUpdateNextHop(fibEntry, *face5, 30);
auto interest1 = makeInterest("/F6sEwB24I", false, nullopt, 282);
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index cea980f..a8fed80 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -115,7 +115,8 @@
void
insertFibEntry(StrategyNoRouteFixture<S>* fixture)
{
- fixture->fib.insert(Name()).first->addOrUpdateNextHop(*fixture->face1, 10);
+ fib::Entry* entry = fixture->fib.insert(Name()).first;
+ fixture->fib.addOrUpdateNextHop(*entry, *fixture->face1, 10);
}
};
@@ -132,7 +133,8 @@
void
insertFibEntry(StrategyNoRouteFixture<S>* fixture)
{
- fixture->fib.insert("/localhop").first->addOrUpdateNextHop(*fixture->face2, 10);
+ fib::Entry* entry = fixture->fib.insert("/localhop").first;
+ fixture->fib.addOrUpdateNextHop(*entry, *fixture->face2, 10);
// face1 and face2 are both non-local; Interest from face1 cannot be forwarded to face2
}
};
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index ec88374..a2fa21d 100644
--- a/tests/daemon/fw/strategy-scope-control.t.cpp
+++ b/tests/daemon/fw/strategy-scope-control.t.cpp
@@ -116,7 +116,7 @@
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
{
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
- fibEntry->addOrUpdateNextHop(*this->localFace4, 10);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->localFace4, 10);
auto interest = makeInterest("/localhost/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
@@ -135,7 +135,7 @@
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
{
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
- fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 10);
auto interest = makeInterest("/localhost/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
@@ -157,8 +157,8 @@
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
{
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
- fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
- fibEntry->addOrUpdateNextHop(*this->localFace4, 20);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 10);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->localFace4, 20);
auto interest = makeInterest("/localhost/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
@@ -178,7 +178,7 @@
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
{
fib::Entry* fibEntry = this->fib.insert("/localhop/A").first;
- fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 10);
auto interest = makeInterest("/localhop/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
@@ -200,8 +200,8 @@
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
{
fib::Entry* fibEntry = this->fib.insert("/localhop/A").first;
- fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
- fibEntry->addOrUpdateNextHop(*this->localFace4, 20);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 10);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->localFace4, 20);
auto interest = makeInterest("/localhop/A/1");
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
@@ -221,8 +221,8 @@
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
{
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
- fibEntry->addOrUpdateNextHop(*this->localFace4, 10);
- fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 20);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->localFace4, 10);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 20);
auto interest = makeInterest("/localhost/A/1", false, nullopt, 1460);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
@@ -246,8 +246,8 @@
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
{
fib::Entry* fibEntry = this->fib.insert("/localhop/A").first;
- fibEntry->addOrUpdateNextHop(*this->localFace4, 10);
- fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 20);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->localFace4, 10);
+ this->fib.addOrUpdateNextHop(*fibEntry, *this->nonLocalFace2, 20);
auto interest = makeInterest("/localhop/A/1", 1377);
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index ce7bc26..3007f38 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -242,7 +242,8 @@
{
Forwarder& forwarder = this->getForwarder(i);
Fib& fib = forwarder.getFib();
- fib.insert(prefix).first->addOrUpdateNextHop(const_cast<Face&>(face), cost);
+ fib::Entry* entry = fib.insert(prefix).first;
+ fib.addOrUpdateNextHop(*entry, const_cast<Face&>(face), cost);
}
void