management: Update nfd::RibControlCommand::applyDefaults to reflect spec update
Change-Id: Ib64ccfa56c6304a32a72bece99040cc3a53e6404
Refs: #1722
diff --git a/src/management/nfd-control-command.hpp b/src/management/nfd-control-command.hpp
index 0068317..252812c 100644
--- a/src/management/nfd-control-command.hpp
+++ b/src/management/nfd-control-command.hpp
@@ -495,7 +495,7 @@
.required(CONTROL_PARAMETER_ORIGIN)
.required(CONTROL_PARAMETER_COST)
.required(CONTROL_PARAMETER_FLAGS)
- .required(CONTROL_PARAMETER_EXPIRATION_PERIOD);
+ .optional(CONTROL_PARAMETER_EXPIRATION_PERIOD);
}
virtual void
@@ -513,14 +513,6 @@
if (!parameters.hasFlags()) {
parameters.setFlags(ROUTE_FLAG_CHILD_INHERIT);
}
- if (!parameters.hasExpirationPeriod()) {
- if (parameters.getFaceId() == 0) {
- parameters.setExpirationPeriod(time::milliseconds::max());
- }
- else {
- parameters.setExpirationPeriod(time::hours(1));
- }
- }
}
virtual void
diff --git a/tests/unit-tests/management/test-nfd-control-command.cpp b/tests/unit-tests/management/test-nfd-control-command.cpp
index 78b2877..045cd68 100644
--- a/tests/unit-tests/management/test-nfd-control-command.cpp
+++ b/tests/unit-tests/management/test-nfd-control-command.cpp
@@ -225,8 +225,7 @@
BOOST_CHECK_EQUAL(p1.getCost(), 0);
BOOST_REQUIRE(p1.hasFlags());
BOOST_CHECK_EQUAL(p1.getFlags(), static_cast<uint64_t>(ROUTE_FLAG_CHILD_INHERIT));
- BOOST_REQUIRE(p1.hasExpirationPeriod());
- BOOST_CHECK_GT(p1.getExpirationPeriod(), time::hours(240));
+ BOOST_CHECK_EQUAL(p1.hasExpirationPeriod(), false);
ControlParameters p2;
p2.setName("ndn:/example")
@@ -234,7 +233,7 @@
.setCost(6);
BOOST_CHECK_NO_THROW(command.validateRequest(p2));
command.applyDefaultsToRequest(p2);
- BOOST_CHECK_EQUAL(p2.getExpirationPeriod(), time::hours(1));
+ BOOST_CHECK_EQUAL(p2.hasExpirationPeriod(), false);
BOOST_CHECK_NO_THROW(command.validateResponse(p2));
}