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