dc57977fada814ba68c5eaa464e4800c059378ea
[onosfw.git] /
1 /*
2  * Copyright 2015 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.openflow.controller;
18
19 import com.google.common.annotations.Beta;
20 import org.onosproject.net.driver.HandlerBehaviour;
21 import org.onosproject.net.flow.instructions.ExtensionTreatment;
22 import org.onosproject.net.flow.instructions.ExtensionTreatmentType;
23 import org.projectfloodlight.openflow.protocol.OFFactory;
24 import org.projectfloodlight.openflow.protocol.action.OFAction;
25
26 /**
27  * Interprets extension instructions and converts them to/from OpenFlow objects.
28  */
29 @Beta
30 public interface ExtensionTreatmentInterpreter extends HandlerBehaviour {
31
32     /**
33      * Returns true if the given extension instruction is supported by this
34      * driver.
35      *
36      * @param extensionTreatmentType extension instruction type
37      * @return true if the instruction is supported, otherwise false
38      */
39     boolean supported(ExtensionTreatmentType extensionTreatmentType);
40
41     /**
42      * Maps an extension instruction to an OpenFlow action.
43      *
44      * @param factory OpenFlow factory
45      * @param extensionTreatment extension instruction
46      * @return OpenFlow action
47      */
48     OFAction mapInstruction(OFFactory factory, ExtensionTreatment extensionTreatment);
49
50     /**
51      * Maps an OpenFlow action to an extension instruction.
52      *
53      * @param action OpenFlow action
54      * @return extension instruction
55      */
56     ExtensionTreatment mapAction(OFAction action);
57
58 }