blob: 93d8e0cea2831e024b33dadb596cc0990270c908 [file] [log] [blame]
Carmelo Cascone1022a4e2017-05-25 00:16:18 -04001/*
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
17package org.onosproject.net.pi.runtime;
18
19import com.google.common.annotations.Beta;
20import org.onosproject.net.flow.FlowRule;
21import 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
27public 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}