blob: e26d99e513c7a229717f5bc8339d099b9e46743b [file] [log] [blame]
Yi Tsengb8e19f12017-06-07 15:47:23 -07001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Yi Tsengb8e19f12017-06-07 15:47:23 -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 */
16
17package org.onosproject.dhcprelay.store;
18
19import org.onosproject.net.HostId;
20import org.onosproject.store.Store;
21import org.onosproject.store.StoreDelegate;
22
23import java.util.Collection;
24import java.util.Optional;
25
26/**
27 * Stores DHCP records which relay-ed by DHCP relay application.
28 */
29public 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}