Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [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.pcepio.protocol; |
| 17 | |
| 18 | import org.jboss.netty.buffer.ChannelBuffer; |
| 19 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| 20 | import org.onosproject.pcepio.types.PcepObjectHeader; |
| 21 | |
| 22 | /** |
| 23 | * Abstraction of an entity providing PCEP Metric Object. |
| 24 | */ |
| 25 | public interface PcepMetricObject { |
| 26 | |
| 27 | /** |
| 28 | * Returns Metric value in Metric Object. |
| 29 | * |
| 30 | * @return Metric value |
| 31 | */ |
| 32 | int getMetricVal(); |
| 33 | |
| 34 | /** |
| 35 | * Sets Metric value in Metric Object with specified value. |
| 36 | * |
| 37 | * @param value Metric value |
| 38 | */ |
| 39 | void setMetricVal(int value); |
| 40 | |
| 41 | /** |
| 42 | * Returns Y flag in Metric Object. |
| 43 | * |
| 44 | * @return Y flag in Metric Object |
| 45 | */ |
| 46 | byte getYFlag(); |
| 47 | |
| 48 | /** |
| 49 | * Sets Y flag in Metric Object with specified value. |
| 50 | * |
| 51 | * @param value Y flag |
| 52 | */ |
| 53 | void setYFlag(byte value); |
| 54 | |
| 55 | /** |
| 56 | * Returns C flag in Metric Object. |
| 57 | * |
| 58 | * @return C flag in Metric Object |
| 59 | */ |
| 60 | boolean getCFlag(); |
| 61 | |
| 62 | /** |
| 63 | * Sets C flag in Metric Object with specified value. |
| 64 | * |
| 65 | * @param value C flag |
| 66 | */ |
| 67 | void setCFlag(boolean value); |
| 68 | |
| 69 | /** |
| 70 | * Returns B flag in Metric Object. |
| 71 | * |
| 72 | * @return B flag in Metric Object |
| 73 | */ |
| 74 | boolean getBFlag(); |
| 75 | |
| 76 | /** |
| 77 | * Sets B flag in Metric Object with specified value. |
| 78 | * |
| 79 | * @param value B flag |
| 80 | */ |
| 81 | void setBFlag(boolean value); |
| 82 | |
| 83 | /** |
| 84 | * Returns BType field in Metric Object. |
| 85 | * |
| 86 | * @return BType field in Metric Object |
| 87 | */ |
| 88 | byte getBType(); |
| 89 | |
| 90 | /** |
| 91 | * Sets BType field in Metric Object with specified value. |
| 92 | * |
| 93 | * @param value BType field |
| 94 | */ |
| 95 | void setBType(byte value); |
| 96 | |
| 97 | /** |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 98 | * Writes the Metric Object into channel buffer. |
| 99 | * |
| 100 | * @param bb channel buffer |
| 101 | * @return Returns the writerIndex of this buffer |
| 102 | * @throws PcepParseException while writing METRIC object into Channel Buffer. |
| 103 | */ |
| 104 | int write(ChannelBuffer bb) throws PcepParseException; |
| 105 | |
| 106 | /** |
| 107 | * Builder interface with get and set functions to build Metric object. |
| 108 | */ |
Sho SHIMIZU | 260f6ef | 2015-08-11 13:53:31 -0700 | [diff] [blame] | 109 | interface Builder { |
Sho SHIMIZU | 74361c1 | 2015-08-11 12:31:48 -0700 | [diff] [blame] | 110 | |
| 111 | /** |
| 112 | * Builds Metric Object. |
| 113 | * |
| 114 | * @return Metric Object |
| 115 | * @throws PcepParseException when mandatory object is not set |
| 116 | */ |
| 117 | PcepMetricObject build() throws PcepParseException; |
| 118 | |
| 119 | /** |
| 120 | * Returns Metric object header. |
| 121 | * |
| 122 | * @return Metric object header |
| 123 | */ |
| 124 | PcepObjectHeader getMetricObjHeader(); |
| 125 | |
| 126 | /** |
| 127 | * Sets Metric object header and returns its builder. |
| 128 | * |
| 129 | * @param obj Metric object header |
| 130 | * @return Builder by setting Metric object header |
| 131 | */ |
| 132 | Builder setMetricObjHeader(PcepObjectHeader obj); |
| 133 | |
| 134 | /** |
| 135 | * Returns Metric value in Metric Object. |
| 136 | * |
| 137 | * @return Metric value |
| 138 | */ |
| 139 | int getMetricVal(); |
| 140 | |
| 141 | /** |
| 142 | * Sets Metric Value in Metric Object and returns its builder. |
| 143 | * |
| 144 | * @param value Metric Value |
| 145 | * @return Builder by setting Metric Value |
| 146 | */ |
| 147 | Builder setMetricVal(int value); |
| 148 | |
| 149 | /** |
| 150 | * Returns Flags in Metric Object. |
| 151 | * |
| 152 | * @return Flags in Metric Object |
| 153 | */ |
| 154 | byte getYFlag(); |
| 155 | |
| 156 | /** |
| 157 | * Sets Flags in Metric Object and returns its builder. |
| 158 | * |
| 159 | * @param value Flags |
| 160 | * @return Builder by setting Flags |
| 161 | */ |
| 162 | Builder setYFlag(byte value); |
| 163 | |
| 164 | /** |
| 165 | * Returns C flag in Metric Object. |
| 166 | * |
| 167 | * @return C flag in Metric Object |
| 168 | */ |
| 169 | boolean getCFlag(); |
| 170 | |
| 171 | /** |
| 172 | * Sets C flag in Metric Object and returns its builder. |
| 173 | * |
| 174 | * @param value C flag |
| 175 | * @return Builder by setting C flag |
| 176 | */ |
| 177 | Builder setCFlag(boolean value); |
| 178 | |
| 179 | /** |
| 180 | * Returns B flag in Metric Object. |
| 181 | * |
| 182 | * @return B flag in Metric Object |
| 183 | */ |
| 184 | boolean getBFlag(); |
| 185 | |
| 186 | /** |
| 187 | * Sets B flag in Metric Object and returns its builder. |
| 188 | * |
| 189 | * @param value B flag |
| 190 | * @return Builder by setting B flag |
| 191 | */ |
| 192 | Builder setBFlag(boolean value); |
| 193 | |
| 194 | /** |
| 195 | * Returns BType field in Metric Object. |
| 196 | * |
| 197 | * @return BType field in Metric Object |
| 198 | */ |
| 199 | byte getBType(); |
| 200 | |
| 201 | /** |
| 202 | * Sets B Type field in Metric Object and returns its builder. |
| 203 | * |
| 204 | * @param value B Type field |
| 205 | * @return Builder by setting B Type field |
| 206 | */ |
| 207 | Builder setBType(byte value); |
| 208 | |
| 209 | /** |
| 210 | * Sets P flag in Metric object header and returns its builder. |
| 211 | * |
| 212 | * @param value boolean value to set P flag |
| 213 | * @return Builder by setting P flag |
| 214 | */ |
| 215 | Builder setPFlag(boolean value); |
| 216 | |
| 217 | /** |
| 218 | * Sets I flag in Metric object header and returns its builder. |
| 219 | * |
| 220 | * @param value boolean value to set I flag |
| 221 | * @return Builder by setting I flag |
| 222 | */ |
| 223 | Builder setIFlag(boolean value); |
| 224 | } |
| 225 | } |