Moved ProxyArp, SDN-IP and BgpRouter to use new config format.

The new config format is based on the new network configuration subsystem.

Includes a few config fixes to NetworkConfigLoader and InterfaceManager.

Change-Id: Id7f766736decb7afb6b63c2731d3baba9fc7c764
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
index cde59d1..e0e9faf 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
@@ -23,6 +23,8 @@
 import org.onlab.packet.MacAddress;
 import org.onlab.packet.VlanId;
 import org.onosproject.core.ApplicationId;
+import org.onosproject.incubator.net.intf.Interface;
+import org.onosproject.incubator.net.intf.InterfaceService;
 import org.onosproject.net.ConnectPoint;
 import org.onosproject.net.Host;
 import org.onosproject.net.flow.DefaultTrafficSelector;
@@ -43,8 +45,6 @@
 import org.onosproject.routing.FibListener;
 import org.onosproject.routing.FibUpdate;
 import org.onosproject.routing.IntentRequestListener;
-import org.onosproject.routing.config.BgpPeer;
-import org.onosproject.routing.config.Interface;
 import org.onosproject.routing.config.RoutingConfigurationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -81,6 +81,7 @@
     private final ApplicationId appId;
     private final IntentService intentService;
     private final HostService hostService;
+    private final InterfaceService interfaceService;
     private final Map<IntentKey, PointToPointIntent> peerIntents;
     private final Map<IpPrefix, MultiPointToSinglePointIntent> routeIntents;
 
@@ -104,10 +105,12 @@
      */
     IntentSynchronizer(ApplicationId appId, IntentService intentService,
                        HostService hostService,
-                       RoutingConfigurationService configService) {
+                       RoutingConfigurationService configService,
+                       InterfaceService interfaceService) {
         this.appId = appId;
         this.intentService = intentService;
         this.hostService = hostService;
+        this.interfaceService = interfaceService;
         peerIntents = new ConcurrentHashMap<>();
         routeIntents = new ConcurrentHashMap<>();
 
@@ -122,12 +125,7 @@
      * Starts the synchronizer.
      */
     public void start() {
-        bgpIntentsSynchronizerExecutor.execute(new Runnable() {
-            @Override
-            public void run() {
-                doIntentSynchronizationThread();
-            }
-        });
+        bgpIntentsSynchronizerExecutor.execute(this::doIntentSynchronizationThread);
     }
 
     /**
@@ -313,24 +311,11 @@
             MacAddress nextHopMacAddress) {
 
         // Find the attachment point (egress interface) of the next hop
-        Interface egressInterface;
-        if (configService.getBgpPeers().containsKey(nextHopIpAddress)) {
-            // Route to a peer
-            log.debug("Route to peer {}", nextHopIpAddress);
-            BgpPeer peer =
-                    configService.getBgpPeers().get(nextHopIpAddress);
-            egressInterface =
-                    configService.getInterface(peer.connectPoint());
-        } else {
-            // Route to non-peer
-            log.debug("Route to non-peer {}", nextHopIpAddress);
-            egressInterface =
-                    configService.getMatchingInterface(nextHopIpAddress);
-            if (egressInterface == null) {
-                log.warn("No outgoing interface found for {}",
-                         nextHopIpAddress);
-                return null;
-            }
+        Interface egressInterface = interfaceService.getMatchingInterface(nextHopIpAddress);
+        if (egressInterface == null) {
+            log.warn("No outgoing interface found for {}",
+                     nextHopIpAddress);
+            return null;
         }
 
         //
@@ -341,7 +326,8 @@
         log.debug("Generating intent for prefix {}, next hop mac {}",
                   prefix, nextHopMacAddress);
 
-        for (Interface intf : configService.getInterfaces()) {
+        for (Interface intf : interfaceService.getInterfaces()) {
+            // TODO this should be only peering interfaces
             if (!intf.connectPoint().equals(egressInterface.connectPoint())) {
                 ConnectPoint srcPort = intf.connectPoint();
                 ingressPorts.add(srcPort);