Moved routing/bgp config into common routing bundle.

This allows the configuration to be used from multiple applications.

 * The class that reads the configuration file is now a service so that
   config can be consumed by components in other bundles.
 * Name of config reader classes has been generalized to RoutingConfigService
 * All config has been added to RoutingConfigService, instead of having
   two service interfaces like we did previously

Change-Id: Iaec9daf0f5b72abe2d6709fb75188d6d81947478
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/HostToInterfaceAdaptor.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/HostToInterfaceAdaptor.java
deleted file mode 100644
index e6275a6..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/HostToInterfaceAdaptor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import java.util.Set;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-import org.onosproject.sdnip.config.Interface;
-
-import com.google.common.collect.Sets;
-
-/**
- * Provides InterfaceService using PortAddresses data from the HostService.
- */
-public class HostToInterfaceAdaptor implements InterfaceService {
-
-    private final HostService hostService;
-
-    public HostToInterfaceAdaptor(HostService hostService) {
-        this.hostService = checkNotNull(hostService);
-    }
-
-    @Override
-    public Set<Interface> getInterfaces() {
-        Set<PortAddresses> addresses = hostService.getAddressBindings();
-        Set<Interface> interfaces = Sets.newHashSetWithExpectedSize(addresses.size());
-        for (PortAddresses a : addresses) {
-            interfaces.add(new Interface(a));
-        }
-        return interfaces;
-    }
-
-    @Override
-    public Interface getInterface(ConnectPoint connectPoint) {
-        checkNotNull(connectPoint);
-
-        Set<PortAddresses> portAddresses =
-                hostService.getAddressBindingsForPort(connectPoint);
-
-        for (PortAddresses addresses : portAddresses) {
-            if (addresses.connectPoint().equals(connectPoint)) {
-                return new Interface(addresses);
-            }
-        }
-
-        return null;
-    }
-
-    @Override
-    public Interface getMatchingInterface(IpAddress ipAddress) {
-        checkNotNull(ipAddress);
-
-        for (PortAddresses portAddresses : hostService.getAddressBindings()) {
-            for (InterfaceIpAddress ia : portAddresses.ipAddresses()) {
-                if (ia.subnetAddress().contains(ipAddress)) {
-                    return new Interface(portAddresses);
-                }
-            }
-        }
-
-        return null;
-    }
-
-}
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 85574b8..b1c9961 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/IntentSynchronizer.java
@@ -37,9 +37,9 @@
 import org.onosproject.net.intent.PointToPointIntent;
 import org.onosproject.routingapi.FibListener;
 import org.onosproject.routingapi.FibUpdate;
-import org.onosproject.sdnip.config.BgpPeer;
-import org.onosproject.sdnip.config.Interface;
-import org.onosproject.sdnip.config.SdnIpConfigurationService;
+import org.onosproject.routingapi.config.BgpPeer;
+import org.onosproject.routingapi.config.Interface;
+import org.onosproject.routingapi.config.RoutingConfigurationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -79,8 +79,7 @@
     private volatile boolean isElectedLeader = false;
     private volatile boolean isActivatedLeader = false;
 
-    private final SdnIpConfigurationService configService;
-    private final InterfaceService interfaceService;
+    private final RoutingConfigurationService configService;
 
     /**
      * Class constructor.
@@ -88,18 +87,15 @@
      * @param appId the Application ID
      * @param intentService the intent service
      * @param configService the SDN-IP configuration service
-     * @param interfaceService the interface service
      */
     IntentSynchronizer(ApplicationId appId, IntentService intentService,
-                       SdnIpConfigurationService configService,
-                       InterfaceService interfaceService) {
+                       RoutingConfigurationService configService) {
         this.appId = appId;
         this.intentService = intentService;
         peerIntents = new ConcurrentHashMap<>();
         routeIntents = new ConcurrentHashMap<>();
 
         this.configService = configService;
-        this.interfaceService = interfaceService;
 
         bgpIntentsSynchronizerExecutor = Executors.newSingleThreadExecutor(
                 new ThreadFactoryBuilder()
@@ -289,12 +285,12 @@
             BgpPeer peer =
                     configService.getBgpPeers().get(nextHopIpAddress);
             egressInterface =
-                    interfaceService.getInterface(peer.connectPoint());
+                    configService.getInterface(peer.connectPoint());
         } else {
             // Route to non-peer
             log.debug("Route to non-peer {}", nextHopIpAddress);
             egressInterface =
-                    interfaceService.getMatchingInterface(nextHopIpAddress);
+                    configService.getMatchingInterface(nextHopIpAddress);
             if (egressInterface == null) {
                 log.warn("No outgoing interface found for {}",
                          nextHopIpAddress);
@@ -310,7 +306,7 @@
         log.debug("Generating intent for prefix {}, next hop mac {}",
                   prefix, nextHopMacAddress);
 
-        for (Interface intf : interfaceService.getInterfaces()) {
+        for (Interface intf : configService.getInterfaces()) {
             if (!intf.connectPoint().equals(egressInterface.connectPoint())) {
                 ConnectPoint srcPort = intf.connectPoint();
                 ingressPorts.add(srcPort);
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/InterfaceService.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/InterfaceService.java
deleted file mode 100644
index 7b821d3..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/InterfaceService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip;
-
-import java.util.Set;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.sdnip.config.Interface;
-
-/**
- * Provides information about the interfaces in the network.
- */
-public interface InterfaceService {
-    /**
-     * Retrieves the entire set of interfaces in the network.
-     *
-     * @return the set of interfaces
-     */
-    Set<Interface> getInterfaces();
-
-    /**
-     * Retrieves the interface associated with the given connect point.
-     *
-     * @param connectPoint the connect point to retrieve interface information
-     * for
-     * @return the interface
-     */
-    Interface getInterface(ConnectPoint connectPoint);
-
-    /**
-     * Retrieves the interface that matches the given IP address. Matching
-     * means that the IP address is in one of the interface's assigned subnets.
-     *
-     * @param ipAddress IP address to match
-     * @return the matching interface
-     */
-    Interface getMatchingInterface(IpAddress ipAddress);
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
index 93b442d..baad757 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/PeerConnectivityManager.java
@@ -28,11 +28,11 @@
 import org.onosproject.net.flow.TrafficSelector;
 import org.onosproject.net.flow.TrafficTreatment;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.sdnip.config.BgpPeer;
-import org.onosproject.sdnip.config.BgpSpeaker;
-import org.onosproject.sdnip.config.Interface;
-import org.onosproject.sdnip.config.InterfaceAddress;
-import org.onosproject.sdnip.config.SdnIpConfigurationService;
+import org.onosproject.routingapi.config.BgpPeer;
+import org.onosproject.routingapi.config.BgpSpeaker;
+import org.onosproject.routingapi.config.Interface;
+import org.onosproject.routingapi.config.InterfaceAddress;
+import org.onosproject.routingapi.config.RoutingConfigurationService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,8 +51,7 @@
     private static final short BGP_PORT = 179;
 
     private final IntentSynchronizer intentSynchronizer;
-    private final SdnIpConfigurationService configService;
-    private final InterfaceService interfaceService;
+    private final RoutingConfigurationService configService;
 
     private final ApplicationId appId;
 
@@ -62,23 +61,20 @@
      * @param appId              the application ID
      * @param intentSynchronizer the intent synchronizer
      * @param configService      the SDN-IP config service
-     * @param interfaceService   the interface service
      */
     public PeerConnectivityManager(ApplicationId appId,
                                    IntentSynchronizer intentSynchronizer,
-                                   SdnIpConfigurationService configService,
-                                   InterfaceService interfaceService) {
+                                   RoutingConfigurationService configService) {
         this.appId = appId;
         this.intentSynchronizer = intentSynchronizer;
         this.configService = configService;
-        this.interfaceService = interfaceService;
     }
 
     /**
      * Starts the peer connectivity manager.
      */
     public void start() {
-        if (interfaceService.getInterfaces().isEmpty()) {
+        if (configService.getInterfaces().isEmpty()) {
             log.warn("No interfaces found in configuration file");
         }
 
@@ -142,7 +138,7 @@
         List<InterfaceAddress> interfaceAddresses =
                 bgpSpeaker.interfaceAddresses();
 
-        Interface peerInterface = interfaceService.getInterface(
+        Interface peerInterface = configService.getInterface(
                 bgpPeer.connectPoint());
 
         if (peerInterface == null) {
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
index 2f24e15..cf6280d 100644
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
+++ b/apps/sdnip/src/main/java/org/onosproject/sdnip/SdnIp.java
@@ -29,10 +29,9 @@
 import org.onosproject.config.NetworkConfigService;
 import org.onosproject.core.ApplicationId;
 import org.onosproject.core.CoreService;
-import org.onosproject.net.host.HostService;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.routingapi.RoutingService;
-import org.onosproject.sdnip.config.SdnIpConfigurationReader;
+import org.onosproject.routingapi.config.RoutingConfigurationService;
 import org.slf4j.Logger;
 
 import static org.slf4j.LoggerFactory.getLogger;
@@ -54,9 +53,6 @@
     protected IntentService intentService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected HostService hostService;
-
-    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected ClusterService clusterService;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
@@ -65,6 +61,9 @@
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected RoutingService routingService;
 
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected RoutingConfigurationService config;
+
     //
     // NOTE: Unused reference - needed to guarantee that the
     // NetworkConfigReader component is activated and the network configuration
@@ -74,7 +73,6 @@
     protected NetworkConfigService networkConfigService;
 
     private IntentSynchronizer intentSynchronizer;
-    private SdnIpConfigurationReader config;
     private PeerConnectivityManager peerConnectivity;
 
     private LeadershipEventListener leadershipEventListener =
@@ -87,22 +85,16 @@
         log.info("SDN-IP started");
 
         appId = coreService.registerApplication(SDN_IP_APP);
-        config = new SdnIpConfigurationReader();
-        config.readConfiguration();
 
         localControllerNode = clusterService.getLocalNode();
 
-        InterfaceService interfaceService =
-            new HostToInterfaceAdaptor(hostService);
-
         intentSynchronizer = new IntentSynchronizer(appId, intentService,
-                                                    config, interfaceService);
+                                                    config);
         intentSynchronizer.start();
 
         peerConnectivity = new PeerConnectivityManager(appId,
                                                        intentSynchronizer,
-                                                       config,
-                                                       interfaceService);
+                                                       config);
         peerConnectivity.start();
 
         routingService.start(intentSynchronizer);
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/BgpPeer.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/BgpPeer.java
deleted file mode 100644
index 5d89075..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/BgpPeer.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip.config;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.MoreObjects;
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-
-import java.util.Objects;
-
-/**
- * Configuration details for a BGP peer.
- */
-public class BgpPeer {
-    private final ConnectPoint connectPoint;
-    private final IpAddress ipAddress;
-
-    /**
-     * Creates a new BgpPeer.
-     *
-     * @param dpid the DPID of the switch the peer is attached at, as a String
-     * @param port the port the peer is attached at
-     * @param ipAddress the IP address of the peer as a String
-     */
-    public BgpPeer(@JsonProperty("attachmentDpid") String dpid,
-                   @JsonProperty("attachmentPort") long port,
-                   @JsonProperty("ipAddress") String ipAddress) {
-        this.connectPoint = new ConnectPoint(
-                DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(dpid)),
-                PortNumber.portNumber(port));
-        this.ipAddress = IpAddress.valueOf(ipAddress);
-    }
-
-    /**
-     * Gets the connection point of the peer.
-     *
-     * @return the connection point
-     */
-    public ConnectPoint connectPoint() {
-        return connectPoint;
-    }
-
-    /**
-     * Gets the IP address of the peer.
-     *
-     * @return the IP address
-     */
-    public IpAddress ipAddress() {
-        return ipAddress;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(connectPoint, ipAddress);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        }
-
-        if (!(obj instanceof BgpPeer)) {
-            return false;
-        }
-
-        BgpPeer that = (BgpPeer) obj;
-        return Objects.equals(this.connectPoint, that.connectPoint)
-                && Objects.equals(this.ipAddress, that.ipAddress);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .add("connectPoint", connectPoint)
-                .add("ipAddress", ipAddress)
-                .toString();
-    }
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/BgpSpeaker.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/BgpSpeaker.java
deleted file mode 100644
index 6e89b1f..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/BgpSpeaker.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip.config;
-
-import com.fasterxml.jackson.annotation.JsonCreator;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.MoreObjects;
-import org.onlab.packet.MacAddress;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-
-import java.util.List;
-import java.util.Objects;
-
-/**
- * Represents a BGP daemon in SDN network.
- * <p>
- * Each BGP speaker has a attachment point, which includes a switch DPID and a
- * switch port. Each BGP speaker has one MAC address and several IP addresses,
- * which are used to peer with BGP peers outside the SDN network. For each
- * peer outside the SDN network, we configure a different IP address to BGP
- * speaker inside the SDN network.
- * </p>
- * <p>
- * Each BGP speaker has a name, which is a unique identifying String that is
- * used to reference this speaker in the configuration.
- * </p>
- */
-public class BgpSpeaker {
-    private final String name;
-    private final ConnectPoint connectPoint;
-    private final MacAddress macAddress;
-    private List<InterfaceAddress> interfaceAddresses;
-
-    /**
-     * Class constructor used by the JSON library to create an object.
-     *
-     * @param name the name of the BGP speaker inside SDN network
-     * @param attachmentDpid the DPID where the BGP speaker is attached to
-     * @param attachmentPort the port where the BGP speaker is attached to
-     * @param macAddress the MAC address of the BGP speaker
-     */
-    @JsonCreator
-    public BgpSpeaker(@JsonProperty("name") String name,
-            @JsonProperty("attachmentDpid") String attachmentDpid,
-            @JsonProperty("attachmentPort") long attachmentPort,
-            @JsonProperty("macAddress") String macAddress) {
-
-        this.name = name;
-        this.macAddress = MacAddress.valueOf(macAddress);
-        this.connectPoint = new ConnectPoint(
-                DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(attachmentDpid)),
-                PortNumber.portNumber(attachmentPort));
-    }
-
-    /**
-     * Sets the addresses we configured for the BGP speaker on all virtual
-     * {@link Interface}s.
-     *
-     * @param interfaceAddresses a list of IP addresses of the BGP speaker
-     * configured on all virtual interfaces
-     */
-    @JsonProperty("interfaceAddresses")
-    public void setInterfaceAddresses(
-            List<InterfaceAddress> interfaceAddresses) {
-        this.interfaceAddresses = interfaceAddresses;
-    }
-
-    /**
-     * Gets the BGP speaker name.
-     *
-     * @return the BGP speaker name
-     */
-    public String name() {
-        return name;
-    }
-
-    /**
-     * Gets the connect point where the BGP speaker is attached.
-     *
-     * @return the connect point
-     */
-    public ConnectPoint connectPoint() {
-        return connectPoint;
-    }
-
-    /**
-     * Gets the MAC address of the BGP speaker.
-     *
-     * @return the MAC address
-     */
-    public MacAddress macAddress() {
-        return macAddress;
-    }
-
-    /**
-     * Gets all IP addresses configured on all {@link Interface}s of the
-     * BGP speaker.
-     *
-     * @return a list of IP addresses of the BGP speaker configured on all
-     * virtual interfaces
-     */
-    public List<InterfaceAddress> interfaceAddresses() {
-        return interfaceAddresses;
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof BgpSpeaker)) {
-            return false;
-        }
-
-        BgpSpeaker otherBgpSpeaker = (BgpSpeaker) other;
-
-        return  name.equals(otherBgpSpeaker.name) &&
-                connectPoint.equals(
-                        otherBgpSpeaker.connectPoint) &&
-                macAddress.equals(otherBgpSpeaker.macAddress) &&
-                interfaceAddresses.equals(otherBgpSpeaker.interfaceAddresses);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(name, connectPoint, macAddress,
-                interfaceAddresses);
-
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .add("speakerName", name)
-                .add("connectPoint", connectPoint)
-                .add("macAddress", macAddress)
-                .add("interfaceAddresses", interfaceAddresses)
-                .toString();
-    }
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/Configuration.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/Configuration.java
deleted file mode 100644
index 3d917cd..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/Configuration.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip.config;
-
-import java.util.Collections;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Contains the configuration data for SDN-IP that has been read from a
- * JSON-formatted configuration file.
- */
-public class Configuration {
-    // We call the BGP routers in our SDN network the BGP speakers, and call
-    // the BGP routers outside our SDN network the BGP peers.
-    private List<BgpSpeaker> bgpSpeakers;
-    private List<BgpPeer> peers;
-
-    /**
-     * Default constructor.
-     */
-    public Configuration() {
-    }
-
-    /**
-     * Gets a list of bgpSpeakers in the system, represented by
-     * {@link BgpSpeaker} objects.
-     *
-     * @return the list of BGP speakers
-     */
-    public List<BgpSpeaker> getBgpSpeakers() {
-        return Collections.unmodifiableList(bgpSpeakers);
-    }
-
-    /**
-     * Sets a list of bgpSpeakers in the system.
-     *
-     * @param bgpSpeakers the list of BGP speakers
-     */
-    @JsonProperty("bgpSpeakers")
-    public void setBgpSpeakers(List<BgpSpeaker> bgpSpeakers) {
-        this.bgpSpeakers = bgpSpeakers;
-    }
-
-    /**
-     * Gets a list of BGP peers we are configured to peer with. Peers are
-     * represented by {@link BgpPeer} objects.
-     *
-     * @return the list of BGP peers
-     */
-    public List<BgpPeer> getPeers() {
-        return Collections.unmodifiableList(peers);
-    }
-
-    /**
-     * Sets a list of BGP peers we are configured to peer with.
-     *
-     * @param peers the list of BGP peers
-     */
-    @JsonProperty("bgpPeers")
-    public void setPeers(List<BgpPeer> peers) {
-        this.peers = peers;
-    }
-
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/Interface.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/Interface.java
deleted file mode 100644
index 2179653..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/Interface.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip.config;
-
-import java.util.Objects;
-import java.util.Set;
-
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.Sets;
-
-/**
- * An Interface is a set of addresses that are logically mapped to a switch
- * port in the network.
- */
-public class Interface {
-    private final ConnectPoint connectPoint;
-    private final Set<InterfaceIpAddress> ipAddresses;
-    private final MacAddress macAddress;
-    private final VlanId vlan;
-
-    /**
-     * Creates an Interface based on a connection point, a set of interface
-     * IP addresses, and a MAC address.
-     *
-     * @param connectPoint the connect point this interface is mapped to
-     * @param ipAddresses the IP addresses for the interface
-     * @param macAddress the MAC address of the interface
-     * @param vlan VLAN identifier
-     */
-    public Interface(ConnectPoint connectPoint,
-                     Set<InterfaceIpAddress> ipAddresses,
-                     MacAddress macAddress, VlanId vlan) {
-        this.connectPoint = connectPoint;
-        this.ipAddresses = Sets.newHashSet(ipAddresses);
-        this.macAddress = macAddress;
-        this.vlan = vlan;
-    }
-
-    /**
-     * Creates an Interface based on a PortAddresses object.
-     *
-     * @param portAddresses the PortAddresses object to turn into an Interface
-     */
-    public Interface(PortAddresses portAddresses) {
-        connectPoint = portAddresses.connectPoint();
-        ipAddresses = Sets.newHashSet(portAddresses.ipAddresses());
-        macAddress = portAddresses.mac();
-        vlan = portAddresses.vlan();
-    }
-
-    /**
-     * Retrieves the connection point that this interface maps to.
-     *
-     * @return the connection point
-     */
-    public ConnectPoint connectPoint() {
-        return connectPoint;
-    }
-
-    /**
-     * Retrieves the set of IP addresses that are assigned to the interface.
-     *
-     * @return the set of interface IP addresses
-     */
-    public Set<InterfaceIpAddress> ipAddresses() {
-        return ipAddresses;
-    }
-
-    /**
-     * Retrieves the MAC address that is assigned to the interface.
-     *
-     * @return the MAC address
-     */
-    public MacAddress mac() {
-        return macAddress;
-    }
-
-    /**
-     * Retrieves the VLAN ID that is assigned to the interface.
-     *
-     * @return the VLAN ID
-     */
-    public VlanId vlan() {
-        return vlan;
-    }
-
-    @Override
-    public boolean equals(Object other) {
-        if (!(other instanceof Interface)) {
-            return false;
-        }
-
-        Interface otherInterface = (Interface) other;
-
-        return  connectPoint.equals(otherInterface.connectPoint) &&
-                ipAddresses.equals(otherInterface.ipAddresses) &&
-                macAddress.equals(otherInterface.macAddress) &&
-                vlan.equals(otherInterface.vlan);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(connectPoint, ipAddresses, macAddress, vlan);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .add("connectPoint", connectPoint)
-                .add("ipAddresses", ipAddresses)
-                .add("macAddress", macAddress)
-                .add("vlan", vlan)
-                .toString();
-    }
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/InterfaceAddress.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/InterfaceAddress.java
deleted file mode 100644
index 7b14735..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/InterfaceAddress.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip.config;
-
-import java.util.Objects;
-
-import org.onlab.packet.IpAddress;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.google.common.base.MoreObjects;
-
-/**
- * Represents an address of a {@link BgpSpeaker} configured on an
- * {@link Interface}.
- * <p>
- * Each InterfaceAddress includes the interface name and an IP address.
- * </p>
- */
-public class InterfaceAddress {
-    private final ConnectPoint connectPoint;
-    private final IpAddress ipAddress;
-
-    /**
-     * Creates an InterfaceAddress object.
-     *
-     * @param dpid the DPID of the interface as a String
-     * @param port the port of the interface
-     * @param ipAddress the IP address of a {@link BgpSpeaker} configured on
-     * the interface
-     */
-    public InterfaceAddress(@JsonProperty("interfaceDpid") String dpid,
-                            @JsonProperty("interfacePort") int port,
-                            @JsonProperty("ipAddress") String ipAddress) {
-        this.connectPoint = new ConnectPoint(
-                DeviceId.deviceId(SdnIpConfigurationReader.dpidToUri(dpid)),
-                PortNumber.portNumber(port));
-        this.ipAddress = IpAddress.valueOf(ipAddress);
-    }
-
-    /**
-     * Gets the connection point of the peer.
-     *
-     * @return the connection point
-     */
-    public ConnectPoint connectPoint() {
-        return connectPoint;
-    }
-
-    /**
-     * Gets the IP address of a BGP speaker configured on an {@link Interface}.
-     *
-     * @return the IP address
-     */
-    public IpAddress ipAddress() {
-        return ipAddress;
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hash(connectPoint, ipAddress);
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj == this) {
-            return true;
-        }
-
-        if (!(obj instanceof InterfaceAddress)) {
-            return false;
-        }
-
-        InterfaceAddress that = (InterfaceAddress) obj;
-        return Objects.equals(this.connectPoint, that.connectPoint)
-                && Objects.equals(this.ipAddress, that.ipAddress);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(getClass())
-                .add("connectPoint", connectPoint)
-                .add("ipAddress", ipAddress)
-                .toString();
-    }
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/SdnIpConfigurationReader.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/SdnIpConfigurationReader.java
deleted file mode 100644
index b36f421..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/SdnIpConfigurationReader.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip.config;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.onlab.packet.IpAddress;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/**
- * Implementation of SdnIpConfigurationService which reads SDN-IP configuration
- * from a file.
- */
-public class SdnIpConfigurationReader implements SdnIpConfigurationService {
-
-    private final Logger log = LoggerFactory.getLogger(getClass());
-
-    private static final String CONFIG_DIR = "../config";
-    private static final String DEFAULT_CONFIG_FILE = "sdnip.json";
-    private String configFileName = DEFAULT_CONFIG_FILE;
-
-    private Map<String, BgpSpeaker> bgpSpeakers = new ConcurrentHashMap<>();
-    private Map<IpAddress, BgpPeer> bgpPeers = new ConcurrentHashMap<>();
-
-    /**
-     * Reads SDN-IP related information contained in the configuration file.
-     *
-     * @param configFilename the name of the configuration file for the SDN-IP
-     * application
-     */
-    private void readConfiguration(String configFilename) {
-        File configFile = new File(CONFIG_DIR, configFilename);
-        ObjectMapper mapper = new ObjectMapper();
-
-        try {
-            log.info("Loading config: {}", configFile.getAbsolutePath());
-            Configuration config = mapper.readValue(configFile,
-                                                    Configuration.class);
-            for (BgpSpeaker speaker : config.getBgpSpeakers()) {
-                bgpSpeakers.put(speaker.name(), speaker);
-            }
-            for (BgpPeer peer : config.getPeers()) {
-                bgpPeers.put(peer.ipAddress(), peer);
-            }
-        } catch (FileNotFoundException e) {
-            log.warn("Configuration file not found: {}", configFileName);
-        } catch (IOException e) {
-            log.error("Error loading configuration", e);
-        }
-    }
-
-    /**
-     * Instructs the configuration reader to read the configuration from the file.
-     */
-    public void readConfiguration() {
-        readConfiguration(configFileName);
-    }
-
-    @Override
-    public Map<String, BgpSpeaker> getBgpSpeakers() {
-        return Collections.unmodifiableMap(bgpSpeakers);
-    }
-
-    @Override
-    public Map<IpAddress, BgpPeer> getBgpPeers() {
-        return Collections.unmodifiableMap(bgpPeers);
-    }
-
-    /**
-     * Converts DPIDs of the form xx:xx:xx:xx:xx:xx:xx to OpenFlow provider
-     * device URIs.
-     *
-     * @param dpid the DPID string to convert
-     * @return the URI string for this device
-     */
-    static String dpidToUri(String dpid) {
-        return "of:" + dpid.replace(":", "");
-    }
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/SdnIpConfigurationService.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/SdnIpConfigurationService.java
deleted file mode 100644
index 3b86a22..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/SdnIpConfigurationService.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip.config;
-
-import java.util.Map;
-
-import org.onlab.packet.IpAddress;
-
-/**
- * Provides information about the BGP elements configured in the network.
- */
-public interface SdnIpConfigurationService {
-
-    /**
-     * Gets the list of BGP speakers inside the SDN network.
-     *
-     * @return the map of BGP speaker names to BGP speaker objects
-     */
-    public Map<String, BgpSpeaker> getBgpSpeakers();
-
-    /**
-     * Gets the list of configured BGP peers.
-     *
-     * @return the map from peer IP address to BgpPeer object
-     */
-    public Map<IpAddress, BgpPeer> getBgpPeers();
-
-}
diff --git a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/package-info.java b/apps/sdnip/src/main/java/org/onosproject/sdnip/config/package-info.java
deleted file mode 100644
index 7689a2e..0000000
--- a/apps/sdnip/src/main/java/org/onosproject/sdnip/config/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * SDN-IP configuration services.
- */
-package org.onosproject.sdnip.config;
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/HostToInterfaceAdaptorTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/HostToInterfaceAdaptorTest.java
deleted file mode 100644
index 096e63c..0000000
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/HostToInterfaceAdaptorTest.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.sdnip;
-
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.VlanId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.PortNumber;
-import org.onosproject.net.host.HostService;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.onosproject.net.host.PortAddresses;
-import org.onosproject.sdnip.config.Interface;
-
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
-
-/**
- * Unit tests for the HostToInterfaceAdaptor class.
- */
-public class HostToInterfaceAdaptorTest {
-
-    private HostService hostService;
-    private HostToInterfaceAdaptor adaptor;
-
-    private Set<PortAddresses> portAddresses;
-    private Map<ConnectPoint, Interface> interfaces;
-
-    private static final ConnectPoint CP1 = new ConnectPoint(
-            DeviceId.deviceId("of:1"), PortNumber.portNumber(1));
-    private static final ConnectPoint CP2 = new ConnectPoint(
-            DeviceId.deviceId("of:1"), PortNumber.portNumber(2));
-    private static final ConnectPoint CP3 = new ConnectPoint(
-            DeviceId.deviceId("of:2"), PortNumber.portNumber(1));
-
-    private static final ConnectPoint NON_EXISTENT_CP = new ConnectPoint(
-            DeviceId.deviceId("doesnotexist"), PortNumber.portNumber(1));
-
-    @Before
-    public void setUp() throws Exception {
-        hostService = createMock(HostService.class);
-
-        portAddresses = Sets.newHashSet();
-        interfaces = Maps.newHashMap();
-
-        InterfaceIpAddress ia11 =
-            new InterfaceIpAddress(IpAddress.valueOf("192.168.1.1"),
-                                   IpPrefix.valueOf("192.168.1.0/24"));
-        createPortAddressesAndInterface(CP1,
-                Sets.newHashSet(ia11),
-                MacAddress.valueOf("00:00:00:00:00:01"),
-                VlanId.NONE);
-
-        // Two addresses in the same subnet
-        InterfaceIpAddress ia21 =
-            new InterfaceIpAddress(IpAddress.valueOf("192.168.2.1"),
-                                   IpPrefix.valueOf("192.168.2.0/24"));
-        InterfaceIpAddress ia22 =
-            new InterfaceIpAddress(IpAddress.valueOf("192.168.2.2"),
-                                   IpPrefix.valueOf("192.168.2.0/24"));
-        createPortAddressesAndInterface(CP2,
-                Sets.newHashSet(ia21, ia22),
-                MacAddress.valueOf("00:00:00:00:00:02"),
-                VlanId.vlanId((short) 4));
-
-        // Two addresses in different subnets
-        InterfaceIpAddress ia31 =
-            new InterfaceIpAddress(IpAddress.valueOf("192.168.3.1"),
-                                   IpPrefix.valueOf("192.168.3.0/24"));
-        InterfaceIpAddress ia41 =
-            new InterfaceIpAddress(IpAddress.valueOf("192.168.4.1"),
-                                   IpPrefix.valueOf("192.168.4.0/24"));
-        createPortAddressesAndInterface(CP3,
-                Sets.newHashSet(ia31, ia41),
-                MacAddress.valueOf("00:00:00:00:00:03"),
-                VlanId.NONE);
-
-        expect(hostService.getAddressBindings()).andReturn(portAddresses).anyTimes();
-
-        replay(hostService);
-
-        adaptor = new HostToInterfaceAdaptor(hostService);
-    }
-
-    /**
-     * Creates both a PortAddresses and an Interface for the given inputs and
-     * places them in the correct global data stores.
-     *
-     * @param cp the connect point
-     * @param ipAddresses the set of interface IP addresses
-     * @param mac the MAC address
-     * @param vlan the VLAN ID
-     */
-    private void createPortAddressesAndInterface(
-            ConnectPoint cp, Set<InterfaceIpAddress> ipAddresses,
-            MacAddress mac, VlanId vlan) {
-        PortAddresses pa = new PortAddresses(cp, ipAddresses, mac, vlan);
-        portAddresses.add(pa);
-        expect(hostService.getAddressBindingsForPort(cp)).andReturn(
-                Collections.singleton(pa)).anyTimes();
-
-        Interface intf = new Interface(cp, ipAddresses, mac, vlan);
-        interfaces.put(cp, intf);
-    }
-
-    /**
-     * Tests {@link HostToInterfaceAdaptor#getInterfaces()}.
-     * Verifies that the set of interfaces returned matches what is expected
-     * based on the input PortAddresses data.
-     */
-    @Test
-    public void testGetInterfaces() {
-        Set<Interface> adaptorIntfs = adaptor.getInterfaces();
-
-        assertEquals(3, adaptorIntfs.size());
-        assertTrue(adaptorIntfs.contains(this.interfaces.get(CP1)));
-        assertTrue(adaptorIntfs.contains(this.interfaces.get(CP2)));
-        assertTrue(adaptorIntfs.contains(this.interfaces.get(CP3)));
-    }
-
-    /**
-     * Tests {@link HostToInterfaceAdaptor#getInterface(ConnectPoint)}.
-     * Verifies that the correct interface is returned for a given connect
-     * point.
-     */
-    @Test
-    public void testGetInterface() {
-        assertEquals(this.interfaces.get(CP1), adaptor.getInterface(CP1));
-        assertEquals(this.interfaces.get(CP2), adaptor.getInterface(CP2));
-        assertEquals(this.interfaces.get(CP3), adaptor.getInterface(CP3));
-
-        // Try and get an interface for a connect point with no addresses
-        reset(hostService);
-        expect(hostService.getAddressBindingsForPort(NON_EXISTENT_CP))
-                .andReturn(Collections.<PortAddresses>emptySet()).anyTimes();
-        replay(hostService);
-
-        assertNull(adaptor.getInterface(NON_EXISTENT_CP));
-    }
-
-    /**
-     * Tests {@link HostToInterfaceAdaptor#getInterface(ConnectPoint)} in the
-     * case that the input connect point is null.
-     * Verifies that a NullPointerException is thrown.
-     */
-    @Test(expected = NullPointerException.class)
-    public void testGetInterfaceNull() {
-        adaptor.getInterface(null);
-    }
-
-    /**
-     * Tests {@link HostToInterfaceAdaptor#getMatchingInterface(IpAddress)}.
-     * Verifies that the correct interface is returned based on the given IP
-     * address.
-     */
-    @Test
-    public void testGetMatchingInterface() {
-        assertEquals(this.interfaces.get(CP1),
-                adaptor.getMatchingInterface(IpAddress.valueOf("192.168.1.100")));
-        assertEquals(this.interfaces.get(CP2),
-                adaptor.getMatchingInterface(IpAddress.valueOf("192.168.2.100")));
-        assertEquals(this.interfaces.get(CP3),
-                adaptor.getMatchingInterface(IpAddress.valueOf("192.168.3.100")));
-        assertEquals(this.interfaces.get(CP3),
-                adaptor.getMatchingInterface(IpAddress.valueOf("192.168.4.100")));
-
-        // Try and match an address we don't have subnet configured for
-        assertNull(adaptor.getMatchingInterface(IpAddress.valueOf("1.1.1.1")));
-    }
-
-    /**
-     * Tests {@link HostToInterfaceAdaptor#getMatchingInterface(IpAddress)} in the
-     * case that the input IP address is null.
-     * Verifies that a NullPointerException is thrown.
-     */
-    @Test(expected = NullPointerException.class)
-    public void testGetMatchingInterfaceNull() {
-        adaptor.getMatchingInterface(null);
-    }
-
-}
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
index 857f49a..ffe839f 100644
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
+++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/IntentSyncTest.java
@@ -44,10 +44,10 @@
 import org.onosproject.routingapi.FibEntry;
 import org.onosproject.routingapi.FibUpdate;
 import org.onosproject.routingapi.RouteEntry;
+import org.onosproject.routingapi.config.BgpPeer;
+import org.onosproject.routingapi.config.Interface;
+import org.onosproject.routingapi.config.RoutingConfigurationService;
 import org.onosproject.sdnip.IntentSynchronizer.IntentKey;
-import org.onosproject.sdnip.config.BgpPeer;
-import org.onosproject.sdnip.config.Interface;
-import org.onosproject.sdnip.config.SdnIpConfigurationService;
 
 import java.util.Collections;
 import java.util.HashMap;
@@ -70,8 +70,7 @@
  */
 public class IntentSyncTest extends AbstractIntentTest {
 
-    private SdnIpConfigurationService sdnIpConfigService;
-    private InterfaceService interfaceService;
+    private RoutingConfigurationService routingConfig;
     private IntentService intentService;
 
     private static final ConnectPoint SW1_ETH1 = new ConnectPoint(
@@ -107,13 +106,19 @@
     @Before
     public void setUp() throws Exception {
         super.setUp();
-        setUpInterfaceService();
 
+        routingConfig = createMock(RoutingConfigurationService.class);
+
+        // These will set expectations on routingConfig
+        setUpInterfaceService();
         setUpBgpPeers();
+
+        replay(routingConfig);
+
         intentService = createMock(IntentService.class);
 
         intentSynchronizer = new IntentSynchronizer(APPID, intentService,
-                                                    sdnIpConfigService, interfaceService);
+                                                    routingConfig);
     }
 
     /**
@@ -140,10 +145,7 @@
         peers.put(IpAddress.valueOf(peer1Sw4Eth1),
                   new BgpPeer("00:00:00:00:00:00:00:04", 1, peer1Sw4Eth1));
 
-        sdnIpConfigService = createMock(SdnIpConfigurationService.class);
-        expect(sdnIpConfigService.getBgpPeers()).andReturn(peers).anyTimes();
-        replay(sdnIpConfigService);
-
+        expect(routingConfig.getBgpPeers()).andReturn(peers).anyTimes();
     }
 
     /**
@@ -151,8 +153,6 @@
      */
     private void setUpInterfaceService() {
 
-        interfaceService = createMock(InterfaceService.class);
-
         Set<Interface> interfaces = Sets.newHashSet();
 
         Set<InterfaceIpAddress> interfaceIpAddresses1 = Sets.newHashSet();
@@ -190,17 +190,16 @@
                                           MacAddress.valueOf("00:00:00:00:00:04"),
                                           VlanId.vlanId((short) 1));
 
-        expect(interfaceService.getInterface(SW4_ETH1)).andReturn(sw4Eth1).anyTimes();
+        expect(routingConfig.getInterface(SW4_ETH1)).andReturn(
+                sw4Eth1).anyTimes();
         interfaces.add(sw4Eth1);
 
-        expect(interfaceService.getInterface(SW1_ETH1)).andReturn(
+        expect(routingConfig.getInterface(SW1_ETH1)).andReturn(
                 sw1Eth1).anyTimes();
-        expect(interfaceService.getInterface(SW2_ETH1)).andReturn(
+        expect(routingConfig.getInterface(SW2_ETH1)).andReturn(
                 sw2Eth1).anyTimes();
-        expect(interfaceService.getInterface(SW3_ETH1)).andReturn(
-                sw3Eth1).anyTimes();
-        expect(interfaceService.getInterfaces()).andReturn(interfaces).anyTimes();
-        replay(interfaceService);
+        expect(routingConfig.getInterface(SW3_ETH1)).andReturn(sw3Eth1).anyTimes();
+        expect(routingConfig.getInterfaces()).andReturn(interfaces).anyTimes();
     }
 
     /**
@@ -517,7 +516,7 @@
 
         // Set up expectation
         reset(intentService);
-        Set<Intent> intents = new HashSet<Intent>();
+        Set<Intent> intents = new HashSet<>();
         intents.add(intent1);
         expect(intentService.getIntentState(intent1.key()))
                 .andReturn(IntentState.INSTALLED).anyTimes();
@@ -584,9 +583,9 @@
                 DefaultTrafficTreatment.builder();
         treatmentBuilder.setEthDst(MacAddress.valueOf(nextHopMacAddress));
 
-        Set<ConnectPoint> ingressPoints = new HashSet<ConnectPoint>();
-        for (Interface intf : interfaceService.getInterfaces()) {
-            if (!intf.equals(interfaceService.getInterface(egressPoint))) {
+        Set<ConnectPoint> ingressPoints = new HashSet<>();
+        for (Interface intf : routingConfig.getInterfaces()) {
+            if (!intf.equals(routingConfig.getInterface(egressPoint))) {
                 ConnectPoint srcPort = intf.connectPoint();
                 ingressPoints.add(srcPort);
             }
diff --git a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
index ed703b9..b3678c4 100644
--- a/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
+++ b/apps/sdnip/src/test/java/org/onosproject/sdnip/PeerConnectivityManagerTest.java
@@ -40,11 +40,11 @@
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.PointToPointIntent;
-import org.onosproject.sdnip.config.BgpPeer;
-import org.onosproject.sdnip.config.BgpSpeaker;
-import org.onosproject.sdnip.config.Interface;
-import org.onosproject.sdnip.config.InterfaceAddress;
-import org.onosproject.sdnip.config.SdnIpConfigurationService;
+import org.onosproject.routingapi.config.BgpPeer;
+import org.onosproject.routingapi.config.BgpSpeaker;
+import org.onosproject.routingapi.config.Interface;
+import org.onosproject.routingapi.config.InterfaceAddress;
+import org.onosproject.routingapi.config.RoutingConfigurationService;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -75,8 +75,7 @@
 
     private PeerConnectivityManager peerConnectivityManager;
     private IntentSynchronizer intentSynchronizer;
-    private SdnIpConfigurationService configInfoService;
-    private InterfaceService interfaceService;
+    private RoutingConfigurationService routingConfig;
     private IntentService intentService;
 
     private Map<String, BgpSpeaker> bgpSpeakers;
@@ -114,6 +113,9 @@
     @Before
     public void setUp() throws Exception {
         super.setUp();
+        routingConfig = createMock(RoutingConfigurationService.class);
+
+        // These will set expectations on routingConfig
         bgpSpeakers = Collections.unmodifiableMap(setUpBgpSpeakers());
         interfaces = Collections.unmodifiableMap(setUpInterfaces());
         peers = Collections.unmodifiableMap(setUpPeers());
@@ -135,8 +137,7 @@
                 "bgpSpeaker1",
                 "00:00:00:00:00:00:00:01", 100,
                 "00:00:00:00:00:01");
-        List<InterfaceAddress> interfaceAddresses1 =
-                new LinkedList<InterfaceAddress>();
+        List<InterfaceAddress> interfaceAddresses1 = new LinkedList<>();
         interfaceAddresses1.add(new InterfaceAddress(dpid1, 1, "192.168.10.101"));
         interfaceAddresses1.add(new InterfaceAddress(dpid2, 1, "192.168.20.101"));
         bgpSpeaker1.setInterfaceAddresses(interfaceAddresses1);
@@ -147,8 +148,7 @@
                 "bgpSpeaker2",
                 "00:00:00:00:00:00:00:01", 100,
                 "00:00:00:00:00:02");
-        List<InterfaceAddress> interfaceAddresses2 =
-                new LinkedList<InterfaceAddress>();
+        List<InterfaceAddress> interfaceAddresses2 = new LinkedList<>();
         interfaceAddresses2.add(new InterfaceAddress(dpid1, 1, "192.168.10.102"));
         interfaceAddresses2.add(new InterfaceAddress(dpid2, 1, "192.168.20.102"));
         bgpSpeaker2.setInterfaceAddresses(interfaceAddresses2);
@@ -158,8 +158,7 @@
                 "bgpSpeaker3",
                 "00:00:00:00:00:00:00:02", 100,
                 "00:00:00:00:00:03");
-        List<InterfaceAddress> interfaceAddresses3 =
-                new LinkedList<InterfaceAddress>();
+        List<InterfaceAddress> interfaceAddresses3 = new LinkedList<>();
         interfaceAddresses3.add(new InterfaceAddress(dpid1, 1, "192.168.10.103"));
         interfaceAddresses3.add(new InterfaceAddress(dpid2, 1, "192.168.20.103"));
         bgpSpeaker3.setInterfaceAddresses(interfaceAddresses3);
@@ -198,22 +197,19 @@
                 VlanId.NONE);
         configuredInterfaces.put(interfaceSw2Eth1, intfsw2eth1);
 
-        interfaceService = createMock(InterfaceService.class);
-
-        expect(interfaceService.getInterface(s1Eth1))
+        expect(routingConfig.getInterface(s1Eth1))
                 .andReturn(intfsw1eth1).anyTimes();
-        expect(interfaceService.getInterface(s2Eth1))
+        expect(routingConfig.getInterface(s2Eth1))
                 .andReturn(intfsw2eth1).anyTimes();
 
         // Non-existent interface used during one of the tests
-        expect(interfaceService.getInterface(new ConnectPoint(
+        expect(routingConfig.getInterface(new ConnectPoint(
                     DeviceId.deviceId(SdnIp.dpidToUri("00:00:00:00:00:00:01:00")),
                     PortNumber.portNumber(1))))
                     .andReturn(null).anyTimes();
 
-        expect(interfaceService.getInterfaces()).andReturn(
+        expect(routingConfig.getInterfaces()).andReturn(
                 Sets.newHashSet(configuredInterfaces.values())).anyTimes();
-        replay(interfaceService);
 
         return configuredInterfaces;
     }
@@ -250,7 +246,7 @@
      */
     private List<PointToPointIntent> setUpIntentList() {
 
-        intentList = new ArrayList<PointToPointIntent>();
+        intentList = new ArrayList<>();
 
         setUpBgpIntents();
         setUpIcmpIntents();
@@ -538,23 +534,21 @@
      */
     private void initPeerConnectivity() throws TestUtilsException {
 
-        configInfoService = createMock(SdnIpConfigurationService.class);
-        expect(configInfoService.getBgpPeers()).andReturn(peers).anyTimes();
-        expect(configInfoService.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes();
-        replay(configInfoService);
+        expect(routingConfig.getBgpPeers()).andReturn(peers).anyTimes();
+        expect(routingConfig.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes();
+        replay(routingConfig);
 
         intentService = createMock(IntentService.class);
         replay(intentService);
 
         intentSynchronizer = new IntentSynchronizer(APPID, intentService,
-                                                    configInfoService,
-                                                    interfaceService);
+                                                    routingConfig);
         intentSynchronizer.leaderChanged(true);
         TestUtils.setField(intentSynchronizer, "isActivatedLeader", true);
 
         peerConnectivityManager =
             new PeerConnectivityManager(APPID, intentSynchronizer,
-                                        configInfoService, interfaceService);
+                                        routingConfig);
     }
 
     /**
@@ -587,19 +581,17 @@
      */
     @Test
     public void testNullInterfaces() {
-        reset(interfaceService);
-        expect(interfaceService.getInterfaces()).andReturn(
+        reset(routingConfig);
+        expect(routingConfig.getInterfaces()).andReturn(
                 Sets.<Interface>newHashSet()).anyTimes();
-        expect(interfaceService.getInterface(s2Eth1))
+        expect(routingConfig.getInterface(s2Eth1))
                 .andReturn(null).anyTimes();
-        expect(interfaceService.getInterface(s1Eth1))
+        expect(routingConfig.getInterface(s1Eth1))
         .andReturn(null).anyTimes();
-        replay(interfaceService);
 
-        reset(configInfoService);
-        expect(configInfoService.getBgpPeers()).andReturn(peers).anyTimes();
-        expect(configInfoService.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes();
-        replay(configInfoService);
+        expect(routingConfig.getBgpPeers()).andReturn(peers).anyTimes();
+        expect(routingConfig.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes();
+        replay(routingConfig);
 
         reset(intentService);
         replay(intentService);
@@ -612,17 +604,13 @@
      */
     @Test
     public void testNullBgpPeers() {
-        reset(interfaceService);
-        expect(interfaceService.getInterfaces()).andReturn(
+        reset(routingConfig);
+        expect(routingConfig.getInterfaces()).andReturn(
                 Sets.newHashSet(interfaces.values())).anyTimes();
-        replay(interfaceService);
 
-        reset(configInfoService);
-        expect(configInfoService.getBgpPeers()).andReturn(
-                new HashMap<IpAddress, BgpPeer>()).anyTimes();
-        expect(configInfoService.getBgpSpeakers()).andReturn(
-                bgpSpeakers).anyTimes();
-        replay(configInfoService);
+        expect(routingConfig.getBgpPeers()).andReturn(new HashMap<>()).anyTimes();
+        expect(routingConfig.getBgpSpeakers()).andReturn(bgpSpeakers).anyTimes();
+        replay(routingConfig);
 
         reset(intentService);
         replay(intentService);
@@ -635,17 +623,14 @@
      */
     @Test
     public void testNullBgpSpeakers() {
-        reset(interfaceService);
-        expect(interfaceService.getInterfaces()).andReturn(
+        reset(routingConfig);
+        expect(routingConfig.getInterfaces()).andReturn(
                 Sets.newHashSet(interfaces.values())).anyTimes();
-        replay(interfaceService);
 
-        reset(configInfoService);
-        expect(configInfoService.getBgpPeers()).andReturn(
-                peers).anyTimes();
-        expect(configInfoService.getBgpSpeakers()).andReturn(
+        expect(routingConfig.getBgpPeers()).andReturn(peers).anyTimes();
+        expect(routingConfig.getBgpSpeakers()).andReturn(
                 Collections.emptyMap()).anyTimes();
-        replay(configInfoService);
+        replay(routingConfig);
 
         reset(intentService);
         replay(intentService);
@@ -676,8 +661,7 @@
                 "bgpSpeaker100",
                 "00:00:00:00:00:00:01:00", 100,
                 "00:00:00:00:01:00");
-        List<InterfaceAddress> interfaceAddresses100 =
-                new LinkedList<InterfaceAddress>();
+        List<InterfaceAddress> interfaceAddresses100 = new LinkedList<>();
         interfaceAddresses100.add(new InterfaceAddress(dpid1, 1, "192.168.10.201"));
         interfaceAddresses100.add(new InterfaceAddress(dpid2, 1, "192.168.20.201"));
         bgpSpeaker100.setInterfaceAddresses(interfaceAddresses100);