Esin Karaman | 971fb7f | 2017-12-28 13:44:52 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 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 | |
| 18 | package org.onosproject.drivers.bmv2.mirror; |
| 19 | |
| 20 | import org.onosproject.drivers.bmv2.api.runtime.Bmv2Entity; |
| 21 | import org.onosproject.drivers.bmv2.api.runtime.Bmv2Handle; |
| 22 | import org.onosproject.net.DeviceId; |
| 23 | |
| 24 | import java.util.Collection; |
| 25 | |
| 26 | /** |
| 27 | * Mirror of entities installed on a BMv2 device. |
| 28 | * |
| 29 | * @param <H> Handle class |
| 30 | * @param <E> Entity class |
| 31 | */ |
| 32 | public interface Bmv2Mirror<H extends Bmv2Handle, E extends Bmv2Entity> { |
| 33 | |
| 34 | /** |
| 35 | * Returns all entries for the given device ID. |
| 36 | * |
| 37 | * @param deviceId device ID |
| 38 | * @return collection of BMv2 entries |
| 39 | */ |
| 40 | Collection<E> getAll(DeviceId deviceId); |
| 41 | |
| 42 | /** |
| 43 | * Returns entry associated to the given handle, if present, otherwise |
| 44 | * null. |
| 45 | * |
| 46 | * @param handle handle |
| 47 | * @return BMv2 entry |
| 48 | */ |
| 49 | E get(H handle); |
| 50 | |
| 51 | /** |
| 52 | * Stores the given entry associating it to the given handle. |
| 53 | * |
| 54 | * @param handle handle |
| 55 | * @param entry entry |
| 56 | */ |
| 57 | void put(H handle, E entry); |
| 58 | |
| 59 | /** |
| 60 | * Removes the entry associated to the given handle. |
| 61 | * |
| 62 | * @param handle handle |
| 63 | */ |
| 64 | void remove(H handle); |
| 65 | } |