blob: 836b0297e896185b7bcd1b8bdfc7769c7681bfdd [file] [log] [blame]
bharat saraswalf7364db2015-08-11 13:39:31 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
bharat saraswalf7364db2015-08-11 13:39:31 +05303 *
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;
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +053021import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException;
bharat saraswalf7364db2015-08-11 13:39:31 +053022import org.onosproject.pcepio.exceptions.PcepParseException;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053023
24import static org.hamcrest.MatcherAssert.assertThat;
Sho SHIMIZUe090a422015-09-04 17:35:49 -070025import static org.hamcrest.Matchers.instanceOf;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053026import static org.hamcrest.core.Is.is;
bharat saraswalf7364db2015-08-11 13:39:31 +053027
28public class PcepInitiateMsgTest {
29
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053030 /**
31 * This test case checks for srp, lsp, end-point, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053032 */
bharat saraswalf7364db2015-08-11 13:39:31 +053033 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +053034 public void initiateMessageTest1() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +053035
36 /* srp, lsp, end-point, ERO.
37 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053038 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, 0x54,
bharat saraswalf7364db2015-08-11 13:39:31 +053039 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object
40 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x08, //LSP object
41 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
42 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
43 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02,
44 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathTlv
45 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
46 0x07, 0x10, 0x00, 0x14, //ERO object
47 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
48 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
49
50 byte[] testInitiateCreationMsg = {0};
51 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
52 buffer.writeBytes(initiateCreationMsg);
53
54 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
55 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053056
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053057
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053058 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +053059
Sho SHIMIZUe090a422015-09-04 17:35:49 -070060 assertThat(message, instanceOf(PcepInitiateMsg.class));
bharat saraswalf7364db2015-08-11 13:39:31 +053061
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053062 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053063
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053064 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053065
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053066 testInitiateCreationMsg = buf.array();
67
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053068 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053069 testInitiateCreationMsg = new byte[iReadLen];
70 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
71
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053072 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +053073 }
74
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053075 /**
76 * This test case checks for srp and lsp objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053077 */
bharat saraswalf7364db2015-08-11 13:39:31 +053078 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +053079 public void initiateMessageTest2() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +053080 /* srp, lsp.
81 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053082 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
bharat saraswalf7364db2015-08-11 13:39:31 +053083 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
84 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x20, 0x10, //LSP object
85 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
86 0x01, 0x01, 0x01, 0x01, 0x00, 0x43, (byte) 0x83, 0x01,
87 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +053088 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33}; //SymbolicPathTlv
bharat saraswalf7364db2015-08-11 13:39:31 +053089
90 byte[] testInitiateDeletionMsg = {0};
91 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
92 buffer.writeBytes(initiateDeletionMsg);
93
94 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
95 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053096
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +053097 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +053098
Sho SHIMIZUe090a422015-09-04 17:35:49 -070099 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530100
bharat saraswalf7364db2015-08-11 13:39:31 +0530101
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530102 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
103 message.writeTo(buf);
104 testInitiateDeletionMsg = buf.array();
105
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530106 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530107 testInitiateDeletionMsg = new byte[iReadLen];
108 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
109
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530110 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530111 }
112
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530113 /**
114 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
115 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO objects
116 * in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530117 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530118 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530119 public void initiateMessageTest3() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530120
121 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
122 * StatefulLspErrorCodeTlv, StatefulRsvpErrorSpecTlv), END-POINTS, ERO.
123 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530124 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530125 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530126 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530127 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
128 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
129 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
130 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
131 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
132 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
133 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
134 0x07, 0x10, 0x00, 0x14, //ERO object
135 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
136 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
137
138 byte[] testInitiateCreationMsg = {0};
139 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
140 buffer.writeBytes(initiateCreationMsg);
141
142 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
143 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530144
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530145 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530146
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700147 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530148
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530149 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530150
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530151 message.writeTo(buf);
152 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530153
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530154 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530155 testInitiateCreationMsg = new byte[iReadLen];
156 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
157
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530158 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530159 }
160
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530161 /**
162 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
163 * StatefulLspErrorCodeTlv), END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530164 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530165 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530166 public void initiateMessageTest4() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530167
168 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
169 * StatefulLspErrorCodeTlv), END-POINT, ERO.
170 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530171 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530172 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530173 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530174 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
175 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
176 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
177 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530178 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530179 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
180 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
181 0x07, 0x10, 0x00, 0x14, //ERO object
182 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
183 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
184
185 byte[] testInitiateCreationMsg = {0};
186 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
187 buffer.writeBytes(initiateCreationMsg);
188
189 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
190 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530191
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530192 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530193
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700194 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530195
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530196 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
197 message.writeTo(buf);
198 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530199
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530200 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530201 testInitiateCreationMsg = new byte[iReadLen];
202 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
203
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530204 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530205 }
206
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530207 /**
208 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
209 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530210 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530211 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530212 public void initiateMessageTest5() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530213
214 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
215 * END-POINT, ERO.
216 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530217 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530218 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530219 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530220 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
221 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
222 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
223 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530224 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530225 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
226 0x07, 0x10, 0x00, 0x14, //ERO object
227 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530228 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
bharat saraswalf7364db2015-08-11 13:39:31 +0530229
230 byte[] testInitiateCreationMsg = {0};
231 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
232 buffer.writeBytes(initiateCreationMsg);
233
234 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
235 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530236
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530237 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530238
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700239 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530240
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530241 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530242
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530243 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530244
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530245 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530246
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530247 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530248 testInitiateCreationMsg = new byte[iReadLen];
249 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
250
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530251 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530252 }
253
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530254 /**
255 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
256 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530257 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530258 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530259 public void initiateMessageTest6() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530260
261 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
262 * END-POINT, ERO.
263 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530264 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x5c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530265 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530266 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530267 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03,
268 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
269 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
270 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530271 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530272 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
273 0x07, 0x10, 0x00, 0x14, //ERO object
274 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530275 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
bharat saraswalf7364db2015-08-11 13:39:31 +0530276
277 byte[] testInitiateCreationMsg = {0};
278 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
279 buffer.writeBytes(initiateCreationMsg);
280
281 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
282 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530283
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530284
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530285 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530286
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700287 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530288
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530289 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530290
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530291 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530292
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530293 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530294
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530295 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530296 testInitiateCreationMsg = new byte[iReadLen];
297 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
298
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530299 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530300 }
301
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530302 /**
303 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
304 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530305 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530306 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530307 public void initiateMessageTest7() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530308
309 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
310 * END-POINT, ERO.
311 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530312 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x54,
bharat saraswalf7364db2015-08-11 13:39:31 +0530313 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530314 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530315 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
316 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
317 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
318 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
319 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
320 0x07, 0x10, 0x00, 0x14, //ERO object
321 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
322 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
323
324 byte[] testInitiateCreationMsg = {0};
325 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
326 buffer.writeBytes(initiateCreationMsg);
327
328 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
329 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530330
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530331
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530332 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530333
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700334 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530335
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530336 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530337
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530338 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530339
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530340 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530341
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530342 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530343 testInitiateCreationMsg = new byte[iReadLen];
344 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
345
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530346 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530347 }
348
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530349 /**
350 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
351 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530352 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530353 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530354 public void initiateMessageTest8() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530355
356 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
357 * END-POINT, ERO.
358 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530359 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x4c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530360 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
361 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
362 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
363 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
364 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
365 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
366 0x07, 0x10, 0x00, 0x14, //ERO object
367 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
368 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
369
370 byte[] testInitiateCreationMsg = {0};
371 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
372 buffer.writeBytes(initiateCreationMsg);
373
374 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
375 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530376
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530377
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530378 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530379
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700380 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530381
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530382 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530383
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530384 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530385
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530386 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530387
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530388 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530389 testInitiateCreationMsg = new byte[iReadLen];
390 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
391
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530392 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530393 }
394
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530395 /**
396 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
397 * END-POINT, ERO objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530398 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530399 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530400 public void initiateMessageTest9() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530401
402 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv),
403 * END-POINT, ERO.
404 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530405 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530406 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
407 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
408 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
409 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
410 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
411 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
412 0x07, 0x10, 0x00, 0x04};
413
414 byte[] testInitiateCreationMsg = {0};
415 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
416 buffer.writeBytes(initiateCreationMsg);
417
418 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
419 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530420
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530421
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530422 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530423
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700424 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530425
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530426 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530427
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530428 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530429
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530430 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530431
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530432 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530433 testInitiateCreationMsg = new byte[iReadLen];
434 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
435
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530436 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530437 }
438
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530439 /**
440 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv)
441 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530442 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530443 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530444 public void initiateMessageTest10() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530445
446 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, StatefulRsvpErrorSpecTlv).
447 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530448 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
bharat saraswalf7364db2015-08-11 13:39:31 +0530449 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
450 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
451 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
452 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
453 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f,
454 (byte) 0xb6, 0x02, 0x4e, 0x20, 0x00, 0x11, 0x00, 0x04, 0x54, 0x31, 0x32, 0x33, //SymbolicPathNameTlv
455 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08 //StatefulLspErrorCodeTlv
456 };
457
458 byte[] testInitiateDeletionMsg = {0};
459 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
460 buffer.writeBytes(initiateDeletionMsg);
461
462 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
463 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530464
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530465
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530466 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530467
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700468 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530469
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530470 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530471
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530472 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530473
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530474 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530475
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530476 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530477 testInitiateDeletionMsg = new byte[iReadLen];
478 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
479
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530480 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530481 }
482
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530483 /**
484 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
485 * StatefulLspErrorCodeTlv) objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530486 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530487 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530488 public void initiateMessageTest11() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530489
490 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
491 StatefulLspErrorCodeTlv).*/
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530492 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x44,
bharat saraswalf7364db2015-08-11 13:39:31 +0530493 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
494 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
495 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
496 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
497 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
498 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
499 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
500 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08}; //StatefulLspErrorCodeTlv
501
502 byte[] testInitiateDeletionMsg = {0};
503 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
504 buffer.writeBytes(initiateDeletionMsg);
505
506 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
507 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530508
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530509
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530510 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530511
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700512 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530513
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530514 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530515
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530516 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530517
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530518 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530519
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530520 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530521 testInitiateDeletionMsg = new byte[iReadLen];
522 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
523
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530524 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530525 }
526
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530527 /**
528 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
529 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530530 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530531 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530532 public void initiateMessageTest12() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530533
534 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
535 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530536 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530537 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
538 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
539 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
540 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
541 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
542 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00 //SymbolicPathNameTlv
543 };
544
545 byte[] testInitiateDeletionMsg = {0};
546 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
547 buffer.writeBytes(initiateDeletionMsg);
548
549 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
550 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530551
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530552
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530553 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530554
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700555 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530556
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530557 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530558
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530559 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530560
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530561 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530562
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530563 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530564 testInitiateDeletionMsg = new byte[iReadLen];
565 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
566
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530567 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530568 }
569
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530570 /**
571 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
572 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530573 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530574 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530575 public void initiateMessageTest13() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530576
577 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv).
578 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530579 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x3c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530580 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
581 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
582 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
583 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
584 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530585 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00}; //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530586
587 byte[] testInitiateDeletionMsg = {0};
588 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
589 buffer.writeBytes(initiateDeletionMsg);
590
591 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
592 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530593
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530594
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530595 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530596
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700597 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530598
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530599 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530600
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530601 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530602
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530603 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530604
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530605 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530606 testInitiateDeletionMsg = new byte[iReadLen];
607 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
608
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530609 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530610 }
611
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530612 /**
613 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv)
614 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530615 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530616 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530617 public void initiateMessageTest14() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530618
619 /* SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
620 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530621 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x34,
bharat saraswalf7364db2015-08-11 13:39:31 +0530622 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
623 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
624 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
625 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
626 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530627 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
bharat saraswalf7364db2015-08-11 13:39:31 +0530628
629 byte[] testInitiateDeletionMsg = {0};
630 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
631 buffer.writeBytes(initiateDeletionMsg);
632
633 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
634 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530635
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530636
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530637 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530638
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700639 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530640
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530641 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530642
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530643 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530644
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530645 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530646
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530647 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530648 testInitiateDeletionMsg = new byte[iReadLen];
649 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
650
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530651 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530652 }
653
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530654 /**
655 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv)
656 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530657 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530658 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530659 public void initiateMessageTest15() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530660
661 /* SRP, LSP (StatefulIPv4LspIdentidiersTlv).
662 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530663 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x2c,
bharat saraswalf7364db2015-08-11 13:39:31 +0530664 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
665 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
666 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
667 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
668 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
669
670 byte[] testInitiateDeletionMsg = {0};
671 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
672 buffer.writeBytes(initiateDeletionMsg);
673
674 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
675 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530676
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530677
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530678 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530679
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700680 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530681
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530682 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530683
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530684 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530685
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530686 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530687
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530688 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530689 testInitiateDeletionMsg = new byte[iReadLen];
690 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
691
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530692 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530693 }
694
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530695 /**
696 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
697 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530698 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530699 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530700 public void initiateMessageTest16() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530701
702 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530703 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x50,
bharat saraswalf7364db2015-08-11 13:39:31 +0530704 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
705 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
706 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
707 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
708 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
709 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
710 0x07, 0x10, 0x00, 0x04, //ERO object
711 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
712 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
713
714 byte[] testInitiateCreationMsg = {0};
715 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
716 buffer.writeBytes(initiateCreationMsg);
717
718 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
719 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530720
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530721
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530722 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530723
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700724 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530725
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530726 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530727
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530728 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530729
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530730 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530731
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530732 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530733 testInitiateCreationMsg = new byte[iReadLen];
734 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
735
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530736 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530737 }
738
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530739 /**
740 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
741 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530742 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530743 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530744 public void initiateMessageTest17() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530745
746 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530747 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x58,
bharat saraswalf7364db2015-08-11 13:39:31 +0530748 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
749 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
750 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
751 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
752 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
753 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
754 0x07, 0x10, 0x00, 0x04, //ERO object
755 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
756 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
757 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
758
759 byte[] testInitiateCreationMsg = {0};
760 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
761 buffer.writeBytes(initiateCreationMsg);
762
763 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
764 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530765
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530766
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530767 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530768
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700769 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530770
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530771 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530772
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530773 message.writeTo(buf);
774 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530775
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530776 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530777 testInitiateCreationMsg = new byte[iReadLen];
778 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
779
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530780 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530781 }
782
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530783 /**
784 * This test case checks for srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
785 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530786 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530787 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530788 public void initiateMessageTest18() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530789 //srp,lsp (StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530790 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530791 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
792 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
793 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
794 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
795 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
796 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
797 0x07, 0x10, 0x00, 0x04, //ERO object
798 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
799 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
800 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
801 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
802
803 byte[] testInitiateCreationMsg = {0};
804 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
805 buffer.writeBytes(initiateCreationMsg);
806
807 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
808 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530809
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530810
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530811 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530812
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700813 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530814
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530815 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530816
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530817 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530818
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530819 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530820
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530821 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530822 testInitiateCreationMsg = new byte[iReadLen];
823 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
824
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530825 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530826 }
827
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530828 /**
829 * This test case checks for srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
830 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530831 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530832 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530833 public void initiateMessageTest19() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530834 //srp,lsp(all tlvs),end-point,ero,lspa,bandwidth,metric-list
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530835 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x74,
bharat saraswalf7364db2015-08-11 13:39:31 +0530836 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
837 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
838 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
839 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
840 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
841 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathTlv
842 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08,
843 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
844 0x07, 0x10, 0x00, 0x04, //ERO object
845 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
846 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
847 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
848 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
849
850 byte[] testInitiateCreationMsg = {0};
851 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
852 buffer.writeBytes(initiateCreationMsg);
853
854 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
855 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530856
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530857
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530858 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530859
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700860 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530861
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530862 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530863
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530864 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530865
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530866 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530867
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530868 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530869 testInitiateCreationMsg = new byte[iReadLen];
870 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
871
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530872 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530873 }
874
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530875 /**
876 * This test case checks for srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
877 * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv) objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530878 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530879 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530880 public void initiateMessageTest20() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530881 /* srp,lsp (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, srp,
882 * lsp(SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv).
883 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530884 byte[] initiateDeletionMsg = new byte[]{0x20, 0x0C, 0x00, 0x64,
bharat saraswalf7364db2015-08-11 13:39:31 +0530885 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530886 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530887 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
888 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
889 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
890 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
891 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, //SRP object
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530892 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
bharat saraswalf7364db2015-08-11 13:39:31 +0530893 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
894 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
895 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
896 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20};
897
898 byte[] testInitiateDeletionMsg = {0};
899 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
900 buffer.writeBytes(initiateDeletionMsg);
901
902 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
903 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530904
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530905
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530906 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530907
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700908 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530909
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530910 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530911
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530912 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530913
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530914 testInitiateDeletionMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530915
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530916 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530917 testInitiateDeletionMsg = new byte[iReadLen];
918 buf.readBytes(testInitiateDeletionMsg, 0, iReadLen);
919
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530920 assertThat(testInitiateDeletionMsg, is(initiateDeletionMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530921 }
922
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530923 /**
924 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
925 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530926 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530927 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530928 public void initiateMessageTest21() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530929 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
930 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero
931 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530932 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0x94,
bharat saraswalf7364db2015-08-11 13:39:31 +0530933 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
934 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
935 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
936 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
937 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
938 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
939 0x07, 0x10, 0x00, 0x14, //ERO object
940 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
941 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
942 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
943 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
944 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
945 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
946 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
947 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
948 0x07, 0x10, 0x00, 0x14, //ERO object
949 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
950 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00};
951
952 byte[] testInitiateCreationMsg = {0};
953 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
954 buffer.writeBytes(initiateCreationMsg);
955
956 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
957 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530958
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530959
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530960 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530961
Sho SHIMIZUe090a422015-09-04 17:35:49 -0700962 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530963
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530964 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530965
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530966 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530967
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530968 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530969
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530970 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530971 testInitiateCreationMsg = new byte[iReadLen];
972 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
973
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530974 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530975 }
976
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530977 /**
978 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
979 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +0530980 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530981 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +0530982 public void initiateMessageTest22() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +0530983 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
984 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa
985 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +0530986 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xA8,
bharat saraswalf7364db2015-08-11 13:39:31 +0530987 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
988 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
989 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
990 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
991 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
992 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
993 0x07, 0x10, 0x00, 0x14, //ERO object
994 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
995 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
996 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
997 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
998 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
999 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1000 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1001 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1002 0x07, 0x10, 0x00, 0x14, //ERO object
1003 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1004 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1005 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1006 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
1007
1008 byte[] testInitiateCreationMsg = {0};
1009 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1010 buffer.writeBytes(initiateCreationMsg);
1011
1012 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1013 PcepMessage message = null;
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301014
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301015 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301016
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001017 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301018
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301019 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301020
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301021 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301022
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301023 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301024
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301025 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301026 testInitiateCreationMsg = new byte[iReadLen];
1027 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
bharat saraswalf7364db2015-08-11 13:39:31 +05301028
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301029 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301030 }
1031
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301032 /**
1033 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1034 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301035 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301036 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05301037 public void initiateMessageTest23() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +05301038 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
1039 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1040 */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301041 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xB0,
bharat saraswalf7364db2015-08-11 13:39:31 +05301042 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1043 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1044 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1045 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1046 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1047 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1048 0x07, 0x10, 0x00, 0x14, //ERO object
1049 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1050 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1051 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1052 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1053 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1054 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1055 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1056 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1057 0x07, 0x10, 0x00, 0x14, //ERO object
1058 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1059 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1060 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1061 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1062 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object
1063
1064 byte[] testInitiateCreationMsg = {0};
1065 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1066 buffer.writeBytes(initiateCreationMsg);
1067
1068 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1069 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301070
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301071
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301072 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301073
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001074 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301075
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301076 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301077
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301078 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301079
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301080 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301081
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301082 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301083 testInitiateCreationMsg = new byte[iReadLen];
1084 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1085
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301086 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301087 }
1088
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301089 /**
1090 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth
1091 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301092 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301093 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05301094 public void initiateMessageTest24() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +05301095 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,
1096 * srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth*/
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301097 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xBC,
bharat saraswalf7364db2015-08-11 13:39:31 +05301098 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1099 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1100 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1101 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1102 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1103 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1104 0x07, 0x10, 0x00, 0x14, //ERO object
1105 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1106 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1107 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1108 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1109 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1110 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1111 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1112 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1113 0x07, 0x10, 0x00, 0x14, //ERO object
1114 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1115 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1116 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1117 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1118 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1119 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1120
1121 byte[] testInitiateCreationMsg = {0};
1122 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1123 buffer.writeBytes(initiateCreationMsg);
1124
1125 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1126 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301127
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301128
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301129 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301130
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001131 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301132
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301133 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301134
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301135 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301136
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301137 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301138
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301139 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301140 testInitiateCreationMsg = new byte[iReadLen];
1141 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1142
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301143 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301144 }
1145
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301146 /**
1147 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
1148 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1149 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301150 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301151 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05301152 public void initiateMessageTest25() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +05301153
1154 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,
1155 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1156 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301157 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xC4,
bharat saraswalf7364db2015-08-11 13:39:31 +05301158 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1159 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1160 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1161 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1162 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1163 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1164 0x07, 0x10, 0x00, 0x14, //ERO object
1165 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1166 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1167 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1168 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1169 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1170 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1171 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1172 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1173 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1174 0x07, 0x10, 0x00, 0x14, //ERO object
1175 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1176 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1177 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1178 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1179 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1180 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1181
1182 byte[] testInitiateCreationMsg = {0};
1183 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1184 buffer.writeBytes(initiateCreationMsg);
1185
1186 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1187 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301188
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301189
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301190 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301191
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001192 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301193
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301194 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301195
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301196 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301197
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301198 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301199
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301200 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301201 testInitiateCreationMsg = new byte[iReadLen];
1202 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1203
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301204 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301205 }
1206
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301207 /**
1208 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
1209 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1210 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301211 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301212 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05301213 public void initiateMessageTest26() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +05301214
1215 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,bandwidth,metric-list,
1216 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1217 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301218 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xD0,
bharat saraswalf7364db2015-08-11 13:39:31 +05301219 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1220 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1221 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1222 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1223 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1224 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1225 0x07, 0x10, 0x00, 0x14, //ERO object
1226 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1227 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1228 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1229 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1230 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1231 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1232 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1233 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1234 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1235 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1236 0x07, 0x10, 0x00, 0x14, //ERO object
1237 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1238 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1239 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1240 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1241 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1242 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1243
1244 byte[] testInitiateCreationMsg = {0};
1245 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1246 buffer.writeBytes(initiateCreationMsg);
1247
1248 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1249 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301250
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301251
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301252 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301253
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001254 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301255
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301256 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301257
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301258 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301259
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301260 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301261
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301262 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301263 testInitiateCreationMsg = new byte[iReadLen];
1264 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1265
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301266 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301267 }
1268
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301269 /**
1270 * This test case checks for srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
1271 * srp,lsp(StatefulIPv4LspIdentidiersTlv), end-point,ero,lspa,bandwidth,metric-list
1272 * objects in PcInitiate message.
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301273 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301274 @Test
Mahesh Poojary Sf1bbd362016-02-25 18:19:59 +05301275 public void initiateMessageTest27() throws PcepParseException, PcepOutOfBoundMessageException {
bharat saraswalf7364db2015-08-11 13:39:31 +05301276
1277 /*srp,lsp(StatefulIPv4LspIdentidiersTlv),end-point,ero,lspa,bandwidth,metric-list,
1278 * srp,lsp(StatefulIPv4LspIdentidiersTlv),
1279 * end-point,ero,lspa,bandwidth,metric-list */
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301280 byte[] initiateCreationMsg = new byte[]{0x20, 0x0C, 0x00, (byte) 0xE4,
bharat saraswalf7364db2015-08-11 13:39:31 +05301281 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1282 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1283 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1284 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1285 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1286 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1287 0x07, 0x10, 0x00, 0x14, //ERO object
1288 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1289 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1290 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1292 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1293 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1294 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1295 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP object
1296 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1297 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1298 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1299 0x04, 0x12, 0x00, 0x0C, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, //Endpoints Object
1300 0x07, 0x10, 0x00, 0x14, //ERO object
1301 0x01, 0x08, 0x0C, 0x01, 0x01, 0x01, 0x00, 0x00,
1302 0x01, 0x08, 0x0C, 0x01, 0x01, 0x02, 0x00, 0x00,
1303 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1304 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1305 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1306 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1307
1308 byte[] testInitiateCreationMsg = {0};
1309 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1310 buffer.writeBytes(initiateCreationMsg);
1311
1312 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1313 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301314
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301315
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301316 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301317
Sho SHIMIZUe090a422015-09-04 17:35:49 -07001318 assertThat(message, instanceOf(PcepInitiateMsg.class));
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301319
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301320 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301321
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301322 message.writeTo(buf);
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301323
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301324 testInitiateCreationMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301325
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301326 int iReadLen = buf.writerIndex();
Phaneendra Mandaeb63bea2015-08-24 19:02:19 +05301327 testInitiateCreationMsg = new byte[iReadLen];
1328 buf.readBytes(testInitiateCreationMsg, 0, iReadLen);
1329
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301330 assertThat(testInitiateCreationMsg, is(initiateCreationMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301331 }
Priyanka bhaskarf6d16762015-08-27 15:08:47 +05301332}