Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 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.net.flow.instructions; |
| 18 | |
| 19 | import java.util.List; |
| 20 | |
| 21 | /** |
| 22 | * An extensible instruction type. |
| 23 | */ |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 24 | public interface ExtensionTreatment { |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Gets the type of the extension instruction. |
| 28 | * |
| 29 | * @return type |
| 30 | */ |
alshabib | 880b644 | 2015-11-23 22:13:04 -0800 | [diff] [blame] | 31 | ExtensionTreatmentType type(); |
Jonathan Hart | 3c25916 | 2015-10-21 21:31:19 -0700 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * Sets a property on the extension instruction. |
| 35 | * |
| 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 |
| 41 | */ |
| 42 | <T> void setPropertyValue(String key, T value) throws ExtensionPropertyException; |
| 43 | |
| 44 | /** |
| 45 | * Gets a property value of an extension instruction. |
| 46 | * |
| 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 |
| 52 | */ |
| 53 | <T> T getPropertyValue(String key) throws ExtensionPropertyException; |
| 54 | |
| 55 | /** |
| 56 | * Gets a list of all properties on the extension instruction. |
| 57 | * |
| 58 | * @return list of properties |
| 59 | */ |
| 60 | List<String> getProperties(); |
| 61 | |
| 62 | /** |
| 63 | * Serialize the extension instruction to a byte array. |
| 64 | * |
| 65 | * @return byte array |
| 66 | */ |
| 67 | byte[] serialize(); |
| 68 | |
| 69 | /** |
| 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. |
| 72 | * |
| 73 | * @param data input byte array |
| 74 | */ |
| 75 | void deserialize(byte[] data); |
| 76 | |
| 77 | |
| 78 | } |