blob: 9341f326e780bf9efd741369aa0b70c218b40461 [file] [log] [blame]
Sho SHIMIZUaf1dffc2015-09-04 15:56:07 -07001/*
2 * Copyright 2014-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 */
Sho SHIMIZU3559c312015-11-04 14:59:31 -080016package org.onosproject.pcepio.protocol;
Sho SHIMIZUaf1dffc2015-09-04 15:56:07 -070017
18import org.jboss.netty.buffer.ChannelBuffer;
19import org.jboss.netty.buffer.ChannelBuffers;
20import org.junit.Test;
21import org.onosproject.pcepio.exceptions.PcepParseException;
Sho SHIMIZU3559c312015-11-04 14:59:31 -080022
Sho SHIMIZUaf1dffc2015-09-04 15:56:07 -070023import static org.hamcrest.MatcherAssert.assertThat;
Sho SHIMIZUaf1dffc2015-09-04 15:56:07 -070024import static org.hamcrest.Matchers.instanceOf;
Sho SHIMIZU3559c312015-11-04 14:59:31 -080025import static org.hamcrest.core.Is.is;
Sho SHIMIZUaf1dffc2015-09-04 15:56:07 -070026
27public class PcepInitiateMsgExtTest {
28
29 /**
30 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
31 * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv),
32 * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST objects in PcInitiate message.
33 */
34 @Test
35 public void initiateMessageTest1() throws PcepParseException {
36
37 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
38 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC-LIST.
39 */
40 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA4,
41 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
42 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
43 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03,
44 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
45 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
46 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
47 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
48 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
50 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
51 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
52 0x07, 0x10, 0x00, 0x14, //ERO object
53 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
54 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
55 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
57 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
58 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01, //Metric object
59 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
60
61 byte[] testInitiateCreationMsg = {0};
62 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
63 buffer.writeBytes(initiateCreationMsg);
64
65 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
66 PcepMessage message = null;
67
68 message = reader.readFrom(buffer);
69
70 assertThat(message, instanceOf(PcepInitiateMsg.class));
71 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
72
73 message.writeTo(buf);
74
75 testInitiateCreationMsg = buf.array();
76
77 int iReadLen = buf.writerIndex();
78 testInitiateCreationMsg = new byte[iReadLen];
79 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
80
81 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
82 }
83
84 /**
85 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
86 * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv,
87 * StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT
88 * objects in PcInitiate message.
89 */
90 @Test
91 public void initiateMessageTest2() throws PcepParseException {
92
93 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
94 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
95 */
96 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8,
97 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
98 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
99 0x20, 0x10, 0x00, 0x48, 0x00, 0x00, 0x10, 0x03, //LSP object
100 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
101 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
102 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
103 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
104 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
105 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
106 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
107 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv
108 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05,
109 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
110 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
111 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
112 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
113 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
114 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
115 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
116
117 byte[] testInitiateCreationMsg = {0};
118 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
119 buffer.writeBytes(initiateCreationMsg);
120
121 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
122 PcepMessage message = null;
123
124 message = reader.readFrom(buffer);
125
126 assertThat(message, instanceOf(PcepInitiateMsg.class));
127 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
128
129 message.writeTo(buf);
130
131 testInitiateCreationMsg = buf.array();
132
133 int iReadLen = buf.writerIndex();
134 testInitiateCreationMsg = new byte[iReadLen];
135 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
136
137 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
138 }
139
140 /**
141 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
142 * StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS,
143 * ERO, LSPA, BANDWIDTH objects in PcInitiate message.
144 */
145 @Test
146 public void initiateMessageTest3() throws PcepParseException {
147
148 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
149 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA, BANDWIDTH.
150 */
151 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c,
152 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
153 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
154 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
155 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
156 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
157 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
158 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
159 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
160 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
161 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
162 // 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv
163 //0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05,
164 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
165 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
166 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
167 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
168 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
169 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00};
170
171 byte[] testInitiateCreationMsg = {0};
172 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
173 buffer.writeBytes(initiateCreationMsg);
174
175 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
176 PcepMessage message = null;
177
178 message = reader.readFrom(buffer);
179
180 assertThat(message, instanceOf(PcepInitiateMsg.class));
181 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
182
183 message.writeTo(buf);
184
185 testInitiateCreationMsg = buf.array();
186
187 int iReadLen = buf.writerIndex();
188 testInitiateCreationMsg = new byte[iReadLen];
189 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
190
191 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
192 }
193
194 /**
195 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
196 * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv),
197 * END-POINTS, ERO, LSPA objects in PcInitiate message.
198 */
199 @Test
200 public void initiateMessageTest4() throws PcepParseException {
201
202 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
203 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO, LSPA.
204 */
205 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
206 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
207 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
208 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
209 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
210 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
211 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
212 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
213 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
215 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
216 // 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv
217 // 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05,
218 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
219 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
220 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
221 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
222 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
223
224 byte[] testInitiateCreationMsg = {0};
225 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
226 buffer.writeBytes(initiateCreationMsg);
227
228 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
229 PcepMessage message = null;
230
231 message = reader.readFrom(buffer);
232
233 assertThat(message, instanceOf(PcepInitiateMsg.class));
234 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
235
236 message.writeTo(buf);
237
238 testInitiateCreationMsg = buf.array();
239
240 int iReadLen = buf.writerIndex();
241 testInitiateCreationMsg = new byte[iReadLen];
242 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
243
244 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
245 }
246
247 /**
248 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
249 * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA
250 * objects in PcInitiate message.
251 */
252 @Test
253 public void initiateMessageTest5() throws PcepParseException {
254
255 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
256 * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA.
257 */
258 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
259 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
260 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
261 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
262 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
263 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
264 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
265 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
266 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
267 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
268 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
269 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
270 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
271 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
272 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
273 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
274
275 byte[] testInitiateCreationMsg = {0};
276 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
277 buffer.writeBytes(initiateCreationMsg);
278
279 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
280 PcepMessage message = null;
281
282 message = reader.readFrom(buffer);
283
284 assertThat(message, instanceOf(PcepInitiateMsg.class));
285 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
286
287 message.writeTo(buf);
288
289 testInitiateCreationMsg = buf.array();
290
291 int iReadLen = buf.writerIndex();
292 testInitiateCreationMsg = new byte[iReadLen];
293 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
294
295 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
296 }
297
298 /**
299 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
300 * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA,
301 * BANDWIDTH OBJECT objects in PcInitiate message.
302 */
303 @Test
304 public void initiateMessageTest6() throws PcepParseException {
305
306 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
307 * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
308 */
309 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x8c,
310 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
311 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
312 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
313 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
314 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
315 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
316 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
317 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
318 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
319 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
320 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
321 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
322 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
323 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
324 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
325 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00};
326
327 byte[] testInitiateCreationMsg = {0};
328 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
329 buffer.writeBytes(initiateCreationMsg);
330
331 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
332 PcepMessage message = null;
333
334 message = reader.readFrom(buffer);
335
336 assertThat(message, instanceOf(PcepInitiateMsg.class));
337 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
338
339 message.writeTo(buf);
340
341 testInitiateCreationMsg = buf.array();
342
343 int iReadLen = buf.writerIndex();
344 testInitiateCreationMsg = new byte[iReadLen];
345 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
346
347 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
348 }
349
350 /**
351 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
352 * SymbolicPathNameTlv, StatefulLspDbVerTlv, StatefulLspErrorCodeTlv), END-POINTS, ERO,
353 * LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
354 */
355 @Test
356 public void initiateMessageTest7() throws PcepParseException {
357
358 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv,
359 * StatefulLspErrorCodeTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
360 */
361 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x98,
362 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
363 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
364 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
365 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
366 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
367 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
368 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
369 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
370 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
371 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
372 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
373 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
374 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
375 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
376 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
377 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
378 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
379
380 byte[] testInitiateCreationMsg = {0};
381 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
382 buffer.writeBytes(initiateCreationMsg);
383
384 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
385 PcepMessage message = null;
386
387 message = reader.readFrom(buffer);
388
389 assertThat(message, instanceOf(PcepInitiateMsg.class));
390 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
391
392 message.writeTo(buf);
393
394 testInitiateCreationMsg = buf.array();
395
396 int iReadLen = buf.writerIndex();
397 testInitiateCreationMsg = new byte[iReadLen];
398 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
399
400 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
401 }
402
403 /**
404 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
405 * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT
406 * objects in PcInitiate message.
407 */
408 @Test
409 public void initiateMessageTest8() throws PcepParseException {
410
411 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
412 * END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
413 */
414 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x90,
415 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
416 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
417 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object
418 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
419 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
420 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
421 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
422 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
423 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
424 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
425 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
426 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
427 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
428 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
429 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
430 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
431
432 byte[] testInitiateCreationMsg = {0};
433 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
434 buffer.writeBytes(initiateCreationMsg);
435
436 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
437 PcepMessage message = null;
438
439 message = reader.readFrom(buffer);
440
441 assertThat(message, instanceOf(PcepInitiateMsg.class));
442 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
443
444 message.writeTo(buf);
445
446 testInitiateCreationMsg = buf.array();
447
448 int iReadLen = buf.writerIndex();
449 testInitiateCreationMsg = new byte[iReadLen];
450 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
451
452 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
453 }
454
455 /**
456 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
457 * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT
458 * objects in PcInitiate message.
459 */
460 @Test
461 public void initiateMessageTest9() throws PcepParseException {
462
463 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
464 * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
465 */
466 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
467 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
468 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
469 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03, //LSP object
470 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
471 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
472 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
473 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
474 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
475 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
476 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
477 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
478 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
479 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
480 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
481 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
482
483 byte[] testInitiateCreationMsg = {0};
484 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
485 buffer.writeBytes(initiateCreationMsg);
486
487 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
488 PcepMessage message = null;
489
490 message = reader.readFrom(buffer);
491
492 assertThat(message, instanceOf(PcepInitiateMsg.class));
493 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
494
495 message.writeTo(buf);
496
497 testInitiateCreationMsg = buf.array();
498
499 int iReadLen = buf.writerIndex();
500 testInitiateCreationMsg = new byte[iReadLen];
501 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
502
503 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
504 }
505
506 /**
507 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
508 * SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
509 */
510 @Test
511 public void initiateMessageTest10() throws PcepParseException {
512
513 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
514 * END-POINTS, ERO, LSPA OBJECT.
515 */
516 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70,
517 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
518 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
519 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
520 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
521 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
522 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
523 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
524 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
525 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
526 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
527 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
528 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
529
530 byte[] testInitiateCreationMsg = {0};
531 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
532 buffer.writeBytes(initiateCreationMsg);
533
534 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
535 PcepMessage message = null;
536
537 message = reader.readFrom(buffer);
538
539 assertThat(message, instanceOf(PcepInitiateMsg.class));
540 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
541
542 message.writeTo(buf);
543
544 testInitiateCreationMsg = buf.array();
545
546 int iReadLen = buf.writerIndex();
547 testInitiateCreationMsg = new byte[iReadLen];
548 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
549
550 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
551 }
552
553 /**
554 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
555 * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA OBJECT
556 * objects in PcInitiate message.
557 */
558 @Test
559 public void initiateMessageTest11() throws PcepParseException {
560
561 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
562 * END-POINTS, ERO, LSPA OBJECT.
563 */
564 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7C,
565 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
566 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
567 0x20, 0x10, 0x00, 0x30, 0x00, 0x00, 0x10, 0x03,
568 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
569 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
570 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
571 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
572 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
573 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
574 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
575 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
576 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
577 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
578 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
579
580 byte[] testInitiateCreationMsg = {0};
581 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
582 buffer.writeBytes(initiateCreationMsg);
583
584 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
585 PcepMessage message = null;
586
587 message = reader.readFrom(buffer);
588
589 assertThat(message, instanceOf(PcepInitiateMsg.class));
590 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
591
592 message.writeTo(buf);
593
594 int iReadLen = buf.writerIndex();
595 testInitiateCreationMsg = new byte[iReadLen];
596 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
597
598 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
599 }
600
601 /**
602 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
603 * SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT
604 * objects in PcInitiate message.
605 */
606 @Test
607 public void initiateMessageTest12() throws PcepParseException {
608
609 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
610 * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
611 */
612 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x78,
613 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
614 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
615 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
616 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
617 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
618 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
619 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
620 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
621 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
622 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
623 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
624 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
625 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
626
627 byte[] testInitiateCreationMsg = {0};
628 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
629 buffer.writeBytes(initiateCreationMsg);
630
631 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
632 PcepMessage message = null;
633
634 message = reader.readFrom(buffer);
635
636 assertThat(message, instanceOf(PcepInitiateMsg.class));
637 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
638
639 message.writeTo(buf);
640
641 testInitiateCreationMsg = buf.array();
642
643 int iReadLen = buf.writerIndex();
644 testInitiateCreationMsg = new byte[iReadLen];
645 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
646
647 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
648 }
649
650 /**
651 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
652 * SymbolicPathNameTlv, StatefulLspDbVerTlv), END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT
653 * objects in PcInitiate message.
654 */
655 @Test
656 public void initiateMessageTest13() throws PcepParseException {
657
658 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, StatefulLspDbVerTlv),
659 * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT.
660 */
661 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x84,
662 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
663 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
664 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
665 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
666 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
667 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
668 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
669 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
670 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
671 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
672 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
673 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
674 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
675 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
676
677 byte[] testInitiateCreationMsg = {0};
678 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
679 buffer.writeBytes(initiateCreationMsg);
680
681 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
682 PcepMessage message = null;
683
684 message = reader.readFrom(buffer);
685
686 assertThat(message, instanceOf(PcepInitiateMsg.class));
687 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
688
689 message.writeTo(buf);
690
691 testInitiateCreationMsg = buf.array();
692
693 int iReadLen = buf.writerIndex();
694 testInitiateCreationMsg = new byte[iReadLen];
695 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
696
697 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
698 }
699
700 /**
701 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
702 * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT objects in PcInitiate message.
703 */
704 @Test
705 public void initiateMessageTest14() throws PcepParseException {
706
707 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
708 * END-POINTS, ERO, LSPA, BANDWIDTH , METRIC OBJECT.
709 */
710 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x7c,
711 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
712 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
713 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
714 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
715 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
716 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
717 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
718 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
719 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
720 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
721 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
722 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
723 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
724
725 byte[] testInitiateCreationMsg = {0};
726 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
727 buffer.writeBytes(initiateCreationMsg);
728
729 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
730 PcepMessage message = null;
731
732 message = reader.readFrom(buffer);
733
734 assertThat(message, instanceOf(PcepInitiateMsg.class));
735 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
736
737 message.writeTo(buf);
738
739 testInitiateCreationMsg = buf.array();
740
741 int iReadLen = buf.writerIndex();
742 testInitiateCreationMsg = new byte[iReadLen];
743 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
744
745 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
746 }
747
748 /**
749 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
750 * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message.
751 */
752 @Test
753 public void initiateMessageTest15() throws PcepParseException {
754
755 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
756 * END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
757 */
758 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x70,
759 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
760 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
761 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
762 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
763 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
764 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
765 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
766 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
767 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
768 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
769 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
770 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
771
772 byte[] testInitiateCreationMsg = {0};
773 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
774 buffer.writeBytes(initiateCreationMsg);
775
776 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
777 PcepMessage message = null;
778
779 message = reader.readFrom(buffer);
780
781 assertThat(message, instanceOf(PcepInitiateMsg.class));
782 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
783
784 message.writeTo(buf);
785
786 testInitiateCreationMsg = buf.array();
787
788 int iReadLen = buf.writerIndex();
789 testInitiateCreationMsg = new byte[iReadLen];
790 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
791
792 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
793 }
794
795 /**
796 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
797 * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
798 */
799 @Test
800 public void initiateMessageTest16() throws PcepParseException {
801
802 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
803 * END-POINTS, ERO, LSPA OBJECT.
804 */
805 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68,
806 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
807 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
808 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
809 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
810 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
811 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
812 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
813 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
814 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
815 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
816 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
817
818 byte[] testInitiateCreationMsg = {0};
819 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
820 buffer.writeBytes(initiateCreationMsg);
821
822 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
823 PcepMessage message = null;
824
825 message = reader.readFrom(buffer);
826
827 assertThat(message, instanceOf(PcepInitiateMsg.class));
828 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
829
830 message.writeTo(buf);
831
832 testInitiateCreationMsg = buf.array();
833
834 int iReadLen = buf.writerIndex();
835 testInitiateCreationMsg = new byte[iReadLen];
836 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
837
838 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
839 }
840
841 /**
842 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT
843 * objects in PcInitiate message.
844 */
845 @Test
846 public void initiateMessageTest17() throws PcepParseException {
847
848 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
849 */
850 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
851 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
852 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
853 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
854 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
855 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
856 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
857 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
858 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
859 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
860 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
861
862 byte[] testInitiateCreationMsg = {0};
863 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
864 buffer.writeBytes(initiateCreationMsg);
865
866 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
867 PcepMessage message = null;
868
869 message = reader.readFrom(buffer);
870
871 assertThat(message, instanceOf(PcepInitiateMsg.class));
872 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
873
874 message.writeTo(buf);
875
876 testInitiateCreationMsg = buf.array();
877
878 int iReadLen = buf.writerIndex();
879 testInitiateCreationMsg = new byte[iReadLen];
880 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
881
882 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
883 }
884
885 /**
886 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
887 * BANDWIDTH OBJECT objects in PcInitiate message.
888 */
889 @Test
890 public void initiateMessageTest18() throws PcepParseException {
891
892 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
893 */
894 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x68,
895 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
896 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03,
897 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
898 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
899 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
900 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
901 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
902 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
903 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
904 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
905 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
906
907 byte[] testInitiateCreationMsg = {0};
908 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
909 buffer.writeBytes(initiateCreationMsg);
910
911 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
912 PcepMessage message = null;
913
914
915 message = reader.readFrom(buffer);
916
917 assertThat(message, instanceOf(PcepInitiateMsg.class));
918 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
919
920 message.writeTo(buf);
921
922 testInitiateCreationMsg = buf.array();
923
924 int iReadLen = buf.writerIndex();
925 testInitiateCreationMsg = new byte[iReadLen];
926 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
927
928 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
929 }
930
931 /**
932 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
933 * BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
934 */
935 @Test
936 public void initiateMessageTest19() throws PcepParseException {
937
938 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
939 */
940 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74,
941 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
942 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
943 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
944 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
945 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
946 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
947 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
948 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
949 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
950 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
951 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
952 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
953
954 byte[] testInitiateCreationMsg = {0};
955 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
956 buffer.writeBytes(initiateCreationMsg);
957
958 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
959 PcepMessage message = null;
960
961 message = reader.readFrom(buffer);
962
963 assertThat(message, instanceOf(PcepInitiateMsg.class));
964 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
965
966 message.writeTo(buf);
967
968 testInitiateCreationMsg = buf.array();
969
970 int iReadLen = buf.writerIndex();
971 testInitiateCreationMsg = new byte[iReadLen];
972 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
973
974 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
975 }
976
977 /**
978 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
979 * BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
980 */
981 @Test
982 public void initiateMessageTest20() throws PcepParseException {
983
984 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
985 */
986 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
987 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
988 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
989 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
990 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
991 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
992 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
993 0x07, 0x10, 0x00, 0x04, //ERO object
994 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
995 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
996 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
997 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01};
998
999 byte[] testInitiateCreationMsg = {0};
1000 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1001 buffer.writeBytes(initiateCreationMsg);
1002
1003 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1004 PcepMessage message = null;
1005
1006 message = reader.readFrom(buffer);
1007
1008 assertThat(message, instanceOf(PcepInitiateMsg.class));
1009 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1010
1011 message.writeTo(buf);
1012
1013 testInitiateCreationMsg = buf.array();
1014
1015 int iReadLen = buf.writerIndex();
1016 testInitiateCreationMsg = new byte[iReadLen];
1017 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1018
1019 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1020 }
1021
1022 /**
1023 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA,
1024 * BANDWIDTH OBJECT objects in PcInitiate message.
1025 */
1026 @Test
1027 public void initiateMessageTest21() throws PcepParseException {
1028
1029 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
1030 */
1031 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
1032 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1033 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1034 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1035 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1036 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1037 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1038 0x07, 0x10, 0x00, 0x04,
1039 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1040 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1041 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
1042
1043 byte[] testInitiateCreationMsg = {0};
1044 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1045 buffer.writeBytes(initiateCreationMsg);
1046
1047 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1048 PcepMessage message = null;
1049
1050 message = reader.readFrom(buffer);
1051
1052 assertThat(message, instanceOf(PcepInitiateMsg.class));
1053 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1054
1055 message.writeTo(buf);
1056
1057 testInitiateCreationMsg = buf.array();
1058
1059 int iReadLen = buf.writerIndex();
1060 testInitiateCreationMsg = new byte[iReadLen];
1061 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1062
1063 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1064 }
1065
1066 /**
1067 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO,
1068 * LSPA OBJECT objects in PcInitiate message.
1069 */
1070 @Test
1071 public void initiateMessageTest22() throws PcepParseException {
1072
1073 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
1074 */
1075 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
1076 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1077 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1078 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1079 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1080 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1081 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1082 0x07, 0x10, 0x00, 0x04, //ERO object
1083 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1084 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1085
1086 byte[] testInitiateCreationMsg = {0};
1087 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1088 buffer.writeBytes(initiateCreationMsg);
1089
1090 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1091 PcepMessage message = null;
1092
1093 message = reader.readFrom(buffer);
1094
1095 assertThat(message, instanceOf(PcepInitiateMsg.class));
1096 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1097
1098 message.writeTo(buf);
1099
1100 testInitiateCreationMsg = buf.array();
1101
1102 int iReadLen = buf.writerIndex();
1103 testInitiateCreationMsg = new byte[iReadLen];
1104 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1105
1106 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1107 }
1108
1109 /**
1110 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
1111 * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
1112 */
1113 @Test
1114 public void initiateMessageTest23() throws PcepParseException {
1115
1116 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA OBJECT.
1117 */
1118 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
1119 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1120 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1121 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1122 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1123 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1124 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1125 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1126 0x07, 0x10, 0x00, 0x04, //ERO object
1127 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1128 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1129
1130 byte[] testInitiateCreationMsg = {0};
1131 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1132 buffer.writeBytes(initiateCreationMsg);
1133
1134 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1135 PcepMessage message = null;
1136
1137 message = reader.readFrom(buffer);
1138
1139 assertThat(message, instanceOf(PcepInitiateMsg.class));
1140 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1141
1142 message.writeTo(buf);
1143
1144 testInitiateCreationMsg = buf.array();
1145
1146 int iReadLen = buf.writerIndex();
1147 testInitiateCreationMsg = new byte[iReadLen];
1148 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1149
1150 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1151 }
1152
1153 /**
1154 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
1155 * END-POINTS, ERO, LSPA BANDWIDTH OBJECT objects in PcInitiate message.
1156 */
1157 @Test
1158 public void initiateMessageTest25() throws PcepParseException {
1159
1160 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS, ERO, LSPA BANDWIDTH OBJECT.
1161 */
1162 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
1163 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1164 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1165 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1166 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1167 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1168 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1169 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1170 0x07, 0x10, 0x00, 0x04, //ERO object
1171 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1172 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1173 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
1174
1175 byte[] testInitiateCreationMsg = {0};
1176 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1177 buffer.writeBytes(initiateCreationMsg);
1178
1179 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1180 PcepMessage message = null;
1181
1182 message = reader.readFrom(buffer);
1183
1184 assertThat(message, instanceOf(PcepInitiateMsg.class));
1185 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1186
1187 message.writeTo(buf);
1188
1189 testInitiateCreationMsg = buf.array();
1190
1191 int iReadLen = buf.writerIndex();
1192 testInitiateCreationMsg = new byte[iReadLen];
1193 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1194
1195 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1196 }
1197
1198 /**
1199 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS,
1200 * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
1201 */
1202 @Test
1203 public void initiateMessageTest26() throws PcepParseException {
1204
1205 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv), END-POINTS,
1206 * ERO, LSPA, BANDWIDTH, METRIC OBJECT.
1207 */
1208 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x6C,
1209 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1210 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1211 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1212 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1213 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1214 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1215 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1216 0x07, 0x10, 0x00, 0x04, //ERO object
1217 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1218 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1219 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1220 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object
1221
1222 byte[] testInitiateCreationMsg = {0};
1223 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1224 buffer.writeBytes(initiateCreationMsg);
1225
1226 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1227 PcepMessage message = null;
1228
1229 message = reader.readFrom(buffer);
1230
1231 assertThat(message, instanceOf(PcepInitiateMsg.class));
1232 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1233
1234 message.writeTo(buf);
1235
1236 testInitiateCreationMsg = buf.array();
1237
1238 int iReadLen = buf.writerIndex();
1239 testInitiateCreationMsg = new byte[iReadLen];
1240 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1241
1242 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1243 }
1244
1245 /**
1246 * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA,
1247 * BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
1248 */
1249 @Test
1250 public void initiateMessageTest27() throws PcepParseException {
1251
1252 /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH, METRIC OBJECT.
1253 */
1254 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
1255 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1256 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1257 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1258 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1259 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1260 0x07, 0x10, 0x00, 0x04, //ERO object
1261 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1262 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1263 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1264 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object
1265
1266 byte[] testInitiateCreationMsg = {0};
1267 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1268 buffer.writeBytes(initiateCreationMsg);
1269
1270 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1271 PcepMessage message = null;
1272
1273 message = reader.readFrom(buffer);
1274
1275 assertThat(message, instanceOf(PcepInitiateMsg.class));
1276 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1277
1278 message.writeTo(buf);
1279
1280 testInitiateCreationMsg = buf.array();
1281
1282 int iReadLen = buf.writerIndex();
1283 testInitiateCreationMsg = new byte[iReadLen];
1284 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1285
1286 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1287 }
1288
1289 /**
1290 * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO,
1291 * LSPA, BANDWIDTH OBJECT objects in PcInitiate message.
1292 */
1293 @Test
1294 public void initiateMessageTest28() throws PcepParseException {
1295
1296 /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA, BANDWIDTH OBJECT.
1297 */
1298 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
1299 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1300 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1301 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1302 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1303 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1304 0x07, 0x10, 0x00, 0x04, //ERO object
1305 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1306 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1307 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
1308
1309 byte[] testInitiateCreationMsg = {0};
1310 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1311 buffer.writeBytes(initiateCreationMsg);
1312
1313 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1314 PcepMessage message = null;
1315
1316 message = reader.readFrom(buffer);
1317
1318 assertThat(message, instanceOf(PcepInitiateMsg.class));
1319 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1320
1321 message.writeTo(buf);
1322
1323 testInitiateCreationMsg = buf.array();
1324
1325 int iReadLen = buf.writerIndex();
1326 testInitiateCreationMsg = new byte[iReadLen];
1327 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1328
1329 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1330 }
1331
1332 /**
1333 * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv),
1334 * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
1335 */
1336 @Test
1337 public void initiateMessageTest29() throws PcepParseException {
1338
1339 /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
1340 */
1341 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4C,
1342 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1343 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1344 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1345 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1346 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1347 0x07, 0x10, 0x00, 0x04, //ERO object
1348 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1349 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1350
1351 byte[] testInitiateCreationMsg = {0};
1352 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1353 buffer.writeBytes(initiateCreationMsg);
1354
1355 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1356 PcepMessage message = null;
1357
1358 message = reader.readFrom(buffer);
1359
1360 assertThat(message, instanceOf(PcepInitiateMsg.class));
1361 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1362
1363 message.writeTo(buf);
1364
1365 testInitiateCreationMsg = buf.array();
1366
1367 int iReadLen = buf.writerIndex();
1368 testInitiateCreationMsg = new byte[iReadLen];
1369 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1370
1371 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1372 }
1373
1374 /**
1375 * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv),
1376 * END-POINTS, ERO, LSPA OBJECT objects in PcInitiate message.
1377 */
1378 @Test
1379 public void initiateMessageTest30() throws PcepParseException {
1380
1381 /* SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
1382 */
1383 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5C,
1384 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1385 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1386 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1387 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1388 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1389 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
1390 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1391 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1392 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1393
1394 byte[] testInitiateCreationMsg = {0};
1395 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1396 buffer.writeBytes(initiateCreationMsg);
1397
1398 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1399 PcepMessage message = null;
1400
1401 message = reader.readFrom(buffer);
1402
1403 assertThat(message, instanceOf(PcepInitiateMsg.class));
1404 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1405
1406 message.writeTo(buf);
1407
1408 testInitiateCreationMsg = buf.array();
1409
1410 int iReadLen = buf.writerIndex();
1411 testInitiateCreationMsg = new byte[iReadLen];
1412 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1413
1414 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1415 }
1416
1417 /**
1418 * This test case checks for SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT
1419 * objects in PcInitiate message.
1420 */
1421 @Test
1422 public void initiateMessageTest31() throws PcepParseException {
1423
1424 /* SRP, LSP (SymbolicPathNameTlv), END-POINTS, ERO, LSPA OBJECT.
1425 */
1426 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
1427 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1428 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1429 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1430 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1431 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
1432 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1433 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1434 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1435
1436 byte[] testInitiateCreationMsg = {0};
1437 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1438 buffer.writeBytes(initiateCreationMsg);
1439
1440 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1441 PcepMessage message = null;
1442
1443 message = reader.readFrom(buffer);
1444
1445 assertThat(message, instanceOf(PcepInitiateMsg.class));
1446 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1447
1448 message.writeTo(buf);
1449
1450 testInitiateCreationMsg = buf.array();
1451
1452 int iReadLen = buf.writerIndex();
1453 testInitiateCreationMsg = new byte[iReadLen];
1454 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1455
1456 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1457 }
1458
1459 /**
1460 * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1461 * ERO, LSPA, BANDWIDTH, METRIC OBJECT objects in PcInitiate message.
1462 */
1463 @Test
1464 public void initiateMessageTest32() throws PcepParseException {
1465
1466 /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1467 * ERO, LSPA, BANDWIDTH, METRIC OBJECT.
1468 */
1469 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
1470 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1471 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1472 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1473 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1474 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1475 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1476 0x07, 0x10, 0x00, 0x04, //ERO object
1477 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1478 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1479 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1480 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01}; //Metric object
1481
1482 byte[] testInitiateCreationMsg = {0};
1483 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1484 buffer.writeBytes(initiateCreationMsg);
1485
1486 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1487 PcepMessage message = null;
1488
1489 message = reader.readFrom(buffer);
1490
1491 assertThat(message, instanceOf(PcepInitiateMsg.class));
1492 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1493
1494 message.writeTo(buf);
1495
1496 testInitiateCreationMsg = buf.array();
1497
1498 int iReadLen = buf.writerIndex();
1499 testInitiateCreationMsg = new byte[iReadLen];
1500 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1501
1502 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1503 }
1504
1505 /**
1506 * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1507 * ERO, LSPA, BANDWIDTH OBJECT objects in PcInitiate message.
1508 */
1509 @Test
1510 public void initiateMessageTest33() throws PcepParseException {
1511
1512 /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1513 * ERO, LSPA, BANDWIDTH OBJECT.
1514 */
1515 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
1516 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1517 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1518 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1519 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1520 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1521 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1522 0x07, 0x10, 0x00, 0x04, //ERO object
1523 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1524 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1525 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
1526
1527 byte[] testInitiateCreationMsg = {0};
1528 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1529 buffer.writeBytes(initiateCreationMsg);
1530
1531 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1532 PcepMessage message = null;
1533
1534 message = reader.readFrom(buffer);
1535
1536 assertThat(message, instanceOf(PcepInitiateMsg.class));
1537 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1538
1539 message.writeTo(buf);
1540
1541 testInitiateCreationMsg = buf.array();
1542
1543 int iReadLen = buf.writerIndex();
1544 testInitiateCreationMsg = new byte[iReadLen];
1545 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1546
1547 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1548 }
1549
1550 /**
1551 * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1552 * ERO, LSPA OBJECT objects in PcInitiate message.
1553 */
1554 @Test
1555 public void initiateMessageTest34() throws PcepParseException {
1556
1557 /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1558 * ERO, LSPA OBJECT.
1559 */
1560 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
1561 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1562 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1563 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1564 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1565 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1566 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1567 0x07, 0x10, 0x00, 0x04, //ERO object
1568 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1569 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1570
1571 byte[] testInitiateCreationMsg = {0};
1572 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1573 buffer.writeBytes(initiateCreationMsg);
1574
1575 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1576 PcepMessage message = null;
1577
1578 message = reader.readFrom(buffer);
1579
1580 assertThat(message, instanceOf(PcepInitiateMsg.class));
1581 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1582
1583 message.writeTo(buf);
1584
1585 testInitiateCreationMsg = buf.array();
1586
1587 int iReadLen = buf.writerIndex();
1588 testInitiateCreationMsg = new byte[iReadLen];
1589 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1590
1591 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1592 }
1593
1594 /**
1595 * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1596 * ERO, LSPA OBJECT objects in PcInitiate message.
1597 */
1598 @Test
1599 public void initiateMessageTest35() throws PcepParseException {
1600
1601 /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1602 * ERO, LSPA OBJECT.
1603 */
1604 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x60,
1605 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1606 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1607 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1608 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1609 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1610 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1611 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
1612 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1613 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1614 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1615
1616 byte[] testInitiateCreationMsg = {0};
1617 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1618 buffer.writeBytes(initiateCreationMsg);
1619
1620 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1621 PcepMessage message = null;
1622
1623 message = reader.readFrom(buffer);
1624
1625 assertThat(message, instanceOf(PcepInitiateMsg.class));
1626 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1627
1628 message.writeTo(buf);
1629
1630 testInitiateCreationMsg = buf.array();
1631
1632 int iReadLen = buf.writerIndex();
1633 testInitiateCreationMsg = new byte[iReadLen];
1634 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1635
1636 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1637 }
1638
1639 /**
1640 * This test case checks for SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1641 * ERO, LSPA OBJECT objects in PcInitiate message.
1642 */
1643 @Test
1644 public void initiateMessageTest36() throws PcepParseException {
1645
1646 /* SRP, LSP ( StatefulLspDbVerTlv), END-POINTS,
1647 * ERO, LSPA OBJECT.
1648 */
1649 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
1650 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1651 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1652 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1653 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1654 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1655 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x0C, 0x01, //ERO object
1656 0x01, 0x01, 0x00, 0x00, 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1657 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1658 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00};
1659
1660 byte[] testInitiateCreationMsg = {0};
1661 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1662 buffer.writeBytes(initiateCreationMsg);
1663
1664 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1665 PcepMessage message = null;
1666
1667 message = reader.readFrom(buffer);
1668
1669 assertThat(message, instanceOf(PcepInitiateMsg.class));
1670 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1671
1672 message.writeTo(buf);
1673
1674 testInitiateCreationMsg = buf.array();
1675
1676 int iReadLen = buf.writerIndex();
1677 testInitiateCreationMsg = new byte[iReadLen];
1678 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1679
1680 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
1681 }
1682}
1683