blob: d42ca3cc121194310af7a377174c96c0349ad15a [file] [log] [blame]
bharat saraswalf7364db2015-08-11 13:39:31 +05301/*
2 * Copyright 2014-2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.pcepio;
17
Priyanka bhaskarda7506b2015-08-27 15:51:00 +053018import static org.hamcrest.core.Is.is;
19import static org.hamcrest.core.IsSame.sameInstance;
20
bharat saraswalf7364db2015-08-11 13:39:31 +053021import org.jboss.netty.buffer.ChannelBuffer;
22import org.jboss.netty.buffer.ChannelBuffers;
Priyanka bhaskarda7506b2015-08-27 15:51:00 +053023import static org.hamcrest.MatcherAssert.assertThat;
bharat saraswalf7364db2015-08-11 13:39:31 +053024import org.junit.Test;
25import org.onosproject.pcepio.exceptions.PcepParseException;
26import org.onosproject.pcepio.protocol.PcepFactories;
27import org.onosproject.pcepio.protocol.PcepMessage;
28import org.onosproject.pcepio.protocol.PcepMessageReader;
29import org.onosproject.pcepio.protocol.PcepUpdateMsg;
30
bharat saraswalf7364db2015-08-11 13:39:31 +053031/**
32 * Test cases for PCEP update message.
33 */
34public class PcepUpdateMsgTest2 {
35
Bharat saraswal7092b0e2015-08-24 19:40:59 +053036 /**
37 * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object,
38 * Metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +053039 */
bharat saraswalf7364db2015-08-11 13:39:31 +053040 @Test
41 public void pcepUpdateMsgTest1() throws PcepParseException {
42 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x8c,
43 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
44 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
45 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object
46 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
47 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
48 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
49 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
50 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
51 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
52 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
53 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
54 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
55 0x01, 0x01, 0x04, 0x00,
56 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
58 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
59 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object
60
61 byte[] testupdateMsg = {0};
62 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
63 buffer.writeBytes(updateMsg);
64
65 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
66 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053067
Bharat saraswal7092b0e2015-08-24 19:40:59 +053068 message = reader.readFrom(buffer);
Priyanka bhaskarda7506b2015-08-27 15:51:00 +053069 assertThat(message, sameInstance((PcepUpdateMsg) message));
bharat saraswalf7364db2015-08-11 13:39:31 +053070
Bharat saraswal7092b0e2015-08-24 19:40:59 +053071 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
72 message.writeTo(buf);
73 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +053074
Bharat saraswal7092b0e2015-08-24 19:40:59 +053075 int readLen = buf.writerIndex() - 0;
76 testupdateMsg = new byte[readLen];
77 buf.readBytes(testupdateMsg, 0, readLen);
78
Priyanka bhaskarda7506b2015-08-27 15:51:00 +053079 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +053080 }
81
Bharat saraswal7092b0e2015-08-24 19:40:59 +053082 /**
83 * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,
84 * LSPA, Bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +053085 */
bharat saraswalf7364db2015-08-11 13:39:31 +053086 @Test
87 public void pcepUpdateMsgTest2() throws PcepParseException {
88 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
89 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
90 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
91 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
92 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
93 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
94 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
95 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
96 0x01, 0x01, 0x04, 0x00,
97 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSP object
98 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
99 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
100 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object
101
102 byte[] testupdateMsg = {0};
103 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
104 buffer.writeBytes(updateMsg);
105
106 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
107 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530108
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530109 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530110
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530111 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530112 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
113 message.writeTo(buf);
114 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530115
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530116 int readLen = buf.writerIndex() - 0;
117 testupdateMsg = new byte[readLen];
118 buf.readBytes(testupdateMsg, 0, readLen);
119
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530120 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530121 }
122
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530123 /**
124 * This test case is for SRP object, LSP object, ERO object, LSPA, bandwidth object
125 * Metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530126 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530127 @Test
128 public void pcepUpdateMsgTest3() throws PcepParseException {
129 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
130 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
131 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object
132 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
133 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
134 0x01, 0x01, 0x04, 0x00,
135 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
136 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
137 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
138 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
139
140 byte[] testupdateMsg = {0};
141 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
142 buffer.writeBytes(updateMsg);
143
144 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
145 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530146
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530147 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530148
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530149 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530150 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
151 message.writeTo(buf);
152 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530153
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530154 int readLen = buf.writerIndex() - 0;
155 testupdateMsg = new byte[readLen];
156 buf.readBytes(testupdateMsg, 0, readLen);
157
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530158 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530159 }
160
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530161 /**
162 * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,bandwidth object
163 * Metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530164 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530165 @Test
166 public void pcepUpdateMsgTest4() throws PcepParseException {
167 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c,
168 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
169 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
170 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
171 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
172 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
173 0x01, 0x01, 0x04, 0x00,
174 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
175 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
176 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
177 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
178
179 byte[] testupdateMsg = {0};
180 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
181 buffer.writeBytes(updateMsg);
182
183 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
184 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530185
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530186 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530187
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530188 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530189 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
190 message.writeTo(buf);
191 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530192
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530193 int readLen = buf.writerIndex() - 0;
194 testupdateMsg = new byte[readLen];
195 buf.readBytes(testupdateMsg, 0, readLen);
196
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530197 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530198 }
199
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530200 /**
201 * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,bandwidth object
202 * Metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530203 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530204 @Test
205 public void pcepUpdateMsgTest5() throws PcepParseException {
206 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60,
207 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
208 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
209 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
210 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
211 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
212 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
213 0x01, 0x01, 0x04, 0x00,
214 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
216 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
217 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
218
219 byte[] testupdateMsg = {0};
220 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
221 buffer.writeBytes(updateMsg);
222
223 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
224 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530225
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530226 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530227
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530228 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530229 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
230 message.writeTo(buf);
231 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530232
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530233 int readLen = buf.writerIndex() - 0;
234 testupdateMsg = new byte[readLen];
235 buf.readBytes(testupdateMsg, 0, readLen);
236
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530237 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530238 }
239
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530240 /**
241 * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, LSPA, bandwidth object
242 * Metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530243 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530244 @Test
245 public void pcepUpdateMsgTest6() throws PcepParseException {
246 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c,
247 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
248 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
249 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
250 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
251 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
252 0x01, 0x01, 0x04, 0x00,
253 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
254 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
255 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
256 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
257
258 byte[] testupdateMsg = {0};
259 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
260 buffer.writeBytes(updateMsg);
261
262 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
263 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530264
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530265 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530266
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530267 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530268 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
269 message.writeTo(buf);
270 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530271
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530272 int readLen = buf.writerIndex() - 0;
273 testupdateMsg = new byte[readLen];
274 buf.readBytes(testupdateMsg, 0, readLen);
275
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530276 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530277 }
278
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530279 /**
280 * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,
281 * bandwidth object Metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530282 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530283 @Test
284 public void pcepUpdateMsgTest7() throws PcepParseException {
285 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64,
286 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
287 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
288 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
289 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
290 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
291 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
292 0x01, 0x01, 0x04, 0x00,
293 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
294 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
295 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
296 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
297
298 byte[] testupdateMsg = {0};
299 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
300 buffer.writeBytes(updateMsg);
301
302 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
303 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530304
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530305 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530306
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530307 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530308 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
309 message.writeTo(buf);
310 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530311
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530312 int readLen = buf.writerIndex() - 0;
313 testupdateMsg = new byte[readLen];
314 buf.readBytes(testupdateMsg, 0, readLen);
315
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530316 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530317 }
318
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530319 /**
320 * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA
321 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530322 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530323 @Test
324 public void pcepUpdateMsgTest8() throws PcepParseException {
325 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c,
326 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
327 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
328 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
329 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
330 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
331 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
332 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
333 0x01, 0x01, 0x04, 0x00,
334 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
335 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
336 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
337
338 byte[] testupdateMsg = {0};
339 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
340 buffer.writeBytes(updateMsg);
341
342 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
343 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530344
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530345 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530346
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530347 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530348 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
349 message.writeTo(buf);
350 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530351
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530352 int readLen = buf.writerIndex() - 0;
353 testupdateMsg = new byte[readLen];
354 buf.readBytes(testupdateMsg, 0, readLen);
355
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530356 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530357 }
358
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530359 /**
360 * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA
361 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530362 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530363 @Test
364 public void pcepUpdateMsgTest9() throws PcepParseException {
365 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58,
366 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
367 0x20, 0x10, 0x00, 0x18, 0x00, 0x00, 0x10, 0x03,
368 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv
369 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05,
370 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
371 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
372 0x01, 0x01, 0x04, 0x00,
373 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
374 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
375 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
376
377 byte[] testupdateMsg = {0};
378 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
379 buffer.writeBytes(updateMsg);
380
381 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
382 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530383
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530384 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530385
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530386 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530387 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
388 message.writeTo(buf);
389 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530390
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530391 int readLen = buf.writerIndex() - 0;
392 testupdateMsg = new byte[readLen];
393 buf.readBytes(testupdateMsg, 0, readLen);
394
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530395 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530396 }
397
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530398 /**
399 * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA
400 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530401 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530402 @Test
403 public void pcepUpdateMsgTest10() throws PcepParseException {
404 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50,
405 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
406 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
407 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
408 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
409 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
410 0x01, 0x01, 0x04, 0x00,
411 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPa object
412 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
413 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
414
415 byte[] testupdateMsg = {0};
416 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
417 buffer.writeBytes(updateMsg);
418
419 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
420 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530421
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530422 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530423
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530424 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530425 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
426 message.writeTo(buf);
427 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530428
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530429 int readLen = buf.writerIndex() - 0;
430 testupdateMsg = new byte[readLen];
431 buf.readBytes(testupdateMsg, 0, readLen);
432
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530433 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530434 }
435
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530436 /**
437 * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA
438 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530439 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530440 @Test
441 public void pcepUpdateMsgTest11() throws PcepParseException {
442 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
443 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
444 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
445 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
446 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
447 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
448 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
449 0x01, 0x01, 0x04, 0x00,
450 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
451 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
452 0x05, 0x20, 0x00, 0x04}; //Bandwidth object
453
454 byte[] testupdateMsg = {0};
455 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
456 buffer.writeBytes(updateMsg);
457
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530458 PcepFactories.getGenericReader();
bharat saraswalf7364db2015-08-11 13:39:31 +0530459 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530460
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530461 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530462 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
463 message.writeTo(buf);
464 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530465
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530466 int readLen = buf.writerIndex() - 0;
467 testupdateMsg = new byte[readLen];
468 buf.readBytes(testupdateMsg, 0, readLen);
bharat saraswalf7364db2015-08-11 13:39:31 +0530469
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530470 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530471 }
472
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530473 /**
474 * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA
475 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530476 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530477 @Test
478 public void pcepUpdateMsgTest12() throws PcepParseException {
479 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50,
480 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
481 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
482 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
483 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
484 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
485 0x01, 0x01, 0x04, 0x00,
486 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
487 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
488 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
489
490 byte[] testupdateMsg = {0};
491 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
492 buffer.writeBytes(updateMsg);
493
494 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
495 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530496
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530497 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530498
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530499 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530500 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
501 message.writeTo(buf);
502 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530503
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530504 int readLen = buf.writerIndex() - 0;
505 testupdateMsg = new byte[readLen];
506 buf.readBytes(testupdateMsg, 0, readLen);
507
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530508 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530509 }
510
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530511 /**
512 * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,LSPA
513 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530514 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530515 @Test
516 public void pcepUpdateMsgTest13() throws PcepParseException {
517 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58,
518 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
519 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
520 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
521 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
522 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
523 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
524 0x01, 0x01, 0x04, 0x00,
525 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
526 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
527 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
528
529 byte[] testupdateMsg = {0};
530 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
531 buffer.writeBytes(updateMsg);
532
533 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
534 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530535
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530536 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530537
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530538 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530539 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
540 message.writeTo(buf);
541 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530542
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530543 int readLen = buf.writerIndex() - 0;
544 testupdateMsg = new byte[readLen];
545 buf.readBytes(testupdateMsg, 0, readLen);
546
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530547 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530548 }
549
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530550 /**
551 * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA
552 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530553 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530554 @Test
555 public void pcepUpdateMsgTest14() throws PcepParseException {
556 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60,
557 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
558 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
559 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
560 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
561 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
562 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
563 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
564 0x01, 0x01, 0x04, 0x00,
565 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
566 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
567 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
568
569 byte[] testupdateMsg = {0};
570 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
571 buffer.writeBytes(updateMsg);
572
573 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
574 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530575
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530576 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530577
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530578 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530579 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
580 message.writeTo(buf);
581 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530582
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530583 int readLen = buf.writerIndex() - 0;
584 testupdateMsg = new byte[readLen];
585 buf.readBytes(testupdateMsg, 0, readLen);
586
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530587 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530588 }
589
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530590 /**
591 * This test case is for SRP object, LSP object, ERO object,LSPA
592 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530593 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530594 @Test
595 public void pcepUpdateMsgTest15() throws PcepParseException {
596 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
597 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
598 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object
599 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
600 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
601 0x01, 0x01, 0x04, 0x00,
602 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //lspa object
603 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
604 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
605
606 byte[] testupdateMsg = {0};
607 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
608 buffer.writeBytes(updateMsg);
609
610 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
611 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530612
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530613 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530614
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530615 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530616 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
617 message.writeTo(buf);
618 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530619
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530620 int readLen = buf.writerIndex() - 0;
621 testupdateMsg = new byte[readLen];
622 buf.readBytes(testupdateMsg, 0, readLen);
623
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530624 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530625 }
626
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530627 /**
628 * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,LSPA
629 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530630 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530631 @Test
632 public void pcepUpdateMsgTest16() throws PcepParseException {
633 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
634 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
635 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
636 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
637 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
638 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
639 0x01, 0x01, 0x04, 0x00,
640 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
641 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
642 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
643
644 byte[] testupdateMsg = {0};
645 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
646 buffer.writeBytes(updateMsg);
647
648 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
649 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530650
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530651 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530652
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530653 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530654 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
655 message.writeTo(buf);
656 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530657
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530658 int readLen = buf.writerIndex() - 0;
659 testupdateMsg = new byte[readLen];
660 buf.readBytes(testupdateMsg, 0, readLen);
661
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530662 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530663 }
664
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530665 /**
666 * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA
667 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530668 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530669 @Test
670 public void pcepUpdateMsgTest17() throws PcepParseException {
671 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58,
672 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
673 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
674 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
675 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
676 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
677 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
678 0x01, 0x01, 0x04, 0x00,
679 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
680 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
681 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
682
683 byte[] testupdateMsg = {0};
684 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
685 buffer.writeBytes(updateMsg);
686
687 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
688 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530689
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530690 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530691
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530692 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530693 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
694 message.writeTo(buf);
695 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530696
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530697 int readLen = buf.writerIndex() - 0;
698 testupdateMsg = new byte[readLen];
699 buf.readBytes(testupdateMsg, 0, readLen);
700
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530701 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530702 }
703
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530704 /**
705 * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA
706 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530707 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530708 @Test
709 public void pcepUpdateMsgTest18() throws PcepParseException {
710 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
711 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
712 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
713 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
714 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
715 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
716 0x01, 0x01, 0x04, 0x00,
717 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
718 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
719 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
720
721 byte[] testupdateMsg = {0};
722 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
723 buffer.writeBytes(updateMsg);
724
725 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
726 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530727
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530728 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530729
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530730 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530731 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
732 message.writeTo(buf);
733 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530734
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530735 int readLen = buf.writerIndex() - 0;
736 testupdateMsg = new byte[readLen];
737 buf.readBytes(testupdateMsg, 0, readLen);
738
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530739 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530740 }
741
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530742 /**
743 * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,
744 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530745 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530746 @Test
747 public void pcepUpdateMsgTest19() throws PcepParseException {
748 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c,
749 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
750 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
751 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
752 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
753 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
754 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
755 0x01, 0x01, 0x04, 0x00,
756 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
757 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
758 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
759
760 byte[] testupdateMsg = {0};
761 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
762 buffer.writeBytes(updateMsg);
763
764 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
765 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530766
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530767 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530768
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530769 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530770 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
771 message.writeTo(buf);
772 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530773
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530774 int readLen = buf.writerIndex() - 0;
775 testupdateMsg = new byte[readLen];
776 buf.readBytes(testupdateMsg, 0, readLen);
777
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530778 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530779 }
780
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530781 /**
782 * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,
783 * Bandwidth , metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530784 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530785 @Test
786 public void pcepUpdateMsgTest20() throws PcepParseException {
787 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
788 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
789 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
790 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
791 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
792 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
793 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
794 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
795 0x01, 0x01, 0x04, 0x00,
796 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
797 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
798
799 byte[] testupdateMsg = {0};
800 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
801 buffer.writeBytes(updateMsg);
802
803 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
804 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530805
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530806 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530807
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530808 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530809 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
810 message.writeTo(buf);
811 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530812
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530813 int readLen = buf.writerIndex() - 0;
814 testupdateMsg = new byte[readLen];
815 buf.readBytes(testupdateMsg, 0, readLen);
816
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530817 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530818 }
819
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530820 /**
821 * This test case is for SRP object, LSP object, ERO object,
822 * Bandwidth , metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530823 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530824 @Test
825 public void pcepUpdateMsgTest21() throws PcepParseException {
826 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
827 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
828 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object
829 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
830 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
831 0x01, 0x01, 0x04, 0x00,
832 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
833 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
834
835 byte[] testupdateMsg = {0};
836 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
837 buffer.writeBytes(updateMsg);
838
839 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
840 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530841
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530842 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530843
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530844 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530845 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
846 message.writeTo(buf);
847 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530848
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530849 int readLen = buf.writerIndex() - 0;
850 testupdateMsg = new byte[readLen];
851 buf.readBytes(testupdateMsg, 0, readLen);
852
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530853 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530854 }
855
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530856 /**
857 * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,
858 * Bandwidth , metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530859 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530860 @Test
861 public void pcepUpdateMsgTest22() throws PcepParseException {
862 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
863 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
864 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
865 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
866 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
867 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
868 0x01, 0x01, 0x04, 0x00,
869 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
870 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
871
872 byte[] testupdateMsg = {0};
873 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
874 buffer.writeBytes(updateMsg);
875
876 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
877 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530878
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530879 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530880
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530881 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530882 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
883 message.writeTo(buf);
884 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530885
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530886 int readLen = buf.writerIndex() - 0;
887 testupdateMsg = new byte[readLen];
888 buf.readBytes(testupdateMsg, 0, readLen);
889
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530890 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530891 }
892
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530893 /**
894 * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,
895 * Bandwidth , metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530896 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530897 @Test
898 public void pcepUpdateMsgTest23() throws PcepParseException {
899 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
900 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
901 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
902 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
903 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
904 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
905 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
906 0x01, 0x01, 0x04, 0x00,
907 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
908 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
909
910 byte[] testupdateMsg = {0};
911 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
912 buffer.writeBytes(updateMsg);
913
914 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
915 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530916
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530917 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530918
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530919 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530920 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
921 message.writeTo(buf);
922 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530923
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530924 int readLen = buf.writerIndex() - 0;
925 testupdateMsg = new byte[readLen];
926 buf.readBytes(testupdateMsg, 0, readLen);
927
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530928 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530929 }
930
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530931 /**
932 * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,
933 * Bandwidth , metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530934 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530935 @Test
936 public void pcepUpdateMsgTest24() throws PcepParseException {
937 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
938 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
939 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
940 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
941 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
942 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
943 0x01, 0x01, 0x04, 0x00,
944 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
945 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
946
947 byte[] testupdateMsg = {0};
948 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
949 buffer.writeBytes(updateMsg);
950
951 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
952 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530953
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530954 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530955
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530956 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530957 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
958 message.writeTo(buf);
959 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530960
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530961 int readLen = buf.writerIndex() - 0;
962 testupdateMsg = new byte[readLen];
963 buf.readBytes(testupdateMsg, 0, readLen);
964
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530965 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530966 }
967
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530968 /**
969 * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,
970 * Bandwidth , metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530971 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530972 @Test
973 public void pcepUpdateMsgTest25() throws PcepParseException {
974 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50,
975 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
976 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
977 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
978 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
979 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
980 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
981 0x01, 0x01, 0x04, 0x00,
982 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
983 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
984
985 byte[] testupdateMsg = {0};
986 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
987 buffer.writeBytes(updateMsg);
988
989 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
990 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530991
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530992 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530993
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530994 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530995 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
996 message.writeTo(buf);
997 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530998
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530999 int readLen = buf.writerIndex() - 0;
1000 testupdateMsg = new byte[readLen];
1001 buf.readBytes(testupdateMsg, 0, readLen);
1002
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301003 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301004 }
1005
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301006 /**
1007 * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,
1008 * LSPA object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301009 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301010 @Test
1011 public void pcepUpdateMsgTest26() throws PcepParseException {
1012 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
1013 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1014 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
1015 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1016 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1017 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1018 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
1019 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1020 0x01, 0x01, 0x04, 0x00,
1021 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1022 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
1023
1024 byte[] testupdateMsg = {0};
1025 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1026 buffer.writeBytes(updateMsg);
1027
1028 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1029 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301030
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301031 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301032
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301033 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301034 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1035 message.writeTo(buf);
1036 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301037
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301038 int readLen = buf.writerIndex() - 0;
1039 testupdateMsg = new byte[readLen];
1040 buf.readBytes(testupdateMsg, 0, readLen);
1041
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301042 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301043 }
1044
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301045 /**
1046 * This test case is for SRP object, LSP object, ERO object,
1047 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301048 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301049 @Test
1050 public void pcepUpdateMsgTest27() throws PcepParseException {
1051 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x34,
1052 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1053 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object
1054 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
1055 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1056 0x01, 0x01, 0x04, 0x00,
1057 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
1058
1059 byte[] testupdateMsg = {0};
1060 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1061 buffer.writeBytes(updateMsg);
1062
1063 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1064 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301065
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301066 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301067
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301068 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301069 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1070 message.writeTo(buf);
1071 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301072
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301073 int readLen = buf.writerIndex() - 0;
1074 testupdateMsg = new byte[readLen];
1075 buf.readBytes(testupdateMsg, 0, readLen);
1076
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301077 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301078 }
1079
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301080 /**
1081 * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,
1082 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301083 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301084 @Test
1085 public void pcepUpdateMsgTest28() throws PcepParseException {
1086 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
1087 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1088 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1089 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
1090 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
1091 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1092 0x01, 0x01, 0x04, 0x00,
1093 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1094
1095 byte[] testupdateMsg = {0};
1096 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1097 buffer.writeBytes(updateMsg);
1098
1099 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1100 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301101
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301102 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301103
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301104 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301105 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1106 message.writeTo(buf);
1107 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301108
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301109 int readLen = buf.writerIndex() - 0;
1110 testupdateMsg = new byte[readLen];
1111 buf.readBytes(testupdateMsg, 0, readLen);
1112
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301113 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301114 }
1115
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301116 /**
1117 * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object,
1118 * lspa object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301119 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301120 @Test
1121 public void pcepUpdateMsgTest29() throws PcepParseException {
1122 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
1123 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1124 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1125 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1126 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1127 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1128 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
1129 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1130 0x01, 0x01, 0x04, 0x00,
1131 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1132 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
1133
1134 byte[] testupdateMsg = {0};
1135 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1136 buffer.writeBytes(updateMsg);
1137
1138 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1139 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301140
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301141 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301142
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301143 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301144 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1145 message.writeTo(buf);
1146 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301147
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301148 int readLen = buf.writerIndex() - 0;
1149 testupdateMsg = new byte[readLen];
1150 buf.readBytes(testupdateMsg, 0, readLen);
1151
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301152 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301153 }
1154
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301155 /**
1156 * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object,
1157 * bandwidth object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301158 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301159 @Test
1160 public void pcepUpdateMsgTest30() throws PcepParseException {
1161 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
1162 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1163 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1164 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1165 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1166 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1167 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
1168 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1169 0x01, 0x01, 0x04, 0x00,
1170 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
1171
1172 byte[] testupdateMsg = {0};
1173 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1174 buffer.writeBytes(updateMsg);
1175
1176 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1177 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301178
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301179 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301180
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301181 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301182 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1183 message.writeTo(buf);
1184 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301185
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301186 int readLen = buf.writerIndex() - 0;
1187 testupdateMsg = new byte[readLen];
1188 buf.readBytes(testupdateMsg, 0, readLen);
1189
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301190 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301191 }
1192
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301193 /**
1194 * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object,
1195 * metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301196 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301197 @Test
1198 public void pcepUpdateMsgTest31() throws PcepParseException {
1199 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
1200 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1201 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1202 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1203 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1205 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
1206 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1207 0x01, 0x01, 0x04, 0x00,
1208 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1209
1210 byte[] testupdateMsg = {0};
1211 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1212 buffer.writeBytes(updateMsg);
1213
1214 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1215 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301216
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301217 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301218
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301219 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301220 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1221 message.writeTo(buf);
1222 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301223
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301224 int readLen = buf.writerIndex() - 0;
1225 testupdateMsg = new byte[readLen];
1226 buf.readBytes(testupdateMsg, 0, readLen);
1227
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301228 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301229 }
1230
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301231 /**
1232 * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object,
1233 * Metric object in PcepUpdate message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301234 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301235 @Test
1236 public void pcepUpdateMsgTest32() throws PcepParseException {
1237 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64,
1238 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1239 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1240 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object
1241 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv
1242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02,
1243 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object
1244 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1245 0x01, 0x01, 0x04, 0x00,
1246 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1247 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
1248 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1249
1250 byte[] testupdateMsg = {0};
1251 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1252 buffer.writeBytes(updateMsg);
1253
1254 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1255 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301256
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301257 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301258
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301259 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301260 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1261 message.writeTo(buf);
1262 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301263
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301264 int readLen = buf.writerIndex() - 0;
1265 testupdateMsg = new byte[readLen];
1266 buf.readBytes(testupdateMsg, 0, readLen);
1267
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301268 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301269 }
1270}
1271