Revert "mgmt: add EndpointId field to NextHopRecord class"

This reverts commit ccce0bc969575b6b876ff43a2943bf93645353e1.

Refs: #4973
Change-Id: I21b5fc5f405e8856d5615d966911c6372c3f1d3b
diff --git a/ndn-cxx/encoding/tlv-nfd.hpp b/ndn-cxx/encoding/tlv-nfd.hpp
index 3048b73..1c30ab4 100644
--- a/ndn-cxx/encoding/tlv-nfd.hpp
+++ b/ndn-cxx/encoding/tlv-nfd.hpp
@@ -94,7 +94,6 @@
   // FIB Management
   FibEntry      = 128,
   NextHopRecord = 129,
-  EndpointId    = 113,
 
   // Strategy Choice Management
   StrategyChoice = 128,
diff --git a/ndn-cxx/mgmt/nfd/fib-entry.cpp b/ndn-cxx/mgmt/nfd/fib-entry.cpp
index 6fcb8e5..94154e3 100644
--- a/ndn-cxx/mgmt/nfd/fib-entry.cpp
+++ b/ndn-cxx/mgmt/nfd/fib-entry.cpp
@@ -53,22 +53,6 @@
 }
 
 NextHopRecord&
-NextHopRecord::setEndpointId(uint64_t endpointId)
-{
-  m_endpointId = endpointId;
-  m_wire.reset();
-  return *this;
-}
-
-NextHopRecord&
-NextHopRecord::unsetEndpointId()
-{
-  m_endpointId = nullopt;
-  m_wire.reset();
-  return *this;
-}
-
-NextHopRecord&
 NextHopRecord::setCost(uint64_t cost)
 {
   m_cost = cost;
@@ -82,9 +66,6 @@
 {
   size_t totalLength = 0;
 
-  if (m_endpointId) {
-    totalLength += prependNonNegativeIntegerBlock(block, ndn::tlv::nfd::EndpointId, *m_endpointId);
-  }
   totalLength += prependNonNegativeIntegerBlock(block, ndn::tlv::nfd::Cost, m_cost);
   totalLength += prependNonNegativeIntegerBlock(block, ndn::tlv::nfd::FaceId, m_faceId);
 
@@ -139,38 +120,22 @@
   }
   m_cost = readNonNegativeInteger(*val);
   ++val;
-
-  if (val != m_wire.elements_end() && val->type() == tlv::nfd::EndpointId) {
-    m_endpointId = readNonNegativeInteger(*val);
-    ++val;
-  }
-  else {
-    m_endpointId = nullopt;
-  }
 }
 
 bool
 operator==(const NextHopRecord& a, const NextHopRecord& b)
 {
   return a.getFaceId() == b.getFaceId() &&
-      a.hasEndpointId() == b.hasEndpointId() &&
-      (!a.hasEndpointId() || a.getEndpointId() == b.getEndpointId()) &&
       a.getCost() == b.getCost();
 }
 
 std::ostream&
 operator<<(std::ostream& os, const NextHopRecord& nh)
 {
-  os << "NextHopRecord("
-     << "FaceId: " << nh.getFaceId() << ", ";
-
-  if (nh.hasEndpointId()) {
-    os << "EndpointId: " << nh.getEndpointId() << ", ";
-  }
-
-  os << "Cost: " << nh.getCost();
-
-  return os << ")";
+  return os << "NextHopRecord("
+            << "FaceId: " << nh.getFaceId() << ", "
+            << "Cost: " << nh.getCost()
+            << ")";
 }
 
 ////////////////////
diff --git a/ndn-cxx/mgmt/nfd/fib-entry.hpp b/ndn-cxx/mgmt/nfd/fib-entry.hpp
index 72a79dc..74dd611 100644
--- a/ndn-cxx/mgmt/nfd/fib-entry.hpp
+++ b/ndn-cxx/mgmt/nfd/fib-entry.hpp
@@ -54,25 +54,6 @@
   NextHopRecord&
   setFaceId(uint64_t faceId);
 
-  bool
-  hasEndpointId() const
-  {
-    return m_endpointId.has_value();
-  }
-
-  uint64_t
-  getEndpointId() const
-  {
-    BOOST_ASSERT(hasEndpointId());
-    return *m_endpointId;
-  }
-
-  NextHopRecord&
-  setEndpointId(uint64_t endpointId);
-
-  NextHopRecord&
-  unsetEndpointId();
-
   uint64_t
   getCost() const
   {
@@ -94,7 +75,6 @@
 
 private:
   uint64_t m_faceId;
-  optional<uint64_t> m_endpointId;
   uint64_t m_cost;
 
   mutable Block m_wire;
diff --git a/tests/unit/mgmt/nfd/fib-entry.t.cpp b/tests/unit/mgmt/nfd/fib-entry.t.cpp
index b199ba9..ff5d21b 100644
--- a/tests/unit/mgmt/nfd/fib-entry.t.cpp
+++ b/tests/unit/mgmt/nfd/fib-entry.t.cpp
@@ -39,10 +39,8 @@
   for (size_t i = 1; i < 4; i++) {
     nexthops.push_back(NextHopRecord()
                        .setFaceId(i * 10)
-                       .setEndpointId(i * 10 + 1)
                        .setCost(i * 100 + 100));
   }
-  nexthops.front().unsetEndpointId();
 
   return FibEntry()
       .setPrefix("/this/is/a/test")
@@ -53,15 +51,13 @@
 {
   NextHopRecord record1;
   record1.setFaceId(10)
-      .setEndpointId(7)
       .setCost(200);
   const Block& wire = record1.wireEncode();
 
   static const uint8_t expected[] = {
-    0x81, 0x09, // NextHopRecord
+    0x81, 0x06, // NextHopRecord
           0x69, 0x01, 0x0a, // FaceId
           0x6a, 0x01, 0xc8, // Cost
-          0x71, 0x01, 0x07 // EndpointId
   };
   BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
                                 wire.begin(), wire.end());
@@ -79,20 +75,12 @@
   record2 = record1;
   BOOST_CHECK_EQUAL(record1, record2);
 
-  record1.setEndpointId(7);
-  record2.setEndpointId(7);
-  BOOST_CHECK_EQUAL(record1, record2);
-
   record2.setFaceId(42);
   BOOST_CHECK_NE(record1, record2);
 
   record2 = record1;
   record2.setCost(42);
   BOOST_CHECK_NE(record1, record2);
-
-  record2 = record1;
-  record2.setEndpointId(42);
-  BOOST_CHECK_NE(record1, record2);
 }
 
 BOOST_AUTO_TEST_CASE(FibEntryNoNextHopsEncode)
@@ -119,34 +107,30 @@
   FibEntry entry1 = makeFibEntry();
   NextHopRecord oneMore;
   oneMore.setFaceId(40);
-  oneMore.setEndpointId(8);
   oneMore.setCost(500);
   entry1.addNextHopRecord(oneMore);
   const Block& wire = entry1.wireEncode();
 
-static const uint8_t expected[] = {
-     0x80, 0x41, // FibEntry
-           0x07, 0x13, // Name
-                 0x08, 0x04, 0x74, 0x68, 0x69, 0x73, // GenericNameComponent
-                 0x08, 0x02, 0x69, 0x73, // GenericNameComponent
-                 0x08, 0x01, 0x61, // GenericNameComponent
-                 0x08, 0x04, 0x74, 0x65, 0x73, 0x74, // GenericNameComponent
-           0x81, 0x06, // NextHopRecord
-                 0x69, 0x01, 0x0a, // FaceId
-                 0x6a, 0x01, 0xc8, // Cost
-           0x81, 0x0a, // NextHopRecord
-                 0x69, 0x01, 0x14, // FaceId
-                 0x6a, 0x02, 0x01, 0x2c, // Cost
-                 0x71, 0x01, 0x15, // EndpointId
-           0x81, 0x0a, // NextHopRecord
-                 0x69, 0x01, 0x1e, // FaceId
-                 0x6a, 0x02, 0x01, 0x90, // Cost
-                 0x71, 0x01, 0x1f, // EndpointId
-           0x81, 0x0a, // NextHopRecord
-                 0x69, 0x01, 0x28, // FaceId
-                 0x6a, 0x02, 0x01, 0xf4, // Cost
-                 0x71, 0x01, 0x08 // EndpointId
-   };
+  static const uint8_t expected[] = {
+    0x80, 0x38, // FibEntry
+          0x07, 0x13, // Name
+                0x08, 0x04, 0x74, 0x68, 0x69, 0x73, // GenericNameComponent
+                0x08, 0x02, 0x69, 0x73, // GenericNameComponent
+                0x08, 0x01, 0x61, // GenericNameComponent
+                0x08, 0x04, 0x74, 0x65, 0x73, 0x74, // GenericNameComponent
+          0x81, 0x06, // NextHopRecord
+                0x69, 0x01, 0x0a, // FaceId
+                0x6a, 0x01, 0xc8, // Cost
+          0x81, 0x07, // NextHopRecord
+                0x69, 0x01, 0x14, // FaceId
+                0x6a, 0x02, 0x01, 0x2c, // Cost
+          0x81, 0x07, // NextHopRecord
+                0x69, 0x01, 0x1e, // FaceId
+                0x6a, 0x02, 0x01, 0x90, // Cost
+          0x81, 0x07, // NextHopRecord
+                0x69, 0x01, 0x28, // FaceId
+                0x6a, 0x02, 0x01, 0xf4, // Cost
+  };
   BOOST_CHECK_EQUAL_COLLECTIONS(expected, expected + sizeof(expected),
                                 wire.begin(), wire.end());
 
@@ -175,7 +159,6 @@
   entry2 = entry1;
   auto nh1 = NextHopRecord()
              .setFaceId(1)
-             .setEndpointId(7)
              .setCost(1000);
   entry1.addNextHopRecord(nh1);
   BOOST_CHECK_NE(entry1, entry2);
@@ -183,7 +166,6 @@
 
   auto nh42 = NextHopRecord()
               .setFaceId(42)
-              .setEndpointId(22)
               .setCost(42);
   entry1.addNextHopRecord(nh42);
   entry2.addNextHopRecord(nh42)
@@ -216,8 +198,8 @@
   BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(entry),
                     "FibEntry(Prefix: /this/is/a/test,\n"
                     "         NextHops: [NextHopRecord(FaceId: 10, Cost: 200),\n"
-                    "                    NextHopRecord(FaceId: 20, EndpointId: 21, Cost: 300),\n"
-                    "                    NextHopRecord(FaceId: 30, EndpointId: 31, Cost: 400)]\n"
+                    "                    NextHopRecord(FaceId: 20, Cost: 300),\n"
+                    "                    NextHopRecord(FaceId: 30, Cost: 400)]\n"
                     "         )");
 }