blob: 7c2127f9437ee8905d66e1096b6861f66930b708 [file] [log] [blame]
samanwita palf28207b2015-09-04 10:41:56 -07001/*
Thomas Vachuska54dc3522015-09-09 00:11:45 -07002 * Copyright 2015 Open Networking Laboratory
samanwita palf28207b2015-09-04 10:41:56 -07003 *
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 */
16package org.onosproject.dhcp;
17
18import org.onlab.packet.Ip4Address;
19import org.onlab.packet.MacAddress;
samanwita pal2a313402015-09-14 16:03:22 -070020import org.onosproject.net.HostId;
samanwita palf28207b2015-09-04 10:41:56 -070021
22import java.util.Map;
23
24/**
25 * DHCP Service Interface.
26 */
Thomas Vachuskaa1da42e2015-09-09 00:45:22 -070027public interface DhcpService {
samanwita palf28207b2015-09-04 10:41:56 -070028
29 /**
30 * Returns a collection of all the MacAddress to IPAddress mapping.
31 *
32 * @return collection of mappings.
33 */
samanwita pal2a313402015-09-14 16:03:22 -070034 Map<HostId, IpAssignment> listMapping();
samanwita palf28207b2015-09-04 10:41:56 -070035
36 /**
37 * Returns the default lease time granted by the DHCP Server.
38 *
39 * @return lease time
40 */
41 int getLeaseTime();
42
43 /**
44 * Returns the default renewal time granted by the DHCP Server.
45 *
46 * @return renewal time
47 */
48 int getRenewalTime();
49
50 /**
51 * Returns the default rebinding time granted by the DHCP Server.
52 *
53 * @return rebinding time
54 */
55 int getRebindingTime();
56
57 /**
58 * Registers a static IP mapping with the DHCP Server.
59 *
60 * @param macID macID of the client
61 * @param ipAddress IP Address requested for the client
62 * @return true if the mapping was successfully registered, false otherwise
63 */
64 boolean setStaticMapping(MacAddress macID, Ip4Address ipAddress);
65
66 /**
67 * Removes a static IP mapping with the DHCP Server.
68 *
69 * @param macID macID of the client
70 * @return true if the mapping was successfully removed, false otherwise
71 */
72 boolean removeStaticMapping(MacAddress macID);
73
74 /**
75 * Returns the list of all the available IPs with the server.
76 *
77 * @return list of available IPs
78 */
79 Iterable<Ip4Address> getAvailableIPs();
80
81}