ONOS-2926 Remove IP instead of host when the IP mapping is released

Change-Id: Ifea3366ce8a18ea068e615636b3069e769221c0e
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpManager.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpManager.java
index 345d5ad..153463a 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpManager.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DhcpManager.java
@@ -481,7 +481,10 @@
                         }
                     }
                 } else if (incomingPacketType.getValue() == DHCPPacketType.DHCPRELEASE.getValue()) {
-                    dhcpStore.releaseIP(hostId);
+                    Ip4Address ip4Address = dhcpStore.releaseIP(hostId);
+                    if (ip4Address != null) {
+                        hostProviderService.removeIpFromHost(hostId, ip4Address);
+                    }
                 }
             }
         }
@@ -666,9 +669,10 @@
                 if ((ipAssignment.assignmentStatus() != IpAssignment.AssignmentStatus.Option_Expired) &&
                         (ipAssignment.leasePeriod() > 0) && (timeLapsed > (ipAssignment.leasePeriodMs()))) {
 
-                    dhcpStore.releaseIP(entry.getKey());
-                    // TODO remove only the IP from the host entry when the API is in place.
-                    hostProviderService.hostVanished(entry.getKey());
+                    Ip4Address ip4Address = dhcpStore.releaseIP(entry.getKey());
+                    if (ip4Address != null) {
+                        hostProviderService.removeIpFromHost(entry.getKey(), ipAssignment.ipAddress());
+                    }
                 }
             }
             timeout = Timer.getTimer().newTimeout(new PurgeListTask(), timerDelay, TimeUnit.MINUTES);
diff --git a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDhcpStore.java b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDhcpStore.java
index dbdadb3..63f69d4 100644
--- a/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDhcpStore.java
+++ b/apps/dhcp/src/main/java/org/onosproject/dhcp/impl/DistributedDhcpStore.java
@@ -212,7 +212,7 @@
     }
 
     @Override
-    public void releaseIP(HostId hostId) {
+    public Ip4Address releaseIP(HostId hostId) {
         if (allocationMap.containsKey(hostId)) {
             IpAssignment newAssignment = IpAssignment.builder(allocationMap.get(hostId).value())
                                                     .assignmentStatus(IpAssignment.AssignmentStatus.Option_Expired)
@@ -222,7 +222,9 @@
             if (ipWithinRange(freeIP)) {
                 freeIPPool.add(freeIP);
             }
+            return freeIP;
         }
+        return null;
     }
 
     @Override