Modified BGP and FPM route sources to push to new route service.

Also created an adapter to adapt the new interface to the old one for
backwards compatibilty with existing FIB components.

Change-Id: If8eb2220d9e4e69af135a8f9469ffda567ed4448
diff --git a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
index fd6718d..7769f6f 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java
@@ -33,8 +33,7 @@
 import org.onlab.junit.TestUtils.TestUtilsException;
 import org.onlab.packet.Ip4Address;
 import org.onlab.packet.Ip4Prefix;
-import org.onosproject.routing.RouteListener;
-import org.onosproject.routing.RouteUpdate;
+import org.onosproject.incubator.net.routing.RouteAdminService;
 import org.osgi.service.component.ComponentContext;
 
 import java.net.InetAddress;
@@ -48,6 +47,7 @@
 import java.util.concurrent.TimeUnit;
 
 import static org.easymock.EasyMock.createMock;
+import static org.easymock.EasyMock.createNiceMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.hamcrest.Matchers.hasSize;
@@ -85,6 +85,8 @@
     // Timeout waiting for a message to be received
     private static final int MESSAGE_TIMEOUT_MS = 5000; // 5s
 
+    private RouteAdminService routeService;
+
     // The BGP Session Manager to test
     private BgpSessionManager bgpSessionManager;
 
@@ -102,19 +104,6 @@
     // The socket that the remote peers should connect to
     private InetSocketAddress connectToSocket;
 
-    private final DummyRouteListener dummyRouteListener =
-        new DummyRouteListener();
-
-    /**
-     * Dummy implementation for the RouteListener interface.
-     */
-    private class DummyRouteListener implements RouteListener {
-        @Override
-        public void update(Collection<RouteUpdate> routeUpdate) {
-            // Nothing to do
-        }
-    }
-
     /**
      * A class to capture the state for a BGP peer.
      */
@@ -238,13 +227,11 @@
     }
 
     @SuppressWarnings("unchecked")
-    private Dictionary
-            getDictionaryMock(ComponentContext componentContext) {
+    private void getDictionaryMock(ComponentContext componentContext) {
         Dictionary dictionary = createMock(Dictionary.class);
         expect(dictionary.get("bgpPort")).andReturn("0");
         replay(dictionary);
         expect(componentContext.getProperties()).andReturn(dictionary);
-        return dictionary;
     }
 
     @Before
@@ -262,12 +249,16 @@
         // connections.
         //
         bgpSessionManager = new BgpSessionManager();
+
+        routeService = createNiceMock(RouteAdminService.class);
+        replay(routeService);
+        bgpSessionManager.routeService = routeService;
+
         // NOTE: We use port 0 to bind on any available port
         ComponentContext componentContext = createMock(ComponentContext.class);
-        Dictionary dictionary = getDictionaryMock(componentContext);
+        getDictionaryMock(componentContext);
         replay(componentContext);
         bgpSessionManager.activate(componentContext);
-        bgpSessionManager.start(dummyRouteListener);
 
         // Get the port number the BGP Session Manager is listening on
         Channel serverChannel = TestUtils.getField(bgpSessionManager,
@@ -547,6 +538,7 @@
         withdrawnRoutes.add(Ip4Prefix.valueOf("70.0.0.0/16"));
         withdrawnRoutes.add(Ip4Prefix.valueOf("80.0.0.0/24"));
         withdrawnRoutes.add(Ip4Prefix.valueOf("90.0.0.0/32"));
+
         // Write the routes
         message = peer1.peerChannelHandler.prepareBgpUpdate(
                         NEXT_HOP1_ROUTER,
diff --git a/apps/routing/src/test/java/org/onosproject/routing/impl/RouterAsyncArpTest.java b/apps/routing/src/test/java/org/onosproject/routing/impl/RouterAsyncArpTest.java
index 1519758..f05a287 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/impl/RouterAsyncArpTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/impl/RouterAsyncArpTest.java
@@ -39,7 +39,7 @@
 import org.onosproject.net.host.HostService;
 import org.onosproject.net.provider.ProviderId;
 import org.onosproject.routing.config.RoutingConfigurationService;
-import org.onosproject.routing.impl.Router.InternalHostListener;
+import org.onosproject.routing.impl.DefaultRouter.InternalHostListener;
 import org.onosproject.routing.RouteSourceService;
 import org.onosproject.routing.FibEntry;
 import org.onosproject.routing.FibListener;
@@ -74,7 +74,7 @@
             DeviceId.deviceId("of:0000000000000003"),
             PortNumber.portNumber(1));
 
-    private Router router;
+    private DefaultRouter router;
     private InternalHostListener internalHostListener;
 
     @Before
@@ -90,7 +90,7 @@
 
         fibListener = createMock(FibListener.class);
 
-        router = new Router();
+        router = new DefaultRouter();
         router.coreService = createNiceMock(CoreService.class);
         router.hostService = hostService;
         router.routingConfigurationService = routingConfigurationService;
diff --git a/apps/routing/src/test/java/org/onosproject/routing/impl/RouterTest.java b/apps/routing/src/test/java/org/onosproject/routing/impl/RouterTest.java
index ba4a043..2e3b740 100644
--- a/apps/routing/src/test/java/org/onosproject/routing/impl/RouterTest.java
+++ b/apps/routing/src/test/java/org/onosproject/routing/impl/RouterTest.java
@@ -90,7 +90,7 @@
     private static final ConnectPoint SW6_ETH1 = new ConnectPoint(
             DeviceId.deviceId("of:0000000000000006"),
             PortNumber.portNumber(1));
-    private Router router;
+    private DefaultRouter router;
 
     @Before
     public void setUp() throws Exception {
@@ -105,7 +105,7 @@
 
         fibListener = createMock(FibListener.class);
 
-        router = new Router();
+        router = new DefaultRouter();
         router.coreService = createNiceMock(CoreService.class);
         router.hostService = hostService;
         router.routingConfigurationService = routingConfigurationService;