Added IPv6 routing support to SDN-IP, and integrated it with BGP:
 * The routing entries as received from BGP can be either IPv4 or IPv6
 * The CLI prints the IPv4 and IPv6 routes
 * The BGP peering is still over IPv4, so configuration-wise the IPv6
   routes from the eBGP peers have to be configured to use the IPv4 peering.
 * The integration/testing with the IPv6 Network Discovery Protocol is not
   done yet.
 * The integration/testing with IPv6 intents is not done yet.

Also:
 * Moved nested class BgpSessionManager.BgpRouteSelector out of the
   BgpSessionManager class.
 * Code cleanup.

Change-Id: I9f2dbe4395a72d353bbf215a8a14b01b53c3423f
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/BgpRoutesListCommand.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/BgpRoutesListCommand.java
index 56ad480..037c985 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/BgpRoutesListCommand.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/cli/BgpRoutesListCommand.java
@@ -46,7 +46,10 @@
             required = false, multiValued = false)
     private String bgpNeighbor;
 
-    private static final String FORMAT_SUMMARY = "Total BGP routes = %d";
+    private static final String FORMAT_SUMMARY_V4 =
+        "Total BGP IPv4 routes = %d";
+    private static final String FORMAT_SUMMARY_V6 =
+        "Total BGP IPv6 routes = %d";
     private static final String FORMAT_HEADER =
         "   Network            Next Hop        Origin LocalPref       MED BGP-ID";
     private static final String FORMAT_ROUTE_LINE1 =
@@ -60,7 +63,7 @@
 
         // Print summary of the routes
         if (routesSummary) {
-            printSummary(service.getBgpRoutes());
+            printSummary(service.getBgpRoutes4(), service.getBgpRoutes6());
             return;
         }
 
@@ -81,43 +84,61 @@
 
         // Print the routes
         if (foundBgpSession != null) {
-            printRoutes(foundBgpSession.bgpRibIn4().values());
-            printRoutes(foundBgpSession.bgpRibIn6().values());
+            printRoutes(foundBgpSession.getBgpRibIn4(),
+                        foundBgpSession.getBgpRibIn6());
         } else {
-            printRoutes(service.getBgpRoutes());
+            printRoutes(service.getBgpRoutes4(), service.getBgpRoutes6());
         }
     }
 
     /**
      * Prints summary of the routes.
      *
-     * @param routes the routes
+     * @param routes4 the IPv4 routes
+     * @param routes6 the IPv6 routes
      */
-    private void printSummary(Collection<BgpRouteEntry> routes) {
+    private void printSummary(Collection<BgpRouteEntry> routes4,
+                              Collection<BgpRouteEntry> routes6) {
         if (outputJson()) {
             ObjectMapper mapper = new ObjectMapper();
             ObjectNode result = mapper.createObjectNode();
-            result.put("totalRoutes", routes.size());
+            result.put("totalRoutes4", routes4.size());
+            result.put("totalRoutes6", routes6.size());
             print("%s", result);
         } else {
-            print(FORMAT_SUMMARY, routes.size());
+            print(FORMAT_SUMMARY_V4, routes4.size());
+            print(FORMAT_SUMMARY_V6, routes6.size());
         }
     }
 
     /**
      * Prints all routes.
      *
-     * @param routes the routes to print
+     * @param routes4 the IPv4 routes to print
+     * @param routes6 the IPv6 routes to print
      */
-    private void printRoutes(Collection<BgpRouteEntry> routes) {
+    private void printRoutes(Collection<BgpRouteEntry> routes4,
+                             Collection<BgpRouteEntry> routes6) {
         if (outputJson()) {
-            print("%s", json(routes));
+            ObjectMapper mapper = new ObjectMapper();
+            ObjectNode result = mapper.createObjectNode();
+            result.put("routes4", json(routes4));
+            result.put("routes6", json(routes6));
+            print("%s", result);
         } else {
+            // The IPv4 routes
             print(FORMAT_HEADER);
-            for (BgpRouteEntry route : routes) {
+            for (BgpRouteEntry route : routes4) {
                 printRoute(route);
             }
-            print(FORMAT_SUMMARY, routes.size());
+            print(FORMAT_SUMMARY_V4, routes4.size());
+            print("");                  // Empty separator line
+            // The IPv6 routes
+            print(FORMAT_HEADER);
+            for (BgpRouteEntry route : routes6) {
+                printRoute(route);
+            }
+            print(FORMAT_SUMMARY_V6, routes6.size());
         }
     }