Thomas Vachuska

Modifying packaging to make the DHCP GUI work from WAR bundle-style packaging.

Change-Id: I1b9685fa1eebcac63ad41bc60db1f98b30aba656
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -30,7 +30,7 @@ public interface DHCPService { ...@@ -30,7 +30,7 @@ public interface DHCPService {
30 * 30 *
31 * @return collection of mappings. 31 * @return collection of mappings.
32 */ 32 */
33 - Map<MacAddress, Ip4Address> listMapping(); 33 + Map<MacAddress, IPAssignment> listMapping();
34 34
35 /** 35 /**
36 * Returns the default lease time granted by the DHCP Server. 36 * Returns the default lease time granted by the DHCP Server.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -77,7 +77,7 @@ public interface DHCPStore { ...@@ -77,7 +77,7 @@ public interface DHCPStore {
77 * 77 *
78 * @return the collection of the mappings 78 * @return the collection of the mappings
79 */ 79 */
80 - Map<MacAddress, Ip4Address> listMapping(); 80 + Map<MacAddress, IPAssignment> listMapping();
81 81
82 /** 82 /**
83 * Assigns the requested IP to the MAC ID (if available) for an indefinite period of time. 83 * Assigns the requested IP to the MAC ID (if available) for an indefinite period of time.
......
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
16 package org.onosproject.dhcp.cli; 16 package org.onosproject.dhcp.cli;
17 17
18 import org.apache.karaf.shell.commands.Command; 18 import org.apache.karaf.shell.commands.Command;
19 -import org.onlab.packet.Ip4Address;
20 import org.onlab.packet.MacAddress; 19 import org.onlab.packet.MacAddress;
21 import org.onosproject.cli.AbstractShellCommand; 20 import org.onosproject.cli.AbstractShellCommand;
22 import org.onosproject.dhcp.DHCPService; 21 import org.onosproject.dhcp.DHCPService;
22 +import org.onosproject.dhcp.IPAssignment;
23 23
24 import java.util.Map; 24 import java.util.Map;
25 25
...@@ -35,10 +35,10 @@ public class DHCPListAllMappings extends AbstractShellCommand { ...@@ -35,10 +35,10 @@ public class DHCPListAllMappings extends AbstractShellCommand {
35 protected void execute() { 35 protected void execute() {
36 36
37 DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class); 37 DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
38 - Map<MacAddress, Ip4Address> allocationMap = dhcpService.listMapping(); 38 + Map<MacAddress, IPAssignment> allocationMap = dhcpService.listMapping();
39 39
40 - for (Map.Entry<MacAddress, Ip4Address> entry : allocationMap.entrySet()) { 40 + for (Map.Entry<MacAddress, IPAssignment> entry : allocationMap.entrySet()) {
41 - print(DHCP_MAPPING_FORMAT, entry.getKey().toString(), entry.getValue().toString()); 41 + print(DHCP_MAPPING_FORMAT, entry.getKey().toString(), entry.getValue().ipAddress().toString());
42 } 42 }
43 } 43 }
44 } 44 }
......
...@@ -38,6 +38,7 @@ import org.onosproject.core.ApplicationId; ...@@ -38,6 +38,7 @@ import org.onosproject.core.ApplicationId;
38 import org.onosproject.core.CoreService; 38 import org.onosproject.core.CoreService;
39 import org.onosproject.dhcp.DHCPService; 39 import org.onosproject.dhcp.DHCPService;
40 import org.onosproject.dhcp.DHCPStore; 40 import org.onosproject.dhcp.DHCPStore;
41 +import org.onosproject.dhcp.IPAssignment;
41 import org.onosproject.net.config.ConfigFactory; 42 import org.onosproject.net.config.ConfigFactory;
42 import org.onosproject.net.config.NetworkConfigEvent; 43 import org.onosproject.net.config.NetworkConfigEvent;
43 import org.onosproject.net.config.NetworkConfigListener; 44 import org.onosproject.net.config.NetworkConfigListener;
...@@ -213,8 +214,7 @@ public class DHCPManager implements DHCPService { ...@@ -213,8 +214,7 @@ public class DHCPManager implements DHCPService {
213 } 214 }
214 215
215 @Override 216 @Override
216 - public Map<MacAddress, Ip4Address> listMapping() { 217 + public Map<MacAddress, IPAssignment> listMapping() {
217 -
218 return dhcpStore.listMapping(); 218 return dhcpStore.listMapping();
219 } 219 }
220 220
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.dhcp.impl;
17 +
18 +import com.google.common.collect.ImmutableList;
19 +import org.apache.felix.scr.annotations.Activate;
20 +import org.apache.felix.scr.annotations.Component;
21 +import org.apache.felix.scr.annotations.Deactivate;
22 +import org.apache.felix.scr.annotations.Reference;
23 +import org.apache.felix.scr.annotations.ReferenceCardinality;
24 +import org.apache.felix.scr.annotations.Service;
25 +import org.onosproject.ui.UiExtension;
26 +import org.onosproject.ui.UiExtensionService;
27 +import org.onosproject.ui.UiMessageHandlerFactory;
28 +import org.onosproject.ui.UiView;
29 +import org.slf4j.Logger;
30 +import org.slf4j.LoggerFactory;
31 +
32 +import java.util.List;
33 +
34 +import static org.onosproject.ui.UiView.Category.NETWORK;
35 +
36 +/**
37 + * Mechanism to stream data to the GUI.
38 + */
39 +@Component(immediate = true, enabled = true)
40 +@Service(value = DHCPUi.class)
41 +public class DHCPUi {
42 +
43 + private final Logger log = LoggerFactory.getLogger(getClass());
44 + private static final ClassLoader CL = DHCPUi.class.getClassLoader();
45 +
46 + @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
47 + protected UiExtensionService uiExtensionService;
48 +
49 + private final UiMessageHandlerFactory messageHandlerFactory =
50 + () -> ImmutableList.of(new DhcpViewMessageHandler());
51 +
52 + private final List<UiView> views = ImmutableList.of(
53 + new UiView(NETWORK, "dhcp", "DHCP Server")
54 + );
55 +
56 + private final UiExtension uiExtension =
57 + new UiExtension.Builder(CL, views)
58 + .messageHandlerFactory(messageHandlerFactory)
59 + .resourcePath("gui")
60 + .build();
61 +
62 + @Activate
63 + protected void activate() {
64 + uiExtensionService.register(uiExtension);
65 + log.info("Started");
66 + }
67 +
68 + @Deactivate
69 + protected void deactivate() {
70 + uiExtensionService.unregister(uiExtension);
71 + log.info("Stopped");
72 + }
73 +
74 +}
...\ No newline at end of file ...\ No newline at end of file
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +package org.onosproject.dhcp.impl;
17 +
18 +import com.fasterxml.jackson.databind.node.ObjectNode;
19 +import com.google.common.collect.ImmutableSet;
20 +import org.onlab.packet.MacAddress;
21 +import org.onosproject.cli.AbstractShellCommand;
22 +import org.onosproject.dhcp.DHCPService;
23 +import org.onosproject.dhcp.IPAssignment;
24 +import org.onosproject.ui.RequestHandler;
25 +import org.onosproject.ui.UiMessageHandler;
26 +import org.onosproject.ui.table.TableModel;
27 +import org.onosproject.ui.table.TableRequestHandler;
28 +
29 +import java.util.Collection;
30 +import java.util.Date;
31 +import java.util.Map;
32 +
33 +/**
34 + * DHCPViewMessageHandler class implementation.
35 + */
36 +public class DhcpViewMessageHandler extends UiMessageHandler {
37 +
38 + private static final String DHCP_DATA_REQ = "dhcpDataRequest";
39 + private static final String DHCP_DATA_RESP = "dhcpDataResponse";
40 + private static final String DHCP = "dhcps";
41 +
42 + private static final String MAC = "mac";
43 + private static final String IP = "ip";
44 + private static final String LEASE = "lease";
45 +
46 + private static final String[] COL_IDS = {
47 + MAC, IP, LEASE
48 + };
49 +
50 + @Override
51 + protected Collection<RequestHandler> createRequestHandlers() {
52 + return ImmutableSet.of(
53 + new DataRequestHandler()
54 + );
55 + }
56 +
57 + private final class DataRequestHandler extends TableRequestHandler {
58 +
59 + private DataRequestHandler() {
60 + super(DHCP_DATA_REQ, DHCP_DATA_RESP, DHCP);
61 + }
62 +
63 + @Override
64 + protected String defaultColumnId() {
65 + return MAC;
66 + }
67 +
68 + @Override
69 + protected String[] getColumnIds() {
70 + return COL_IDS;
71 + }
72 +
73 + @Override
74 + protected void populateTable(TableModel tm, ObjectNode payload) {
75 + DHCPService dhcpService = AbstractShellCommand.get(DHCPService.class);
76 + Map<MacAddress, IPAssignment> allocationMap = dhcpService.listMapping();
77 +
78 + for (Map.Entry<MacAddress, IPAssignment> entry : allocationMap.entrySet()) {
79 + populateRow(tm.addRow(), entry);
80 + }
81 + }
82 +
83 + private void populateRow(TableModel.Row row, Map.Entry<MacAddress, IPAssignment> entry) {
84 + if (entry.getValue().leasePeriod() > 0) {
85 + Date now = new Date(entry.getValue().timestamp().getTime() + entry.getValue().leasePeriod());
86 + row.cell(MAC, entry.getKey())
87 + .cell(IP, entry.getValue().ipAddress())
88 + .cell(LEASE, now.toString());
89 + } else {
90 + row.cell(MAC, entry.getKey())
91 + .cell(IP, entry.getValue().ipAddress())
92 + .cell(LEASE, "Infinite Static Lease");
93 + }
94 + }
95 + }
96 +}
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -224,17 +224,17 @@ public class DistributedDHCPStore implements DHCPStore { ...@@ -224,17 +224,17 @@ public class DistributedDHCPStore implements DHCPStore {
224 } 224 }
225 225
226 @Override 226 @Override
227 - public Map<MacAddress, Ip4Address> listMapping() { 227 + public Map<MacAddress, IPAssignment> listMapping() {
228 228
229 - Map<MacAddress, Ip4Address> allMapping = new HashMap<>(); 229 + Map<MacAddress, IPAssignment> allMapping = new HashMap<>();
230 for (Map.Entry<MacAddress, Versioned<IPAssignment>> entry: allocationMap.entrySet()) { 230 for (Map.Entry<MacAddress, Versioned<IPAssignment>> entry: allocationMap.entrySet()) {
231 IPAssignment assignment = entry.getValue().value(); 231 IPAssignment assignment = entry.getValue().value();
232 if (assignment.assignmentStatus() == IPAssignment.AssignmentStatus.Option_Assigned) { 232 if (assignment.assignmentStatus() == IPAssignment.AssignmentStatus.Option_Assigned) {
233 - allMapping.put(entry.getKey(), assignment.ipAddress()); 233 + allMapping.put(entry.getKey(), assignment);
234 } 234 }
235 } 235 }
236 -
237 return allMapping; 236 return allMapping;
237 +
238 } 238 }
239 239
240 @Override 240 @Override
......
...@@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; ...@@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
21 import org.onlab.packet.Ip4Address; 21 import org.onlab.packet.Ip4Address;
22 import org.onlab.packet.MacAddress; 22 import org.onlab.packet.MacAddress;
23 import org.onosproject.dhcp.DHCPService; 23 import org.onosproject.dhcp.DHCPService;
24 +import org.onosproject.dhcp.IPAssignment;
24 import org.onosproject.rest.AbstractWebResource; 25 import org.onosproject.rest.AbstractWebResource;
25 26
26 import javax.ws.rs.Consumes; 27 import javax.ws.rs.Consumes;
...@@ -71,11 +72,11 @@ public class DHCPWebResource extends AbstractWebResource { ...@@ -71,11 +72,11 @@ public class DHCPWebResource extends AbstractWebResource {
71 public Response listMappings() { 72 public Response listMappings() {
72 ObjectNode root = mapper().createObjectNode(); 73 ObjectNode root = mapper().createObjectNode();
73 74
74 - final Map<MacAddress, Ip4Address> intents = service.listMapping(); 75 + final Map<MacAddress, IPAssignment> intents = service.listMapping();
75 ArrayNode arrayNode = root.putArray("mappings"); 76 ArrayNode arrayNode = root.putArray("mappings");
76 intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode() 77 intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
77 .put("mac", i.getKey().toString()) 78 .put("mac", i.getKey().toString())
78 - .put("ip", i.getValue().toString()))); 79 + .put("ip", i.getValue().ipAddress().toString())));
79 80
80 return ok(root.toString()).build(); 81 return ok(root.toString()).build();
81 } 82 }
...@@ -123,11 +124,11 @@ public class DHCPWebResource extends AbstractWebResource { ...@@ -123,11 +124,11 @@ public class DHCPWebResource extends AbstractWebResource {
123 } 124 }
124 } 125 }
125 126
126 - final Map<MacAddress, Ip4Address> intents = service.listMapping(); 127 + final Map<MacAddress, IPAssignment> intents = service.listMapping();
127 ArrayNode arrayNode = root.putArray("mappings"); 128 ArrayNode arrayNode = root.putArray("mappings");
128 intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode() 129 intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
129 .put("mac", i.getKey().toString()) 130 .put("mac", i.getKey().toString())
130 - .put("ip", i.getValue().toString()))); 131 + .put("ip", i.getValue().ipAddress().toString())));
131 } catch (IOException e) { 132 } catch (IOException e) {
132 throw new IllegalArgumentException(e.getMessage()); 133 throw new IllegalArgumentException(e.getMessage());
133 } 134 }
...@@ -149,11 +150,11 @@ public class DHCPWebResource extends AbstractWebResource { ...@@ -149,11 +150,11 @@ public class DHCPWebResource extends AbstractWebResource {
149 if (!service.removeStaticMapping(MacAddress.valueOf(macID))) { 150 if (!service.removeStaticMapping(MacAddress.valueOf(macID))) {
150 throw new IllegalArgumentException("Static Mapping Removal Failed."); 151 throw new IllegalArgumentException("Static Mapping Removal Failed.");
151 } 152 }
152 - final Map<MacAddress, Ip4Address> intents = service.listMapping(); 153 + final Map<MacAddress, IPAssignment> intents = service.listMapping();
153 ArrayNode arrayNode = root.putArray("mappings"); 154 ArrayNode arrayNode = root.putArray("mappings");
154 intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode() 155 intents.entrySet().forEach(i -> arrayNode.add(mapper().createObjectNode()
155 .put("mac", i.getKey().toString()) 156 .put("mac", i.getKey().toString())
156 - .put("ip", i.getValue().toString()))); 157 + .put("ip", i.getValue().ipAddress().toString())));
157 158
158 return ok(root.toString()).build(); 159 return ok(root.toString()).build();
159 } 160 }
......
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- DHCP Server -- CSS file
19 + */
20 +
21 +#ov-dhcp h2 {
22 + display: inline-block;
23 +}
24 +
25 +#ov-dhcp div.ctrl-btns {
26 + width: 45px;
27 +}
1 +<!-- DHCP Server partial HTML -->
2 +<div id="ov-dhcp">
3 + <div class="tabular-header">
4 + <h2>DHCP Mappings ({{tableData.length}} total)</h2>
5 + <div class="ctrl-btns">
6 + <div class="refresh" ng-class="{active: autoRefresh}"
7 + icon icon-size="36" icon-id="refresh"
8 + tooltip tt-msg="autoRefreshTip"
9 + ng-click="toggleRefresh()"></div>
10 + </div>
11 + </div>
12 +
13 + <div class="summary-list" onos-table-resize>
14 + <div ng-show="loading" class="loading-wheel"
15 + icon icon-id="loading" icon-size="75"></div>
16 +
17 + <div class="table-header" onos-sortable-header>
18 + <table>
19 + <tr>
20 + <td colId="mac" sortable>MAC Address</td>
21 + <td colId="ip" sortable>IP Address</td>
22 + <td colId="lease" sortable>Lease Expiry</td>
23 + </tr>
24 + </table>
25 + </div>
26 +
27 + <div class="table-body">
28 + <table onos-flash-changes id-prop="mac">
29 + <tr ng-if="!tableData.length" class="no-data">
30 + <td colspan="2">
31 + No mappings found
32 + </td>
33 + </tr>
34 +
35 + <tr ng-repeat="dhcp in tableData track by $index"
36 + ng-click="selectCallback($event, dhcp)"
37 + ng-repeat-complete row-id="{{dhcp.mac}}">
38 + <td>{{dhcp.mac}}</td>
39 + <td>{{dhcp.ip}}</td>
40 + <td>{{dhcp.lease}}</td>
41 + </tr>
42 + </table>
43 + </div>
44 +
45 + </div>
46 +
47 +</div>
1 +/*
2 + * Copyright 2015 Open Networking Laboratory
3 + *
4 + * Licensed under the Apache License, Version 2.0 (the "License");
5 + * you may not use this file except in compliance with the License.
6 + * You may obtain a copy of the License at
7 + *
8 + * http://www.apache.org/licenses/LICENSE-2.0
9 + *
10 + * Unless required by applicable law or agreed to in writing, software
11 + * distributed under the License is distributed on an "AS IS" BASIS,
12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 + * See the License for the specific language governing permissions and
14 + * limitations under the License.
15 + */
16 +
17 +/*
18 + ONOS GUI -- DHCP Server View Module
19 + */
20 +
21 +(function () {
22 + 'use strict';
23 +
24 + // injected refs
25 + var $log, $scope;
26 +
27 + angular.module('ovDhcp', [])
28 + .controller('OvDhcpCtrl',
29 + ['$log', '$scope', 'TableBuilderService',
30 +
31 + function (_$log_, _$scope_, tbs) {
32 + $log = _$log_;
33 + $scope = _$scope_;
34 +
35 + function selCb($event, row) {
36 + $log.debug('Got a click on:', row);
37 + }
38 +
39 + tbs.buildTable({
40 + scope: $scope,
41 + tag: 'dhcp',
42 + selCb: selCb
43 + });
44 +
45 + $scope.$on('$destroy', function () {
46 + $log.debug('OvDhcpCtrl has been destroyed');
47 + });
48 +
49 + $log.log('OvDhcpCtrl has been created');
50 + }]);
51 +}());
...\ No newline at end of file ...\ No newline at end of file
1 +<link rel="stylesheet" href="app/view/dhcp/dhcp.css">
...\ No newline at end of file ...\ No newline at end of file
1 +<script src="app/view/dhcp/dhcp.js"></script>
...\ No newline at end of file ...\ No newline at end of file
1 /* 1 /*
2 - * Copyright 2014 Open Networking Laboratory 2 + * Copyright 2015 Open Networking Laboratory
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
...@@ -29,9 +29,10 @@ import org.onlab.packet.MacAddress; ...@@ -29,9 +29,10 @@ import org.onlab.packet.MacAddress;
29 import org.onlab.packet.UDP; 29 import org.onlab.packet.UDP;
30 import org.onosproject.core.CoreServiceAdapter; 30 import org.onosproject.core.CoreServiceAdapter;
31 import org.onosproject.dhcp.DHCPStore; 31 import org.onosproject.dhcp.DHCPStore;
32 -import org.onosproject.net.config.NetworkConfigRegistryAdapter; 32 +import org.onosproject.dhcp.IPAssignment;
33 import org.onosproject.net.Host; 33 import org.onosproject.net.Host;
34 import org.onosproject.net.HostId; 34 import org.onosproject.net.HostId;
35 +import org.onosproject.net.config.NetworkConfigRegistryAdapter;
35 import org.onosproject.net.host.HostDescription; 36 import org.onosproject.net.host.HostDescription;
36 import org.onosproject.net.host.HostProvider; 37 import org.onosproject.net.host.HostProvider;
37 import org.onosproject.net.host.HostProviderRegistry; 38 import org.onosproject.net.host.HostProviderRegistry;
...@@ -49,6 +50,7 @@ import org.onosproject.net.provider.ProviderId; ...@@ -49,6 +50,7 @@ import org.onosproject.net.provider.ProviderId;
49 50
50 import java.nio.ByteBuffer; 51 import java.nio.ByteBuffer;
51 import java.util.ArrayList; 52 import java.util.ArrayList;
53 +import java.util.Date;
52 import java.util.HashMap; 54 import java.util.HashMap;
53 import java.util.List; 55 import java.util.List;
54 import java.util.Map; 56 import java.util.Map;
...@@ -238,9 +240,15 @@ public class DHCPManagerTest { ...@@ -238,9 +240,15 @@ public class DHCPManagerTest {
238 public void releaseIP(MacAddress macID) { 240 public void releaseIP(MacAddress macID) {
239 } 241 }
240 242
241 - public Map<MacAddress, Ip4Address> listMapping() { 243 + public Map<MacAddress, IPAssignment> listMapping() {
242 - Map<MacAddress, Ip4Address> map = new HashMap<>(); 244 + Map<MacAddress, IPAssignment> map = new HashMap<>();
243 - map.put(CLIENT1_MAC, Ip4Address.valueOf(EXPECTED_IP)); 245 + IPAssignment assignment = IPAssignment.builder()
246 + .ipAddress(Ip4Address.valueOf(EXPECTED_IP))
247 + .assignmentStatus(IPAssignment.AssignmentStatus.Option_Assigned)
248 + .leasePeriod(300)
249 + .timestamp(new Date())
250 + .build();
251 + map.put(CLIENT1_MAC, assignment);
244 return map; 252 return map;
245 } 253 }
246 254
......