Allow overriding configured host with another configured host
Change-Id: I7a0676abe934413105c57d3e17c43520b5adeabc
diff --git a/core/store/dist/src/main/java/org/onosproject/store/host/impl/DistributedHostStore.java b/core/store/dist/src/main/java/org/onosproject/store/host/impl/DistributedHostStore.java
index 437474f..04a85f1 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/host/impl/DistributedHostStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/host/impl/DistributedHostStore.java
@@ -146,15 +146,14 @@
private boolean shouldUpdate(DefaultHost existingHost,
ProviderId providerId,
- HostId hostId,
HostDescription hostDescription,
boolean replaceIPs) {
if (existingHost == null) {
return true;
}
- // Avoid overriding configured hosts
- if (existingHost.configured()) {
+ // Avoid overriding configured host with learnt host
+ if (existingHost.configured() && !hostDescription.configured()) {
return false;
}
@@ -192,7 +191,7 @@
HostDescription hostDescription,
boolean replaceIPs) {
hostsConsistentMap.computeIf(hostId,
- existingHost -> shouldUpdate(existingHost, providerId, hostId,
+ existingHost -> shouldUpdate(existingHost, providerId,
hostDescription, replaceIPs),
(id, existingHost) -> {
HostLocation location = hostDescription.location();