mirror of
https://github.com/opennetworkinglab/onos.git
synced 2026-05-05 12:16:13 +02:00
[CORD-2223] Avoid unnecessary probing when a host moves within the same switch
Change-Id: I777234564801ab236bf48ecf04ce75aaa1061a18
This commit is contained in:
parent
105736e0c0
commit
653e2ac0af
@ -407,10 +407,17 @@ public class HostLocationProvider extends AbstractProvider implements HostProvid
|
||||
Host existingHost = hostService.getHost(hid);
|
||||
if (existingHost != null) {
|
||||
Set<HostLocation> prevLocations = existingHost.locations();
|
||||
newLocations.addAll(prevLocations);
|
||||
|
||||
if (!existingHost.locations().contains(hloc)) {
|
||||
if (prevLocations.stream().noneMatch(loc -> loc.deviceId().equals(hloc.deviceId()))) {
|
||||
// New location is on a device that we haven't seen before
|
||||
// Could be a dual-home host. Append new location and send out the probe
|
||||
newLocations.addAll(prevLocations);
|
||||
probeLocations(existingHost);
|
||||
} else {
|
||||
// Move within the same switch
|
||||
// Simply replace old location that is on the same device
|
||||
prevLocations.stream().filter(loc -> !loc.deviceId().equals(hloc.deviceId()))
|
||||
.forEach(newLocations::add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user