VOL-2392 dhcpl2relay-allocation is updated when ONU is deleted
Change-Id: I8aae1f18dc3e3d4c753cd0e9e83072ee71078469
diff --git a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java b/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
index 2cd4f88..7bdd9c5 100755
--- a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
+++ b/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
@@ -1099,6 +1099,14 @@
log.info("Device {} is removed from DHCP allocationmap ", deviceId);
}
break;
+ case PORT_REMOVED:
+ Port port = event.port();
+ deviceId = event.subject().id();
+ log.info("Port {} is deleted on device {}", port, deviceId);
+ allocationMap.entrySet().removeIf(entry -> port.number().equals(entry.getValue().
+ location().port()) && deviceId.equals(entry.getValue().location().deviceId()));
+ log.info("Port {} on device {} is removed from DHCP allocationmap", event.port(), deviceId);
+ break;
default:
break;
}