tools: nfdc route commands accept and print RouteOrigin strings

refs #3987

Change-Id: I47594546e3fe9279fff5ea6ade9ce38cb3b05b6c
diff --git a/tools/nfdc/rib-module.cpp b/tools/nfdc/rib-module.cpp
index d7f04cd..ffcb18c 100644
--- a/tools/nfdc/rib-module.cpp
+++ b/tools/nfdc/rib-module.cpp
@@ -38,7 +38,7 @@
   defRouteList
     .setTitle("print RIB routes")
     .addArg("nexthop", ArgValueType::FACE_ID_OR_URI, Required::NO, Positional::YES)
-    .addArg("origin", ArgValueType::UNSIGNED, Required::NO, Positional::NO);
+    .addArg("origin", ArgValueType::ROUTE_ORIGIN, Required::NO, Positional::NO);
   parser.addCommand(defRouteList, &RibModule::list);
 
   CommandDefinition defRouteShow("route", "show");
@@ -52,7 +52,7 @@
     .setTitle("add a route")
     .addArg("prefix", ArgValueType::NAME, Required::YES, Positional::YES)
     .addArg("nexthop", ArgValueType::FACE_ID_OR_URI, Required::YES, Positional::YES)
-    .addArg("origin", ArgValueType::UNSIGNED, Required::NO, Positional::NO)
+    .addArg("origin", ArgValueType::ROUTE_ORIGIN, Required::NO, Positional::NO)
     .addArg("cost", ArgValueType::UNSIGNED, Required::NO, Positional::NO)
     .addArg("no-inherit", ArgValueType::NONE, Required::NO, Positional::NO)
     .addArg("capture", ArgValueType::NONE, Required::NO, Positional::NO)
@@ -64,7 +64,7 @@
     .setTitle("remove a route")
     .addArg("prefix", ArgValueType::NAME, Required::YES, Positional::YES)
     .addArg("nexthop", ArgValueType::FACE_ID_OR_URI, Required::YES, Positional::YES)
-    .addArg("origin", ArgValueType::UNSIGNED, Required::NO, Positional::NO);
+    .addArg("origin", ArgValueType::ROUTE_ORIGIN, Required::NO, Positional::NO);
   parser.addCommand(defRouteRemove, &RibModule::remove);
 }
 
@@ -73,7 +73,7 @@
 {
   auto nexthopIt = ctx.args.find("nexthop");
   std::set<uint64_t> nexthops;
-  auto origin = ctx.args.getOptional<uint64_t>("origin");
+  auto origin = ctx.args.getOptional<RouteOrigin>("origin");
 
   if (nexthopIt != ctx.args.end()) {
     FindFace findFace(ctx);
@@ -144,7 +144,7 @@
 {
   auto prefix = ctx.args.get<Name>("prefix");
   const boost::any& nexthop = ctx.args.at("nexthop");
-  auto origin = ctx.args.get<uint64_t>("origin", ndn::nfd::ROUTE_ORIGIN_STATIC);
+  auto origin = ctx.args.get<RouteOrigin>("origin", ndn::nfd::ROUTE_ORIGIN_STATIC);
   auto cost = ctx.args.get<uint64_t>("cost", 0);
   bool wantChildInherit = !ctx.args.get<bool>("no-inherit", false);
   bool wantCapture = ctx.args.get<bool>("capture", false);
@@ -191,7 +191,7 @@
       text::ItemAttributes ia;
       ctx.out << ia("prefix") << resp.getName()
               << ia("nexthop") << resp.getFaceId()
-              << ia("origin") << resp.getOrigin()
+              << ia("origin") << static_cast<RouteOrigin>(resp.getOrigin())
               << ia("cost") << resp.getCost()
               << ia("flags") << static_cast<ndn::nfd::RouteFlags>(resp.getFlags());
       if (resp.hasExpirationPeriod()) {
@@ -212,7 +212,7 @@
 {
   auto prefix = ctx.args.get<Name>("prefix");
   const boost::any& nexthop = ctx.args.at("nexthop");
-  auto origin = ctx.args.get<uint64_t>("origin", ndn::nfd::ROUTE_ORIGIN_STATIC);
+  auto origin = ctx.args.get<RouteOrigin>("origin", ndn::nfd::ROUTE_ORIGIN_STATIC);
 
   FindFace findFace(ctx);
   FindFace::Code res = findFace.execute(nexthop, true);
@@ -245,7 +245,7 @@
         text::ItemAttributes ia;
         ctx.out << ia("prefix") << resp.getName()
                 << ia("nexthop") << resp.getFaceId()
-                << ia("origin") << resp.getOrigin()
+                << ia("origin") << static_cast<RouteOrigin>(resp.getOrigin())
                 << '\n';
       },
       ctx.makeCommandFailureHandler("removing route"),
@@ -290,7 +290,7 @@
   for (const Route& route : item.getRoutes()) {
     os << "<route>"
        << "<faceId>" << route.getFaceId() << "</faceId>"
-       << "<origin>" << route.getOrigin() << "</origin>"
+       << "<origin>" << static_cast<RouteOrigin>(route.getOrigin()) << "</origin>"
        << "<cost>" << route.getCost() << "</cost>";
     if (route.getFlags() == ndn::nfd::ROUTE_FLAGS_NONE) {
        os << "<flags/>";
@@ -352,7 +352,7 @@
     os << ia("prefix") << entry.getName();
   }
   os << ia("nexthop") << route.getFaceId();
-  os << ia("origin") << static_cast<uint64_t>(route.getOrigin());
+  os << ia("origin") << static_cast<RouteOrigin>(route.getOrigin());
   os << ia("cost") << route.getCost();
   os << ia("flags") << static_cast<ndn::nfd::RouteFlags>(route.getFlags());