Moved registering routing configs out of the RoutingConfigImpl

Change-Id: Ib2e7bcfd7a84ee3dc8a285265ca4599e99744531
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 ce43a6a..54b6337 100644
--- a/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
+++ b/apps/bgprouter/src/main/java/org/onosproject/bgprouter/BgpRouter.java
@@ -25,7 +25,7 @@
 import org.onosproject.incubator.component.ComponentService;
 import org.onosproject.incubator.net.intf.InterfaceService;
 import org.onosproject.net.DeviceId;
-import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.NetworkConfigRegistry;
 import org.onosproject.net.device.DeviceEvent;
 import org.onosproject.net.device.DeviceListener;
 import org.onosproject.net.device.DeviceService;
@@ -33,7 +33,7 @@
 import org.onosproject.net.packet.PacketService;
 import org.onosproject.routing.RoutingService;
 import org.onosproject.routing.config.BgpConfig;
-import org.onosproject.routing.config.RoutingConfigurationService;
+import org.onosproject.routing.config.RoutingConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -54,17 +54,11 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected CoreService coreService;
 
-    // We depend on the routing configuration being available before starting
-    // up. When we have dynamic configuration support this will no longer be
-    // necessary.
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected RoutingConfigurationService routingConfigurationService;
-
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected InterfaceService interfaceService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected NetworkConfigService networkConfigService;
+    protected NetworkConfigRegistry networkConfigService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected PacketService packetService;
@@ -101,6 +95,8 @@
     protected void activate() {
         appId = coreService.registerApplication(BGP_ROUTER_APP);
 
+        RoutingConfiguration.register(networkConfigService);
+
         components.forEach(name -> componentService.activate(appId, name));
 
         ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
@@ -139,6 +135,8 @@
     protected void deactivate() {
         components.forEach(name -> componentService.deactivate(appId, name));
 
+        RoutingConfiguration.unregister(networkConfigService);
+
         connectivityManager.stop();
         icmpHandler.stop();
         deviceService.removeListener(deviceListener);