Frank Wang | e11a98d | 2016-10-26 17:04:03 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2017-present Open Networking Foundation |
Frank Wang | e11a98d | 2016-10-26 17:04:03 +0800 | [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.behaviour; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
| 19 | import org.onlab.util.Bandwidth; |
| 20 | import org.onosproject.net.Annotated; |
| 21 | import org.onosproject.net.Description; |
| 22 | |
| 23 | import java.util.Map; |
| 24 | import java.util.Optional; |
| 25 | |
| 26 | /** |
| 27 | * Default implementation of immutable Qos description. |
| 28 | */ |
| 29 | @Beta |
| 30 | public interface QosDescription extends Description, Annotated { |
| 31 | |
| 32 | /** |
| 33 | * Denotes the type of the Qos. |
| 34 | */ |
| 35 | enum Type { |
| 36 | /** |
| 37 | * Corresponds to Hierarchy token bucket classifier. |
| 38 | */ |
| 39 | HTB, |
| 40 | |
| 41 | /** |
| 42 | * Corresponds to Hierarchical Fair Service Curve classifier. |
| 43 | */ |
| 44 | HFSC, |
| 45 | |
| 46 | /** |
| 47 | * Corresponds to Stochastic Fairness Queueing classifier. |
| 48 | */ |
| 49 | SFQ, |
| 50 | |
| 51 | /** |
| 52 | * Corresponds to Controlled Delay classifier classifier. |
| 53 | */ |
| 54 | CODEL, |
| 55 | |
| 56 | /** |
| 57 | * Corresponds to Fair Queuing with Controlled Delay classifier. |
| 58 | */ |
| 59 | FQ_CODEL, |
| 60 | |
| 61 | /** |
| 62 | * No operation. |
| 63 | */ |
| 64 | NOOP, |
| 65 | |
| 66 | /** |
| 67 | * DPDK egress policer. |
| 68 | */ |
| 69 | EGRESS_POLICER |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Returns qos identifier. |
| 74 | * |
| 75 | * @return qos identifier |
| 76 | */ |
| 77 | QosId qosId(); |
| 78 | |
| 79 | /** |
| 80 | * Returns qos type. |
| 81 | * |
| 82 | * @return qos type |
| 83 | */ |
| 84 | Type type(); |
| 85 | |
| 86 | /** |
| 87 | * Returns the max rate of qos, Valid only in specific qos type. |
| 88 | * |
| 89 | * @return Maximum rate shared by all queued traffic, in bit/s. |
| 90 | */ |
| 91 | Optional<Bandwidth> maxRate(); |
| 92 | |
| 93 | /** |
| 94 | * Returns Committed Information Rate of Qos, Valid only in specific qos type. |
| 95 | * the CIR is measured in bytes of IP packets per second. |
| 96 | * |
| 97 | * @return cir |
| 98 | */ |
| 99 | Optional<Long> cir(); |
| 100 | |
| 101 | /** |
| 102 | * Returns Committed Burst Size of Qos, Valid only in specific qos type. |
| 103 | * the CBS is measured in bytes and represents a token bucket. |
| 104 | * |
| 105 | * @return cbs |
| 106 | */ |
| 107 | Optional<Long> cbs(); |
| 108 | |
| 109 | /** |
| 110 | * Returns map of integer-Queue pairs, Valid only in specific qos type. |
| 111 | * |
| 112 | * @return queues |
| 113 | */ |
| 114 | Optional<Map<Long, QueueDescription>> queues(); |
| 115 | |
| 116 | /** |
| 117 | * Builder of qos description entities. |
| 118 | */ |
| 119 | interface Builder { |
| 120 | /** |
| 121 | * Returns qos description builder with a given name. |
| 122 | * |
| 123 | * @param qosId qos identifier |
| 124 | * @return bridge description builder |
| 125 | */ |
| 126 | Builder qosId(QosId qosId); |
| 127 | |
| 128 | /** |
| 129 | * Returns qos description builder with a given type. |
| 130 | * |
| 131 | * @param type qos type |
| 132 | * @return bridge description builder |
| 133 | */ |
| 134 | Builder type(Type type); |
| 135 | |
| 136 | /** |
| 137 | * Returns qos description builder with given maxRate. |
| 138 | * |
| 139 | * @param maxRate qos max rate |
| 140 | * @return qos description builder |
| 141 | */ |
| 142 | Builder maxRate(Bandwidth maxRate); |
| 143 | |
| 144 | /** |
| 145 | * Returns qos description builder with a given cir. |
| 146 | * @param cir in bytes of IP packets per second |
| 147 | * @return qos description builder |
| 148 | */ |
| 149 | Builder cir(Long cir); |
| 150 | |
| 151 | /** |
| 152 | * Returns qos description builder with a given cbs. |
| 153 | * |
| 154 | * @param cbs in bytes and represents a token bucket |
| 155 | * @return qos description builder |
| 156 | */ |
| 157 | Builder cbs(Long cbs); |
| 158 | |
| 159 | /** |
| 160 | * Returns qos description builder with a given queues. |
| 161 | * |
| 162 | * @param queues the map from queue numbers to Queue records |
| 163 | * @return qos description builder |
| 164 | */ |
| 165 | Builder queues(Map<Long, QueueDescription> queues); |
| 166 | |
| 167 | /** |
| 168 | * Builds an immutable qos description. |
| 169 | * |
| 170 | * @return qos description |
| 171 | */ |
| 172 | QosDescription build(); |
| 173 | } |
| 174 | } |