Dual-homing probing improvements
(1) Active probing mechanism in the following two scenarios
(1-1) Probe all ports on the pair device within the same vlan (excluding the pair port) when the 1st location of a host is learnt
(1-2) Probe again when a device/port goes down and comes up again
* Introduce HostLocationProvingService
- DISCOVER mode: discover potential new locations
- VERIFY mode: verify old locations
* Can be enabled/disabled via component config
* Improve HostHandlerTest to test the probing behavior
(2) Fix an issue that redirection flow doesn't get installed after device re-connects
(3) Temporarily fix a race condition in HostHandler by adding a little bit delay
Change-Id: I33d3fe94a6ca491a88b8e06f65bef11447ead0bf
diff --git a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
index b7d32a1..7ea430d 100644
--- a/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
+++ b/src/main/java/org/onosproject/segmentrouting/config/DeviceConfiguration.java
@@ -501,6 +501,20 @@
}
/**
+ * Returns all ports that has a subnet that contains any of the given IP addresses.
+ *
+ * @param ips a set of IP addresses
+ * @return a set of connect point that has a subnet that contains any of the given IP addresses
+ */
+ public Set<ConnectPoint> getPortByIps(Set<IpAddress> ips) {
+ return srManager.interfaceService.getInterfaces().stream()
+ .filter(intf -> intf.ipAddressesList().stream().anyMatch(intfAddress ->
+ ips.stream().anyMatch(ip -> intfAddress.subnetAddress().contains(ip))))
+ .map(Interface::connectPoint)
+ .collect(Collectors.toSet());
+ }
+
+ /**
* Returns the router ip address of segment router that has the
* specified ip address in its subnets.
*