Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 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.model; |
| 18 | |
| 19 | import com.google.common.annotations.Beta; |
| 20 | |
| 21 | import java.util.Collection; |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 22 | import java.util.Optional; |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 23 | |
| 24 | /** |
| 25 | * Model of a match+action table in a protocol-independent pipeline. |
| 26 | */ |
| 27 | @Beta |
| 28 | public interface PiTableModel { |
| 29 | |
| 30 | /** |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 31 | * Returns the ID of this table. |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 32 | * |
| 33 | * @return a string value |
| 34 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 35 | PiTableId id(); |
| 36 | |
| 37 | /** |
| 38 | * Returns the type of this table. |
| 39 | * |
| 40 | * @return table type |
| 41 | */ |
| 42 | PiTableType tableType(); |
| 43 | |
| 44 | /** |
| 45 | * Returns the model of the action profile that implements this table. Meaningful if this table is of type {@link |
| 46 | * PiTableType#INDIRECT}, otherwise returns null. |
| 47 | * |
| 48 | * @return action profile ID |
| 49 | */ |
| 50 | PiActionProfileModel actionProfile(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 51 | |
| 52 | /** |
| 53 | * Returns the maximum number of entries supported by this table. |
| 54 | * |
| 55 | * @return an integer value |
| 56 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 57 | long maxSize(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 58 | |
| 59 | /** |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 60 | * Returns a collection of direct counters associated to this table. |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 61 | * |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 62 | * @return collection of direct counters |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 63 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 64 | Collection<PiCounterModel> counters(); |
| 65 | |
| 66 | /** |
| 67 | * Returns a collection of direct meters associated to this table. |
| 68 | * |
| 69 | * @return collection of direct meters |
| 70 | */ |
| 71 | Collection<PiMeterModel> meters(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 72 | |
| 73 | /** |
| 74 | * Returns true if this table supports aging, false otherwise. |
| 75 | * |
| 76 | * @return a boolean value |
| 77 | */ |
| 78 | boolean supportsAging(); |
| 79 | |
| 80 | /** |
| 81 | * Returns the collection of match fields supported by this table. |
| 82 | * |
| 83 | * @return a collection of match field models |
| 84 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 85 | Collection<PiMatchFieldModel> matchFields(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 86 | |
| 87 | /** |
| 88 | * Returns the actions supported by this table. |
| 89 | * |
| 90 | * @return a collection of action models |
| 91 | */ |
| 92 | Collection<PiActionModel> actions(); |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 93 | |
| 94 | /** |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 95 | * Returns the model of the default action associated with this table, if any. |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 96 | * |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 97 | * @return optional default action model |
| 98 | */ |
| 99 | Optional<PiActionModel> defaultAction(); |
| 100 | |
| 101 | /** |
| 102 | * Returns true if the default action has mutable parameters that can be changed at runtime, false otherwise. |
| 103 | * |
| 104 | * @return true if the default action has mutable parameters, false otherwise |
| 105 | */ |
| 106 | boolean hasDefaultMutableParams(); |
| 107 | |
| 108 | /** |
| 109 | * Returns the action model associated with the given ID, if present. If not present, it means that this table does |
| 110 | * not support such an action. |
| 111 | * |
| 112 | * @param actionId action ID |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 113 | * @return optional action model |
| 114 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 115 | Optional<PiActionModel> action(PiActionId actionId); |
| 116 | |
| 117 | /** |
| 118 | * Returns the match field model associated with the given ID, if present. If not present, it means that this table |
| 119 | * does not support such a match field. |
| 120 | * |
| 121 | * @param matchFieldId match field ID |
| 122 | * @return optional match field model |
| 123 | */ |
| 124 | Optional<PiMatchFieldModel> matchField(PiMatchFieldId matchFieldId); |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 125 | |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 126 | } |