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 java.util.LinkedList;
|
| 19 |
|
| 20 | import org.jboss.netty.buffer.ChannelBuffer;
|
| 21 | import org.onosproject.pcepio.exceptions.PcepParseException;
|
| 22 | import org.onosproject.pcepio.types.PcepObjectHeader;
|
| 23 | import org.onosproject.pcepio.types.PcepValueType;
|
| 24 |
|
| 25 | /**
|
| 26 | * Abstraction of an entity providing PCEP TE Object.
|
| 27 | */
|
| 28 | public interface PcepTEObject {
|
| 29 |
|
| 30 | /**
|
| 31 | * Returns TE object header.
|
| 32 | *
|
| 33 | * @return TE object header
|
| 34 | */
|
| 35 | PcepObjectHeader getTEObjHeader();
|
| 36 |
|
| 37 | /**
|
| 38 | * Sets TE Object header.
|
| 39 | *
|
| 40 | * @param obj TE Object header
|
| 41 | */
|
| 42 | void setTEObjHeader(PcepObjectHeader obj);
|
| 43 |
|
| 44 | /**
|
| 45 | * Returns ProtocolId in TE Object.
|
| 46 | *
|
| 47 | * @return ProtocolId in TE Object
|
| 48 | */
|
| 49 | byte getProtocolId();
|
| 50 |
|
| 51 | /**
|
| 52 | * Sets ProtocolId in TE Object.
|
| 53 | *
|
| 54 | * @param yProtId ProtocolId in TE Object
|
| 55 | */
|
| 56 | void setProtocolId(byte yProtId);
|
| 57 |
|
| 58 | /**
|
| 59 | * Returns R flag in TE Object.
|
| 60 | *
|
| 61 | * @return R flag in TE Object
|
| 62 | */
|
| 63 | boolean getRFlag();
|
| 64 |
|
| 65 | /**
|
| 66 | * Sets R flag in TE Object.
|
| 67 | *
|
| 68 | * @param bRFlag R flag in TE Object
|
| 69 | */
|
| 70 | void setRFlag(boolean bRFlag);
|
| 71 |
|
| 72 | /**
|
| 73 | * Returns S flag in TE Object.
|
| 74 | *
|
| 75 | * @return S flag in TE Object
|
| 76 | */
|
| 77 | boolean getSFlag();
|
| 78 |
|
| 79 | /**
|
| 80 | * Sets S flag in TE Object.
|
| 81 | *
|
| 82 | * @param bSFlag S flag in TE Object
|
| 83 | */
|
| 84 | void setSFlag(boolean bSFlag);
|
| 85 |
|
| 86 | /**
|
| 87 | * Returns TE ID in TE Object.
|
| 88 | *
|
| 89 | * @return TE ID in TE Object
|
| 90 | */
|
| 91 | int getTEId();
|
| 92 |
|
| 93 | /**
|
| 94 | * Sets TE ID in TE Object.
|
| 95 | *
|
| 96 | * @param iTEId TE ID in TE Object
|
| 97 | */
|
| 98 | void setTEId(int iTEId);
|
| 99 |
|
| 100 | /**
|
| 101 | * Returns list of Optional Tlvs in TE Object.
|
| 102 | *
|
| 103 | * @return list of Optional Tlvs
|
| 104 | */
|
| 105 | LinkedList<PcepValueType> getOptionalTlv();
|
| 106 |
|
| 107 | /**
|
| 108 | * Sets list of Optional Tlvs in TE Object.
|
| 109 | *
|
| 110 | * @param llOptionalTlv list of Optional Tlvs
|
| 111 | */
|
| 112 | void setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
|
| 113 |
|
| 114 | /**
|
| 115 | * Prints attributes of TE object.
|
| 116 | */
|
| 117 | void print();
|
| 118 |
|
| 119 | /**
|
| 120 | * Writes the TE Object into channel buffer.
|
| 121 | *
|
| 122 | * @param bb channel buffer
|
| 123 | * @return Returns the writerIndex of this buffer
|
| 124 | * @throws PcepParseException when obj header is not written to channel buffer
|
| 125 | */
|
| 126 | public int write(ChannelBuffer bb) throws PcepParseException;
|
| 127 |
|
| 128 | /**
|
| 129 | * Builder interface with get and set functions to build TE object.
|
| 130 | */
|
| 131 | public interface Builder {
|
| 132 |
|
| 133 | /**
|
| 134 | * Builds TE Object.
|
| 135 | *
|
| 136 | * @return TE Object
|
| 137 | */
|
| 138 | PcepTEObject build();
|
| 139 |
|
| 140 | /**
|
| 141 | * Returns TE object header.
|
| 142 | *
|
| 143 | * @return TE object header
|
| 144 | */
|
| 145 | PcepObjectHeader getTEObjHeader();
|
| 146 |
|
| 147 | /**
|
| 148 | * Sets TE object header and returns its builder.
|
| 149 | *
|
| 150 | * @param obj TE object header
|
| 151 | * @return Builder by setting TE object header
|
| 152 | */
|
| 153 | Builder setTEObjHeader(PcepObjectHeader obj);
|
| 154 |
|
| 155 | /**
|
| 156 | * Returns ProtocolId in TE Object.
|
| 157 | *
|
| 158 | * @return ProtocolId in TE Object
|
| 159 | */
|
| 160 | byte getProtocolId();
|
| 161 |
|
| 162 | /**
|
| 163 | * Sets ProtocolId in TE Object and returns its builder.
|
| 164 | *
|
| 165 | * @param yProtId ProtocolId in TE Object
|
| 166 | * @return Builder by setting ProtocolId
|
| 167 | */
|
| 168 | Builder setProtocolId(byte yProtId);
|
| 169 |
|
| 170 | /**
|
| 171 | * Returns R flag in TE Object.
|
| 172 | *
|
| 173 | * @return R flag in TE Object
|
| 174 | */
|
| 175 | boolean getRFlag();
|
| 176 |
|
| 177 | /**
|
| 178 | * Sets R flag in TE Object and returns its builder.
|
| 179 | *
|
| 180 | * @param bRFlag R flag in TE Object
|
| 181 | * @return Builder by setting R flag
|
| 182 | */
|
| 183 | Builder setRFlag(boolean bRFlag);
|
| 184 |
|
| 185 | /**
|
| 186 | * Returns S flag in TE Object.
|
| 187 | *
|
| 188 | * @return S flag in TE Object
|
| 189 | */
|
| 190 | boolean getSFlag();
|
| 191 |
|
| 192 | /**
|
| 193 | * Sets S flag in TE Object and returns its builder.
|
| 194 | *
|
| 195 | * @param bSFlag S flag in TE Object
|
| 196 | * @return Builder by setting S flag
|
| 197 | */
|
| 198 | Builder setSFlag(boolean bSFlag);
|
| 199 |
|
| 200 | /**
|
| 201 | * Returns TE ID in TE Object.
|
| 202 | *
|
| 203 | * @return TE ID in TE Object
|
| 204 | */
|
| 205 | int getTEId();
|
| 206 |
|
| 207 | /**
|
| 208 | * Sets TE ID in TE Object and returns its builder.
|
| 209 | *
|
| 210 | * @param iTEId TE ID in TE Object
|
| 211 | * @return Builder by setting TE ID
|
| 212 | */
|
| 213 | Builder setTEId(int iTEId);
|
| 214 |
|
| 215 | /**
|
| 216 | * Returns list of Optional Tlvs in TE Object.
|
| 217 | *
|
| 218 | * @return list of Optional Tlvs
|
| 219 | */
|
| 220 | LinkedList<PcepValueType> getOptionalTlv();
|
| 221 |
|
| 222 | /**
|
| 223 | * Sets list of Optional Tlvs in TE Object and returns its builder.
|
| 224 | *
|
| 225 | * @param llOptionalTlv list of Optional Tlvs
|
| 226 | * @return Builder by setting list of Optional Tlvs
|
| 227 | */
|
| 228 | Builder setOptionalTlv(LinkedList<PcepValueType> llOptionalTlv);
|
| 229 |
|
| 230 | /**
|
| 231 | * Sets P flag in TE object header and returns its builder.
|
| 232 | *
|
| 233 | * @param value boolean value to set P flag
|
| 234 | * @return Builder by setting P flag
|
| 235 | */
|
| 236 | Builder setPFlag(boolean value);
|
| 237 |
|
| 238 | /**
|
| 239 | * Sets I flag in TE object header and returns its builder.
|
| 240 | *
|
| 241 | * @param value boolean value to set I flag
|
| 242 | * @return Builder by setting I flag
|
| 243 | */
|
| 244 | Builder setIFlag(boolean value);
|
| 245 | }
|
| 246 | } |