mgmt: fix conflicting TLV-TYPE assignment

Amends df5053824fc53eec6847067faa2da8b0ebb69917

Change-Id: Ifba9fcac63528594c6442973adce313a95116c75
Refs: #4318, #4538
diff --git a/src/encoding/tlv-nfd.hpp b/src/encoding/tlv-nfd.hpp
index 1c4d12d..12ef55b 100644
--- a/src/encoding/tlv-nfd.hpp
+++ b/src/encoding/tlv-nfd.hpp
@@ -38,6 +38,7 @@
   Origin              = 111,
   Cost                = 106,
   Capacity            = 131,
+  Count               = 132,
   Flags               = 108,
   Mask                = 112,
   Strategy            = 107,
diff --git a/src/mgmt/nfd/control-command.cpp b/src/mgmt/nfd/control-command.cpp
index 556a0ed..07e8b17 100644
--- a/src/mgmt/nfd/control-command.cpp
+++ b/src/mgmt/nfd/control-command.cpp
@@ -275,11 +275,11 @@
 {
   m_requestValidator
     .required(CONTROL_PARAMETER_NAME)
-    .optional(CONTROL_PARAMETER_N_CS_ENTRIES);
+    .optional(CONTROL_PARAMETER_COUNT);
   m_responseValidator
     .required(CONTROL_PARAMETER_NAME)
     .optional(CONTROL_PARAMETER_CAPACITY)
-    .required(CONTROL_PARAMETER_N_CS_ENTRIES);
+    .required(CONTROL_PARAMETER_COUNT);
 }
 
 void
@@ -287,8 +287,8 @@
 {
   this->ControlCommand::validateRequest(parameters);
 
-  if (parameters.hasNCsEntries() && parameters.getNCsEntries() == 0) {
-    BOOST_THROW_EXCEPTION(ArgumentError("NCsEntries must be positive"));
+  if (parameters.hasCount() && parameters.getCount() == 0) {
+    BOOST_THROW_EXCEPTION(ArgumentError("Count must be positive"));
   }
 }
 
diff --git a/src/mgmt/nfd/control-parameters.cpp b/src/mgmt/nfd/control-parameters.cpp
index c0377c5..65360a5 100644
--- a/src/mgmt/nfd/control-parameters.cpp
+++ b/src/mgmt/nfd/control-parameters.cpp
@@ -52,20 +52,19 @@
   size_t totalLength = 0;
 
   if (this->hasDefaultCongestionThreshold()) {
-    totalLength += prependNonNegativeIntegerBlock(encoder,
-                   tlv::nfd::DefaultCongestionThreshold, m_defaultCongestionThreshold);
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::DefaultCongestionThreshold,
+                                                  m_defaultCongestionThreshold);
   }
   if (this->hasBaseCongestionMarkingInterval()) {
-    totalLength += prependNonNegativeIntegerBlock(encoder,
-                   tlv::nfd::BaseCongestionMarkingInterval, m_baseCongestionMarkingInterval.count());
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::BaseCongestionMarkingInterval,
+                                                  m_baseCongestionMarkingInterval.count());
   }
   if (this->hasFacePersistency()) {
-    totalLength += prependNonNegativeIntegerBlock(encoder,
-                   tlv::nfd::FacePersistency, m_facePersistency);
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::FacePersistency, m_facePersistency);
   }
   if (this->hasExpirationPeriod()) {
-    totalLength += prependNonNegativeIntegerBlock(encoder,
-                   tlv::nfd::ExpirationPeriod, m_expirationPeriod.count());
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::ExpirationPeriod,
+                                                  m_expirationPeriod.count());
   }
   if (this->hasStrategy()) {
     totalLength += prependNestedBlock(encoder, tlv::nfd::Strategy, m_strategy);
@@ -76,8 +75,8 @@
   if (this->hasFlags()) {
     totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Flags, m_flags);
   }
-  if (this->hasNCsEntries()) {
-    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::NCsEntries, m_nCsEntries);
+  if (this->hasCount()) {
+    totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Count, m_count);
   }
   if (this->hasCapacity()) {
     totalLength += prependNonNegativeIntegerBlock(encoder, tlv::nfd::Capacity, m_capacity);
@@ -176,10 +175,10 @@
     m_capacity = readNonNegativeInteger(*val);
   }
 
-  val = m_wire.find(tlv::nfd::NCsEntries);
-  m_hasFields[CONTROL_PARAMETER_N_CS_ENTRIES] = val != m_wire.elements_end();
-  if (this->hasNCsEntries()) {
-    m_nCsEntries = readNonNegativeInteger(*val);
+  val = m_wire.find(tlv::nfd::Count);
+  m_hasFields[CONTROL_PARAMETER_COUNT] = val != m_wire.elements_end();
+  if (this->hasCount()) {
+    m_count = readNonNegativeInteger(*val);
   }
 
   val = m_wire.find(tlv::nfd::Flags);
@@ -337,8 +336,8 @@
     os << "Capacity: " << parameters.getCapacity() << ", ";
   }
 
-  if (parameters.hasNCsEntries()) {
-    os << "NCsEntries: " << parameters.getNCsEntries() << ", ";
+  if (parameters.hasCount()) {
+    os << "Count: " << parameters.getCount() << ", ";
   }
 
   if (parameters.hasFlags()) {
diff --git a/src/mgmt/nfd/control-parameters.hpp b/src/mgmt/nfd/control-parameters.hpp
index 7005e9d..c325e0b 100644
--- a/src/mgmt/nfd/control-parameters.hpp
+++ b/src/mgmt/nfd/control-parameters.hpp
@@ -41,7 +41,7 @@
   CONTROL_PARAMETER_ORIGIN,
   CONTROL_PARAMETER_COST,
   CONTROL_PARAMETER_CAPACITY,
-  CONTROL_PARAMETER_N_CS_ENTRIES,
+  CONTROL_PARAMETER_COUNT,
   CONTROL_PARAMETER_FLAGS,
   CONTROL_PARAMETER_MASK,
   CONTROL_PARAMETER_STRATEGY,
@@ -60,7 +60,7 @@
   "Origin",
   "Cost",
   "Capacity",
-  "NCsEntries",
+  "Count",
   "Flags",
   "Mask",
   "Strategy",
@@ -316,32 +316,32 @@
   }
 
   bool
-  hasNCsEntries() const
+  hasCount() const
   {
-    return m_hasFields[CONTROL_PARAMETER_N_CS_ENTRIES];
+    return m_hasFields[CONTROL_PARAMETER_COUNT];
   }
 
   uint64_t
-  getNCsEntries() const
+  getCount() const
   {
-    BOOST_ASSERT(this->hasNCsEntries());
-    return m_nCsEntries;
+    BOOST_ASSERT(this->hasCount());
+    return m_count;
   }
 
   ControlParameters&
-  setNCsEntries(uint64_t nCsEntries)
+  setCount(uint64_t count)
   {
     m_wire.reset();
-    m_nCsEntries = nCsEntries;
-    m_hasFields[CONTROL_PARAMETER_N_CS_ENTRIES] = true;
+    m_count = count;
+    m_hasFields[CONTROL_PARAMETER_COUNT] = true;
     return *this;
   }
 
   ControlParameters&
-  unsetNCsEntries()
+  unsetCount()
   {
     m_wire.reset();
-    m_hasFields[CONTROL_PARAMETER_N_CS_ENTRIES] = false;
+    m_hasFields[CONTROL_PARAMETER_COUNT] = false;
     return *this;
   }
 
@@ -607,7 +607,7 @@
   RouteOrigin         m_origin;
   uint64_t            m_cost;
   uint64_t            m_capacity;
-  uint64_t            m_nCsEntries;
+  uint64_t            m_count;
   uint64_t            m_flags;
   uint64_t            m_mask;
   Name                m_strategy;
diff --git a/tests/unit-tests/mgmt/nfd/control-command.t.cpp b/tests/unit-tests/mgmt/nfd/control-command.t.cpp
index d76b67c..3d826cc 100644
--- a/tests/unit-tests/mgmt/nfd/control-command.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-command.t.cpp
@@ -309,16 +309,16 @@
   command.validateRequest(p1);
   BOOST_CHECK(Name("/PREFIX/cs/erase").isPrefixOf(command.getRequestName("/PREFIX", p1)));
 
-  // good limit-entries request
+  // good limited request
   ControlParameters p2;
   p2.setName("/IMw1RaLF");
-  p2.setNCsEntries(177);
+  p2.setCount(177);
   command.validateRequest(p2);
 
   // bad request: zero entry
   ControlParameters p3;
   p3.setName("/ahMID1jcib");
-  p3.setNCsEntries(0);
+  p3.setCount(0);
   BOOST_CHECK_THROW(command.validateRequest(p3), ControlCommand::ArgumentError);
 
   // bad request: forbidden field
@@ -334,32 +334,31 @@
   // good normal response
   ControlParameters p1;
   p1.setName("/TwiIwCdR");
-  p1.setNCsEntries(1);
+  p1.setCount(1);
   command.validateResponse(p1);
 
   // good limit exceeded request
   ControlParameters p2;
   p2.setName("/NMsiy44pr");
   p2.setCapacity(360);
-  p2.setNCsEntries(360);
+  p2.setCount(360);
   command.validateResponse(p2);
 
   // good zero-entry response
   ControlParameters p3;
   p3.setName("/5f1LRPh1L");
-  p3.setNCsEntries(0);
+  p3.setCount(0);
   command.validateResponse(p3);
 
-  // bad request: missing NCsEntries
+  // bad request: missing Count
   ControlParameters p4(p1);
-  p4.unsetNCsEntries();
+  p4.unsetCount();
   BOOST_CHECK_THROW(command.validateResponse(p4), ControlCommand::ArgumentError);
 
   // bad request: zero capacity
   ControlParameters p5(p1);
   p5.setCapacity(0);
   BOOST_CHECK_THROW(command.validateResponse(p5), ControlCommand::ArgumentError);
-
 }
 
 BOOST_AUTO_TEST_CASE(StrategyChoiceSet)
diff --git a/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
index 14be320..6030060 100644
--- a/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
@@ -43,7 +43,7 @@
   BOOST_CHECK_EQUAL(decoded.hasOrigin(), false);
   BOOST_CHECK_EQUAL(decoded.hasCost(), false);
   BOOST_CHECK_EQUAL(decoded.hasCapacity(), false);
-  BOOST_CHECK_EQUAL(decoded.hasNCsEntries(), false);
+  BOOST_CHECK_EQUAL(decoded.hasCount(), false);
   BOOST_CHECK_EQUAL(decoded.hasFlags(), false);
   BOOST_CHECK_EQUAL(decoded.hasMask(), false);
   BOOST_CHECK_EQUAL(decoded.hasStrategy(), false);
@@ -57,7 +57,7 @@
   input.setOrigin(ROUTE_ORIGIN_NLSR);
   input.setCost(1388);
   input.setCapacity(2632);
-  input.setNCsEntries(3100);
+  input.setCount(3100);
   input.setFlags(0xAFC4);
   input.setMask(0xF7A1);
   input.setStrategy("/strategy-name");
@@ -72,7 +72,7 @@
   BOOST_CHECK_EQUAL(decoded.hasOrigin(), true);
   BOOST_CHECK_EQUAL(decoded.hasCost(), true);
   BOOST_CHECK_EQUAL(decoded.hasCapacity(), true);
-  BOOST_CHECK_EQUAL(decoded.hasNCsEntries(), true);
+  BOOST_CHECK_EQUAL(decoded.hasCount(), true);
   BOOST_CHECK_EQUAL(decoded.hasFlags(), true);
   BOOST_CHECK_EQUAL(decoded.hasMask(), true);
   BOOST_CHECK_EQUAL(decoded.hasStrategy(), true);
@@ -86,7 +86,7 @@
   BOOST_CHECK_EQUAL(decoded.getOrigin(), ROUTE_ORIGIN_NLSR);
   BOOST_CHECK_EQUAL(decoded.getCost(), 1388);
   BOOST_CHECK_EQUAL(decoded.getCapacity(), 2632);
-  BOOST_CHECK_EQUAL(decoded.getNCsEntries(), 3100);
+  BOOST_CHECK_EQUAL(decoded.getCount(), 3100);
   BOOST_CHECK_EQUAL(decoded.getFlags(), 0xAFC4);
   BOOST_CHECK_EQUAL(decoded.getMask(), 0xF7A1);
   BOOST_CHECK_EQUAL(decoded.getStrategy(), "/strategy-name");
@@ -100,7 +100,7 @@
   input.unsetOrigin();
   input.unsetCost();
   input.unsetCapacity();
-  input.unsetNCsEntries();
+  input.unsetCount();
   input.unsetFlags();
   input.unsetMask();
   input.unsetStrategy();
@@ -113,7 +113,7 @@
   BOOST_CHECK_EQUAL(input.hasOrigin(), false);
   BOOST_CHECK_EQUAL(input.hasCost(), false);
   BOOST_CHECK_EQUAL(input.hasCapacity(), false);
-  BOOST_CHECK_EQUAL(input.hasNCsEntries(), false);
+  BOOST_CHECK_EQUAL(input.hasCount(), false);
   BOOST_CHECK_EQUAL(input.hasFlags(), false);
   BOOST_CHECK_EQUAL(input.hasMask(), false);
   BOOST_CHECK_EQUAL(input.hasStrategy(), false);