Move reactive-routing-specific config and classes out of common routing bundle

Change-Id: I463e5225337bfaa0ec85285658dbbabc8059f209
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/IntentRequestListener.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/IntentRequestListener.java
new file mode 100644
index 0000000..b93b3ff
--- /dev/null
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/IntentRequestListener.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2017-present 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.reactive.routing;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onosproject.net.ConnectPoint;
+
+/**
+ * An interface to process intent requests.
+ */
+public interface IntentRequestListener {
+
+    /**
+     * Sets up connectivity for packet from Internet to a host in local
+     * SDN network.
+     *
+     * @param dstIpAddress IP address of destination host in local SDN network
+     */
+    void setUpConnectivityInternetToHost(IpAddress dstIpAddress);
+
+    /**
+     * Sets up the connectivity for two hosts in local SDN network.
+     *
+     * @param dstIpAddress the destination IP address
+     * @param srcIpAddress the source IP address
+     * @param srcMacAddress the source MAC address
+     * @param srcConnectPoint the connectPoint of the source host
+     */
+    void setUpConnectivityHostToHost(IpAddress dstIpAddress,
+                                     IpAddress srcIpAddress,
+                                     MacAddress srcMacAddress,
+                                     ConnectPoint srcConnectPoint);
+
+    /**
+     * Sets up connectivity for packet from a local host to the Internet.
+     *
+     * @param hostIp IP address of the local host
+     * @param prefix external IP prefix that the host is talking to
+     * @param nextHopIpAddress IP address of the next hop router for the prefix
+     */
+    void setUpConnectivityHostToInternet(IpAddress hostIp, IpPrefix prefix,
+                                                IpAddress nextHopIpAddress);
+
+    /**
+     * Adds one new ingress connect point into ingress points of an existing
+     * intent and resubmits the new intent.
+     * <p>
+     * If there is already an intent for an IP prefix in the system, we do not
+     * need to create a new one, we only need to update this existing intent by
+     * adding more ingress points.
+     * </p>
+     *
+     * @param ipPrefix the IP prefix used to search the existing
+     *        MultiPointToSinglePointIntent
+     * @param ingressConnectPoint the ingress connect point to be added into
+     *        the exiting intent
+     */
+    void updateExistingMp2pIntent(IpPrefix ipPrefix,
+                                  ConnectPoint ingressConnectPoint);
+
+    /**
+     * Checks whether there is a MultiPointToSinglePointIntent in memory for a
+     * given IP prefix.
+     *
+     * @param ipPrefix the IP prefix used to search the existing
+     *        MultiPointToSinglePointIntent
+     * @return true if there is a MultiPointToSinglePointIntent, otherwise false
+     */
+    boolean mp2pIntentExists(IpPrefix ipPrefix);
+
+}
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/LocalIpPrefixEntry.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/LocalIpPrefixEntry.java
new file mode 100644
index 0000000..49f336e
--- /dev/null
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/LocalIpPrefixEntry.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright 2017-present 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.reactive.routing;
+
+import com.google.common.base.MoreObjects;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+
+import java.util.Objects;
+
+/**
+ * Configuration details for an IP prefix entry.
+ */
+public class LocalIpPrefixEntry {
+    private final IpPrefix ipPrefix;
+    private final IpPrefixType type;
+    private final IpAddress gatewayIpAddress;
+
+    /**
+     * Specifies the type of local IP prefix.
+     */
+    public enum IpPrefixType {
+        /**
+         * Public IP prefixes should be exchanged by eBGP.
+         */
+        PUBLIC,
+        /**
+         * Private IP prefixes should be used only locally and not exchanged
+         * by eBGP.
+         */
+        PRIVATE,
+        /**
+         * For IP prefixes in blacklist.
+         */
+        BLACK_LIST
+    }
+
+    /**
+     * Creates a new IP prefix entry.
+     *
+     * @param ipPrefix         an IP prefix
+     * @param type             an IP prefix type as an IpPrefixType
+     * @param gatewayIpAddress IP of the gateway
+     */
+    public LocalIpPrefixEntry(IpPrefix ipPrefix,
+                              IpPrefixType type,
+                              IpAddress gatewayIpAddress) {
+        this.ipPrefix = ipPrefix;
+        this.type = type;
+        this.gatewayIpAddress = gatewayIpAddress;
+    }
+
+    /**
+     * Gets the IP prefix of the IP prefix entry.
+     *
+     * @return the IP prefix
+     */
+    public IpPrefix ipPrefix() {
+        return ipPrefix;
+    }
+
+    /**
+     * Gets the IP prefix type of the IP prefix entry.
+     *
+     * @return the IP prefix type
+     */
+    public IpPrefixType ipPrefixType() {
+        return type;
+    }
+
+    /**
+     * Gets the gateway IP address of the IP prefix entry.
+     *
+     * @return the gateway IP address
+     */
+    public IpAddress getGatewayIpAddress() {
+        return gatewayIpAddress;
+    }
+
+    /**
+     * Tests whether the IP version of this entry is IPv4.
+     *
+     * @return true if the IP version of this entry is IPv4, otherwise false.
+     */
+    public boolean isIp4() {
+        return ipPrefix.isIp4();
+    }
+
+    /**
+     * Tests whether the IP version of this entry is IPv6.
+     *
+     * @return true if the IP version of this entry is IPv6, otherwise false.
+     */
+    public boolean isIp6() {
+        return ipPrefix.isIp6();
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(ipPrefix, type);
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == this) {
+            return true;
+        }
+
+        if (!(obj instanceof LocalIpPrefixEntry)) {
+            return false;
+        }
+
+        LocalIpPrefixEntry that = (LocalIpPrefixEntry) obj;
+        return Objects.equals(this.ipPrefix, that.ipPrefix)
+                && Objects.equals(this.type, that.type);
+    }
+
+    @Override
+    public String toString() {
+        return MoreObjects.toStringHelper(getClass())
+                .add("ipPrefix", ipPrefix)
+                .add("ipPrefixType", type)
+                .toString();
+    }
+}
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfig.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfig.java
new file mode 100644
index 0000000..fd7e519
--- /dev/null
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfig.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2017-present 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.reactive.routing;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.collect.Sets;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.net.config.Config;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Set;
+
+/**
+ * Configuration object for prefix config.
+ */
+public class ReactiveRoutingConfig extends Config<ApplicationId> {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    public static final String IP4LOCALPREFIXES = "ip4LocalPrefixes";
+    public static final String IP6LOCALPREFIXES = "ip6LocalPrefixes";
+    public static final String IPPREFIX = "ipPrefix";
+    public static final String TYPE = "type";
+    public static final String GATEWAYIP = "gatewayIp";
+    public static final String VIRTUALGATEWAYMACADDRESS =
+                               "virtualGatewayMacAddress";
+
+    /**
+     * Gets the set of configured local IPv4 prefixes.
+     *
+     * @return IPv4 prefixes
+     */
+    public Set<LocalIpPrefixEntry> localIp4PrefixEntries() {
+        Set<LocalIpPrefixEntry> prefixes = Sets.newHashSet();
+
+        JsonNode prefixesNode = object.get(IP4LOCALPREFIXES);
+        if (prefixesNode == null) {
+            log.warn("ip4LocalPrefixes is null!");
+            return prefixes;
+        }
+
+        prefixesNode.forEach(jsonNode -> {
+
+            prefixes.add(new LocalIpPrefixEntry(
+                    IpPrefix.valueOf(jsonNode.get(IPPREFIX).asText()),
+                    LocalIpPrefixEntry.IpPrefixType.valueOf(jsonNode.get(TYPE).asText()),
+                    IpAddress.valueOf(jsonNode.get(GATEWAYIP).asText())));
+        });
+
+        return prefixes;
+    }
+
+    /**
+     * Gets the set of configured local IPv6 prefixes.
+     *
+     * @return IPv6 prefixes
+     */
+    public Set<LocalIpPrefixEntry> localIp6PrefixEntries() {
+        Set<LocalIpPrefixEntry> prefixes = Sets.newHashSet();
+
+        JsonNode prefixesNode = object.get(IP6LOCALPREFIXES);
+
+        if (prefixesNode == null) {
+            log.warn("ip6LocalPrefixes is null!");
+            return prefixes;
+        }
+
+        prefixesNode.forEach(jsonNode -> {
+
+            prefixes.add(new LocalIpPrefixEntry(
+                    IpPrefix.valueOf(jsonNode.get(IPPREFIX).asText()),
+                    LocalIpPrefixEntry.IpPrefixType.valueOf(jsonNode.get(TYPE).asText()),
+                    IpAddress.valueOf(jsonNode.get(GATEWAYIP).asText())));
+        });
+
+        return prefixes;
+    }
+
+    /**
+     *  Gets of the virtual gateway MAC address.
+     *
+     * @return virtual gateway MAC address
+     */
+    public MacAddress virtualGatewayMacAddress() {
+        return MacAddress.valueOf(
+                object.get(VIRTUALGATEWAYMACADDRESS).asText());
+    }
+}
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfiguration.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfiguration.java
new file mode 100644
index 0000000..4308ddb
--- /dev/null
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfiguration.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2017-present 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.reactive.routing;
+
+import com.google.common.collect.ImmutableSet;
+import com.googlecode.concurrenttrees.radix.node.concrete.DefaultByteArrayNodeFactory;
+import com.googlecode.concurrenttrees.radixinverted.ConcurrentInvertedRadixTree;
+import com.googlecode.concurrenttrees.radixinverted.InvertedRadixTree;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.packet.Ip4Address;
+import org.onlab.packet.Ip6Address;
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onosproject.core.ApplicationId;
+import org.onosproject.core.CoreService;
+import org.onosproject.incubator.net.intf.InterfaceService;
+import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.config.ConfigFactory;
+import org.onosproject.net.config.NetworkConfigEvent;
+import org.onosproject.net.config.NetworkConfigListener;
+import org.onosproject.net.config.NetworkConfigRegistry;
+import org.onosproject.net.config.NetworkConfigService;
+import org.onosproject.net.config.basics.SubjectFactories;
+import org.onosproject.routing.RoutingService;
+import org.onosproject.routing.config.BgpConfig;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.HashSet;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Reactive routing configuration manager.
+ */
+@Component(immediate = true)
+@Service
+public class ReactiveRoutingConfiguration implements
+        ReactiveRoutingConfigurationService {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigRegistry registry;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected NetworkConfigService configService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected CoreService coreService;
+
+    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
+    protected InterfaceService interfaceService;
+
+    private Set<IpAddress> gatewayIpAddresses = new HashSet<>();
+    private Set<ConnectPoint> bgpPeerConnectPoints = new HashSet<>();
+
+    private InvertedRadixTree<LocalIpPrefixEntry>
+            localPrefixTable4 = new ConcurrentInvertedRadixTree<>(
+                    new DefaultByteArrayNodeFactory());
+    private InvertedRadixTree<LocalIpPrefixEntry>
+            localPrefixTable6 = new ConcurrentInvertedRadixTree<>(
+                    new DefaultByteArrayNodeFactory());
+
+    private MacAddress virtualGatewayMacAddress;
+    private final InternalNetworkConfigListener configListener =
+            new InternalNetworkConfigListener();
+
+    private ConfigFactory<ApplicationId, ReactiveRoutingConfig>
+            reactiveRoutingConfigFactory =
+            new ConfigFactory<ApplicationId, ReactiveRoutingConfig>(
+                    SubjectFactories.APP_SUBJECT_FACTORY,
+                    ReactiveRoutingConfig.class, "reactiveRouting") {
+        @Override
+        public ReactiveRoutingConfig createConfig() {
+            return new ReactiveRoutingConfig();
+        }
+    };
+
+    @Activate
+    public void activate() {
+        configService.addListener(configListener);
+        registry.registerConfigFactory(reactiveRoutingConfigFactory);
+        setUpConfiguration();
+        log.info("Reactive routing configuration service started");
+    }
+
+    @Deactivate
+    public void deactivate() {
+        registry.unregisterConfigFactory(reactiveRoutingConfigFactory);
+        configService.removeListener(configListener);
+        log.info("Reactive routing configuration service stopped");
+    }
+
+    /**
+     * Set up reactive routing information from configuration.
+     */
+    private void setUpConfiguration() {
+        ReactiveRoutingConfig config = configService.getConfig(
+                coreService.registerApplication(ReactiveRoutingConfigurationService
+                        .REACTIVE_ROUTING_APP_ID),
+                ReactiveRoutingConfigurationService.CONFIG_CLASS);
+        if (config == null) {
+            log.warn("No reactive routing config available!");
+            return;
+        }
+        for (LocalIpPrefixEntry entry : config.localIp4PrefixEntries()) {
+            localPrefixTable4.put(createBinaryString(entry.ipPrefix()), entry);
+            gatewayIpAddresses.add(entry.getGatewayIpAddress());
+        }
+        for (LocalIpPrefixEntry entry : config.localIp6PrefixEntries()) {
+            localPrefixTable6.put(createBinaryString(entry.ipPrefix()), entry);
+            gatewayIpAddresses.add(entry.getGatewayIpAddress());
+        }
+
+        virtualGatewayMacAddress = config.virtualGatewayMacAddress();
+
+        // Setup BGP peer connect points
+        ApplicationId routerAppId = coreService.getAppId(RoutingService.ROUTER_APP_ID);
+        if (routerAppId == null) {
+            log.info("Router application ID is null!");
+            return;
+        }
+
+        BgpConfig bgpConfig = configService.getConfig(routerAppId, BgpConfig.class);
+
+        if (bgpConfig == null) {
+            log.info("BGP config is null!");
+            return;
+        } else {
+            bgpPeerConnectPoints =
+                    bgpConfig.bgpSpeakers().stream()
+                    .flatMap(speaker -> speaker.peers().stream())
+                    .map(peer -> interfaceService.getMatchingInterface(peer))
+                    .filter(Objects::nonNull)
+                    .map(intf -> intf.connectPoint())
+                    .collect(Collectors.toSet());
+        }
+    }
+
+    @Override
+    public boolean isIpAddressLocal(IpAddress ipAddress) {
+        if (ipAddress.isIp4()) {
+            return localPrefixTable4.getValuesForKeysPrefixing(
+                    createBinaryString(
+                    IpPrefix.valueOf(ipAddress, Ip4Address.BIT_LENGTH)))
+                    .iterator().hasNext();
+        } else {
+            return localPrefixTable6.getValuesForKeysPrefixing(
+                    createBinaryString(
+                    IpPrefix.valueOf(ipAddress, Ip6Address.BIT_LENGTH)))
+                    .iterator().hasNext();
+        }
+    }
+
+    @Override
+    public boolean isIpPrefixLocal(IpPrefix ipPrefix) {
+        return (localPrefixTable4.getValueForExactKey(
+                createBinaryString(ipPrefix)) != null ||
+                localPrefixTable6.getValueForExactKey(
+                createBinaryString(ipPrefix)) != null);
+    }
+
+    @Override
+    public boolean isVirtualGatewayIpAddress(IpAddress ipAddress) {
+        return gatewayIpAddresses.contains(ipAddress);
+    }
+
+    @Override
+    public MacAddress getVirtualGatewayMacAddress() {
+        return virtualGatewayMacAddress;
+    }
+
+    @Override
+    public Set<ConnectPoint> getBgpPeerConnectPoints() {
+        return ImmutableSet.copyOf(bgpPeerConnectPoints);
+    }
+
+    /**
+     * Creates the binary string representation of an IP prefix.
+     * The prefix can be either IPv4 or IPv6.
+     * The string length is equal to the prefix length + 1.
+     *
+     * For each string, we put a extra "0" in the front. The purpose of
+     * doing this is to store the default route inside InvertedRadixTree.
+     *
+     * @param ipPrefix the IP prefix to use
+     * @return the binary string representation
+     */
+    private static String createBinaryString(IpPrefix ipPrefix) {
+        if (ipPrefix.prefixLength() == 0) {
+            return "0";
+        }
+
+        byte[] octets = ipPrefix.address().toOctets();
+        StringBuilder result = new StringBuilder(ipPrefix.prefixLength());
+        for (int i = 0; i < ipPrefix.prefixLength(); i++) {
+            int byteOffset = i / Byte.SIZE;
+            int bitOffset = i % Byte.SIZE;
+            int mask = 1 << (Byte.SIZE - 1 - bitOffset);
+            byte value = octets[byteOffset];
+            boolean isSet = ((value & mask) != 0);
+            result.append(isSet ? "1" : "0");
+        }
+
+        return "0" + result.toString();
+    }
+
+    private class InternalNetworkConfigListener implements NetworkConfigListener {
+
+        @Override
+        public void event(NetworkConfigEvent event) {
+            switch (event.type()) {
+            case CONFIG_REGISTERED:
+                break;
+            case CONFIG_UNREGISTERED:
+                break;
+            case CONFIG_ADDED:
+            case CONFIG_UPDATED:
+            case CONFIG_REMOVED:
+                if (event.configClass() == ReactiveRoutingConfigurationService.CONFIG_CLASS) {
+                    setUpConfiguration();
+                }
+                break;
+            default:
+                break;
+            }
+        }
+    }
+}
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfigurationService.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfigurationService.java
new file mode 100644
index 0000000..513073f
--- /dev/null
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingConfigurationService.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2017-present 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.reactive.routing;
+
+import org.onlab.packet.IpAddress;
+import org.onlab.packet.IpPrefix;
+import org.onlab.packet.MacAddress;
+import org.onosproject.net.ConnectPoint;
+
+import java.util.Set;
+
+/**
+ * Provides information about the routing configuration.
+ */
+public interface ReactiveRoutingConfigurationService {
+
+    String REACTIVE_ROUTING_APP_ID = "org.onosproject.reactive.routing";
+
+    Class<ReactiveRoutingConfig> CONFIG_CLASS = ReactiveRoutingConfig.class;
+
+
+    MacAddress getVirtualGatewayMacAddress();
+
+    /**
+     * Evaluates whether an IP address is a virtual gateway IP address.
+     *
+     * @param ipAddress the IP address to evaluate
+     * @return true if the IP address is a virtual gateway address, otherwise false
+     */
+    boolean isVirtualGatewayIpAddress(IpAddress ipAddress);
+
+    /**
+     * Evaluates whether an IP address belongs to local SDN network.
+     *
+     * @param ipAddress the IP address to evaluate
+     * @return true if the IP address belongs to local SDN network, otherwise false
+     */
+    boolean isIpAddressLocal(IpAddress ipAddress);
+
+    /**
+     * Evaluates whether an IP prefix belongs to local SDN network.
+     *
+     * @param ipPrefix the IP prefix to evaluate
+     * @return true if the IP prefix belongs to local SDN network, otherwise false
+     */
+    boolean isIpPrefixLocal(IpPrefix ipPrefix);
+
+    /**
+     * Retrieves the entire set of connect points connected to BGP peers in the
+     * network.
+     *
+     * @return the set of connect points connected to BGP peers
+     */
+    Set<ConnectPoint> getBgpPeerConnectPoints();
+
+
+}
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java
index e57d9a5..4998ae6 100644
--- a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/ReactiveRoutingFib.java
@@ -38,7 +38,6 @@
 import org.onosproject.net.intent.Key;
 import org.onosproject.net.intent.MultiPointToSinglePointIntent;
 import org.onosproject.net.intent.constraint.PartialFailureConstraint;
-import org.onosproject.routing.IntentRequestListener;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
diff --git a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java
index d596342..e2faaff 100644
--- a/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java
+++ b/apps/reactive-routing/src/main/java/org/onosproject/reactive/routing/SdnIpReactiveRouting.java
@@ -48,9 +48,7 @@
 import org.onosproject.net.packet.PacketContext;
 import org.onosproject.net.packet.PacketProcessor;
 import org.onosproject.net.packet.PacketService;
-import org.onosproject.routing.IntentRequestListener;
 import org.onosproject.intentsync.IntentSynchronizationService;
-import org.onosproject.routing.config.RoutingConfigurationService;
 import org.slf4j.Logger;
 
 import java.nio.ByteBuffer;
@@ -89,7 +87,7 @@
     protected IntentSynchronizationService intentSynchronizer;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
-    protected RoutingConfigurationService config;
+    protected ReactiveRoutingConfigurationService config;
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected InterfaceService interfaceService;