2 * Copyright 2015 Open Networking Laboratory
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package org.onosproject.net.flow.instructions;
19 import java.util.List;
22 * An extensible instruction type.
24 public interface ExtensionTreatment {
27 * Gets the type of the extension instruction.
31 ExtensionTreatmentType type();
34 * Sets a property on the extension instruction.
36 * @param key property key
37 * @param value value to set for the given key
38 * @param <T> class of the value
39 * @throws ExtensionPropertyException if the given key is not a valid
40 * property on this extension instruction
42 <T> void setPropertyValue(String key, T value) throws ExtensionPropertyException;
45 * Gets a property value of an extension instruction.
47 * @param key property key
48 * @param <T> class of the value
49 * @return value of the property
50 * @throws ExtensionPropertyException if the given key is not a valid
51 * property on this extension instruction
53 <T> T getPropertyValue(String key) throws ExtensionPropertyException;
56 * Gets a list of all properties on the extension instruction.
58 * @return list of properties
60 List<String> getProperties();
63 * Serialize the extension instruction to a byte array.
70 * Deserialize the extension instruction from a byte array. The properties
71 * of this object will be overwritten with the data in the byte array.
73 * @param data input byte array
75 void deserialize(byte[] data);