blob: ff846eb3d91c5972113700b08e93a8d9adf2d9be [file] [log] [blame]
Jordi Ortizaa8de492016-12-01 00:21:36 +01001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Jordi Ortizaa8de492016-12-01 00:21:36 +01003 *
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 */
16package org.onosproject.net.meter;
17
18import org.onosproject.net.DeviceId;
19
20import java.util.Set;
21
22/**
23 * Meter Features of a device.
24 */
25public interface MeterFeatures {
26
27 /**
28 * Return the device id to which this meter features apply.
29 *
30 * @return the device id
31 */
32 DeviceId deviceId();
33
34 /**
35 * Returns the maximum number of meters accepted by the device.
36 *
37 * @return the maximum meter value.
Wailok Shumbe900bd2021-08-05 00:55:47 +080038 * @deprecated in onos-2.5 replaced by {@link #startIndex()} and {@link #endIndex()}
Jordi Ortizaa8de492016-12-01 00:21:36 +010039 */
Wailok Shumbe900bd2021-08-05 00:55:47 +080040 @Deprecated
Jordi Ortizaa8de492016-12-01 00:21:36 +010041 long maxMeter();
42
43 /**
Wailok Shumbe900bd2021-08-05 00:55:47 +080044 * Returns the start index (inclusive) of the meters.
45 *
46 * @return the start index
47 */
48 long startIndex();
49
50 /**
51 * Returns the end index (inclusive) of the meters.
52 *
53 * @return the end index
54 */
55 long endIndex();
56
57 /**
Jordi Ortizaa8de492016-12-01 00:21:36 +010058 * Returns band types supported.
59 *
60 * @return the band types supported.
61 */
62 Set<Band.Type> bandTypes();
63
64 /**
65 * Returns unit types available for meters.
66 *
67 * @return the unit types available.
68 */
69 Set<Meter.Unit> unitTypes();
70
71 /**
72 * Returns if burst size is available.
73 *
74 * @return burst availability
75 */
76 boolean isBurstSupported();
77
78 /**
79 * Returns if statistics collection is available.
80 *
81 * @return statistics availability
82 */
83 boolean isStatsSupported();
84
85 /**
86 * Returns the maximum bands per meter.
87 *
88 * @return the max bands value
89 */
90 short maxBands();
91
92 /**
93 * Returns the maximum colors value for DiffServ operation.
94 *
95 * @return the maximum colors value.
96 */
97 short maxColor();
98
99 /**
cansu.toprak409289d2017-10-27 10:04:05 +0300100 * Returns features flags that supported for meter actions by device.
101 *
102 * @return meter features flags
103 * otherwise empty set.
104 */
105 Set<MeterFeaturesFlag> features();
106
107 /**
Wailok Shumbe900bd2021-08-05 00:55:47 +0800108 * Returns Meter Scope.
109 *
110 * @return meter scope
111 */
112 MeterScope scope();
113
114 /**
Jordi Ortizaa8de492016-12-01 00:21:36 +0100115 * A meter features builder.
116 */
117 interface Builder {
118 /**
119 * Assigns the target device for this meter features.
120 *
121 * @param deviceId a device id
122 * @return this builder
123 */
124 Builder forDevice(DeviceId deviceId);
125
126 /**
127 * Assigns the max meters value for this meter features.
128 *
129 * @param maxMeter the maximum meters available
130 * @return this builder
Wailok Shumbe900bd2021-08-05 00:55:47 +0800131 * @deprecated in onos-2.5 replaced by {@link #withStartIndex(long)} and {@link #withEndIndex(long)}
Jordi Ortizaa8de492016-12-01 00:21:36 +0100132 */
Wailok Shumbe900bd2021-08-05 00:55:47 +0800133 @Deprecated
Jordi Ortizaa8de492016-12-01 00:21:36 +0100134 Builder withMaxMeters(long maxMeter);
135
136 /**
Wailok Shumbe900bd2021-08-05 00:55:47 +0800137 * Assigns the start index (inclusive) for this meter features.
138 *
139 * @param startIndex the start index
140 * @return this builder
141 */
142 Builder withStartIndex(long startIndex);
143
144 /**
145 * Assigns the end index (inclusive) for this meter features.
146 *
147 * @param endIndex the end index
148 * @return this builder
149 */
150 Builder withEndIndex(long endIndex);
151
152 /**
Jordi Ortizaa8de492016-12-01 00:21:36 +0100153 * Assigns the max bands value for this meter features.
154 *
155 * @param maxBands the maximum bands available.
156 * @return this builder
157 */
158 Builder withMaxBands(short maxBands);
159
160 /**
161 * Assigns the max colors value for this meter features.
162 *
163 * @param maxColors the maximum colors available.
164 * @return this builder
165 */
166 Builder withMaxColors(short maxColors);
167
168 /**
169 * Assigns the band types for this meter features.
170 *
171 * @param types the band types available.
172 * @return this builder
173 */
174 Builder withBandTypes(Set<Band.Type> types);
175
176 /**
177 * Assigns the capabilities for this meter features.
178 *
179 * @param units the units available
180 * @return this
181 */
182 Builder withUnits(Set<Meter.Unit> units);
183
184 /**
185 * Assigns the burst capabilities.
186 *
187 * @param hasBurst if the burst is supported
188 * @return this builder
189 */
190 Builder hasBurst(boolean hasBurst);
191
192 /**
193 * Assigns the stats capabilities.
194 *
195 * @param hasStats if the statistics are supported
196 * @return this builder
197 */
198 Builder hasStats(boolean hasStats);
199
200 /**
cansu.toprak409289d2017-10-27 10:04:05 +0300201 * Assigns the features for this meter features for OF1.5.
202 *
203 * @param featureFlags if meter features flags are supported
204 * @return this builder
205 */
206 Builder withFeatures(Set<MeterFeaturesFlag> featureFlags);
207
208 /**
Wailok Shumbe900bd2021-08-05 00:55:47 +0800209 * Assigns the meter scope.
210 *
211 * @param scope the scope
212 * @return this builder
213 */
214 Builder withScope(MeterScope scope);
215
216 /**
Jordi Ortizaa8de492016-12-01 00:21:36 +0100217 * Builds the Meter Features based on the specified parameters.
218 *
219 * @return the meter features
220 */
221 MeterFeatures build();
222 }
223}