[VOL-2744] onos app changes for OLT reboot
Change-Id: Ib934c228dd46d70c2895db193261b2e68e0d6a65
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 038ab60..0e5b593 100755
--- a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
+++ b/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
@@ -1079,9 +1079,11 @@
DeviceId deviceId = event.subject().id();
if (!deviceService.isAvailable(deviceId)) {
log.warn("Device {} is not available ", deviceId);
- allocationMap.entrySet().removeIf(entry -> deviceId.equals(entry.getValue().
- location().deviceId()));
- log.info("Device {} is removed from DHCP allocationmap ", deviceId);
+ if (deviceService.getPorts(deviceId).isEmpty()) {
+ allocationMap.entrySet().removeIf(entry -> deviceId.equals(entry.getValue().
+ location().deviceId()));
+ log.info("Device {} is removed from DHCP allocationmap ", deviceId);
+ }
}
break;
case PORT_REMOVED: