blob: 0f8bb7ba47b51d9e9ea267a99eb4a12c73dab735 [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 */
Sho SHIMIZU3559c312015-11-04 14:59:31 -080016package org.onosproject.pcepio.protocol;
bharat saraswalf7364db2015-08-11 13:39:31 +053017
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;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053022
23import static org.hamcrest.MatcherAssert.assertThat;
Sho SHIMIZUe090a422015-09-04 17:35:49 -070024import static org.hamcrest.Matchers.instanceOf;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053025import static org.hamcrest.core.Is.is;
bharat saraswalf7364db2015-08-11 13:39:31 +053026
27public class PcepInitiateMsgTest {
28
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053029 /**
30 * This test case checks for srp, lsp, end-point, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053031 */
bharat saraswalf7364db2015-08-11 13:39:31 +053032 @Test
33 public void initiateMessageTest1() throws PcepParseException {
34
35 /* srp, lsp, end-point, ERO.
36 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053037 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, 0x54,
bharat saraswalf7364db2015-08-11 13:39:31 +053038 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
39 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, //LSP object
40 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
41 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
42 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02,
43 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathTlv
44 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
45 0x07, 0x10, 0x00, 0x14, //ERO object
46 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
47 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
48
49 byte[] testInitiateCreationMsg = {0};
50 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
51 buffer.writeBytes(initiateCreationMsg);
52
53 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
54 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053055
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053056
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053057 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +053058
Sho SHIMIZUe090a422015-09-04 17:35:49 -070059 assertThat(message, instanceOf(PcepInitiateMsg.class));
bharat saraswalf7364db2015-08-11 13:39:31 +053060
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053061 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053062
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053063 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053064
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053065 testInitiateCreationMsg = buf.array();
66
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053067 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053068 testInitiateCreationMsg = new byte[iReadLen];
69 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
70
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053071 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +053072 }
73
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053074 /**
75 * This test case checks for srp and lsp objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053076 */
bharat saraswalf7364db2015-08-11 13:39:31 +053077 @Test
78 public void initiateMessageTest2() throws PcepParseException {
79 /* srp, lsp.
80 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053081 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
bharat saraswalf7364db2015-08-11 13:39:31 +053082 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
83 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x20, 0x10, //LSP object
84 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
85 0x01, 0x01, 0x01, 0x01, 0x00, 0x43, (byte) 0x83, 0x01,
86 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053087 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33}; //SymbolicPathTlv
bharat saraswalf7364db2015-08-11 13:39:31 +053088
89 byte[] testInitiateDeletionMsg = {0};
90 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
91 buffer.writeBytes(initiateDeletionMsg);
92
93 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
94 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053095
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053096 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +053097
Sho SHIMIZUe090a422015-09-04 17:35:49 -070098 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053099
bharat saraswalf7364db2015-08-11 13:39:31 +0530100
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530101 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
102 message.writeTo(buf);
103 testInitiateDeletionMsg = buf.array();
104
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530105 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530106 testInitiateDeletionMsg = new byte[iReadLen];
107 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
108
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530109 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530110 }
111
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530112 /**
113 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
114 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO objects
115 * in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530116 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530117 @Test
118 public void initiateMessageTest3() throws PcepParseException {
119
120 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
121 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO.
122 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530123 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530124 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530125 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530126 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
127 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
128 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
129 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
130 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
131 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
132 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
133 0x07, 0x10, 0x00, 0x14, //ERO object
134 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
135 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
136
137 byte[] testInitiateCreationMsg = {0};
138 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
139 buffer.writeBytes(initiateCreationMsg);
140
141 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
142 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530143
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530144 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530145
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700146 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530147
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530148 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530149
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530150 message.writeTo(buf);
151 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530152
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530153 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530154 testInitiateCreationMsg = new byte[iReadLen];
155 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
156
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530157 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530158 }
159
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530160 /**
161 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
162 * StatefulLspErrorCodeTlv), END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530163 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530164 @Test
165 public void initiateMessageTest4() throws PcepParseException {
166
167 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
168 * StatefulLspErrorCodeTlv), END-POINT, ERO.
169 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530170 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530171 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530172 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530173 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
174 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
175 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
176 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530177 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530178 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
179 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
180 0x07, 0x10, 0x00, 0x14, //ERO object
181 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
182 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
183
184 byte[] testInitiateCreationMsg = {0};
185 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
186 buffer.writeBytes(initiateCreationMsg);
187
188 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
189 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530190
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530191 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530192
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700193 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530194
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530195 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
196 message.writeTo(buf);
197 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530198
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530199 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530200 testInitiateCreationMsg = new byte[iReadLen];
201 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
202
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530203 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530204 }
205
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530206 /**
207 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
208 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530209 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530210 @Test
211 public void initiateMessageTest5() throws PcepParseException {
212
213 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
214 * END-POINT, ERO.
215 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530216 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530217 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530218 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530219 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
220 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
221 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
222 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530223 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530224 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
225 0x07, 0x10, 0x00, 0x14, //ERO object
226 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530227 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
bharat saraswalf7364db2015-08-11 13:39:31 +0530228
229 byte[] testInitiateCreationMsg = {0};
230 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
231 buffer.writeBytes(initiateCreationMsg);
232
233 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
234 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530235
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530236 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530237
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700238 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530239
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530240 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530241
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530242 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530243
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530244 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530245
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530246 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530247 testInitiateCreationMsg = new byte[iReadLen];
248 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
249
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530250 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530251 }
252
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530253 /**
254 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
255 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530256 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530257 @Test
258 public void initiateMessageTest6() throws PcepParseException {
259
260 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
261 * END-POINT, ERO.
262 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530263 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530264 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530265 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530266 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
267 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
268 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
269 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530270 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530271 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
272 0x07, 0x10, 0x00, 0x14, //ERO object
273 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530274 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
bharat saraswalf7364db2015-08-11 13:39:31 +0530275
276 byte[] testInitiateCreationMsg = {0};
277 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
278 buffer.writeBytes(initiateCreationMsg);
279
280 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
281 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530282
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530283
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530284 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530285
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700286 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530287
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530288 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530289
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530290 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530291
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530292 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530293
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530294 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530295 testInitiateCreationMsg = new byte[iReadLen];
296 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
297
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530298 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530299 }
300
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530301 /**
302 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
303 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530304 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530305 @Test
306 public void initiateMessageTest7() throws PcepParseException {
307
308 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
309 * END-POINT, ERO.
310 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530311 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
bharat saraswalf7364db2015-08-11 13:39:31 +0530312 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530313 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530314 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
315 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
316 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
317 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
318 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
319 0x07, 0x10, 0x00, 0x14, //ERO object
320 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
321 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
322
323 byte[] testInitiateCreationMsg = {0};
324 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
325 buffer.writeBytes(initiateCreationMsg);
326
327 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
328 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530329
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530330
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530331 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530332
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700333 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530334
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530335 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530336
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530337 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530338
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530339 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530340
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530341 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530342 testInitiateCreationMsg = new byte[iReadLen];
343 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
344
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530345 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530346 }
347
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530348 /**
349 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
350 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530351 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530352 @Test
353 public void initiateMessageTest8() throws PcepParseException {
354
355 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
356 * END-POINT, ERO.
357 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530358 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530359 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
360 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
361 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
362 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
363 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
364 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
365 0x07, 0x10, 0x00, 0x14, //ERO object
366 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
367 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
368
369 byte[] testInitiateCreationMsg = {0};
370 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
371 buffer.writeBytes(initiateCreationMsg);
372
373 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
374 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530375
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530376
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530377 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530378
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700379 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530380
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530381 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530382
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530383 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530384
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530385 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530386
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530387 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530388 testInitiateCreationMsg = new byte[iReadLen];
389 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
390
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530391 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530392 }
393
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530394 /**
395 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
396 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530397 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530398 @Test
399 public void initiateMessageTest9() throws PcepParseException {
400
401 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
402 * END-POINT, ERO.
403 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530404 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530405 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
406 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
407 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
408 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
409 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
410 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
411 0x07, 0x10, 0x00, 0x04};
412
413 byte[] testInitiateCreationMsg = {0};
414 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
415 buffer.writeBytes(initiateCreationMsg);
416
417 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
418 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530419
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530420
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530421 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530422
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700423 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530424
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530425 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530426
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530427 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530428
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530429 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530430
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530431 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530432 testInitiateCreationMsg = new byte[iReadLen];
433 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
434
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530435 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530436 }
437
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530438 /**
439 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv)
440 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530441 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530442 @Test
443 public void initiateMessageTest10() throws PcepParseException {
444
445 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv).
446 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530447 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
bharat saraswalf7364db2015-08-11 13:39:31 +0530448 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
449 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
450 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
451 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
452 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f,
453 (byte) 0xb6, 0x02, 0x4e, 0x20, 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
454 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08 //StatefulLspErrorCodeTlv
455 };
456
457 byte[] testInitiateDeletionMsg = {0};
458 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
459 buffer.writeBytes(initiateDeletionMsg);
460
461 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
462 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530463
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530464
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530465 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530466
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700467 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530468
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530469 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530470
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530471 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530472
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530473 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530474
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530475 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530476 testInitiateDeletionMsg = new byte[iReadLen];
477 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
478
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530479 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530480 }
481
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530482 /**
483 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
484 * StatefulLspErrorCodeTlv) objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530485 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530486 @Test
487 public void initiateMessageTest11() throws PcepParseException {
488
489 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
490 StatefulLspErrorCodeTlv).*/
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530491 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
bharat saraswalf7364db2015-08-11 13:39:31 +0530492 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
493 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
494 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
495 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
496 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
497 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
498 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
499 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08}; //StatefulLspErrorCodeTlv
500
501 byte[] testInitiateDeletionMsg = {0};
502 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
503 buffer.writeBytes(initiateDeletionMsg);
504
505 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
506 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530507
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530508
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530509 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530510
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700511 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530512
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530513 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530514
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530515 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530516
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530517 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530518
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530519 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530520 testInitiateDeletionMsg = new byte[iReadLen];
521 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
522
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530523 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530524 }
525
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530526 /**
527 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
528 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530529 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530530 @Test
531 public void initiateMessageTest12() throws PcepParseException {
532
533 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
534 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530535 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530536 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
537 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
538 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
539 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
540 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
541 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00 //SymbolicPathNameTlv
542 };
543
544 byte[] testInitiateDeletionMsg = {0};
545 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
546 buffer.writeBytes(initiateDeletionMsg);
547
548 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
549 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530550
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530551
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530552 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530553
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700554 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530555
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530556 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530557
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530558 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530559
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530560 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530561
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530562 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530563 testInitiateDeletionMsg = new byte[iReadLen];
564 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
565
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530566 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530567 }
568
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530569 /**
570 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
571 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530572 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530573 @Test
574 public void initiateMessageTest13() throws PcepParseException {
575
576 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
577 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530578 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530579 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
580 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
581 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
582 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
583 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530584 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00}; //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530585
586 byte[] testInitiateDeletionMsg = {0};
587 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
588 buffer.writeBytes(initiateDeletionMsg);
589
590 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
591 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530592
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530593
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530594 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530595
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700596 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530597
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530598 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530599
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530600 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530601
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530602 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530603
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530604 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530605 testInitiateDeletionMsg = new byte[iReadLen];
606 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
607
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530608 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530609 }
610
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530611 /**
612 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv)
613 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530614 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530615 @Test
616 public void initiateMessageTest14() throws PcepParseException {
617
618 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
619 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530620 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
bharat saraswalf7364db2015-08-11 13:39:31 +0530621 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
622 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
623 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
624 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
625 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530626 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
bharat saraswalf7364db2015-08-11 13:39:31 +0530627
628 byte[] testInitiateDeletionMsg = {0};
629 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
630 buffer.writeBytes(initiateDeletionMsg);
631
632 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
633 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530634
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530635
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530636 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530637
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700638 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530639
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530640 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530641
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530642 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530643
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530644 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530645
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530646 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530647 testInitiateDeletionMsg = new byte[iReadLen];
648 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
649
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530650 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530651 }
652
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530653 /**
654 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv)
655 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530656 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530657 @Test
658 public void initiateMessageTest15() throws PcepParseException {
659
660 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv).
661 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530662 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x2c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530663 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
664 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
665 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
666 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
667 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
668
669 byte[] testInitiateDeletionMsg = {0};
670 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
671 buffer.writeBytes(initiateDeletionMsg);
672
673 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
674 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530675
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530676
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530677 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530678
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700679 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530680
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530681 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530682
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530683 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530684
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530685 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530686
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530687 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530688 testInitiateDeletionMsg = new byte[iReadLen];
689 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
690
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530691 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530692 }
693
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530694 /**
695 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
696 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530697 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530698 @Test
699 public void initiateMessageTest16() throws PcepParseException {
700
701 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530702 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
bharat saraswalf7364db2015-08-11 13:39:31 +0530703 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
704 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
705 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
706 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
707 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
708 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
709 0x07, 0x10, 0x00, 0x04, //ERO object
710 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
711 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
712
713 byte[] testInitiateCreationMsg = {0};
714 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
715 buffer.writeBytes(initiateCreationMsg);
716
717 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
718 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530719
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530720
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530721 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530722
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700723 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530724
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530725 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530726
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530727 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530728
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530729 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530730
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530731 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530732 testInitiateCreationMsg = new byte[iReadLen];
733 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
734
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530735 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530736 }
737
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530738 /**
739 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
740 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530741 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530742 @Test
743 public void initiateMessageTest17() throws PcepParseException {
744
745 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530746 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
bharat saraswalf7364db2015-08-11 13:39:31 +0530747 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
748 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
749 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
750 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
751 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
752 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
753 0x07, 0x10, 0x00, 0x04, //ERO object
754 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
755 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
756 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
757
758 byte[] testInitiateCreationMsg = {0};
759 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
760 buffer.writeBytes(initiateCreationMsg);
761
762 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
763 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530764
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530765
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530766 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530767
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700768 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530769
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530770 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530771
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530772 message.writeTo(buf);
773 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530774
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530775 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530776 testInitiateCreationMsg = new byte[iReadLen];
777 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
778
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530779 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530780 }
781
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530782 /**
783 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
784 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530785 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530786 @Test
787 public void initiateMessageTest18() throws PcepParseException {
788 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530789 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530790 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
791 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
792 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
793 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
794 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
795 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
796 0x07, 0x10, 0x00, 0x04, //ERO object
797 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
798 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
799 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
800 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
801
802 byte[] testInitiateCreationMsg = {0};
803 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
804 buffer.writeBytes(initiateCreationMsg);
805
806 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
807 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530808
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530809
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530810 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530811
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700812 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530813
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530814 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530815
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530816 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530817
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530818 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530819
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530820 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530821 testInitiateCreationMsg = new byte[iReadLen];
822 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
823
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530824 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530825 }
826
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530827 /**
828 * This test case checks for srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
829 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530830 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530831 @Test
832 public void initiateMessageTest19() throws PcepParseException {
833 //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530834 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74,
bharat saraswalf7364db2015-08-11 13:39:31 +0530835 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
836 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
837 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
838 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
839 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
840 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
841 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08,
842 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
843 0x07, 0x10, 0x00, 0x04, //ERO object
844 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
845 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
846 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
847 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
848
849 byte[] testInitiateCreationMsg = {0};
850 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
851 buffer.writeBytes(initiateCreationMsg);
852
853 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
854 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530855
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530856
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530857 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530858
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700859 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530860
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530861 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530862
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530863 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530864
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530865 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530866
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530867 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530868 testInitiateCreationMsg = new byte[iReadLen];
869 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
870
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530871 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530872 }
873
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530874 /**
875 * This test case checks for srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
876 * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530877 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530878 @Test
879 public void initiateMessageTest20() throws PcepParseException {
880 /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
881 * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
882 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530883 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530884 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530885 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530886 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
887 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
888 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
889 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
890 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530891 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530892 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
893 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
894 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
895 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
896
897 byte[] testInitiateDeletionMsg = {0};
898 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
899 buffer.writeBytes(initiateDeletionMsg);
900
901 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
902 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530903
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530904
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530905 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530906
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700907 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530908
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530909 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530910
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530911 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530912
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530913 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530914
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530915 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530916 testInitiateDeletionMsg = new byte[iReadLen];
917 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
918
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530919 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530920 }
921
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530922 /**
923 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
924 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530925 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530926 @Test
927 public void initiateMessageTest21() throws PcepParseException {
928 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
929 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
930 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530931 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x94,
bharat saraswalf7364db2015-08-11 13:39:31 +0530932 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
933 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
934 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
935 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
936 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
937 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
938 0x07, 0x10, 0x00, 0x14, //ERO object
939 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
940 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
941 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
942 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
943 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
944 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
945 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
946 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
947 0x07, 0x10, 0x00, 0x14, //ERO object
948 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
949 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
950
951 byte[] testInitiateCreationMsg = {0};
952 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
953 buffer.writeBytes(initiateCreationMsg);
954
955 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
956 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530957
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530958
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530959 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530960
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700961 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530962
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530963 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530964
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530965 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530966
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530967 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530968
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530969 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530970 testInitiateCreationMsg = new byte[iReadLen];
971 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
972
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530973 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530974 }
975
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530976 /**
977 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
978 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530979 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530980 @Test
981 public void initiateMessageTest22() throws PcepParseException {
982 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
983 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
984 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530985 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8,
bharat saraswalf7364db2015-08-11 13:39:31 +0530986 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
987 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
988 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
989 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
990 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
991 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
992 0x07, 0x10, 0x00, 0x14, //ERO object
993 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
994 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
995 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
996 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
997 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
998 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
999 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1000 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1001 0x07, 0x10, 0x00, 0x14, //ERO object
1002 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1003 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1004 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1005 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1006
1007 byte[] testInitiateCreationMsg = {0};
1008 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1009 buffer.writeBytes(initiateCreationMsg);
1010
1011 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1012 PcepMessage message = null;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301013
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301014 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301015
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001016 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301017
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301018 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301019
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301020 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301021
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301022 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301023
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301024 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301025 testInitiateCreationMsg = new byte[iReadLen];
1026 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
bharat saraswalf7364db2015-08-11 13:39:31 +05301027
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301028 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301029 }
1030
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301031 /**
1032 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1033 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301034 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301035 @Test
1036 public void initiateMessageTest23() throws PcepParseException {
1037 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
1038 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1039 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301040 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xB0,
bharat saraswalf7364db2015-08-11 13:39:31 +05301041 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1042 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1043 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1044 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1045 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1046 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1047 0x07, 0x10, 0x00, 0x14, //ERO object
1048 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1049 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1050 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1051 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1052 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1053 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1054 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1055 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1056 0x07, 0x10, 0x00, 0x14, //ERO object
1057 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1058 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1059 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1060 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1061 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
1062
1063 byte[] testInitiateCreationMsg = {0};
1064 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1065 buffer.writeBytes(initiateCreationMsg);
1066
1067 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1068 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301069
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301070
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301071 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301072
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001073 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301074
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301075 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301076
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301077 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301078
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301079 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301080
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301081 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301082 testInitiateCreationMsg = new byte[iReadLen];
1083 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1084
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301085 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301086 }
1087
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301088 /**
1089 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1090 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301091 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301092 @Test
1093 public void initiateMessageTest24() throws PcepParseException {
1094 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
1095 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth*/
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301096 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xBC,
bharat saraswalf7364db2015-08-11 13:39:31 +05301097 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1098 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1099 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1100 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1101 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1102 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1103 0x07, 0x10, 0x00, 0x14, //ERO object
1104 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1105 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1106 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1107 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1108 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1109 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1110 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1111 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1112 0x07, 0x10, 0x00, 0x14, //ERO object
1113 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1114 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1115 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1117 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1118 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1119
1120 byte[] testInitiateCreationMsg = {0};
1121 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1122 buffer.writeBytes(initiateCreationMsg);
1123
1124 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1125 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301126
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301127
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301128 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301129
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001130 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301131
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301132 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301133
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301134 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301135
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301136 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301137
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301138 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301139 testInitiateCreationMsg = new byte[iReadLen];
1140 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1141
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301142 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301143 }
1144
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301145 /**
1146 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
1147 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1148 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301149 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301150 @Test
1151 public void initiateMessageTest25() throws PcepParseException {
1152
1153 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
1154 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1155 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301156 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xC4,
bharat saraswalf7364db2015-08-11 13:39:31 +05301157 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1158 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1159 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1160 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1161 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1162 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1163 0x07, 0x10, 0x00, 0x14, //ERO object
1164 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1165 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1166 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1167 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1168 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1169 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1170 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1171 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1172 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1173 0x07, 0x10, 0x00, 0x14, //ERO object
1174 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1175 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1176 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1177 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1178 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1179 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1180
1181 byte[] testInitiateCreationMsg = {0};
1182 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1183 buffer.writeBytes(initiateCreationMsg);
1184
1185 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1186 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301187
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301188
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301189 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301190
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001191 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301192
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301193 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301194
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301195 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301196
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301197 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301198
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301199 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301200 testInitiateCreationMsg = new byte[iReadLen];
1201 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1202
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301203 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301204 }
1205
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301206 /**
1207 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
1208 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1209 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301210 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301211 @Test
1212 public void initiateMessageTest26() throws PcepParseException {
1213
1214 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
1215 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1216 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301217 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xD0,
bharat saraswalf7364db2015-08-11 13:39:31 +05301218 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1219 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1220 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1221 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1222 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1223 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1224 0x07, 0x10, 0x00, 0x14, //ERO object
1225 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1226 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1227 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1228 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1229 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1230 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1231 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1232 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1233 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1234 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1235 0x07, 0x10, 0x00, 0x14, //ERO object
1236 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1237 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1238 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1239 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1240 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1241 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1242
1243 byte[] testInitiateCreationMsg = {0};
1244 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1245 buffer.writeBytes(initiateCreationMsg);
1246
1247 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1248 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301249
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301250
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301251 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301252
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001253 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301254
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301255 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301256
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301257 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301258
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301259 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301260
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301261 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301262 testInitiateCreationMsg = new byte[iReadLen];
1263 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1264
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301265 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301266 }
1267
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301268 /**
1269 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
1270 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1271 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301272 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301273 @Test
1274 public void initiateMessageTest27() throws PcepParseException {
1275
1276 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
1277 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1278 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301279 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xE4,
bharat saraswalf7364db2015-08-11 13:39:31 +05301280 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1281 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1282 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1283 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1284 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1285 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1286 0x07, 0x10, 0x00, 0x14, //ERO object
1287 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1288 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1289 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1290 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1291 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1292 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1293 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1294 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1295 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1296 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1297 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1298 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1299 0x07, 0x10, 0x00, 0x14, //ERO object
1300 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1301 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1302 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1303 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1304 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1305 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1306
1307 byte[] testInitiateCreationMsg = {0};
1308 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1309 buffer.writeBytes(initiateCreationMsg);
1310
1311 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1312 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301313
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301314
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301315 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301316
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001317 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301318
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301319 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301320
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301321 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301322
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301323 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301324
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301325 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301326 testInitiateCreationMsg = new byte[iReadLen];
1327 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1328
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301329 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301330 }
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301331}