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;