blob: 5eb8d9edf745d547a0a3b8853c1e88998e5815f0 [file] [log] [blame]
Yi Tseng7a38f9a2017-06-09 14:36:40 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Yi Tseng7a38f9a2017-06-09 14:36:40 -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.
Yi Tseng51301292017-07-28 13:02:59 -070015 *
Yi Tseng7a38f9a2017-06-09 14:36:40 -070016 */
17
Yi Tseng51301292017-07-28 13:02:59 -070018package org.onosproject.dhcprelay.api;
Yi Tseng7a38f9a2017-06-09 14:36:40 -070019
Kalhee Kimba366062017-11-07 16:32:09 +000020import org.onlab.packet.IpPrefix;
Yi Tseng13a41a12017-07-26 13:45:01 -070021import org.onlab.packet.MacAddress;
Yi Tseng7a38f9a2017-06-09 14:36:40 -070022import org.onosproject.dhcprelay.store.DhcpRecord;
Kalhee Kimba366062017-11-07 16:32:09 +000023import org.onosproject.routing.fpm.api.FpmRecord;
Yi Tseng7a38f9a2017-06-09 14:36:40 -070024import org.onosproject.net.HostId;
Yi Tseng7a38f9a2017-06-09 14:36:40 -070025import java.util.Collection;
Yi Tseng919b2df2017-09-07 16:22:51 -070026import java.util.List;
Yi Tseng7a38f9a2017-06-09 14:36:40 -070027import java.util.Optional;
28
29public interface DhcpRelayService {
30 /**
31 * Gets DHCP record for specific host id (mac + vlan).
32 *
33 * @param hostId the id of host
34 * @return the DHCP record of the host
35 */
36 Optional<DhcpRecord> getDhcpRecord(HostId hostId);
37
38 /**
39 * Gets all DHCP records from store.
40 *
41 * @return all DHCP records from store
42 */
43 Collection<DhcpRecord> getDhcpRecords();
Yi Tseng13a41a12017-07-26 13:45:01 -070044
45 /**
Kalhee Kimd94ceea2017-11-29 19:03:02 +000046 * Updates DHCP record for specific host id (mac + vlan).
47 *
48 * @param hostId the id of host
49 * @param dhcpRecord the DHCP record of the host
50 */
51 void updateDhcpRecord(HostId hostId, DhcpRecord dhcpRecord);
52
53 /**
Yi Tseng13a41a12017-07-26 13:45:01 -070054 * Gets mac address of DHCP server.
55 *
56 * @return the mac address of DHCP server; empty if not exist
Yi Tseng919b2df2017-09-07 16:22:51 -070057 * @deprecated 1.12, use get DHCP server configs method
Yi Tseng13a41a12017-07-26 13:45:01 -070058 */
Yi Tseng919b2df2017-09-07 16:22:51 -070059 @Deprecated
Yi Tseng13a41a12017-07-26 13:45:01 -070060 Optional<MacAddress> getDhcpServerMacAddress();
Yi Tseng919b2df2017-09-07 16:22:51 -070061
62 /**
63 * Gets list of default DHCP server information.
64 *
65 * @return list of default DHCP server information
66 */
67 List<DhcpServerInfo> getDefaultDhcpServerInfoList();
68
69 /**
70 * Gets list of indirect DHCP server information.
71 *
72 * @return list of indirect DHCP server information
73 */
74 List<DhcpServerInfo> getIndirectDhcpServerInfoList();
Kalhee Kimba366062017-11-07 16:32:09 +000075
76 /**
77 * Add DHCP FPM record to store.
78 *
79 * @param prefix the prefix
80 * @param fpmRecord the fpmRecord
81 */
82 void addFpmRecord(IpPrefix prefix, FpmRecord fpmRecord);
83
84 /**
85 * Delete DHCP FPM record from store.
86 *
87 * @param prefix the prefix
88 * @return DHCP record from store; empty value if it does not exist.
89 */
90 Optional<FpmRecord> removeFpmRecord(IpPrefix prefix);
91
92 /**
93 * Gets PD route record for specific prefix.
94 *
95 * @param prefix PD prefix
96 * @return the PD route record from store
97 */
98 Optional<FpmRecord> getFpmRecord(IpPrefix prefix);
99
100 /**
101 * Gets all PD route records from store.
102 *
103 * @return all PD records from store
104 */
105 Collection<FpmRecord> getFpmRecords();
106
107 /**
108 * Determine if DHCP FPM feature is enabled or not.
109 *
110 * @return boolean value
111 */
112 public boolean isDhcpFpmEnabled();
Kalhee Kimd94ceea2017-11-29 19:03:02 +0000113
Yi Tseng7a38f9a2017-06-09 14:36:40 -0700114}