Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 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.bmv2.api.service; |
| 18 | |
| 19 | |
Carmelo Cascone | 9e39e31 | 2016-06-16 14:47:09 -0700 | [diff] [blame] | 20 | import com.google.common.annotations.Beta; |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 21 | import org.onosproject.bmv2.api.context.Bmv2FlowRuleTranslator; |
| 22 | import org.onosproject.bmv2.api.runtime.Bmv2FlowRuleWrapper; |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 23 | import org.onosproject.bmv2.api.runtime.Bmv2TableEntryReference; |
Carmelo Cascone | ee4cd7e | 2016-06-16 18:28:43 -0700 | [diff] [blame] | 24 | import org.onosproject.net.DeviceId; |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * A service for managing BMv2 table entries. |
| 28 | */ |
Carmelo Cascone | 9e39e31 | 2016-06-16 14:47:09 -0700 | [diff] [blame] | 29 | @Beta |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 30 | public interface Bmv2TableEntryService { |
| 31 | |
| 32 | /** |
| 33 | * Returns a flow rule translator. |
| 34 | * |
| 35 | * @return a flow rule translator |
| 36 | */ |
| 37 | Bmv2FlowRuleTranslator getFlowRuleTranslator(); |
| 38 | |
| 39 | /** |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 40 | * Binds the given ONOS flow rule with a BMv2 table entry reference. |
| 41 | * |
| 42 | * @param entryRef a table entry reference |
| 43 | * @param rule a BMv2 flow rule wrapper |
| 44 | */ |
Carmelo Cascone | ee4cd7e | 2016-06-16 18:28:43 -0700 | [diff] [blame] | 45 | void bind(Bmv2TableEntryReference entryRef, Bmv2FlowRuleWrapper rule); |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 46 | |
| 47 | /** |
| 48 | * Returns the ONOS flow rule associated with the given BMv2 table entry reference, or null if there's no such a |
| 49 | * mapping. |
| 50 | * |
| 51 | * @param entryRef a table entry reference |
| 52 | * @return a BMv2 flow rule wrapper |
| 53 | */ |
Carmelo Cascone | ee4cd7e | 2016-06-16 18:28:43 -0700 | [diff] [blame] | 54 | Bmv2FlowRuleWrapper lookup(Bmv2TableEntryReference entryRef); |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 55 | |
| 56 | /** |
| 57 | * Removes any flow rule previously bound with a given BMv2 table entry reference. |
| 58 | * |
| 59 | * @param entryRef a table entry reference |
| 60 | */ |
Carmelo Cascone | ee4cd7e | 2016-06-16 18:28:43 -0700 | [diff] [blame] | 61 | void unbind(Bmv2TableEntryReference entryRef); |
| 62 | |
| 63 | /** |
| 64 | * Removes all bindings for a given device. |
| 65 | * |
| 66 | * @param deviceId a device ID |
| 67 | */ |
| 68 | void unbindAll(DeviceId deviceId); |
Carmelo Cascone | 17fc9e4 | 2016-05-31 11:29:21 -0700 | [diff] [blame] | 69 | } |