Revert "fib: add EndpointId field in NextHop record"
This reverts commit 3ad49db6eaef0d3f4a0a9bdd3356c6bb9845db57.
refs: #4973
Change-Id: I3216a55a8c4ed52cd9181f790f8ab72e44330a38
diff --git a/tests/daemon/fw/best-route-strategy2.t.cpp b/tests/daemon/fw/best-route-strategy2.t.cpp
index e63951c..d8008f7 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, 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_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) {
diff --git a/tests/daemon/fw/forwarder.t.cpp b/tests/daemon/fw/forwarder.t.cpp
index a6d562a..4c2d8d0 100644
--- a/tests/daemon/fw/forwarder.t.cpp
+++ b/tests/daemon/fw/forwarder.t.cpp
@@ -50,7 +50,7 @@
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 @@
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 @@
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 @@
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 @@
});
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);
diff --git a/tests/daemon/fw/multicast-strategy.t.cpp b/tests/daemon/fw/multicast-strategy.t.cpp
index a44ba78..24027f0 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, 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(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;
diff --git a/tests/daemon/fw/ncc-strategy.t.cpp b/tests/daemon/fw/ncc-strategy.t.cpp
index d7172e3..c9a604b 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, 0, 10);
- fibEntry.addOrUpdateNextHop(*face2, 0, 20);
+ fibEntry.addOrUpdateNextHop(*face1, 10);
+ fibEntry.addOrUpdateNextHop(*face2, 20);
Pit& pit = forwarder.getPit();
@@ -118,7 +118,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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);
diff --git a/tests/daemon/fw/strategy-nack-return.t.cpp b/tests/daemon/fw/strategy-nack-return.t.cpp
index 2494710..41b59e2 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, 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 @@
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 @@
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 @@
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;
diff --git a/tests/daemon/fw/strategy-no-route.t.cpp b/tests/daemon/fw/strategy-no-route.t.cpp
index 43c57d0..d554d47 100644
--- a/tests/daemon/fw/strategy-no-route.t.cpp
+++ b/tests/daemon/fw/strategy-no-route.t.cpp
@@ -115,7 +115,7 @@
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 @@
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
}
};
diff --git a/tests/daemon/fw/strategy-scope-control.t.cpp b/tests/daemon/fw/strategy-scope-control.t.cpp
index 0214152..ec88374 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, 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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;
diff --git a/tests/daemon/fw/topology-tester.cpp b/tests/daemon/fw/topology-tester.cpp
index 067e2b7..ce7bc26 100644
--- a/tests/daemon/fw/topology-tester.cpp
+++ b/tests/daemon/fw/topology-tester.cpp
@@ -242,7 +242,7 @@
{
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
diff --git a/tests/daemon/mgmt/fib-manager.t.cpp b/tests/daemon/mgmt/fib-manager.t.cpp
index 0918aaf..6a0ab6c 100644
--- a/tests/daemon/mgmt/fib-manager.t.cpp
+++ b/tests/daemon/mgmt/fib-manager.t.cpp
@@ -301,9 +301,9 @@
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 @@
};
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 @@
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 @@
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));
diff --git a/tests/daemon/table/cleanup.t.cpp b/tests/daemon/table/cleanup.t.cpp
index 25405a6..911de1c 100644
--- a/tests/daemon/table/cleanup.t.cpp
+++ b/tests/daemon/table/cleanup.t.cpp
@@ -49,7 +49,7 @@
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_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 ----
diff --git a/tests/daemon/table/fib.t.cpp b/tests/daemon/table/fib.t.cpp
index 6e83a95..33cbdfe 100644
--- a/tests/daemon/table/fib.t.cpp
+++ b/tests/daemon/table/fib.t.cpp
@@ -52,138 +52,71 @@
// []
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);
}