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