fib: add EndpointId field in NextHop record

refs: #4284

Change-Id: If0cfc21cfa81d6fa3c1590ecdce8fbbc1ea95e13
diff --git a/daemon/table/fib.cpp b/daemon/table/fib.cpp
index 7b6d21a..ccde921 100644
--- a/daemon/table/fib.cpp
+++ b/daemon/table/fib.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /*
- * Copyright (c) 2014-2018,  Regents of the University of California,
+ * Copyright (c) 2014-2019,  Regents of the University of California,
  *                           Arizona Board of Regents,
  *                           Colorado State University,
  *                           University Pierre & Marie Curie, Sorbonne University,
@@ -134,16 +134,28 @@
 }
 
 void
-Fib::removeNextHop(Entry& entry, const Face& face)
+Fib::eraseIfEmpty(Entry& entry)
 {
-  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, uint64_t 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
 {