Jordi Ortiz | aa8de49 | 2016-12-01 00:21:36 +0100 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Jordi Ortiz | aa8de49 | 2016-12-01 00:21:36 +0100 | [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 | package org.onosproject.net.meter; |
| 17 | |
| 18 | import org.onosproject.net.DeviceId; |
| 19 | |
| 20 | import java.util.Set; |
| 21 | |
| 22 | /** |
| 23 | * Meter Features of a device. |
| 24 | */ |
| 25 | public 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. |
| 38 | */ |
| 39 | long maxMeter(); |
| 40 | |
| 41 | /** |
| 42 | * Returns band types supported. |
| 43 | * |
| 44 | * @return the band types supported. |
| 45 | */ |
| 46 | Set<Band.Type> bandTypes(); |
| 47 | |
| 48 | /** |
| 49 | * Returns unit types available for meters. |
| 50 | * |
| 51 | * @return the unit types available. |
| 52 | */ |
| 53 | Set<Meter.Unit> unitTypes(); |
| 54 | |
| 55 | /** |
| 56 | * Returns if burst size is available. |
| 57 | * |
| 58 | * @return burst availability |
| 59 | */ |
| 60 | boolean isBurstSupported(); |
| 61 | |
| 62 | /** |
| 63 | * Returns if statistics collection is available. |
| 64 | * |
| 65 | * @return statistics availability |
| 66 | */ |
| 67 | boolean isStatsSupported(); |
| 68 | |
| 69 | /** |
| 70 | * Returns the maximum bands per meter. |
| 71 | * |
| 72 | * @return the max bands value |
| 73 | */ |
| 74 | short maxBands(); |
| 75 | |
| 76 | /** |
| 77 | * Returns the maximum colors value for DiffServ operation. |
| 78 | * |
| 79 | * @return the maximum colors value. |
| 80 | */ |
| 81 | short maxColor(); |
| 82 | |
| 83 | /** |
cansu.toprak | 409289d | 2017-10-27 10:04:05 +0300 | [diff] [blame] | 84 | * Returns features flags that supported for meter actions by device. |
| 85 | * |
| 86 | * @return meter features flags |
| 87 | * otherwise empty set. |
| 88 | */ |
| 89 | Set<MeterFeaturesFlag> features(); |
| 90 | |
| 91 | /** |
Jordi Ortiz | aa8de49 | 2016-12-01 00:21:36 +0100 | [diff] [blame] | 92 | * A meter features builder. |
| 93 | */ |
| 94 | interface Builder { |
| 95 | /** |
| 96 | * Assigns the target device for this meter features. |
| 97 | * |
| 98 | * @param deviceId a device id |
| 99 | * @return this builder |
| 100 | */ |
| 101 | Builder forDevice(DeviceId deviceId); |
| 102 | |
| 103 | /** |
| 104 | * Assigns the max meters value for this meter features. |
| 105 | * |
| 106 | * @param maxMeter the maximum meters available |
| 107 | * @return this builder |
| 108 | */ |
| 109 | Builder withMaxMeters(long maxMeter); |
| 110 | |
| 111 | /** |
| 112 | * Assigns the max bands value for this meter features. |
| 113 | * |
| 114 | * @param maxBands the maximum bands available. |
| 115 | * @return this builder |
| 116 | */ |
| 117 | Builder withMaxBands(short maxBands); |
| 118 | |
| 119 | /** |
| 120 | * Assigns the max colors value for this meter features. |
| 121 | * |
| 122 | * @param maxColors the maximum colors available. |
| 123 | * @return this builder |
| 124 | */ |
| 125 | Builder withMaxColors(short maxColors); |
| 126 | |
| 127 | /** |
| 128 | * Assigns the band types for this meter features. |
| 129 | * |
| 130 | * @param types the band types available. |
| 131 | * @return this builder |
| 132 | */ |
| 133 | Builder withBandTypes(Set<Band.Type> types); |
| 134 | |
| 135 | /** |
| 136 | * Assigns the capabilities for this meter features. |
| 137 | * |
| 138 | * @param units the units available |
| 139 | * @return this |
| 140 | */ |
| 141 | Builder withUnits(Set<Meter.Unit> units); |
| 142 | |
| 143 | /** |
| 144 | * Assigns the burst capabilities. |
| 145 | * |
| 146 | * @param hasBurst if the burst is supported |
| 147 | * @return this builder |
| 148 | */ |
| 149 | Builder hasBurst(boolean hasBurst); |
| 150 | |
| 151 | /** |
| 152 | * Assigns the stats capabilities. |
| 153 | * |
| 154 | * @param hasStats if the statistics are supported |
| 155 | * @return this builder |
| 156 | */ |
| 157 | Builder hasStats(boolean hasStats); |
| 158 | |
| 159 | /** |
cansu.toprak | 409289d | 2017-10-27 10:04:05 +0300 | [diff] [blame] | 160 | * Assigns the features for this meter features for OF1.5. |
| 161 | * |
| 162 | * @param featureFlags if meter features flags are supported |
| 163 | * @return this builder |
| 164 | */ |
| 165 | Builder withFeatures(Set<MeterFeaturesFlag> featureFlags); |
| 166 | |
| 167 | /** |
Jordi Ortiz | aa8de49 | 2016-12-01 00:21:36 +0100 | [diff] [blame] | 168 | * Builds the Meter Features based on the specified parameters. |
| 169 | * |
| 170 | * @return the meter features |
| 171 | */ |
| 172 | MeterFeatures build(); |
| 173 | } |
| 174 | } |