blob: 84eab6ea8d63d840b2a79041ba79de7240941e6e [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
danielcd9deed2015-10-30 17:16:16 +090022import java.util.List;
samanwita palf28207b2015-09-04 10:41:56 -070023import java.util.Map;
24
danielcd9deed2015-10-30 17:16:16 +090025
samanwita palf28207b2015-09-04 10:41:56 -070026/**
27 * DHCP Service Interface.
28 */
Thomas Vachuskaa1da42e2015-09-09 00:45:22 -070029public interface DhcpService {
samanwita palf28207b2015-09-04 10:41:56 -070030
31 /**
32 * Returns a collection of all the MacAddress to IPAddress mapping.
33 *
34 * @return collection of mappings.
35 */
samanwita pal2a313402015-09-14 16:03:22 -070036 Map<HostId, IpAssignment> listMapping();
samanwita palf28207b2015-09-04 10:41:56 -070037
38 /**
39 * Returns the default lease time granted by the DHCP Server.
40 *
41 * @return lease time
42 */
43 int getLeaseTime();
44
45 /**
46 * Returns the default renewal time granted by the DHCP Server.
47 *
48 * @return renewal time
49 */
50 int getRenewalTime();
51
52 /**
53 * Returns the default rebinding time granted by the DHCP Server.
54 *
55 * @return rebinding time
56 */
57 int getRebindingTime();
58
59 /**
60 * Registers a static IP mapping with the DHCP Server.
daniel877bb2f2015-11-12 21:33:05 +090061 * Supports rangeNotEnforced option
samanwita palf28207b2015-09-04 10:41:56 -070062 *
danielcd9deed2015-10-30 17:16:16 +090063 * @param macID macID of the client
samanwita palf28207b2015-09-04 10:41:56 -070064 * @param ipAddress IP Address requested for the client
daniel877bb2f2015-11-12 21:33:05 +090065 * @param rangeNotEnforced true if rangeNotEnforced was set and the mapping will be eternal
66 * @param addressList subnetMask, DHCP/Router/DNS IP Addresses if rangeNotEnforced was set
danielcd9deed2015-10-30 17:16:16 +090067 * @return true if the mapping was successfully added, false otherwise
samanwita palf28207b2015-09-04 10:41:56 -070068 */
daniel877bb2f2015-11-12 21:33:05 +090069 boolean setStaticMapping(MacAddress macID, Ip4Address ipAddress, boolean rangeNotEnforced,
danielcd9deed2015-10-30 17:16:16 +090070 List<Ip4Address> addressList);
samanwita palf28207b2015-09-04 10:41:56 -070071
72 /**
73 * Removes a static IP mapping with the DHCP Server.
74 *
75 * @param macID macID of the client
76 * @return true if the mapping was successfully removed, false otherwise
77 */
78 boolean removeStaticMapping(MacAddress macID);
79
80 /**
81 * Returns the list of all the available IPs with the server.
82 *
83 * @return list of available IPs
84 */
85 Iterable<Ip4Address> getAvailableIPs();
samanwita palf28207b2015-09-04 10:41:56 -070086}