blob: b8d2695a77baeddfdb0aed94f98c60fcd1ea9f81 [file] [log] [blame]
Sho SHIMIZU74361c12015-08-11 12:31:48 -07001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Sho SHIMIZU74361c12015-08-11 12:31:48 -07003 *
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 */
16package org.onosproject.pcepio.protocol;
17
18import org.jboss.netty.buffer.ChannelBuffer;
19import org.onosproject.pcepio.exceptions.PcepParseException;
20import org.onosproject.pcepio.types.PcepObjectHeader;
21
22/**
23 * Abstraction of an entity providing PCEP Bandwidth Object.
24 */
25public interface PcepBandwidthObject {
26
27 /**
28 * Returns bandwidth value.
29 *
30 * @return bandwidth value
31 */
Priyanka B413fbe82016-05-26 11:44:45 +053032 float getBandwidth();
Sho SHIMIZU74361c12015-08-11 12:31:48 -070033
34 /**
35 * Sets bandwidth with specified value.
36 *
37 * @param iBandwidth Bandwidth's value
38 */
Priyanka B413fbe82016-05-26 11:44:45 +053039 void setBandwidth(float iBandwidth);
Sho SHIMIZU74361c12015-08-11 12:31:48 -070040
41 /**
Sho SHIMIZU74361c12015-08-11 12:31:48 -070042 * Writes the BandwidthObject into channel buffer.
43 *
44 * @param bb channel buffer
45 * @return Returns the writerIndex of this buffer
46 * @throws PcepParseException if bandwidth object header fails to write in channel buffer
47 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -070048 int write(ChannelBuffer bb) throws PcepParseException;
Sho SHIMIZU74361c12015-08-11 12:31:48 -070049
50 /**
51 * Builder interface with get and set functions to build bandwidth object.
52 */
Sho SHIMIZU260f6ef2015-08-11 13:53:31 -070053 interface Builder {
Sho SHIMIZU74361c12015-08-11 12:31:48 -070054
55 /**
56 * Builds BandwidthObject.
57 *
58 * @return BandwidthObject
59 * @throws PcepParseException if build fails while creating PcepBandwidthObject
60 */
61 PcepBandwidthObject build() throws PcepParseException;
62
63 /**
64 * Returns bandwidth object header.
65 *
66 * @return bandwidth object header
67 */
68 PcepObjectHeader getBandwidthObjHeader();
69
70 /**
71 * Sets bandwidth object header and returns its builder.
72 *
73 * @param obj Bandwidth object header
74 * @return Builder by setting Bandwidth object header
75 */
76 Builder setBandwidthObjHeader(PcepObjectHeader obj);
77
78 /**
79 * Returns bandwidth value.
80 *
81 * @return bandwidth
82 */
83 int getBandwidth();
84
85 /**
86 * Sets bandwidth value and return its builder.
87 *
88 * @param iBandwidth bandwidth value
89 * @return Builder by setting bandwidth
90 */
91 Builder setBandwidth(int iBandwidth);
92
93 /**
94 * Sets P flag in Bandwidth object header and returns its builder.
95 *
96 * @param value boolean value to set P flag
97 * @return Builder by setting P flag
98 */
99 Builder setPFlag(boolean value);
100
101 /**
102 * Sets I flag in Bandwidth object header and returns its builder.
103 *
104 * @param value boolean value to set I flag
105 * @return Builder by setting I flag
106 */
107 Builder setIFlag(boolean value);
108 }
109}