Revert "fib: add EndpointId field in NextHop record"
This reverts commit 3ad49db6ea.
refs: #4973
Change-Id: I3216a55a8c4ed52cd9181f790f8ab72e44330a38
This commit is contained in:
1 parent
9aafc2a086
commit
6be9387a4f
21 files changed
+124
-233
No files matched your search
@@ -129,7 +129,7 @@ AccessStrategy::sendToLastNexthop(const FaceEndpoint& ingress, const Interest& i
|
||||
}
|
||||
|
||||
Face* outFace = this->getFace(mi.lastNexthop);
|
||||
if (outFace == nullptr || !fibEntry.hasNextHop(*outFace, 0)) {
|
||||
if (outFace == nullptr || !fibEntry.hasNextHop(*outFace)) {
|
||||
NFD_LOG_DEBUG(pitEntry->getInterest() << " last-nexthop-gone");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ NccStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& i
|
||||
size_t nUpstreams = nexthops.size();
|
||||
|
||||
shared_ptr<Face> bestFace = meInfo.getBestFace();
|
||||
if (bestFace != nullptr && fibEntry.hasNextHop(*bestFace, 0) &&
|
||||
if (bestFace != nullptr && fibEntry.hasNextHop(*bestFace) &&
|
||||
!wouldViolateScope(ingress.face, interest, *bestFace) &&
|
||||
canForwardToLegacy(*pitEntry, *bestFace)) {
|
||||
// TODO Should we use `randlow = 100 + nrand48(h->seed) % 4096U;` ?
|
||||
@@ -112,7 +112,7 @@ NccStrategy::afterReceiveInterest(const FaceEndpoint& ingress, const Interest& i
|
||||
}
|
||||
|
||||
shared_ptr<Face> previousFace = meInfo.previousFace.lock();
|
||||
if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace, 0) &&
|
||||
if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
|
||||
!wouldViolateScope(ingress.face, interest, *previousFace) &&
|
||||
canForwardToLegacy(*pitEntry, *previousFace)) {
|
||||
--nUpstreams;
|
||||
@@ -158,7 +158,7 @@ NccStrategy::doPropagate(FaceId inFaceId, weak_ptr<pit::Entry> pitEntryWeak)
|
||||
MeasurementsEntryInfo& meInfo = this->getMeasurementsEntryInfo(pitEntry);
|
||||
|
||||
shared_ptr<Face> previousFace = meInfo.previousFace.lock();
|
||||
if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace, 0) &&
|
||||
if (previousFace != nullptr && fibEntry.hasNextHop(*previousFace) &&
|
||||
!wouldViolateScope(*inFace, interest, *previousFace) &&
|
||||
canForwardToLegacy(*pitEntry, *previousFace)) {
|
||||
this->sendInterest(pitEntry, FaceEndpoint(*previousFace, 0), interest);
|
||||
|
||||
@@ -77,7 +77,7 @@ FibManager::addNextHop(const Name& topPrefix, const Interest& interest,
|
||||
}
|
||||
|
||||
fib::Entry* entry = m_fib.insert(prefix).first;
|
||||
entry->addOrUpdateNextHop(*face, 0, cost);
|
||||
entry->addOrUpdateNextHop(*face, cost);
|
||||
|
||||
NFD_LOG_TRACE("fib/add-nexthop(" << prefix << ',' << faceId << ',' << cost << "): OK");
|
||||
return done(ControlResponse(200, "Success").setBody(parameters.wireEncode()));
|
||||
@@ -106,7 +106,7 @@ FibManager::removeNextHop(const Name& topPrefix, const Interest& interest,
|
||||
return;
|
||||
}
|
||||
|
||||
entry->removeNextHop(*face, 0);
|
||||
entry->removeNextHop(*face);
|
||||
if (!entry->hasNextHops()) {
|
||||
m_fib.erase(*entry);
|
||||
NFD_LOG_TRACE("fib/remove-nexthop(" << prefix << ',' << faceId << "): OK entry-erased");
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ Nfd::initializeManagement()
|
||||
|
||||
// add FIB entry for NFD Management Protocol
|
||||
Name topPrefix("/localhost/nfd");
|
||||
m_forwarder->getFib().insert(topPrefix).first->addOrUpdateNextHop(*m_internalFace, 0, 0);
|
||||
m_forwarder->getFib().insert(topPrefix).first->addOrUpdateNextHop(*m_internalFace, 0);
|
||||
m_dispatcher->addTopPrefix(topPrefix, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ cleanupOnFaceRemoval(NameTree& nt, Fib& fib, Pit& pit, const Face& face)
|
||||
for (const name_tree::Entry& nte : nt) {
|
||||
fib::Entry* fibEntry = nte.getFibEntry();
|
||||
if (fibEntry != nullptr) {
|
||||
fib.removeNextHopByFace(*fibEntry, face);
|
||||
fib.removeNextHop(*fibEntry, face);
|
||||
}
|
||||
|
||||
for (const auto& pitEntry : nte.getPitEntries()) {
|
||||
|
||||
+11
-20
@@ -34,51 +34,42 @@ Entry::Entry(const Name& prefix)
|
||||
}
|
||||
|
||||
NextHopList::iterator
|
||||
Entry::findNextHop(const Face& face, EndpointId endpointId)
|
||||
Entry::findNextHop(const Face& face)
|
||||
{
|
||||
return std::find_if(m_nextHops.begin(), m_nextHops.end(),
|
||||
[&face, endpointId] (const NextHop& nexthop) {
|
||||
return &nexthop.getFace() == &face && nexthop.getEndpointId() == endpointId;
|
||||
[&face] (const NextHop& nexthop) {
|
||||
return &nexthop.getFace() == &face;
|
||||
});
|
||||
}
|
||||
|
||||
bool
|
||||
Entry::hasNextHop(const Face& face, EndpointId endpointId) const
|
||||
Entry::hasNextHop(const Face& face) const
|
||||
{
|
||||
return const_cast<Entry*>(this)->findNextHop(face, endpointId) != m_nextHops.end();
|
||||
return const_cast<Entry*>(this)->findNextHop(face) != m_nextHops.end();
|
||||
}
|
||||
|
||||
void
|
||||
Entry::addOrUpdateNextHop(Face& face, EndpointId endpointId, uint64_t cost)
|
||||
Entry::addOrUpdateNextHop(Face& face, uint64_t cost)
|
||||
{
|
||||
auto it = this->findNextHop(face, endpointId);
|
||||
auto it = this->findNextHop(face);
|
||||
if (it == m_nextHops.end()) {
|
||||
m_nextHops.emplace_back(face, endpointId);
|
||||
m_nextHops.emplace_back(face);
|
||||
it = std::prev(m_nextHops.end());
|
||||
}
|
||||
|
||||
it->setCost(cost);
|
||||
this->sortNextHops();
|
||||
}
|
||||
|
||||
void
|
||||
Entry::removeNextHop(const Face& face, EndpointId endpointId)
|
||||
Entry::removeNextHop(const Face& face)
|
||||
{
|
||||
auto it = this->findNextHop(face, endpointId);
|
||||
auto it = this->findNextHop(face);
|
||||
if (it != m_nextHops.end()) {
|
||||
m_nextHops.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Entry::removeNextHopByFace(const Face& face)
|
||||
{
|
||||
auto it = std::remove_if(m_nextHops.begin(), m_nextHops.end(),
|
||||
[&face] (const NextHop& nexthop) {
|
||||
return &nexthop.getFace() == &face;
|
||||
});
|
||||
m_nextHops.erase(it, m_nextHops.end());
|
||||
}
|
||||
|
||||
void
|
||||
Entry::sortNextHops()
|
||||
{
|
||||
|
||||
+10
-14
@@ -74,36 +74,32 @@ public:
|
||||
return !m_nextHops.empty();
|
||||
}
|
||||
|
||||
/** \return whether there is a NextHop record for \p face with the given \p endpointId
|
||||
/** \return whether there is a NextHop record for \p face
|
||||
*/
|
||||
bool
|
||||
hasNextHop(const Face& face, EndpointId endpointId) const;
|
||||
hasNextHop(const Face& face) const;
|
||||
|
||||
/** \brief adds a NextHop record
|
||||
*
|
||||
* If a NextHop record for \p face and \p endpointId already exists,
|
||||
* its cost is updated.
|
||||
* If a NextHop record for \p face already exists, its cost is updated.
|
||||
*/
|
||||
void
|
||||
addOrUpdateNextHop(Face& face, EndpointId endpointId, uint64_t cost);
|
||||
addOrUpdateNextHop(Face& face, uint64_t cost);
|
||||
|
||||
/** \brief removes the NextHop record for \p face with the given \p endpointId
|
||||
/** \brief removes a NextHop record
|
||||
*
|
||||
* If no NextHop record for face exists, do nothing.
|
||||
*/
|
||||
void
|
||||
removeNextHop(const Face& face, EndpointId endpointId);
|
||||
|
||||
/** \brief removes all NextHop records on \p face for any \p endpointId
|
||||
*/
|
||||
void
|
||||
removeNextHopByFace(const Face& face);
|
||||
removeNextHop(const Face& face);
|
||||
|
||||
private:
|
||||
/** \note This method is non-const because mutable iterators are needed by callers.
|
||||
*/
|
||||
NextHopList::iterator
|
||||
findNextHop(const Face& face, EndpointId endpointId);
|
||||
findNextHop(const Face& face);
|
||||
|
||||
/** \brief sorts the nexthop list by cost
|
||||
/** \brief sorts the nexthop list
|
||||
*/
|
||||
void
|
||||
sortNextHops();
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace fib {
|
||||
class NextHop
|
||||
{
|
||||
public:
|
||||
NextHop(Face& face, EndpointId endpointId)
|
||||
explicit
|
||||
NextHop(Face& face)
|
||||
: m_face(&face)
|
||||
, m_endpointId(endpointId)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -49,12 +49,6 @@ public:
|
||||
return *m_face;
|
||||
}
|
||||
|
||||
EndpointId
|
||||
getEndpointId() const
|
||||
{
|
||||
return m_endpointId;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
getCost() const
|
||||
{
|
||||
@@ -69,7 +63,6 @@ public:
|
||||
|
||||
private:
|
||||
Face* m_face; // pointer instead of reference so that NextHop is movable
|
||||
EndpointId m_endpointId;
|
||||
uint64_t m_cost = 0;
|
||||
};
|
||||
|
||||
|
||||
+3
-15
@@ -133,28 +133,16 @@ Fib::erase(const Entry& entry)
|
||||
}
|
||||
|
||||
void
|
||||
Fib::eraseIfEmpty(Entry& entry)
|
||||
Fib::removeNextHop(Entry& entry, const Face& face)
|
||||
{
|
||||
entry.removeNextHop(face);
|
||||
|
||||
if (!entry.hasNextHops()) {
|
||||
name_tree::Entry* nte = m_nameTree.getEntry(entry);
|
||||
this->erase(nte, false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Fib::removeNextHop(Entry& entry, const Face& face, EndpointId endpointId)
|
||||
{
|
||||
entry.removeNextHop(face, endpointId);
|
||||
this->eraseIfEmpty(entry);
|
||||
}
|
||||
|
||||
void
|
||||
Fib::removeNextHopByFace(Entry& entry, const Face& face)
|
||||
{
|
||||
entry.removeNextHopByFace(face);
|
||||
this->eraseIfEmpty(entry);
|
||||
}
|
||||
|
||||
Fib::Range
|
||||
Fib::getRange() const
|
||||
{
|
||||
|
||||
+2
-12
@@ -103,15 +103,10 @@ public: // mutation
|
||||
void
|
||||
erase(const Entry& entry);
|
||||
|
||||
/** \brief Remove the NextHop record for the given \p face and \p endpointId
|
||||
/** \brief Remove the NextHop record for \p face
|
||||
*/
|
||||
void
|
||||
removeNextHop(Entry& entry, const Face& face, EndpointId endpointId);
|
||||
|
||||
/** \brief Remove all NextHop records for \p face
|
||||
*/
|
||||
void
|
||||
removeNextHopByFace(Entry& entry, const Face& face);
|
||||
removeNextHop(Entry& entry, const Face& face);
|
||||
|
||||
public: // enumeration
|
||||
typedef boost::transformed_range<name_tree::GetTableEntry<Entry>, const name_tree::Range> Range;
|
||||
@@ -147,11 +142,6 @@ private:
|
||||
void
|
||||
erase(name_tree::Entry* nte, bool canDeleteNte = true);
|
||||
|
||||
/** \brief Erase \p entry if it contains no nexthop records
|
||||
*/
|
||||
void
|
||||
eraseIfEmpty(Entry& entry);
|
||||
|
||||
Range
|
||||
getRange() const;
|
||||
|
||||
|
||||
@@ -77,9 +77,9 @@ BOOST_FIXTURE_TEST_SUITE(TestBestRouteStrategy2, BestRouteStrategy2Fixture)
|
||||
BOOST_AUTO_TEST_CASE(Forward)
|
||||
{
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face3, 0, 30);
|
||||
fibEntry.addOrUpdateNextHop(*face1, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face3, 30);
|
||||
|
||||
shared_ptr<Interest> interest = makeInterest("ndn:/BzgFBchqA");
|
||||
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
|
||||
@@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(Forward)
|
||||
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[4].outFaceId, face1->getId());
|
||||
BOOST_CHECK_EQUAL(strategy.sendInterestHistory[5].outFaceId, face3->getId());
|
||||
|
||||
fibEntry.removeNextHop(*face1, 0);
|
||||
fibEntry.removeNextHop(*face1);
|
||||
|
||||
strategy.sendInterestHistory.clear();
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
|
||||
@@ -50,7 +50,7 @@ BOOST_AUTO_TEST_CASE(SimpleExchange)
|
||||
forwarder.addFace(face2);
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0, 0);
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0);
|
||||
|
||||
BOOST_CHECK_EQUAL(forwarder.getCounters().nInInterests, 0);
|
||||
BOOST_CHECK_EQUAL(forwarder.getCounters().nOutInterests, 0);
|
||||
@@ -91,7 +91,7 @@ BOOST_AUTO_TEST_CASE(CsMatched)
|
||||
forwarder.addFace(face3);
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0, 0);
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0);
|
||||
|
||||
Pit& pit = forwarder.getPit();
|
||||
BOOST_CHECK_EQUAL(pit.size(), 0);
|
||||
@@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(NextHopFaceId)
|
||||
forwarder.addFace(face3);
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face3, 0, 0);
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face3, 0);
|
||||
|
||||
auto interest = makeInterest("/A/B");
|
||||
interest->setTag(make_shared<lp::NextHopFaceIdTag>(face2->getId()));
|
||||
@@ -485,7 +485,7 @@ BOOST_AUTO_TEST_CASE(InterestLoopNack)
|
||||
forwarder.addFace(face4);
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib.insert("/zT4XwK0Hnx").first->addOrUpdateNextHop(*face4, 0, 0);
|
||||
fib.insert("/zT4XwK0Hnx").first->addOrUpdateNextHop(*face4, 0);
|
||||
|
||||
// receive Interest on face1
|
||||
face1->sentNacks.clear();
|
||||
@@ -537,7 +537,7 @@ BOOST_AUTO_TEST_CASE(InterestLoopWithShortLifetime) // Bug 1953
|
||||
});
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0, 0);
|
||||
fib.insert("/A").first->addOrUpdateNextHop(*face2, 0);
|
||||
|
||||
// receive an Interest
|
||||
auto interest = makeInterest("/A/1", false, 50_ms, 82101183);
|
||||
|
||||
@@ -69,9 +69,9 @@ BOOST_FIXTURE_TEST_SUITE(TestMulticastStrategy, MulticastStrategyFixture)
|
||||
BOOST_AUTO_TEST_CASE(Forward2)
|
||||
{
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0, 0);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0, 0);
|
||||
fibEntry.addOrUpdateNextHop(*face3, 0, 0);
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0);
|
||||
fibEntry.addOrUpdateNextHop(*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(Forward2)
|
||||
BOOST_AUTO_TEST_CASE(RejectLoopback)
|
||||
{
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0, 0);
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0);
|
||||
|
||||
shared_ptr<Interest> interest = makeInterest("ndn:/H0D6i5fc");
|
||||
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
|
||||
|
||||
@@ -59,8 +59,8 @@ BOOST_AUTO_TEST_CASE(FavorRespondingUpstream)
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face1, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 20);
|
||||
|
||||
Pit& pit = forwarder.getPit();
|
||||
|
||||
@@ -118,7 +118,7 @@ BOOST_AUTO_TEST_CASE(Bug1853)
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face1, 10);
|
||||
|
||||
Pit& pit = forwarder.getPit();
|
||||
|
||||
@@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(Bug1853)
|
||||
strategy.afterReceiveInterest(FaceEndpoint(*face3, 0), *interest2, pitEntry2);
|
||||
|
||||
// FIB entry is changed before doPropagate executes
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 20);
|
||||
this->advanceClocks(10_ms, 1_s);// should not crash
|
||||
}
|
||||
|
||||
@@ -169,8 +169,8 @@ BOOST_AUTO_TEST_CASE(Bug1961)
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face1, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 20);
|
||||
|
||||
Pit& pit = forwarder.getPit();
|
||||
|
||||
@@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(Bug1971)
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face2, 10);
|
||||
|
||||
Pit& pit = forwarder.getPit();
|
||||
|
||||
@@ -265,8 +265,8 @@ BOOST_AUTO_TEST_CASE(Bug1998)
|
||||
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face1, 0, 10); // face1 is top-ranked nexthop
|
||||
fibEntry.addOrUpdateNextHop(*face2, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face1, 10); // face1 is top-ranked nexthop
|
||||
fibEntry.addOrUpdateNextHop(*face2, 20);
|
||||
|
||||
Pit& pit = forwarder.getPit();
|
||||
|
||||
@@ -368,7 +368,7 @@ BOOST_AUTO_TEST_CASE(PredictionAdjustment) // Bug 3411
|
||||
// NccStrategy has selected one path as the best.
|
||||
// When we reduce the RTT of the other path, ideally it should be selected as the best face.
|
||||
// However, this won't happen due to a weakness in NccStrategy.
|
||||
// See https://redmine.named-data.net/issues/3411#note-4
|
||||
// See https://redmine.named-data.net/issues/3411#note-4
|
||||
shared_ptr<Face> bestFace1 = getMeInfo()->bestFace.lock();
|
||||
if (bestFace1.get() == &linkAB->getFace(nodeA)) {
|
||||
linkCD->setDelay(5_ms);
|
||||
|
||||
@@ -93,9 +93,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(OneUpstream,
|
||||
S, Strategies, StrategyNackReturnFixture<S>)
|
||||
{
|
||||
fib::Entry& fibEntry = *this->fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*this->face3, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*this->face4, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*this->face5, 0, 30);
|
||||
fibEntry.addOrUpdateNextHop(*this->face3, 10);
|
||||
fibEntry.addOrUpdateNextHop(*this->face4, 20);
|
||||
fibEntry.addOrUpdateNextHop(*this->face5, 30);
|
||||
|
||||
auto interest1 = makeInterest("/McQYjMbm", false, nullopt, 992);
|
||||
auto interest2 = makeInterest("/McQYjMbm", false, nullopt, 114);
|
||||
@@ -128,9 +128,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(TwoUpstreams,
|
||||
S, Strategies, StrategyNackReturnFixture<S>)
|
||||
{
|
||||
fib::Entry& fibEntry = *this->fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*this->face3, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*this->face4, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*this->face5, 0, 30);
|
||||
fibEntry.addOrUpdateNextHop(*this->face3, 10);
|
||||
fibEntry.addOrUpdateNextHop(*this->face4, 20);
|
||||
fibEntry.addOrUpdateNextHop(*this->face5, 30);
|
||||
|
||||
auto interest1 = makeInterest("/aS9FAyUV19", 286);
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
|
||||
@@ -161,9 +161,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(Timeout,
|
||||
S, Strategies, StrategyNackReturnFixture<S>)
|
||||
{
|
||||
fib::Entry& fibEntry = *this->fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*this->face3, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*this->face4, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*this->face5, 0, 30);
|
||||
fibEntry.addOrUpdateNextHop(*this->face3, 10);
|
||||
fibEntry.addOrUpdateNextHop(*this->face4, 20);
|
||||
fibEntry.addOrUpdateNextHop(*this->face5, 30);
|
||||
|
||||
auto interest1 = makeInterest("/sIYw0TXWDj", false, 400_ms, 115);
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest1).first;
|
||||
@@ -313,9 +313,9 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(CombineReasons, Combination, NackReasonCombinat
|
||||
StrategyNackReturnFixture<BestRouteStrategy2>)
|
||||
{
|
||||
fib::Entry& fibEntry = *fib.insert(Name()).first;
|
||||
fibEntry.addOrUpdateNextHop(*face3, 0, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face4, 0, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face5, 0, 30);
|
||||
fibEntry.addOrUpdateNextHop(*face3, 10);
|
||||
fibEntry.addOrUpdateNextHop(*face4, 20);
|
||||
fibEntry.addOrUpdateNextHop(*face5, 30);
|
||||
|
||||
auto interest1 = makeInterest("/F6sEwB24I", false, nullopt, 282);
|
||||
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest1).first;
|
||||
|
||||
@@ -115,7 +115,7 @@ public:
|
||||
void
|
||||
insertFibEntry(StrategyNoRouteFixture<S>* fixture)
|
||||
{
|
||||
fixture->fib.insert(Name()).first->addOrUpdateNextHop(*fixture->face1, 0, 10);
|
||||
fixture->fib.insert(Name()).first->addOrUpdateNextHop(*fixture->face1, 10);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -132,7 +132,7 @@ public:
|
||||
void
|
||||
insertFibEntry(StrategyNoRouteFixture<S>* fixture)
|
||||
{
|
||||
fixture->fib.insert("/localhop").first->addOrUpdateNextHop(*fixture->face2, 0, 10);
|
||||
fixture->fib.insert("/localhop").first->addOrUpdateNextHop(*fixture->face2, 10);
|
||||
// face1 and face2 are both non-local; Interest from face1 cannot be forwarded to face2
|
||||
}
|
||||
};
|
||||
|
||||
@@ -116,7 +116,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToLocal,
|
||||
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
|
||||
{
|
||||
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 10);
|
||||
|
||||
auto interest = makeInterest("/localhost/A/1");
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
|
||||
@@ -135,7 +135,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToNonLocal,
|
||||
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
|
||||
{
|
||||
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
|
||||
|
||||
auto interest = makeInterest("/localhost/A/1");
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
|
||||
@@ -157,8 +157,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostInterestToLocalAndNonLocal,
|
||||
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
|
||||
{
|
||||
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 20);
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 20);
|
||||
|
||||
auto interest = makeInterest("/localhost/A/1");
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
|
||||
@@ -178,7 +178,7 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopInterestToNonLocal,
|
||||
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
|
||||
{
|
||||
fib::Entry* fibEntry = this->fib.insert("/localhop/A").first;
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
|
||||
|
||||
auto interest = makeInterest("/localhop/A/1");
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
|
||||
@@ -200,8 +200,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopInterestToNonLocalAndLocal,
|
||||
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
|
||||
{
|
||||
fib::Entry* fibEntry = this->fib.insert("/localhop/A").first;
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 20);
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 20);
|
||||
|
||||
auto interest = makeInterest("/localhop/A/1");
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
|
||||
@@ -221,8 +221,8 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhostNackToNonLocal,
|
||||
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
|
||||
{
|
||||
fib::Entry* fibEntry = this->fib.insert("/localhost/A").first;
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 20);
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 10);
|
||||
fibEntry->addOrUpdateNextHop(*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 @@ BOOST_FIXTURE_TEST_CASE_TEMPLATE(LocalhopNackToNonLocal,
|
||||
T, Tests, StrategyScopeControlFixture<typename T::Strategy>)
|
||||
{
|
||||
fib::Entry* fibEntry = this->fib.insert("/localhop/A").first;
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 0, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 0, 20);
|
||||
fibEntry->addOrUpdateNextHop(*this->localFace4, 10);
|
||||
fibEntry->addOrUpdateNextHop(*this->nonLocalFace2, 20);
|
||||
|
||||
auto interest = makeInterest("/localhop/A/1", 1377);
|
||||
shared_ptr<pit::Entry> pitEntry = this->pit.insert(*interest).first;
|
||||
|
||||
@@ -242,7 +242,7 @@ TopologyTester::registerPrefix(TopologyNode i, const Face& face, const Name& pre
|
||||
{
|
||||
Forwarder& forwarder = this->getForwarder(i);
|
||||
Fib& fib = forwarder.getFib();
|
||||
fib.insert(prefix).first->addOrUpdateNextHop(const_cast<Face&>(face), 0, cost);
|
||||
fib.insert(prefix).first->addOrUpdateNextHop(const_cast<Face&>(face), cost);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -301,9 +301,9 @@ BOOST_AUTO_TEST_CASE(Basic)
|
||||
BOOST_REQUIRE_NE(face3, face::INVALID_FACEID);
|
||||
|
||||
fib::Entry* entry = m_fib.insert("/hello").first;
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face1), 0, 101);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face2), 0, 202);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face3), 0, 303);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face1), 101);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face2), 202);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face3), 303);
|
||||
|
||||
testRemoveNextHop(makeParameters("/hello", face1));
|
||||
BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
|
||||
@@ -354,8 +354,8 @@ BOOST_AUTO_TEST_CASE(ImplicitFaceId)
|
||||
};
|
||||
|
||||
fib::Entry* entry = m_fib.insert("/hello").first;
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face1), 0, 101);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face2), 0, 202);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face1), 101);
|
||||
entry->addOrUpdateNextHop(*m_faceTable.get(face2), 202);
|
||||
|
||||
testWithImplicitFaceId(ControlParameters().setName("/hello").setFaceId(0), face1);
|
||||
BOOST_REQUIRE_EQUAL(m_responses.size(), 1);
|
||||
@@ -385,7 +385,7 @@ BOOST_AUTO_TEST_CASE(RecordNotExist)
|
||||
receiveInterest(req);
|
||||
};
|
||||
|
||||
m_fib.insert("/hello").first->addOrUpdateNextHop(*m_faceTable.get(face1), 0, 101);
|
||||
m_fib.insert("/hello").first->addOrUpdateNextHop(*m_faceTable.get(face1), 101);
|
||||
|
||||
testRemoveNextHop(makeParameters("/hello", face2 + 100));
|
||||
BOOST_REQUIRE_EQUAL(m_responses.size(), 1); // face does not exist
|
||||
@@ -410,8 +410,8 @@ BOOST_AUTO_TEST_CASE(FibDataset)
|
||||
Name prefix = Name("test").appendSegment(i);
|
||||
actualPrefixes.insert(prefix);
|
||||
fib::Entry* fibEntry = m_fib.insert(prefix).first;
|
||||
fibEntry->addOrUpdateNextHop(*m_faceTable.get(addFace()), 0, std::numeric_limits<uint8_t>::max() - 1);
|
||||
fibEntry->addOrUpdateNextHop(*m_faceTable.get(addFace()), 0, std::numeric_limits<uint8_t>::max() - 2);
|
||||
fibEntry->addOrUpdateNextHop(*m_faceTable.get(addFace()), std::numeric_limits<uint8_t>::max() - 1);
|
||||
fibEntry->addOrUpdateNextHop(*m_faceTable.get(addFace()), std::numeric_limits<uint8_t>::max() - 2);
|
||||
}
|
||||
|
||||
receiveInterest(Interest("/localhost/nfd/fib/list").setCanBePrefix(true));
|
||||
|
||||
@@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(Basic)
|
||||
Name name = Name("/P").appendVersion(i);
|
||||
|
||||
fib::Entry* fibEntry = fib.insert(name).first;
|
||||
fibEntry->addOrUpdateNextHop(*face1, 0, 0);
|
||||
fibEntry->addOrUpdateNextHop(*face1, 0);
|
||||
|
||||
shared_ptr<Interest> interest = makeInterest(name);
|
||||
shared_ptr<pit::Entry> pitEntry = pit.insert(*interest).first;
|
||||
@@ -88,24 +88,24 @@ BOOST_AUTO_TEST_CASE(RemoveFibNexthops)
|
||||
BOOST_CHECK_EQUAL(fib.size(), 0);
|
||||
|
||||
fib::Entry* entryA = fib.insert("/A").first;
|
||||
entryA->addOrUpdateNextHop(*face1, 0, 0);
|
||||
entryA->addOrUpdateNextHop(*face2, 0, 0);
|
||||
entryA->addOrUpdateNextHop(*face1, 0);
|
||||
entryA->addOrUpdateNextHop(*face2, 0);
|
||||
// {'/A':[1,2]}
|
||||
|
||||
fib::Entry* entryB = fib.insert("/B").first;
|
||||
entryB->addOrUpdateNextHop(*face1, 0, 0);
|
||||
entryB->addOrUpdateNextHop(*face1, 0);
|
||||
// {'/A':[1,2], '/B':[1]}
|
||||
|
||||
fib::Entry* entryC = fib.insert("/C").first;
|
||||
entryC->addOrUpdateNextHop(*face2, 0, 1);
|
||||
entryC->addOrUpdateNextHop(*face2, 1);
|
||||
// {'/A':[1,2], '/B':[1], '/C':[2]}
|
||||
|
||||
fib::Entry* entryB1 = fib.insert("/B/1").first;
|
||||
entryB1->addOrUpdateNextHop(*face1, 0, 0);
|
||||
entryB1->addOrUpdateNextHop(*face1, 0);
|
||||
// {'/A':[1,2], '/B':[1], '/B/1':[1], '/C':[2]}
|
||||
|
||||
fib::Entry* entryB12 = fib.insert("/B/1/2").first;
|
||||
entryB12->addOrUpdateNextHop(*face1, 0, 0);
|
||||
entryB12->addOrUpdateNextHop(*face1, 0);
|
||||
// {'/A':[1,2], '/B':[1], '/B/1':[1], '/B/1/2':[1], '/C':[2]}
|
||||
|
||||
// ---- close face1 ----
|
||||
|
||||
@@ -52,138 +52,71 @@ BOOST_AUTO_TEST_CASE(FibEntry)
|
||||
// []
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 0);
|
||||
|
||||
// [(face, cost, endpointId)]
|
||||
entry.addOrUpdateNextHop(*face1, 200, 20);
|
||||
// [(face1,200,20)]
|
||||
entry.addOrUpdateNextHop(*face1, 20);
|
||||
// [(face1,20)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 1);
|
||||
BOOST_CHECK_EQUAL(&entry.getNextHops().begin()->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getEndpointId(), 200);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getCost(), 20);
|
||||
|
||||
entry.addOrUpdateNextHop(*face1, 300, 30);
|
||||
// [(face1,200,20), (face1,300,30)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 2);
|
||||
entry.addOrUpdateNextHop(*face1, 30);
|
||||
// [(face1,30)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 1);
|
||||
BOOST_CHECK_EQUAL(&entry.getNextHops().begin()->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getEndpointId(), 200);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getCost(), 20);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getCost(), 30);
|
||||
|
||||
entry.addOrUpdateNextHop(*face2, 400, 40);
|
||||
// [(face1,200,20), (face1,300,30), (face2,400,40)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 3);
|
||||
entry.addOrUpdateNextHop(*face2, 40);
|
||||
// [(face1,30), (face2,40)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 2);
|
||||
{
|
||||
NextHopList::const_iterator it = entry.getNextHops().begin();
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 200);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 20);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 300);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 30);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face2.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 400);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 40);
|
||||
|
||||
++it;
|
||||
BOOST_CHECK(it == entry.getNextHops().end());
|
||||
}
|
||||
|
||||
entry.addOrUpdateNextHop(*face2, 100, 10);
|
||||
// [(face2,100,10), (face1,200,20), (face1,300,30), (face2,400,40)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 4);
|
||||
entry.addOrUpdateNextHop(*face2, 10);
|
||||
// [(face2,10), (face1,30)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 2);
|
||||
{
|
||||
NextHopList::const_iterator it = entry.getNextHops().begin();
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face2.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 100);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 10);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 200);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 20);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 300);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 30);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face2.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 400);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 40);
|
||||
|
||||
++it;
|
||||
BOOST_CHECK(it == entry.getNextHops().end());
|
||||
}
|
||||
|
||||
entry.addOrUpdateNextHop(*face1, 200, 50);
|
||||
// [(face2,100,10), (face1,300,30), (face2,400,40), (face1,200,50)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 4);
|
||||
{
|
||||
NextHopList::const_iterator it = entry.getNextHops().begin();
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face2.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 100);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 10);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 300);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 30);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face2.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 400);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 40);
|
||||
|
||||
++it;
|
||||
BOOST_REQUIRE(it != entry.getNextHops().end());
|
||||
BOOST_CHECK_EQUAL(&it->getFace(), face1.get());
|
||||
BOOST_CHECK_EQUAL(it->getEndpointId(), 200);
|
||||
BOOST_CHECK_EQUAL(it->getCost(), 50);
|
||||
|
||||
++it;
|
||||
BOOST_CHECK(it == entry.getNextHops().end());
|
||||
}
|
||||
|
||||
entry.removeNextHop(*face1, 200);
|
||||
// [(face2,100,10), (face1,300,30), (face2,400,40)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 3);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getFace().getId(), face2->getId());
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getEndpointId(), 100);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getCost(), 10);
|
||||
|
||||
entry.removeNextHop(*face1, 200);
|
||||
// [(face2,100,10), (face1,300,30), (face2,400,40)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 3);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getFace().getId(), face2->getId());
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getEndpointId(), 100);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getCost(), 10);
|
||||
|
||||
entry.removeNextHop(*face2,100);
|
||||
// [(face1,300,30), (face2,400,40)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 2);
|
||||
|
||||
entry.removeNextHop(*face2,400);
|
||||
// [(face1,300,30)]
|
||||
entry.removeNextHop(*face1);
|
||||
// [(face2,10)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 1);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getFace().getId(), face2->getId());
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getCost(), 10);
|
||||
|
||||
entry.removeNextHop(*face1,300);
|
||||
entry.removeNextHop(*face1);
|
||||
// [(face2,10)]
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 1);
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getFace().getId(), face2->getId());
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().begin()->getCost(), 10);
|
||||
|
||||
entry.removeNextHop(*face2);
|
||||
// []
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 0);
|
||||
|
||||
entry.removeNextHop(*face1,300);
|
||||
entry.removeNextHop(*face2);
|
||||
// []
|
||||
BOOST_CHECK_EQUAL(entry.getNextHops().size(), 0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user