Yi Tseng | b8e19f1 | 2017-06-07 15:47:23 -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 | b8e19f1 | 2017-06-07 15:47:23 -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. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.dhcprelay.store; |
| 18 | |
| 19 | import org.onosproject.net.HostId; |
| 20 | import org.onosproject.store.Store; |
| 21 | import org.onosproject.store.StoreDelegate; |
| 22 | |
| 23 | import java.util.Collection; |
| 24 | import java.util.Optional; |
| 25 | |
| 26 | /** |
| 27 | * Stores DHCP records which relay-ed by DHCP relay application. |
| 28 | */ |
| 29 | public interface DhcpRelayStore extends Store<DhcpRelayStoreEvent, StoreDelegate<DhcpRelayStoreEvent>> { |
| 30 | |
| 31 | /** |
| 32 | * Creates or updates DHCP record for specific host id (mac + vlan). |
| 33 | * |
| 34 | * @param hostId the id of host |
| 35 | * @param dhcpRecord the DHCP record to update |
| 36 | */ |
| 37 | void updateDhcpRecord(HostId hostId, DhcpRecord dhcpRecord); |
| 38 | |
| 39 | /** |
| 40 | * Gets DHCP record for specific host id (mac + vlan). |
| 41 | * |
| 42 | * @param hostId the id of host |
| 43 | * @return the DHCP record of the host; empty if record not exists |
| 44 | */ |
| 45 | Optional<DhcpRecord> getDhcpRecord(HostId hostId); |
| 46 | |
| 47 | /** |
| 48 | * Gets all DHCP records from store. |
| 49 | * |
| 50 | * @return all DHCP records from store |
| 51 | */ |
| 52 | Collection<DhcpRecord> getDhcpRecords(); |
| 53 | |
| 54 | /** |
| 55 | * Removes record for specific host id (mac + vlan). |
| 56 | * |
| 57 | * @param hostId the id of host |
| 58 | * @return the DHCP record of the host; empty if record not exists |
| 59 | */ |
| 60 | Optional<DhcpRecord> removeDhcpRecord(HostId hostId); |
| 61 | } |