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 Bandwidth Object.
|
| 24 | */
|
| 25 | public interface PcepBandwidthObject {
|
| 26 |
|
| 27 | /**
|
| 28 | * Returns bandwidth value.
|
| 29 | *
|
| 30 | * @return bandwidth value
|
| 31 | */
|
| 32 | int getBandwidth();
|
| 33 |
|
| 34 | /**
|
| 35 | * Sets bandwidth with specified value.
|
| 36 | *
|
| 37 | * @param iBandwidth Bandwidth's value
|
| 38 | */
|
| 39 | void setBandwidth(int iBandwidth);
|
| 40 |
|
| 41 | /**
|
| 42 | * Prints attributes of bandwidth object.
|
| 43 | */
|
| 44 | void print();
|
| 45 |
|
| 46 | /**
|
| 47 | * Writes the BandwidthObject into channel buffer.
|
| 48 | *
|
| 49 | * @param bb channel buffer
|
| 50 | * @return Returns the writerIndex of this buffer
|
| 51 | * @throws PcepParseException if bandwidth object header fails to write in channel buffer
|
| 52 | */
|
| 53 | public int write(ChannelBuffer bb) throws PcepParseException;
|
| 54 |
|
| 55 | /**
|
| 56 | * Builder interface with get and set functions to build bandwidth object.
|
| 57 | */
|
| 58 | public interface Builder {
|
| 59 |
|
| 60 | /**
|
| 61 | * Builds BandwidthObject.
|
| 62 | *
|
| 63 | * @return BandwidthObject
|
| 64 | * @throws PcepParseException if build fails while creating PcepBandwidthObject
|
| 65 | */
|
| 66 | PcepBandwidthObject build() throws PcepParseException;
|
| 67 |
|
| 68 | /**
|
| 69 | * Returns bandwidth object header.
|
| 70 | *
|
| 71 | * @return bandwidth object header
|
| 72 | */
|
| 73 | PcepObjectHeader getBandwidthObjHeader();
|
| 74 |
|
| 75 | /**
|
| 76 | * Sets bandwidth object header and returns its builder.
|
| 77 | *
|
| 78 | * @param obj Bandwidth object header
|
| 79 | * @return Builder by setting Bandwidth object header
|
| 80 | */
|
| 81 | Builder setBandwidthObjHeader(PcepObjectHeader obj);
|
| 82 |
|
| 83 | /**
|
| 84 | * Returns bandwidth value.
|
| 85 | *
|
| 86 | * @return bandwidth
|
| 87 | */
|
| 88 | int getBandwidth();
|
| 89 |
|
| 90 | /**
|
| 91 | * Sets bandwidth value and return its builder.
|
| 92 | *
|
| 93 | * @param iBandwidth bandwidth value
|
| 94 | * @return Builder by setting bandwidth
|
| 95 | */
|
| 96 | Builder setBandwidth(int iBandwidth);
|
| 97 |
|
| 98 | /**
|
| 99 | * Sets P flag in Bandwidth object header and returns its builder.
|
| 100 | *
|
| 101 | * @param value boolean value to set P flag
|
| 102 | * @return Builder by setting P flag
|
| 103 | */
|
| 104 | Builder setPFlag(boolean value);
|
| 105 |
|
| 106 | /**
|
| 107 | * Sets I flag in Bandwidth object header and returns its builder.
|
| 108 | *
|
| 109 | * @param value boolean value to set I flag
|
| 110 | * @return Builder by setting I flag
|
| 111 | */
|
| 112 | Builder setIFlag(boolean value);
|
| 113 | }
|
| 114 | }
|