Adding Lease expiry to DHCP GUI
Change-Id: I61a8ecf376475c1ac99a59cd11a5ba1e83e6a3c9
diff --git a/onos-app-dhcpserver/src/main/java/org/onosproject/dhcpserver/rest/DHCPWebResource.java b/onos-app-dhcpserver/src/main/java/org/onosproject/dhcpserver/rest/DHCPWebResource.java
index deb38c9..b5cd5f8 100644
--- a/onos-app-dhcpserver/src/main/java/org/onosproject/dhcpserver/rest/DHCPWebResource.java
+++ b/onos-app-dhcpserver/src/main/java/org/onosproject/dhcpserver/rest/DHCPWebResource.java
@@ -21,6 +21,7 @@
import org.onlab.packet.Ip4Address;
import org.onlab.packet.MacAddress;
import org.onosproject.dhcpserver.DHCPService;
+import org.onosproject.dhcpserver.IPAssignment;
import org.onosproject.rest.AbstractWebResource;
import javax.ws.rs.Consumes;
@@ -71,11 +72,11 @@
public Response listMappings() {
ObjectNode root = mapper().createObjectNode();
- final Map<MacAddress, Ip4Address> intents = service.listMapping();
+ final Map<MacAddress, IPAssignment> intents = service.listMapping();
ArrayNode arrayNode = root.putArray("mappings");
intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
.put("mac", i.getKey().toString())
- .put("ip", i.getValue().toString())));
+ .put("ip", i.getValue().ipAddress().toString())));
return ok(root.toString()).build();
}
@@ -123,11 +124,11 @@
}
}
- final Map<MacAddress, Ip4Address> intents = service.listMapping();
+ final Map<MacAddress, IPAssignment> intents = service.listMapping();
ArrayNode arrayNode = root.putArray("mappings");
intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
.put("mac", i.getKey().toString())
- .put("ip", i.getValue().toString())));
+ .put("ip", i.getValue().ipAddress().toString())));
} catch (IOException e) {
throw new IllegalArgumentException(e.getMessage());
}
@@ -149,11 +150,11 @@
if (!service.removeStaticMapping(MacAddress.valueOf(macID))) {
throw new IllegalArgumentException("Static Mapping Removal Failed.");
}
- final Map<MacAddress, Ip4Address> intents = service.listMapping();
+ final Map<MacAddress, IPAssignment> intents = service.listMapping();
ArrayNode arrayNode = root.putArray("mappings");
intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
.put("mac", i.getKey().toString())
- .put("ip", i.getValue().toString())));
+ .put("ip", i.getValue().ipAddress().toString())));
return ok(root.toString()).build();
}