Revert "fib: add EndpointId field in NextHop record"
This reverts commit 3ad49db6eaef0d3f4a0a9bdd3356c6bb9845db57.
refs: #4973
Change-Id: I3216a55a8c4ed52cd9181f790f8ab72e44330a38
diff --git a/daemon/table/fib-entry.cpp b/daemon/table/fib-entry.cpp
index bb49979..ff5c125 100644
--- a/daemon/table/fib-entry.cpp
+++ b/daemon/table/fib-entry.cpp
@@ -34,52 +34,43 @@
}
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()
{
std::sort(m_nextHops.begin(), m_nextHops.end(),