ONOS-1400: Fixing BgpRouter functionality break due to distributed group store changes

Change-Id: I7e0dd3bb32333a19ab234ad66b84fd22a06fc341
diff --git a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
index b50681e..11de4ae 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
@@ -29,6 +29,8 @@
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
 import org.onlab.packet.Ethernet;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
 import org.onlab.packet.IpAddress;
 import org.onlab.packet.IpPrefix;
 import org.onlab.packet.MacAddress;
@@ -145,10 +147,14 @@
 
     private InternalTableHandler provisionStaticTables = new InternalTableHandler();
 
-    private KryoNamespace.Builder appKryo = new KryoNamespace.Builder()
+    private KryoNamespace appKryo = new KryoNamespace.Builder()
                     .register(IpAddress.Version.class)
                     .register(IpAddress.class)
-                    .register(NextHopGroupKey.class);
+                    .register(Ip4Address.class)
+                    .register(Ip6Address.class)
+                    .register(byte[].class)
+                    .register(NextHopGroupKey.class)
+                    .build();
 
     @Activate
     protected void activate() {
@@ -219,7 +225,7 @@
                 NextHop nextHop = nextHops.get(entry.nextHopIp());
                 group = groupService.getGroup(deviceId,
                                               new DefaultGroupKey(
-                                              appKryo.build().serialize(nextHop.group())));
+                                              appKryo.serialize(nextHop.group())));
 
                 if (group == null) {
                     log.debug("Adding pending flow {}", update.entry());
@@ -317,8 +323,8 @@
                     = new DefaultGroupDescription(deviceId,
                                                   GroupDescription.Type.INDIRECT,
                                                   new GroupBuckets(Collections
-                                                                           .singletonList(bucket)),
-                                                  new DefaultGroupKey(appKryo.build().serialize(groupKey)),
+                                                           .singletonList(bucket)),
+                                                  new DefaultGroupKey(appKryo.serialize(groupKey)),
                                                   appId);
 
             groupService.addGroup(groupDescription);
@@ -340,7 +346,6 @@
 
         Group group = groupService.getGroup(deviceId,
                                             new DefaultGroupKey(appKryo.
-                                                                build().
                                                                 serialize(nextHop.group())));
 
         // FIXME disabling group deletes for now until we verify the logic is OK
@@ -714,7 +719,7 @@
                 synchronized (pendingUpdates) {
 
                     NextHopGroupKey nhGroupKey =
-                            appKryo.build().deserialize(group.appCookie().key());
+                            appKryo.deserialize(group.appCookie().key());
                     Map<FibEntry, Group> entriesToInstall =
                             pendingUpdates.removeAll(nhGroupKey)
                                     .stream()
diff --git a/apps/routing/src/main/java/org/onosproject/routing/impl/Router.java b/apps/routing/src/main/java/org/onosproject/routing/impl/Router.java
index fcab78e..71990a1 100644
--- a/apps/routing/src/main/java/org/onosproject/routing/impl/Router.java
+++ b/apps/routing/src/main/java/org/onosproject/routing/impl/Router.java
@@ -15,14 +15,21 @@
  */
 package org.onosproject.routing.impl;
 
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Multimaps;
-import com.google.common.collect.SetMultimap;
-import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import com.googlecode.concurrenttrees.common.KeyValuePair;
-import com.googlecode.concurrenttrees.radix.node.concrete.DefaultByteArrayNodeFactory;
-import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree;
-import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -47,20 +54,14 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimaps;
+import com.google.common.collect.SetMultimap;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import com.googlecode.concurrenttrees.common.KeyValuePair;
+import com.googlecode.concurrenttrees.radix.node.concrete.DefaultByteArrayNodeFactory;
+import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree;
+import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
 
 /**
  * This class processes route updates and maintains a Routing Information Base
@@ -163,7 +164,7 @@
         try {
             routeUpdatesQueue.put(routeUpdates);
         } catch (InterruptedException e) {
-            log.debug("Interrupted while putting on routeUpdatesQueue", e);
+            log.error("Interrupted while putting on routeUpdatesQueue", e);
             Thread.currentThread().interrupt();
         }
     }
@@ -180,10 +181,10 @@
                         routeUpdatesQueue.take();
                     processRouteUpdates(routeUpdates);
                 } catch (InterruptedException e) {
-                    log.debug("Interrupted while taking from updates queue", e);
+                    log.error("Interrupted while taking from updates queue", e);
                     interrupted = true;
                 } catch (Exception e) {
-                    log.debug("exception", e);
+                    log.error("exception", e);
                 }
             }
         } finally {
@@ -198,6 +199,7 @@
      *
      * @return all IPv4 routes from the RIB
      */
+    @Override
     public Collection<RouteEntry> getRoutes4() {
         Iterator<KeyValuePair<RouteEntry>> it =
             ribTable4.getKeyValuePairsForKeysStartingWith("").iterator();
@@ -217,6 +219,7 @@
      *
      * @return all IPv6 routes from the RIB
      */
+    @Override
     public Collection<RouteEntry> getRoutes6() {
         Iterator<KeyValuePair<RouteEntry>> it =
             ribTable6.getKeyValuePairsForKeysStartingWith("").iterator();