blob: b200605d29f597fdb2e470a538b13a84d4c0ef3b [file] [log] [blame]
samanwita palf28207b2015-09-04 10:41:56 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present 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
danielcd9deed2015-10-30 17:16:16 +090024
samanwita palf28207b2015-09-04 10:41:56 -070025/**
26 * DHCP Service Interface.
27 */
Thomas Vachuskaa1da42e2015-09-09 00:45:22 -070028public interface DhcpService {
samanwita palf28207b2015-09-04 10:41:56 -070029
30 /**
31 * Returns a collection of all the MacAddress to IPAddress mapping.
32 *
33 * @return collection of mappings.
34 */
samanwita pal2a313402015-09-14 16:03:22 -070035 Map<HostId, IpAssignment> listMapping();
samanwita palf28207b2015-09-04 10:41:56 -070036
37 /**
38 * Returns the default lease time granted by the DHCP Server.
39 *
40 * @return lease time
41 */
42 int getLeaseTime();
43
44 /**
45 * Returns the default renewal time granted by the DHCP Server.
46 *
47 * @return renewal time
48 */
49 int getRenewalTime();
50
51 /**
52 * Returns the default rebinding time granted by the DHCP Server.
53 *
54 * @return rebinding time
55 */
56 int getRebindingTime();
57
58 /**
59 * Registers a static IP mapping with the DHCP Server.
60 *
Hyunsun Moon04b1fe92016-05-18 21:28:06 -070061 * @param macAddress mac address to have a given ip assignment
62 * @param ipRequest ip address and dhcp options
danielcd9deed2015-10-30 17:16:16 +090063 * @return true if the mapping was successfully added, false otherwise
samanwita palf28207b2015-09-04 10:41:56 -070064 */
Hyunsun Moon04b1fe92016-05-18 21:28:06 -070065 boolean setStaticMapping(MacAddress macAddress, IpAssignment ipRequest);
samanwita palf28207b2015-09-04 10:41:56 -070066
67 /**
68 * Removes a static IP mapping with the DHCP Server.
69 *
70 * @param macID macID of the client
71 * @return true if the mapping was successfully removed, false otherwise
72 */
73 boolean removeStaticMapping(MacAddress macID);
74
75 /**
76 * Returns the list of all the available IPs with the server.
77 *
78 * @return list of available IPs
79 */
80 Iterable<Ip4Address> getAvailableIPs();
samanwita palf28207b2015-09-04 10:41:56 -070081}