Symmetric host probing
In addition, do not probe for host that is no longer in the host store.
Change-Id: I8a750239b9dbd8a913cd8b12debe318ed396fca9
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java
index ffc0e4d..ae35f7b 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/HostHandler.java
@@ -448,18 +448,37 @@
* @param pairRemotePort pair remote port
*/
private void probe(Host host, ConnectPoint location, DeviceId pairDeviceId, PortNumber pairRemotePort) {
+ //Check if the host still exists in the host store
+ if (hostService.getHost(host.id()) == null) {
+ log.debug("Host entry for host {} no more present. Aborting hostprobe discover for this host", host.id());
+ return;
+ }
+
VlanId vlanToProbe = host.vlan().equals(VlanId.NONE) ?
srManager.getInternalVlanId(location) : host.vlan();
- srManager.interfaceService.getInterfaces().stream()
- .filter(i -> i.vlanTagged().contains(vlanToProbe) ||
- i.vlanUntagged().equals(vlanToProbe) ||
- i.vlanNative().equals(vlanToProbe))
- .filter(i -> i.connectPoint().deviceId().equals(pairDeviceId))
- .filter(i -> !i.connectPoint().port().equals(pairRemotePort))
- .forEach(i -> {
- log.debug("Probing host {} on pair device {}", host.id(), i.connectPoint());
- srManager.probingService.probeHost(host, i.connectPoint(), ProbeMode.DISCOVER);
- });
+ if (srManager.symmetricProbing) {
+ srManager.interfaceService.getInterfaces().stream()
+ .filter(i -> i.vlanTagged().contains(vlanToProbe) ||
+ i.vlanUntagged().equals(vlanToProbe) ||
+ i.vlanNative().equals(vlanToProbe))
+ .filter(i -> i.connectPoint().deviceId().equals(pairDeviceId))
+ .filter(i -> i.connectPoint().port().equals(location.port()))
+ .forEach(i -> {
+ log.debug("Probing host {} on pair device {}", host.id(), i.connectPoint());
+ srManager.probingService.probeHost(host, i.connectPoint(), ProbeMode.DISCOVER);
+ });
+ } else {
+ srManager.interfaceService.getInterfaces().stream()
+ .filter(i -> i.vlanTagged().contains(vlanToProbe) ||
+ i.vlanUntagged().equals(vlanToProbe) ||
+ i.vlanNative().equals(vlanToProbe))
+ .filter(i -> i.connectPoint().deviceId().equals(pairDeviceId))
+ .filter(i -> !i.connectPoint().port().equals(pairRemotePort))
+ .forEach(i -> {
+ log.debug("Probing host {} on pair device {}", host.id(), i.connectPoint());
+ srManager.probingService.probeHost(host, i.connectPoint(), ProbeMode.DISCOVER);
+ });
+ }
}
/**
diff --git a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
index 2a126d3..8b1ae2a 100644
--- a/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
+++ b/apps/segmentrouting/app/src/main/java/org/onosproject/segmentrouting/SegmentRoutingManager.java
@@ -239,6 +239,10 @@
label = "Enable active probing to discover dual-homed hosts.")
boolean activeProbing = true;
+ @Property(name = "symmetricProbing", boolValue = false,
+ label = "Enable only send probe on the same port number of the pair device")
+ boolean symmetricProbing = false;
+
@Property(name = "singleHomedDown", boolValue = false,
label = "Enable administratively taking down single-homed hosts "
+ "when all uplinks are gone")
@@ -611,6 +615,13 @@
log.info("{} active probing", activeProbing ? "Enabling" : "Disabling");
}
+ String strSymmetricProving = Tools.get(properties, "symmetricProbing");
+ boolean expectSymmetricProbing = Boolean.parseBoolean(strSymmetricProving);
+ if (expectSymmetricProbing != symmetricProbing) {
+ symmetricProbing = expectSymmetricProbing;
+ log.info("{} symmetric probing", symmetricProbing ? "Enabling" : "Disabling");
+ }
+
String strSingleHomedDown = Tools.get(properties, "singleHomedDown");
boolean expectSingleHomedDown = Boolean.parseBoolean(strSingleHomedDown);
if (expectSingleHomedDown != singleHomedDown) {