Adding a comand to clear allocations, useful when running tests
Change-Id: I2a9f45c971babf1d3746745815de35bbd1f840a2
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 05774ab..1bb5113 100755
--- a/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
+++ b/app/src/main/java/org/opencord/dhcpl2relay/impl/DhcpL2Relay.java
@@ -1058,6 +1058,22 @@
.forEach(allocations::remove);
}
+ public void clearAllocations() {
+ allocations.clear();
+ }
+
+
+ public boolean removeAllocationByConnectPoint(ConnectPoint cp) {
+ for (String key : allocations.keySet()) {
+ DhcpAllocationInfo entry = allocations.asJavaMap().get(key);
+ if (entry.location().equals(cp)) {
+ allocations.remove(key);
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Handles Device status change for the devices which connect
* to the DHCP server.