Phaneendra Manda | 1c0061d | 2015-08-06 12:29:38 +0530 | [diff] [blame] | 1 | /*
|
| 2 | * Copyright 2015 Open Networking Laboratory
|
| 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 | /**
|
| 98 | * Prints attributes of Metric object.
|
| 99 | */
|
| 100 | void print();
|
| 101 |
|
| 102 | /**
|
| 103 | * Writes the Metric Object into channel buffer.
|
| 104 | *
|
| 105 | * @param bb channel buffer
|
| 106 | * @return Returns the writerIndex of this buffer
|
| 107 | * @throws PcepParseException while writing METRIC object into Channel Buffer.
|
| 108 | */
|
| 109 | int write(ChannelBuffer bb) throws PcepParseException;
|
| 110 |
|
| 111 | /**
|
| 112 | * Builder interface with get and set functions to build Metric object.
|
| 113 | */
|
| 114 | public interface Builder {
|
| 115 |
|
| 116 | /**
|
| 117 | * Builds Metric Object.
|
| 118 | *
|
| 119 | * @return Metric Object
|
| 120 | * @throws PcepParseException when mandatory object is not set
|
| 121 | */
|
| 122 | PcepMetricObject build() throws PcepParseException;
|
| 123 |
|
| 124 | /**
|
| 125 | * Returns Metric object header.
|
| 126 | *
|
| 127 | * @return Metric object header
|
| 128 | */
|
| 129 | PcepObjectHeader getMetricObjHeader();
|
| 130 |
|
| 131 | /**
|
| 132 | * Sets Metric object header and returns its builder.
|
| 133 | *
|
| 134 | * @param obj Metric object header
|
| 135 | * @return Builder by setting Metric object header
|
| 136 | */
|
| 137 | Builder setMetricObjHeader(PcepObjectHeader obj);
|
| 138 |
|
| 139 | /**
|
| 140 | * Returns Metric value in Metric Object.
|
| 141 | *
|
| 142 | * @return Metric value
|
| 143 | */
|
| 144 | int getMetricVal();
|
| 145 |
|
| 146 | /**
|
| 147 | * Sets Metric Value in Metric Object and returns its builder.
|
| 148 | *
|
| 149 | * @param value Metric Value
|
| 150 | * @return Builder by setting Metric Value
|
| 151 | */
|
| 152 | Builder setMetricVal(int value);
|
| 153 |
|
| 154 | /**
|
| 155 | * Returns Flags in Metric Object.
|
| 156 | *
|
| 157 | * @return Flags in Metric Object
|
| 158 | */
|
| 159 | byte getYFlag();
|
| 160 |
|
| 161 | /**
|
| 162 | * Sets Flags in Metric Object and returns its builder.
|
| 163 | *
|
| 164 | * @param value Flags
|
| 165 | * @return Builder by setting Flags
|
| 166 | */
|
| 167 | Builder setYFlag(byte value);
|
| 168 |
|
| 169 | /**
|
| 170 | * Returns C flag in Metric Object.
|
| 171 | *
|
| 172 | * @return C flag in Metric Object
|
| 173 | */
|
| 174 | boolean getCFlag();
|
| 175 |
|
| 176 | /**
|
| 177 | * Sets C flag in Metric Object and returns its builder.
|
| 178 | *
|
| 179 | * @param value C flag
|
| 180 | * @return Builder by setting C flag
|
| 181 | */
|
| 182 | Builder setCFlag(boolean value);
|
| 183 |
|
| 184 | /**
|
| 185 | * Returns B flag in Metric Object.
|
| 186 | *
|
| 187 | * @return B flag in Metric Object
|
| 188 | */
|
| 189 | boolean getBFlag();
|
| 190 |
|
| 191 | /**
|
| 192 | * Sets B flag in Metric Object and returns its builder.
|
| 193 | *
|
| 194 | * @param value B flag
|
| 195 | * @return Builder by setting B flag
|
| 196 | */
|
| 197 | Builder setBFlag(boolean value);
|
| 198 |
|
| 199 | /**
|
| 200 | * Returns BType field in Metric Object.
|
| 201 | *
|
| 202 | * @return BType field in Metric Object
|
| 203 | */
|
| 204 | byte getBType();
|
| 205 |
|
| 206 | /**
|
| 207 | * Sets B Type field in Metric Object and returns its builder.
|
| 208 | *
|
| 209 | * @param value B Type field
|
| 210 | * @return Builder by setting B Type field
|
| 211 | */
|
| 212 | Builder setBType(byte value);
|
| 213 |
|
| 214 | /**
|
| 215 | * Sets P flag in Metric object header and returns its builder.
|
| 216 | *
|
| 217 | * @param value boolean value to set P flag
|
| 218 | * @return Builder by setting P flag
|
| 219 | */
|
| 220 | Builder setPFlag(boolean value);
|
| 221 |
|
| 222 | /**
|
| 223 | * Sets I flag in Metric object header and returns its builder.
|
| 224 | *
|
| 225 | * @param value boolean value to set I flag
|
| 226 | * @return Builder by setting I flag
|
| 227 | */
|
| 228 | Builder setIFlag(boolean value);
|
| 229 | }
|
| 230 | }
|