move the reactive routing to new config subsystem
Change-Id: I3e570138afb800c5bd7dbef872cbf9044732fa49
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 8e86056..ac5f148 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
@@ -16,8 +16,17 @@
package org.onosproject.reactive.routing;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
import org.onlab.packet.Ethernet;
import org.onlab.packet.IpAddress;
import org.onlab.packet.IpPrefix;
@@ -39,17 +48,9 @@
import org.onosproject.net.intent.constraint.PartialFailureConstraint;
import org.onosproject.routing.IntentRequestListener;
import org.onosproject.routing.IntentSynchronizationService;
-import org.onosproject.routing.config.RoutingConfigurationService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* FIB component for reactive routing intents.
*/
@@ -64,7 +65,6 @@
private final ApplicationId appId;
private final HostService hostService;
- private final RoutingConfigurationService configService;
private final InterfaceService interfaceService;
private final IntentSynchronizationService intentSynchronizer;
@@ -75,17 +75,14 @@
*
* @param appId application ID to use to generate intents
* @param hostService host service
- * @param configService routing configuration service
* @param interfaceService interface service
* @param intentSynchronizer intent synchronization service
*/
public ReactiveRoutingFib(ApplicationId appId, HostService hostService,
- RoutingConfigurationService configService,
InterfaceService interfaceService,
IntentSynchronizationService intentSynchronizer) {
this.appId = appId;
this.hostService = hostService;
- this.configService = configService;
this.interfaceService = interfaceService;
this.intentSynchronizer = intentSynchronizer;
@@ -95,8 +92,6 @@
@Override
public void setUpConnectivityInternetToHost(IpAddress hostIpAddress) {
checkNotNull(hostIpAddress);
- Set<ConnectPoint> ingressPoints =
- configService.getBgpPeerConnectPoints();
TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
@@ -130,6 +125,24 @@
Key key = Key.of(ipPrefix.toString(), appId);
int priority = ipPrefix.prefixLength() * PRIORITY_MULTIPLIER
+ PRIORITY_OFFSET;
+
+ Set<ConnectPoint> interfaceConnectPoints =
+ interfaceService.getInterfaces().stream()
+ .map(intf -> intf.connectPoint()).collect(Collectors.toSet());
+
+ if (interfaceConnectPoints.isEmpty()) {
+ log.error("The interface connect points are empty!");
+ return;
+ }
+
+ Set<ConnectPoint> ingressPoints = new HashSet<>();
+
+ for (ConnectPoint connectPoint : interfaceConnectPoints) {
+ if (!connectPoint.equals(egressPoint)) {
+ ingressPoints.add(connectPoint);
+ }
+ }
+
MultiPointToSinglePointIntent intent =
MultiPointToSinglePointIntent.builder()
.appId(appId)
@@ -150,7 +163,8 @@
public void setUpConnectivityHostToInternet(IpAddress hostIp, IpPrefix prefix,
IpAddress nextHopIpAddress) {
// Find the attachment point (egress interface) of the next hop
- Interface egressInterface = interfaceService.getMatchingInterface(nextHopIpAddress);
+ Interface egressInterface =
+ interfaceService.getMatchingInterface(nextHopIpAddress);
if (egressInterface == null) {
log.warn("No outgoing interface found for {}",
nextHopIpAddress);