Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 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. |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 15 | * |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 16 | */ |
| 17 | |
Yi Tseng | 5130129 | 2017-07-28 13:02:59 -0700 | [diff] [blame] | 18 | package org.onosproject.dhcprelay.api; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 19 | |
Kalhee Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 20 | import org.onlab.packet.IpPrefix; |
Yi Tseng | 13a41a1 | 2017-07-26 13:45:01 -0700 | [diff] [blame] | 21 | import org.onlab.packet.MacAddress; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 22 | import org.onosproject.dhcprelay.store.DhcpRecord; |
Kalhee Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 23 | import org.onosproject.routing.fpm.api.FpmRecord; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 24 | import org.onosproject.net.HostId; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 25 | import java.util.Collection; |
Yi Tseng | 919b2df | 2017-09-07 16:22:51 -0700 | [diff] [blame] | 26 | import java.util.List; |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 27 | import java.util.Optional; |
| 28 | |
| 29 | public 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 Tseng | 13a41a1 | 2017-07-26 13:45:01 -0700 | [diff] [blame] | 44 | |
| 45 | /** |
Kalhee Kim | d94ceea | 2017-11-29 19:03:02 +0000 | [diff] [blame] | 46 | * 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 Tseng | 13a41a1 | 2017-07-26 13:45:01 -0700 | [diff] [blame] | 54 | * Gets mac address of DHCP server. |
| 55 | * |
| 56 | * @return the mac address of DHCP server; empty if not exist |
Yi Tseng | 919b2df | 2017-09-07 16:22:51 -0700 | [diff] [blame] | 57 | * @deprecated 1.12, use get DHCP server configs method |
Yi Tseng | 13a41a1 | 2017-07-26 13:45:01 -0700 | [diff] [blame] | 58 | */ |
Yi Tseng | 919b2df | 2017-09-07 16:22:51 -0700 | [diff] [blame] | 59 | @Deprecated |
Yi Tseng | 13a41a1 | 2017-07-26 13:45:01 -0700 | [diff] [blame] | 60 | Optional<MacAddress> getDhcpServerMacAddress(); |
Yi Tseng | 919b2df | 2017-09-07 16:22:51 -0700 | [diff] [blame] | 61 | |
| 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 Kim | ba36606 | 2017-11-07 16:32:09 +0000 | [diff] [blame] | 75 | |
| 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 Kim | d94ceea | 2017-11-29 19:03:02 +0000 | [diff] [blame] | 113 | |
Yi Tseng | 7a38f9a | 2017-06-09 14:36:40 -0700 | [diff] [blame] | 114 | } |