mgmt: use RouteOrigin type in Route and ControlParameters
Change-Id: I1fb7e29efbb7ae9523ca294df03478498ef04322
Refs: #3903
diff --git a/tests/unit-tests/mgmt/nfd/control-command.t.cpp b/tests/unit-tests/mgmt/nfd/control-command.t.cpp
index f812088..6e60ad2 100644
--- a/tests/unit-tests/mgmt/nfd/control-command.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-command.t.cpp
@@ -333,7 +333,7 @@
command.applyDefaultsToRequest(p1);
BOOST_REQUIRE(p1.hasOrigin());
- BOOST_CHECK_EQUAL(p1.getOrigin(), static_cast<uint64_t>(ROUTE_ORIGIN_APP));
+ BOOST_CHECK_EQUAL(p1.getOrigin(), ROUTE_ORIGIN_APP);
BOOST_REQUIRE(p1.hasCost());
BOOST_CHECK_EQUAL(p1.getCost(), 0);
BOOST_REQUIRE(p1.hasFlags());
diff --git a/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
index 96d8519..30db9ed 100644
--- a/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/control-parameters.t.cpp
@@ -133,17 +133,17 @@
ControlParameters parameters;
parameters.setName("ndn:/example")
.setFaceId(4)
- .setOrigin(128)
+ .setOrigin(ROUTE_ORIGIN_NLSR)
.setCost(6)
.setFlags(0x01)
- .setExpirationPeriod(time::milliseconds(1800000));
+ .setExpirationPeriod(time::minutes(30));
Block wire = parameters.wireEncode();
ControlParameters decoded(wire);
BOOST_CHECK_EQUAL(decoded.getName(), Name("ndn:/example"));
BOOST_CHECK_EQUAL(decoded.getFaceId(), 4);
- BOOST_CHECK_EQUAL(decoded.getOrigin(), 128);
+ BOOST_CHECK_EQUAL(decoded.getOrigin(), ROUTE_ORIGIN_NLSR);
BOOST_CHECK_EQUAL(decoded.getCost(), 6);
BOOST_CHECK_EQUAL(decoded.getFlags(), 0x01);
BOOST_CHECK_EQUAL(decoded.getExpirationPeriod(), time::milliseconds(1800000));
diff --git a/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp b/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
index 28e4fd7..15c14d1 100644
--- a/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
+++ b/tests/unit-tests/mgmt/nfd/rib-entry.t.cpp
@@ -37,9 +37,9 @@
{
return Route()
.setFaceId(1)
- .setOrigin(128)
+ .setOrigin(ROUTE_ORIGIN_NLSR)
.setCost(100)
- .setFlags(ndn::nfd::ROUTE_FLAG_CAPTURE);
+ .setFlags(ROUTE_FLAG_CAPTURE);
}
static RibEntry
@@ -125,9 +125,9 @@
RibEntry entry1 = makeRibEntry();
entry1.addRoute(Route()
.setFaceId(2)
- .setOrigin(0)
+ .setOrigin(ROUTE_ORIGIN_APP)
.setCost(32)
- .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT)
+ .setFlags(ROUTE_FLAG_CHILD_INHERIT)
.setExpirationPeriod(time::seconds(5)));
const Block& wire = entry1.wireEncode();
@@ -208,7 +208,7 @@
{
Route route;
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(route),
- "Route(FaceId: 0, Origin: 0, Cost: 0, Flags: 0x1, ExpirationPeriod: infinite)");
+ "Route(FaceId: 0, Origin: app, Cost: 0, Flags: 0x1, ExpirationPeriod: infinite)");
RibEntry entry;
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(entry),
@@ -219,14 +219,14 @@
entry = makeRibEntry();
entry.addRoute(Route()
.setFaceId(2)
- .setOrigin(0)
+ .setOrigin(ROUTE_ORIGIN_STATIC)
.setCost(32)
- .setFlags(ndn::nfd::ROUTE_FLAG_CHILD_INHERIT));
+ .setFlags(ROUTE_FLAG_CHILD_INHERIT));
BOOST_CHECK_EQUAL(boost::lexical_cast<std::string>(entry),
"RibEntry(Prefix: /hello/world,\n"
- " Routes: [Route(FaceId: 1, Origin: 128, Cost: 100, Flags: 0x2, "
+ " Routes: [Route(FaceId: 1, Origin: nlsr, Cost: 100, Flags: 0x2, "
"ExpirationPeriod: 10000 milliseconds),\n"
- " Route(FaceId: 2, Origin: 0, Cost: 32, Flags: 0x1, "
+ " Route(FaceId: 2, Origin: static, Cost: 32, Flags: 0x1, "
"ExpirationPeriod: infinite)]\n"
" )");
}