blob: a27b781f9ede361af29792dc9d9659a46236f0b8 [file] [log] [blame]
bharat saraswalf7364db2015-08-11 13:39:31 +05301/*
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
bharat saraswalf7364db2015-08-11 13:39:31 +053018import org.jboss.netty.buffer.ChannelBuffer;
19import org.jboss.netty.buffer.ChannelBuffers;
bharat saraswalf7364db2015-08-11 13:39:31 +053020import 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;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053026
27import static org.hamcrest.MatcherAssert.assertThat;
Sho SHIMIZUe090a422015-09-04 17:35:49 -070028import static org.hamcrest.Matchers.instanceOf;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053029import static org.hamcrest.core.Is.is;
bharat saraswalf7364db2015-08-11 13:39:31 +053030
31public class PcepInitiateMsgTest {
32
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053033 /**
34 * This test case checks for srp, lsp, end-point, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053035 */
bharat saraswalf7364db2015-08-11 13:39:31 +053036 @Test
37 public void initiateMessageTest1() throws PcepParseException {
38
39 /* srp, lsp, end-point, ERO.
40 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053041 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, 0x54,
bharat saraswalf7364db2015-08-11 13:39:31 +053042 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
43 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, //LSP object
44 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
45 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
46 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02,
47 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathTlv
48 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
49 0x07, 0x10, 0x00, 0x14, //ERO object
50 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
51 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
52
53 byte[] testInitiateCreationMsg = {0};
54 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
55 buffer.writeBytes(initiateCreationMsg);
56
57 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
58 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053059
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053060
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053061 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +053062
Sho SHIMIZUe090a422015-09-04 17:35:49 -070063 assertThat(message, instanceOf(PcepInitiateMsg.class));
bharat saraswalf7364db2015-08-11 13:39:31 +053064
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053065 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053066
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053067 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053068
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053069 testInitiateCreationMsg = buf.array();
70
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053071 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053072 testInitiateCreationMsg = new byte[iReadLen];
73 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
74
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053075 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +053076 }
77
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053078 /**
79 * This test case checks for srp and lsp objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053080 */
bharat saraswalf7364db2015-08-11 13:39:31 +053081 @Test
82 public void initiateMessageTest2() throws PcepParseException {
83 /* srp, lsp.
84 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053085 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
bharat saraswalf7364db2015-08-11 13:39:31 +053086 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
87 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x20, 0x10, //LSP object
88 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
89 0x01, 0x01, 0x01, 0x01, 0x00, 0x43, (byte) 0x83, 0x01,
90 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053091 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33}; //SymbolicPathTlv
bharat saraswalf7364db2015-08-11 13:39:31 +053092
93 byte[] testInitiateDeletionMsg = {0};
94 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
95 buffer.writeBytes(initiateDeletionMsg);
96
97 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
98 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053099
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530100 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530101
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700102 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530103
bharat saraswalf7364db2015-08-11 13:39:31 +0530104
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530105 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
106 message.writeTo(buf);
107 testInitiateDeletionMsg = buf.array();
108
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530109 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530110 testInitiateDeletionMsg = new byte[iReadLen];
111 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
112
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530113 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530114 }
115
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530116 /**
117 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
118 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO objects
119 * in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530120 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530121 @Test
122 public void initiateMessageTest3() throws PcepParseException {
123
124 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
125 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO.
126 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530127 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530128 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530129 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530130 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
131 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
132 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
133 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
134 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
135 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
136 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
137 0x07, 0x10, 0x00, 0x14, //ERO object
138 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
139 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
140
141 byte[] testInitiateCreationMsg = {0};
142 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
143 buffer.writeBytes(initiateCreationMsg);
144
145 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
146 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530147
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530148 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530149
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700150 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530151
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530152 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530153
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530154 message.writeTo(buf);
155 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530156
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530157 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530158 testInitiateCreationMsg = new byte[iReadLen];
159 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
160
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530161 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530162 }
163
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530164 /**
165 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
166 * StatefulLspErrorCodeTlv), END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530167 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530168 @Test
169 public void initiateMessageTest4() throws PcepParseException {
170
171 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
172 * StatefulLspErrorCodeTlv), END-POINT, ERO.
173 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530174 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530175 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530176 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530177 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
178 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
179 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
180 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530181 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530182 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
183 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
184 0x07, 0x10, 0x00, 0x14, //ERO object
185 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
186 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
187
188 byte[] testInitiateCreationMsg = {0};
189 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
190 buffer.writeBytes(initiateCreationMsg);
191
192 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
193 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530194
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530195 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530196
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700197 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530198
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530199 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
200 message.writeTo(buf);
201 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530202
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530203 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530204 testInitiateCreationMsg = new byte[iReadLen];
205 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
206
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530207 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530208 }
209
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530210 /**
211 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
212 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530213 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530214 @Test
215 public void initiateMessageTest5() throws PcepParseException {
216
217 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
218 * END-POINT, ERO.
219 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530220 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530221 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530222 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530223 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
224 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
225 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
226 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530227 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530228 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
229 0x07, 0x10, 0x00, 0x14, //ERO object
230 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530231 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
bharat saraswalf7364db2015-08-11 13:39:31 +0530232
233 byte[] testInitiateCreationMsg = {0};
234 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
235 buffer.writeBytes(initiateCreationMsg);
236
237 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
238 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530239
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530240 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530241
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700242 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530243
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530244 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530245
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530246 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530247
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530248 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530249
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530250 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530251 testInitiateCreationMsg = new byte[iReadLen];
252 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
253
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530254 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530255 }
256
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530257 /**
258 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
259 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530260 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530261 @Test
262 public void initiateMessageTest6() throws PcepParseException {
263
264 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
265 * END-POINT, ERO.
266 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530267 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530268 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530269 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530270 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
271 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
272 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
273 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530274 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530275 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
276 0x07, 0x10, 0x00, 0x14, //ERO object
277 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530278 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
bharat saraswalf7364db2015-08-11 13:39:31 +0530279
280 byte[] testInitiateCreationMsg = {0};
281 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
282 buffer.writeBytes(initiateCreationMsg);
283
284 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
285 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530286
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530287
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530288 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530289
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700290 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530291
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530292 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530293
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530294 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530295
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530296 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530297
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530298 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530299 testInitiateCreationMsg = new byte[iReadLen];
300 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
301
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530302 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530303 }
304
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530305 /**
306 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
307 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530308 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530309 @Test
310 public void initiateMessageTest7() throws PcepParseException {
311
312 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
313 * END-POINT, ERO.
314 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530315 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
bharat saraswalf7364db2015-08-11 13:39:31 +0530316 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530317 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530318 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
319 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
320 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
321 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
322 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
323 0x07, 0x10, 0x00, 0x14, //ERO object
324 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
325 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
326
327 byte[] testInitiateCreationMsg = {0};
328 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
329 buffer.writeBytes(initiateCreationMsg);
330
331 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
332 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530333
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530334
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530335 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530336
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700337 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530338
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530339 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530340
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530341 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530342
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530343 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530344
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530345 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530346 testInitiateCreationMsg = new byte[iReadLen];
347 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
348
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530349 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530350 }
351
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530352 /**
353 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
354 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530355 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530356 @Test
357 public void initiateMessageTest8() throws PcepParseException {
358
359 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
360 * END-POINT, ERO.
361 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530362 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530363 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
364 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
365 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
366 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
367 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
368 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
369 0x07, 0x10, 0x00, 0x14, //ERO object
370 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
371 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
372
373 byte[] testInitiateCreationMsg = {0};
374 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
375 buffer.writeBytes(initiateCreationMsg);
376
377 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
378 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530379
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530380
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530381 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530382
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700383 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530384
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530385 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530386
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530387 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530388
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530389 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530390
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530391 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530392 testInitiateCreationMsg = new byte[iReadLen];
393 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
394
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530395 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530396 }
397
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530398 /**
399 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
400 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530401 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530402 @Test
403 public void initiateMessageTest9() throws PcepParseException {
404
405 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
406 * END-POINT, ERO.
407 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530408 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530409 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
410 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
411 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
412 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
413 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
414 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
415 0x07, 0x10, 0x00, 0x04};
416
417 byte[] testInitiateCreationMsg = {0};
418 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
419 buffer.writeBytes(initiateCreationMsg);
420
421 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
422 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530423
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530424
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530425 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530426
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700427 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530428
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530429 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530430
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530431 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530432
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530433 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530434
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530435 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530436 testInitiateCreationMsg = new byte[iReadLen];
437 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
438
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530439 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530440 }
441
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530442 /**
443 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv)
444 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530445 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530446 @Test
447 public void initiateMessageTest10() throws PcepParseException {
448
449 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv).
450 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530451 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
bharat saraswalf7364db2015-08-11 13:39:31 +0530452 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
453 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
454 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
455 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
456 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f,
457 (byte) 0xb6, 0x02, 0x4e, 0x20, 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
458 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08 //StatefulLspErrorCodeTlv
459 };
460
461 byte[] testInitiateDeletionMsg = {0};
462 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
463 buffer.writeBytes(initiateDeletionMsg);
464
465 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
466 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530467
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530468
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530469 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530470
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700471 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530472
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530473 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530474
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530475 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530476
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530477 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530478
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530479 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530480 testInitiateDeletionMsg = new byte[iReadLen];
481 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
482
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530483 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530484 }
485
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530486 /**
487 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
488 * StatefulLspErrorCodeTlv) objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530489 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530490 @Test
491 public void initiateMessageTest11() throws PcepParseException {
492
493 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
494 StatefulLspErrorCodeTlv).*/
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530495 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
bharat saraswalf7364db2015-08-11 13:39:31 +0530496 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
497 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
498 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
499 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
500 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
501 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
502 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
503 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08}; //StatefulLspErrorCodeTlv
504
505 byte[] testInitiateDeletionMsg = {0};
506 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
507 buffer.writeBytes(initiateDeletionMsg);
508
509 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
510 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530511
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530512
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530513 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530514
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700515 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530516
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530517 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530518
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530519 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530520
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530521 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530522
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530523 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530524 testInitiateDeletionMsg = new byte[iReadLen];
525 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
526
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530527 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530528 }
529
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530530 /**
531 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
532 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530533 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530534 @Test
535 public void initiateMessageTest12() throws PcepParseException {
536
537 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
538 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530539 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530540 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
541 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
542 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
543 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
544 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
545 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00 //SymbolicPathNameTlv
546 };
547
548 byte[] testInitiateDeletionMsg = {0};
549 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
550 buffer.writeBytes(initiateDeletionMsg);
551
552 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
553 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530554
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530555
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530556 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530557
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700558 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530559
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530560 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530561
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530562 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530563
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530564 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530565
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530566 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530567 testInitiateDeletionMsg = new byte[iReadLen];
568 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
569
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530570 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530571 }
572
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530573 /**
574 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
575 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530576 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530577 @Test
578 public void initiateMessageTest13() throws PcepParseException {
579
580 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
581 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530582 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530583 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
584 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
585 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
586 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
587 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530588 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00}; //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530589
590 byte[] testInitiateDeletionMsg = {0};
591 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
592 buffer.writeBytes(initiateDeletionMsg);
593
594 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
595 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530596
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530597
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530598 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530599
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700600 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530601
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530602 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530603
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530604 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530605
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530606 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530607
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530608 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530609 testInitiateDeletionMsg = new byte[iReadLen];
610 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
611
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530612 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530613 }
614
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530615 /**
616 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv)
617 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530618 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530619 @Test
620 public void initiateMessageTest14() throws PcepParseException {
621
622 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
623 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530624 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
bharat saraswalf7364db2015-08-11 13:39:31 +0530625 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
626 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
627 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
628 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
629 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530630 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
bharat saraswalf7364db2015-08-11 13:39:31 +0530631
632 byte[] testInitiateDeletionMsg = {0};
633 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
634 buffer.writeBytes(initiateDeletionMsg);
635
636 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
637 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530638
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530639
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530640 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530641
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700642 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530643
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530644 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530645
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530646 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530647
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530648 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530649
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530650 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530651 testInitiateDeletionMsg = new byte[iReadLen];
652 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
653
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530654 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530655 }
656
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530657 /**
658 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv)
659 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530660 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530661 @Test
662 public void initiateMessageTest15() throws PcepParseException {
663
664 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv).
665 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530666 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x2c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530667 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
668 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
669 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
670 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
671 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
672
673 byte[] testInitiateDeletionMsg = {0};
674 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
675 buffer.writeBytes(initiateDeletionMsg);
676
677 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
678 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530679
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530680
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530681 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530682
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700683 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530684
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530685 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530686
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530687 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530688
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530689 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530690
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530691 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530692 testInitiateDeletionMsg = new byte[iReadLen];
693 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
694
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530695 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530696 }
697
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530698 /**
699 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
700 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530701 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530702 @Test
703 public void initiateMessageTest16() throws PcepParseException {
704
705 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530706 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
bharat saraswalf7364db2015-08-11 13:39:31 +0530707 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
708 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
709 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
710 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
711 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
712 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
713 0x07, 0x10, 0x00, 0x04, //ERO object
714 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
715 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
716
717 byte[] testInitiateCreationMsg = {0};
718 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
719 buffer.writeBytes(initiateCreationMsg);
720
721 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
722 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530723
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530724
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530725 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530726
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700727 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530728
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530729 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530730
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530731 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530732
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530733 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530734
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530735 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530736 testInitiateCreationMsg = new byte[iReadLen];
737 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
738
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530739 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530740 }
741
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530742 /**
743 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
744 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530745 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530746 @Test
747 public void initiateMessageTest17() throws PcepParseException {
748
749 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530750 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
bharat saraswalf7364db2015-08-11 13:39:31 +0530751 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
752 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
753 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
754 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
755 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
756 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
757 0x07, 0x10, 0x00, 0x04, //ERO object
758 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
759 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
760 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
761
762 byte[] testInitiateCreationMsg = {0};
763 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
764 buffer.writeBytes(initiateCreationMsg);
765
766 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
767 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530768
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530769
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530770 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530771
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700772 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530773
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530774 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530775
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530776 message.writeTo(buf);
777 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530778
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530779 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530780 testInitiateCreationMsg = new byte[iReadLen];
781 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
782
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530783 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530784 }
785
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530786 /**
787 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
788 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530789 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530790 @Test
791 public void initiateMessageTest18() throws PcepParseException {
792 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530793 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530794 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
795 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
796 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
797 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
798 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
799 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
800 0x07, 0x10, 0x00, 0x04, //ERO object
801 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
802 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
803 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
804 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
805
806 byte[] testInitiateCreationMsg = {0};
807 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
808 buffer.writeBytes(initiateCreationMsg);
809
810 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
811 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530812
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530813
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530814 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530815
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700816 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530817
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530818 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530819
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530820 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530821
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530822 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530823
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530824 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530825 testInitiateCreationMsg = new byte[iReadLen];
826 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
827
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530828 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530829 }
830
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530831 /**
832 * This test case checks for srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
833 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530834 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530835 @Test
836 public void initiateMessageTest19() throws PcepParseException {
837 //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530838 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74,
bharat saraswalf7364db2015-08-11 13:39:31 +0530839 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
840 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
841 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
842 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
843 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
844 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
845 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08,
846 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
847 0x07, 0x10, 0x00, 0x04, //ERO object
848 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
849 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
850 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
851 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
852
853 byte[] testInitiateCreationMsg = {0};
854 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
855 buffer.writeBytes(initiateCreationMsg);
856
857 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
858 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530859
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530860
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530861 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530862
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700863 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530864
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530865 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530866
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530867 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530868
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530869 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530870
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530871 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530872 testInitiateCreationMsg = new byte[iReadLen];
873 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
874
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530875 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530876 }
877
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530878 /**
879 * This test case checks for srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
880 * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530881 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530882 @Test
883 public void initiateMessageTest20() throws PcepParseException {
884 /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
885 * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
886 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530887 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530888 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530889 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530890 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
891 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
892 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
893 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
894 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530895 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530896 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
897 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
898 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
899 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
900
901 byte[] testInitiateDeletionMsg = {0};
902 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
903 buffer.writeBytes(initiateDeletionMsg);
904
905 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
906 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530907
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530908
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530909 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530910
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700911 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530912
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530913 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530914
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530915 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530916
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530917 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530918
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530919 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530920 testInitiateDeletionMsg = new byte[iReadLen];
921 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
922
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530923 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530924 }
925
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530926 /**
927 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
928 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530929 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530930 @Test
931 public void initiateMessageTest21() throws PcepParseException {
932 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
933 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
934 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530935 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x94,
bharat saraswalf7364db2015-08-11 13:39:31 +0530936 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
937 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
938 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
939 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
940 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
941 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
942 0x07, 0x10, 0x00, 0x14, //ERO object
943 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
944 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
945 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
946 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
947 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
948 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
949 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
950 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
951 0x07, 0x10, 0x00, 0x14, //ERO object
952 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
953 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
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;
bharat saraswalf7364db2015-08-11 13:39:31 +0530961
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530962
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530963 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530964
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700965 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530966
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530967 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530968
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530969 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530970
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530971 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530972
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530973 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530974 testInitiateCreationMsg = new byte[iReadLen];
975 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
976
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530977 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530978 }
979
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530980 /**
981 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
982 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530983 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530984 @Test
985 public void initiateMessageTest22() throws PcepParseException {
986 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
987 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
988 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530989 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8,
bharat saraswalf7364db2015-08-11 13:39:31 +0530990 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, 0x14, //ERO object
997 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
998 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
999 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1000 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1001 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1002 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1003 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1004 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1005 0x07, 0x10, 0x00, 0x14, //ERO object
1006 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1007 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1008 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1009 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1010
1011 byte[] testInitiateCreationMsg = {0};
1012 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1013 buffer.writeBytes(initiateCreationMsg);
1014
1015 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1016 PcepMessage message = null;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301017
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301018 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301019
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001020 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301021
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301022 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301023
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301024 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301025
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301026 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301027
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301028 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301029 testInitiateCreationMsg = new byte[iReadLen];
1030 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
bharat saraswalf7364db2015-08-11 13:39:31 +05301031
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301032 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301033 }
1034
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301035 /**
1036 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1037 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301038 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301039 @Test
1040 public void initiateMessageTest23() throws PcepParseException {
1041 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
1042 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1043 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301044 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xB0,
bharat saraswalf7364db2015-08-11 13:39:31 +05301045 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1046 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1047 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1048 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1049 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1050 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1051 0x07, 0x10, 0x00, 0x14, //ERO object
1052 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1053 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1054 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1055 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1056 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1057 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1058 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1059 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1060 0x07, 0x10, 0x00, 0x14, //ERO object
1061 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1062 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1063 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1064 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1065 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
1066
1067 byte[] testInitiateCreationMsg = {0};
1068 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1069 buffer.writeBytes(initiateCreationMsg);
1070
1071 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1072 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301073
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301074
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301075 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301076
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001077 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301078
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301079 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301080
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301081 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301082
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301083 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301084
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301085 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301086 testInitiateCreationMsg = new byte[iReadLen];
1087 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1088
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301089 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301090 }
1091
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301092 /**
1093 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1094 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301095 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301096 @Test
1097 public void initiateMessageTest24() throws PcepParseException {
1098 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
1099 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth*/
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301100 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xBC,
bharat saraswalf7364db2015-08-11 13:39:31 +05301101 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1102 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1103 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1104 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1105 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1106 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1107 0x07, 0x10, 0x00, 0x14, //ERO object
1108 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1109 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1110 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1111 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1112 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1113 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1114 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1115 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1116 0x07, 0x10, 0x00, 0x14, //ERO object
1117 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1118 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1119 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1120 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1121 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1122 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1123
1124 byte[] testInitiateCreationMsg = {0};
1125 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1126 buffer.writeBytes(initiateCreationMsg);
1127
1128 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1129 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301130
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301131
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301132 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301133
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001134 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301135
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301136 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301137
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301138 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301139
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301140 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301141
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301142 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301143 testInitiateCreationMsg = new byte[iReadLen];
1144 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1145
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301146 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301147 }
1148
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301149 /**
1150 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
1151 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1152 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301153 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301154 @Test
1155 public void initiateMessageTest25() throws PcepParseException {
1156
1157 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
1158 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1159 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301160 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xC4,
bharat saraswalf7364db2015-08-11 13:39:31 +05301161 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1162 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1163 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1164 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1165 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1166 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1167 0x07, 0x10, 0x00, 0x14, //ERO object
1168 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1169 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1170 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1171 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1172 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1173 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1174 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1175 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1176 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1177 0x07, 0x10, 0x00, 0x14, //ERO object
1178 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1179 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1180 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1181 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1182 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1183 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1184
1185 byte[] testInitiateCreationMsg = {0};
1186 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1187 buffer.writeBytes(initiateCreationMsg);
1188
1189 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1190 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301191
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301192
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301193 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301194
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001195 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301196
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301197 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301198
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301199 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301200
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301201 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301202
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301203 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301204 testInitiateCreationMsg = new byte[iReadLen];
1205 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1206
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301207 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301208 }
1209
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301210 /**
1211 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
1212 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1213 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301214 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301215 @Test
1216 public void initiateMessageTest26() throws PcepParseException {
1217
1218 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
1219 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1220 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301221 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xD0,
bharat saraswalf7364db2015-08-11 13:39:31 +05301222 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1223 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1224 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1225 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1226 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1227 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1228 0x07, 0x10, 0x00, 0x14, //ERO object
1229 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1230 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1231 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1232 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1233 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1234 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1235 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1236 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1237 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1238 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1239 0x07, 0x10, 0x00, 0x14, //ERO object
1240 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1241 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1242 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1244 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1245 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1246
1247 byte[] testInitiateCreationMsg = {0};
1248 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1249 buffer.writeBytes(initiateCreationMsg);
1250
1251 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1252 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301253
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301254
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301255 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301256
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001257 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301258
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301259 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301260
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301261 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301262
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301263 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301264
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301265 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301266 testInitiateCreationMsg = new byte[iReadLen];
1267 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1268
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301269 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301270 }
1271
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301272 /**
1273 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
1274 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1275 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301276 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301277 @Test
1278 public void initiateMessageTest27() throws PcepParseException {
1279
1280 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
1281 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1282 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301283 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xE4,
bharat saraswalf7364db2015-08-11 13:39:31 +05301284 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1285 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1286 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1287 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1288 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1289 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1290 0x07, 0x10, 0x00, 0x14, //ERO object
1291 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1292 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1293 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1295 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1296 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1297 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1298 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1299 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1300 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1301 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1302 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1303 0x07, 0x10, 0x00, 0x14, //ERO object
1304 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1305 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1306 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1307 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1308 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1309 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1310
1311 byte[] testInitiateCreationMsg = {0};
1312 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1313 buffer.writeBytes(initiateCreationMsg);
1314
1315 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1316 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301317
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301318
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301319 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301320
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001321 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301322
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301323 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301324
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301325 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301326
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301327 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301328
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301329 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301330 testInitiateCreationMsg = new byte[iReadLen];
1331 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1332
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301333 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301334 }
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301335}