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 | /** |
Carmelo Cascone | 50d195f | 2018-09-11 13:26:38 -0700 | [diff] [blame] | 45 | * Returns the model of the action profile that implements this table. |
| 46 | * Meaningful if this table is of type {@link PiTableType#INDIRECT}, |
| 47 | * otherwise returns null. |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 48 | * |
| 49 | * @return action profile ID |
| 50 | */ |
| 51 | PiActionProfileModel actionProfile(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 52 | |
| 53 | /** |
| 54 | * Returns the maximum number of entries supported by this table. |
| 55 | * |
| 56 | * @return an integer value |
| 57 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 58 | long maxSize(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 59 | |
| 60 | /** |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 61 | * Returns a collection of direct counters associated to this table. |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 62 | * |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 63 | * @return collection of direct counters |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 64 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 65 | Collection<PiCounterModel> counters(); |
| 66 | |
| 67 | /** |
| 68 | * Returns a collection of direct meters associated to this table. |
| 69 | * |
| 70 | * @return collection of direct meters |
| 71 | */ |
| 72 | Collection<PiMeterModel> meters(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 73 | |
| 74 | /** |
| 75 | * Returns true if this table supports aging, false otherwise. |
| 76 | * |
| 77 | * @return a boolean value |
| 78 | */ |
| 79 | boolean supportsAging(); |
| 80 | |
| 81 | /** |
| 82 | * Returns the collection of match fields supported by this table. |
| 83 | * |
| 84 | * @return a collection of match field models |
| 85 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 86 | Collection<PiMatchFieldModel> matchFields(); |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 87 | |
| 88 | /** |
| 89 | * Returns the actions supported by this table. |
| 90 | * |
| 91 | * @return a collection of action models |
| 92 | */ |
| 93 | Collection<PiActionModel> actions(); |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 94 | |
| 95 | /** |
Carmelo Cascone | 50d195f | 2018-09-11 13:26:38 -0700 | [diff] [blame] | 96 | * Returns the model of the constant default action associated with this |
| 97 | * table, if any. |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 98 | * |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 99 | * @return optional default action model |
| 100 | */ |
Carmelo Cascone | 50d195f | 2018-09-11 13:26:38 -0700 | [diff] [blame] | 101 | Optional<PiActionModel> constDefaultAction(); |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 102 | |
| 103 | /** |
Carmelo Cascone | 33b27bc | 2018-09-09 22:56:14 -0700 | [diff] [blame] | 104 | * Returns true if the table is populated with static entries that cannot be |
| 105 | * modified by the control plane at runtime. |
| 106 | * |
| 107 | * @return true if table is populated with static entries, false otherwise |
| 108 | */ |
| 109 | boolean isConstantTable(); |
| 110 | |
| 111 | /** |
Carmelo Cascone | 50d195f | 2018-09-11 13:26:38 -0700 | [diff] [blame] | 112 | * Returns the action model associated with the given ID, if present. If not |
| 113 | * present, it means that this table does not support such an action. |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 114 | * |
| 115 | * @param actionId action ID |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 116 | * @return optional action model |
| 117 | */ |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 118 | Optional<PiActionModel> action(PiActionId actionId); |
| 119 | |
| 120 | /** |
Carmelo Cascone | 50d195f | 2018-09-11 13:26:38 -0700 | [diff] [blame] | 121 | * Returns the match field model associated with the given ID, if present. |
| 122 | * If not present, it means that this table does not support such a match |
| 123 | * field. |
Carmelo Cascone | 87892e2 | 2017-11-13 16:01:29 -0800 | [diff] [blame] | 124 | * |
| 125 | * @param matchFieldId match field ID |
| 126 | * @return optional match field model |
| 127 | */ |
| 128 | Optional<PiMatchFieldModel> matchField(PiMatchFieldId matchFieldId); |
Carmelo Cascone | 00a5996 | 2017-06-16 17:51:49 +0900 | [diff] [blame] | 129 | |
Carmelo Cascone | 1022a4e | 2017-05-25 00:16:18 -0400 | [diff] [blame] | 130 | } |