ONOS-2947 Improvements to HostService
- Added ability to replace IPs for existing hosts to HostProviderService
- Moved createOrUpdateHost to use compute() (rather than get/set) in HostStore
Change-Id: I8ac035d010ae65f23158d2237f9fc97c8f811dd4
diff --git a/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java b/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
index 8678a29..f7b7c49 100644
--- a/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
+++ b/core/api/src/main/java/org/onosproject/net/host/HostProviderService.java
@@ -30,7 +30,20 @@
* @param hostId id of the host that been detected
* @param hostDescription description of host and its location
*/
- void hostDetected(HostId hostId, HostDescription hostDescription);
+ @Deprecated
+ default void hostDetected(HostId hostId, HostDescription hostDescription) {
+ hostDetected(hostId, hostDescription, false);
+ }
+
+ /**
+ * Notifies the core when a host has been detected on a network along with
+ * information that identifies the host location.
+ *
+ * @param hostId id of the host that been detected
+ * @param hostDescription description of host and its location
+ * @param replaceIps replace IP set if true, merge IP set otherwise
+ */
+ void hostDetected(HostId hostId, HostDescription hostDescription, boolean replaceIps);
/**
* Notifies the core when a host is no longer detected on a network.
diff --git a/core/api/src/main/java/org/onosproject/net/host/HostStore.java b/core/api/src/main/java/org/onosproject/net/host/HostStore.java
index 35a2a8b..5894fe9 100644
--- a/core/api/src/main/java/org/onosproject/net/host/HostStore.java
+++ b/core/api/src/main/java/org/onosproject/net/host/HostStore.java
@@ -39,12 +39,13 @@
* @param providerId provider identification
* @param hostId host identification
* @param hostDescription host description data
+ * @param replaceIps replace IP set if true, merge IP set otherwise
* @return appropriate event or null if no change resulted
*/
HostEvent createOrUpdateHost(ProviderId providerId, HostId hostId,
- HostDescription hostDescription);
+ HostDescription hostDescription,
+ boolean replaceIps);
- // FIXME: API to remove only IpAddress is missing
/**
* Removes the specified host from the inventory.
*