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