Carry next hop VLAN in the resolved route

Also improve routes command to better display IPv6 routes

Change-Id: I72e78fc2a7ed19322c3b4281c7b93e19484f551e
diff --git a/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java b/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java
index 5ea316e..f32ecd5 100644
--- a/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java
+++ b/cli/src/main/java/org/onosproject/cli/net/RoutesListCommand.java
@@ -39,10 +39,12 @@
         description = "Lists routes in the route store")
 public class RoutesListCommand extends AbstractShellCommand {
 
-    private static final String FORMAT_HEADER =
-        "    Network            Next Hop        Source";
-    private static final String FORMAT_ROUTE =
-            "%-1s   %-18s %-15s %-10s";
+    private static final String NETWORK = "Network";
+    private static final String NEXTHOP = "Next Hop";
+    private static final String SOURCE = "Source";
+
+    private static final String FORMAT_ROUTE = "%-1s   %-18s %-15s %-10s";
+    private static final String FORMAT_ROUTE6 = "%-1s   %-43s %-39s %-10s";
 
     private static final String FORMAT_TABLE = "Table: %s";
     private static final String FORMAT_TOTAL = "   Total: %d";
@@ -59,13 +61,19 @@
             print("%s", result);
         } else {
             service.getRouteTables().forEach(id -> {
-                print(FORMAT_TABLE, id);
-                print(FORMAT_HEADER);
                 Collection<RouteInfo> tableRoutes = service.getRoutes(id);
 
+                String format = tableRoutes.stream().anyMatch(route -> route.prefix().isIp6()) ?
+                        FORMAT_ROUTE6 : FORMAT_ROUTE;
+
+                // Print header
+                print(FORMAT_TABLE, id);
+                print(format, "", NETWORK, NEXTHOP, SOURCE);
+
+                // Print routing entries
                 tableRoutes.stream()
                         .sorted(Comparator.comparing(r -> r.prefix().address()))
-                        .forEach(this::print);
+                        .forEach(route -> this.print(format, route));
 
                 print(FORMAT_TOTAL, tableRoutes.size());
                 print("");
@@ -73,9 +81,9 @@
         }
     }
 
-    private void print(RouteInfo routeInfo) {
+    private void print(String format, RouteInfo routeInfo) {
         routeInfo.allRoutes()
-                .forEach(r -> print(FORMAT_ROUTE, isBestRoute(routeInfo.bestRoute(), r) ? ">" : "",
+                .forEach(r -> print(format, isBestRoute(routeInfo.bestRoute(), r) ? ">" : "",
                         r.prefix(), r.nextHop(), Route.Source.UNDEFINED));
     }