Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-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.net.pi.runtime; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
| 20 | import org.onosproject.net.flow.FlowRule; |
| 21 | import org.onosproject.net.pi.model.PiPipeconf; |
| 22 | |
| 23 | /** |
| 24 | * A service to translate ONOS flow rules to table entries of a protocol-independent pipeline. |
| 25 | */ |
| 26 | @Beta |
| 27 | public interface PiFlowRuleTranslationService { |
| 28 | |
| 29 | /** |
| 30 | * Returns a table entry equivalent to the given flow rule for the given protocol-independent |
| 31 | * pipeline configuration. |
| 32 | * |
| 33 | * @param rule a flow rule |
| 34 | * @param pipeconf a pipeline configuration |
| 35 | * @return a table entry |
| 36 | * @throws PiFlowRuleTranslationException if the flow rule cannot be translated |
| 37 | */ |
| 38 | PiTableEntry translate(FlowRule rule, PiPipeconf pipeconf) |
| 39 | throws PiFlowRuleTranslationException; |
| 40 | |
| 41 | /** |
| 42 | * Signals that an error was encountered while translating flow rule. |
| 43 | */ |
| 44 | class PiFlowRuleTranslationException extends Exception { |
| 45 | |
| 46 | /** |
| 47 | * Creates a new exception with the given message. |
| 48 | * |
| 49 | * @param message a message |
| 50 | */ |
| 51 | public PiFlowRuleTranslationException(String message) { |
| 52 | super(message); |
| 53 | } |
| 54 | } |
| 55 | } |