Implement host probing retry with major refactoring
- Implement probe retry
- Switch to typical core/provider design pattern for HostProbingService
and as a result decoupling the dependency between SR and HostLocationProvider
Change-Id: I33a15af580677ea376b421ac3e26f9821dcca844
diff --git a/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java b/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java
index f71c1d0..3982731 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java
@@ -27,8 +27,8 @@
import org.onosproject.net.HostLocation;
import org.onosproject.net.PortNumber;
import org.onosproject.net.host.HostEvent;
-import org.onosproject.net.host.HostLocationProbingService.ProbeMode;
import org.onosproject.net.host.HostService;
+import org.onosproject.net.host.ProbeMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -185,6 +185,9 @@
// For each old location
Sets.difference(prevLocations, newLocations).forEach(prevLocation -> {
+ // First of all, verify each old location
+ srManager.probingService.probeHost(host, prevLocation, ProbeMode.VERIFY);
+
// Remove routing rules for old IPs
Sets.difference(prevIps, newIps).forEach(ip -> {
if (doubleTaggedHost) {
@@ -392,7 +395,7 @@
srManager.getPairDeviceId(cp.deviceId())
.ifPresent(pairDeviceId -> srManager.hostService.getConnectedHosts(pairDeviceId).stream()
.filter(host -> isHostInVlanOfPort(host, pairDeviceId, cp))
- .forEach(host -> srManager.probingService.probeHostLocation(host, cp, ProbeMode.DISCOVER))
+ .forEach(host -> srManager.probingService.probeHost(host, cp, ProbeMode.DISCOVER))
);
}
}
@@ -435,7 +438,7 @@
.filter(i -> !i.connectPoint().port().equals(pairRemotePort))
.forEach(i -> {
log.debug("Probing host {} on pair device {}", host.id(), i.connectPoint());
- srManager.probingService.probeHostLocation(host, i.connectPoint(), ProbeMode.DISCOVER);
+ srManager.probingService.probeHost(host, i.connectPoint(), ProbeMode.DISCOVER);
});
}
diff --git a/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 317e7f4..52ca18e 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -77,7 +77,7 @@
import org.onosproject.net.flowobjective.FlowObjectiveService;
import org.onosproject.net.host.HostEvent;
import org.onosproject.net.host.HostListener;
-import org.onosproject.net.host.HostLocationProbingService;
+import org.onosproject.net.host.HostProbingService;
import org.onosproject.net.host.HostService;
import org.onosproject.net.host.InterfaceIpAddress;
import org.onosproject.net.intent.WorkPartitionService;
@@ -186,7 +186,7 @@
HostService hostService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- HostLocationProbingService probingService;
+ HostProbingService probingService;
@Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
public DeviceService deviceService;