mgmt: fix CsInfo.Capacity decoding
refs #4050
Change-Id: Icc6d3cc45f1c7ea042b6c0a8c03d70e89852fcee
diff --git a/src/mgmt/nfd/cs-info.cpp b/src/mgmt/nfd/cs-info.cpp
index c7b7f7d..8953103 100644
--- a/src/mgmt/nfd/cs-info.cpp
+++ b/src/mgmt/nfd/cs-info.cpp
@@ -89,7 +89,7 @@
auto val = m_wire.elements_begin();
if (val != m_wire.elements_end() && val->type() == tlv::nfd::Capacity) {
- m_nHits = readNonNegativeInteger(*val);
+ m_capacity = readNonNegativeInteger(*val);
++val;
}
else {
diff --git a/tests/unit-tests/mgmt/nfd/cs-info.t.cpp b/tests/unit-tests/mgmt/nfd/cs-info.t.cpp
index 9e499af..46a0ed3 100644
--- a/tests/unit-tests/mgmt/nfd/cs-info.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/cs-info.t.cpp
@@ -60,7 +60,12 @@
BOOST_CHECK_EQUAL_COLLECTIONS(wire.begin(), wire.end(), EXPECTED, EXPECTED + sizeof(EXPECTED));
CsInfo csi2(wire);
- BOOST_CHECK_EQUAL(csi1, csi2);
+ BOOST_CHECK_EQUAL(csi2.getCapacity(), 20177);
+ BOOST_CHECK_EQUAL(csi2.getEnableAdmit(), false);
+ BOOST_CHECK_EQUAL(csi2.getEnableServe(), true);
+ BOOST_CHECK_EQUAL(csi2.getNEntries(), 5509);
+ BOOST_CHECK_EQUAL(csi2.getNHits(), 12951);
+ BOOST_CHECK_EQUAL(csi2.getNMisses(), 28179);
}
BOOST_AUTO_TEST_CASE(Equality)