blob: e2461a8900df653398311367c1f7ad24c43cbf45 [file] [log] [blame]
Carmelo Cascone1022a4e2017-05-25 00:16:18 -04001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
Carmelo Cascone1022a4e2017-05-25 00:16:18 -04003 *
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
17package org.onosproject.net.pi.model;
18
19import com.google.common.annotations.Beta;
20
21import java.util.Collection;
Carmelo Cascone00a59962017-06-16 17:51:49 +090022import java.util.Optional;
Carmelo Cascone1022a4e2017-05-25 00:16:18 -040023
24/**
25 * Model of a match+action table in a protocol-independent pipeline.
26 */
27@Beta
28public interface PiTableModel {
29
30 /**
Carmelo Cascone87892e22017-11-13 16:01:29 -080031 * Returns the ID of this table.
Carmelo Cascone1022a4e2017-05-25 00:16:18 -040032 *
33 * @return a string value
34 */
Carmelo Cascone87892e22017-11-13 16:01:29 -080035 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 Cascone1022a4e2017-05-25 00:16:18 -040051
52 /**
53 * Returns the maximum number of entries supported by this table.
54 *
55 * @return an integer value
56 */
Carmelo Cascone87892e22017-11-13 16:01:29 -080057 long maxSize();
Carmelo Cascone1022a4e2017-05-25 00:16:18 -040058
59 /**
Carmelo Cascone87892e22017-11-13 16:01:29 -080060 * Returns a collection of direct counters associated to this table.
Carmelo Cascone1022a4e2017-05-25 00:16:18 -040061 *
Carmelo Cascone87892e22017-11-13 16:01:29 -080062 * @return collection of direct counters
Carmelo Cascone1022a4e2017-05-25 00:16:18 -040063 */
Carmelo Cascone87892e22017-11-13 16:01:29 -080064 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 Cascone1022a4e2017-05-25 00:16:18 -040072
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 Cascone87892e22017-11-13 16:01:29 -080085 Collection<PiMatchFieldModel> matchFields();
Carmelo Cascone1022a4e2017-05-25 00:16:18 -040086
87 /**
88 * Returns the actions supported by this table.
89 *
90 * @return a collection of action models
91 */
92 Collection<PiActionModel> actions();
Carmelo Cascone00a59962017-06-16 17:51:49 +090093
94 /**
Carmelo Cascone87892e22017-11-13 16:01:29 -080095 * Returns the model of the default action associated with this table, if any.
Carmelo Cascone00a59962017-06-16 17:51:49 +090096 *
Carmelo Cascone87892e22017-11-13 16:01:29 -080097 * @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 Cascone00a59962017-06-16 17:51:49 +0900113 * @return optional action model
114 */
Carmelo Cascone87892e22017-11-13 16:01:29 -0800115 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 Cascone00a59962017-06-16 17:51:49 +0900125
Carmelo Cascone1022a4e2017-05-25 00:16:18 -0400126}