fw: eliminate fibEntry in Strategy API
Strategy::lookupFib can be used to obtain FIB entry.
FIB lookup is skipped when strategy does not need it.
refs #3205
Change-Id: Icba67229cbc261d9def44ffa91461ea4b09982b2
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index 00c059f..a3b2aba 100644
--- a/tests/daemon/fw/best-route-strategy2.t.cpp
+++ b/tests/daemon/fw/best-route-strategy2.t.cpp
@@ -89,7 +89,7 @@
// first Interest goes to nexthop with lowest FIB cost,
// however face1 is downstream so it cannot be used
pitEntry->insertOrUpdateInRecord(face1, *interest);
- strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
+ strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.back().outFaceId, face2->getId());
@@ -101,7 +101,7 @@
function<void()> periodicalRetxFrom4; // let periodicalRetxFrom4 lambda capture itself
periodicalRetxFrom4 = [&] {
pitEntry->insertOrUpdateInRecord(face4, *interest);
- strategy.afterReceiveInterest(*face4, *interest, fibEntry, pitEntry);
+ strategy.afterReceiveInterest(*face4, *interest, pitEntry);
size_t nSent = strategy.sendInterestHistory.size();
if (nSent > nSentLast) {
@@ -133,7 +133,7 @@
for (int i = 0; i < 3; ++i) {
this->advanceClocks(TICK, BestRouteStrategy2::RETX_SUPPRESSION_MAX * 2);
pitEntry->insertOrUpdateInRecord(face5, *interest);
- strategy.afterReceiveInterest(*face5, *interest, fibEntry, pitEntry);
+ strategy.afterReceiveInterest(*face5, *interest, pitEntry);
}
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 3);
BOOST_CHECK_NE(strategy.sendInterestHistory[0].outFaceId, face1->getId());
@@ -209,7 +209,7 @@
shared_ptr<fib::Entry> fibEntry = scenario.makeFibEntry(this);
- strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
+ strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory[0].pitEntry, pitEntry);
@@ -240,7 +240,7 @@
lp::Nack nack3 = makeNack("/McQYjMbm", 992, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
- strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+ strategy.afterReceiveNack(*face3, nack3, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 2);
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
@@ -269,13 +269,13 @@
lp::Nack nack3 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
- strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+ strategy.afterReceiveNack(*face3, nack3, pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0); // don't send Nack until all upstreams have Nacked
lp::Nack nack4 = makeNack("/aS9FAyUV19", 286, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
- strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+ strategy.afterReceiveNack(*face4, nack4, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
@@ -305,7 +305,7 @@
lp::Nack nack4 = makeNack("/sIYw0TXWDj", 223, lp::NackReason::CONGESTION);
pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
- strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+ strategy.afterReceiveNack(*face4, nack4, pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
}
@@ -442,13 +442,13 @@
lp::Nack nack3 = makeNack("/F6sEwB24I", 282, combination.getX());
pitEntry->getOutRecord(*face3)->setIncomingNack(nack3);
- strategy.afterReceiveNack(*face3, nack3, fibEntry, pitEntry);
+ strategy.afterReceiveNack(*face3, nack3, pitEntry);
BOOST_CHECK_EQUAL(strategy.sendNackHistory.size(), 0);
lp::Nack nack4 = makeNack("/F6sEwB24I", 282, combination.getY());
pitEntry->getOutRecord(*face4)->setIncomingNack(nack4);
- strategy.afterReceiveNack(*face4, nack4, fibEntry, pitEntry);
+ strategy.afterReceiveNack(*face4, nack4, pitEntry);
BOOST_REQUIRE_EQUAL(strategy.sendNackHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendNackHistory[0].pitEntry, pitEntry);
diff --git a/tests/daemon/fw/client-control-strategy.t.cpp b/tests/daemon/fw/client-control-strategy.t.cpp
index e180ec9..0305b47 100644
--- a/tests/daemon/fw/client-control-strategy.t.cpp
+++ b/tests/daemon/fw/client-control-strategy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -66,7 +66,7 @@
pitEntry1->insertOrUpdateInRecord(face4, *interest1);
strategy.sendInterestHistory.clear();
- strategy.afterReceiveInterest(*face4, *interest1, fibEntry, pitEntry1);
+ strategy.afterReceiveInterest(*face4, *interest1, pitEntry1);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[0].outFaceId, face1->getId());
@@ -76,7 +76,7 @@
pitEntry2->insertOrUpdateInRecord(face4, *interest2);
strategy.sendInterestHistory.clear();
- strategy.afterReceiveInterest(*face4, *interest2, fibEntry, pitEntry2);
+ strategy.afterReceiveInterest(*face4, *interest2, pitEntry2);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[0].outFaceId, face2->getId());
@@ -89,7 +89,7 @@
face3->close(); // face3 is closed and its FaceId becomes invalid
strategy.sendInterestHistory.clear();
strategy.rejectPendingInterestHistory.clear();
- strategy.afterReceiveInterest(*face4, *interest3, fibEntry, pitEntry3);
+ strategy.afterReceiveInterest(*face4, *interest3, pitEntry3);
BOOST_REQUIRE_EQUAL(strategy.sendInterestHistory.size(), 0);
BOOST_REQUIRE_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
}
diff --git a/tests/daemon/fw/dummy-strategy.hpp b/tests/daemon/fw/dummy-strategy.hpp
index 25623cb..ca6a858 100644
--- a/tests/daemon/fw/dummy-strategy.hpp
+++ b/tests/daemon/fw/dummy-strategy.hpp
@@ -55,13 +55,11 @@
virtual void
afterReceiveInterest(const Face& inFace,
const Interest& interest,
- shared_ptr<fib::Entry> fibEntry,
shared_ptr<pit::Entry> pitEntry) override
{
++afterReceiveInterest_count;
if (wantAfterReceiveInterestCalls) {
- afterReceiveInterestCalls.push_back(std::make_tuple(inFace.getId(), interest,
- fibEntry, pitEntry));
+ afterReceiveInterestCalls.emplace_back(inFace.getId(), interest, pitEntry);
}
if (interestOutFace) {
@@ -89,7 +87,6 @@
virtual void
afterReceiveNack(const Face& inFace,
const lp::Nack& nack,
- shared_ptr<fib::Entry> fibEntry,
shared_ptr<pit::Entry> pitEntry) override
{
++afterReceiveNack_count;
@@ -98,8 +95,7 @@
public:
int afterReceiveInterest_count;
bool wantAfterReceiveInterestCalls;
- std::vector<std::tuple<FaceId, Interest, shared_ptr<fib::Entry>,
- shared_ptr<pit::Entry>>> afterReceiveInterestCalls;
+ std::vector<std::tuple<FaceId, Interest, shared_ptr<pit::Entry>>> afterReceiveInterestCalls;
shared_ptr<Face> interestOutFace;
int beforeSatisfyInterest_count;
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index 3476cd3..5204821 100644
--- a/tests/daemon/fw/multicast-strategy.t.cpp
+++ b/tests/daemon/fw/multicast-strategy.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2016, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -62,7 +62,7 @@
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(face3, *interest);
- strategy.afterReceiveInterest(*face3, *interest, fibEntry, pitEntry);
+ strategy.afterReceiveInterest(*face3, *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 0);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 2);
std::set<FaceId> sentInterestFaceIds;
@@ -96,7 +96,7 @@
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(face1, *interest);
- strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
+ strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
}
@@ -119,7 +119,7 @@
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
pitEntry->insertOrUpdateInRecord(face1, *interest);
- strategy.afterReceiveInterest(*face1, *interest, fibEntry, pitEntry);
+ strategy.afterReceiveInterest(*face1, *interest, pitEntry);
BOOST_CHECK_EQUAL(strategy.rejectPendingInterestHistory.size(), 1);
BOOST_CHECK_EQUAL(strategy.sendInterestHistory.size(), 0);
}
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index fa42622..9fec06b 100644
--- a/tests/daemon/fw/ncc-strategy.t.cpp
+++ b/tests/daemon/fw/ncc-strategy.t.cpp
@@ -79,7 +79,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(interest1).first;
pitEntry1->insertOrUpdateInRecord(face3, interest1);
- strategy->afterReceiveInterest(*face3, interest1, fibEntry, pitEntry1);
+ strategy->afterReceiveInterest(*face3, interest1, pitEntry1);
// forwards to face1 because routing says it's best
// (no io run here: afterReceiveInterest has already sent the Interest)
@@ -104,7 +104,7 @@
shared_ptr<pit::Entry> pitEntry2 = pit.insert(interest2).first;
pitEntry2->insertOrUpdateInRecord(face3, interest2);
- strategy->afterReceiveInterest(*face3, interest2, fibEntry, pitEntry2);
+ strategy->afterReceiveInterest(*face3, interest2, pitEntry2);
// forwards to face2 because it responds previously
this->advanceClocks(time::milliseconds(1));
@@ -141,7 +141,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(face3, *interest1);
- strategy->afterReceiveInterest(*face3, *interest1, fibEntry, pitEntry1);
+ strategy->afterReceiveInterest(*face3, *interest1, pitEntry1);
this->advanceClocks(time::milliseconds(1));
BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
@@ -159,7 +159,7 @@
shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
pitEntry2->insertOrUpdateInRecord(face3, *interest2);
- strategy->afterReceiveInterest(*face3, *interest2, fibEntry, pitEntry2);
+ strategy->afterReceiveInterest(*face3, *interest2, pitEntry2);
// FIB entry is changed before doPropagate executes
fibEntry->addNextHop(face2, 20);
@@ -198,7 +198,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(face3, *interest1);
- strategy->afterReceiveInterest(*face3, *interest1, fibEntry, pitEntry1);
+ strategy->afterReceiveInterest(*face3, *interest1, pitEntry1);
limitedIo.run(2 - strategy->sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
@@ -220,7 +220,7 @@
shared_ptr<pit::Entry> pitEntry2 = pit.insert(*interest2).first;
pitEntry2->insertOrUpdateInRecord(face3, *interest2);
- strategy->afterReceiveInterest(*face3, *interest2, fibEntry, pitEntry2);
+ strategy->afterReceiveInterest(*face3, *interest2, pitEntry2);
limitedIo.run(3 - strategy->sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
@@ -257,7 +257,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(face1, *interest1);
- strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
+ strategy->afterReceiveInterest(*face1, *interest1, pitEntry1);
limitedIo.run(1 - strategy->sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);
@@ -273,7 +273,7 @@
// similar Interest: strategy should still forward it
pitEntry1->insertOrUpdateInRecord(face1, *interest1);
- strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
+ strategy->afterReceiveInterest(*face1, *interest1, pitEntry1);
limitedIo.run(2 - strategy->sendInterestHistory.size(),
time::milliseconds(2000), time::milliseconds(10));
BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 2);
@@ -307,7 +307,7 @@
shared_ptr<pit::Entry> pitEntry1 = pit.insert(*interest1).first;
pitEntry1->insertOrUpdateInRecord(face1, *interest1);
- strategy->afterReceiveInterest(*face1, *interest1, fibEntry, pitEntry1);
+ strategy->afterReceiveInterest(*face1, *interest1, pitEntry1);
// Interest shall go to face2, not loop back to face1
BOOST_REQUIRE_EQUAL(strategy->sendInterestHistory.size(), 1);