Revert "fib: add EndpointId field in NextHop record"
This reverts commit 3ad49db6eaef0d3f4a0a9bdd3356c6bb9845db57.
refs: #4973
Change-Id: I3216a55a8c4ed52cd9181f790f8ab72e44330a38
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);
}