blob: 8e9afee723e53ededa34f55109c21377471aab9c [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 +053031public class PcepUpdateMsgTest {
Bharat saraswal7092b0e2015-08-24 19:40:59 +053032 /**
33 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv), ERO in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +053034 */
bharat saraswalf7364db2015-08-11 13:39:31 +053035 @Test
36 public void pcepUpdateMsgTest1() throws PcepParseException {
Bharat saraswal7092b0e2015-08-24 19:40:59 +053037
bharat saraswalf7364db2015-08-11 13:39:31 +053038 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x30,
39 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
40 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
41 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv
42 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
43 0x07, 0x10, 0x00, 0x04 }; //ERO object
44
45 byte[] testupdateMsg = {0};
46 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
47 buffer.writeBytes(updateMsg);
48
49 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
50 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053051
Bharat saraswal7092b0e2015-08-24 19:40:59 +053052 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +053053
Priyanka bhaskarda7506b2015-08-27 15:51:00 +053054 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +053055 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
56 message.writeTo(buf);
57 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +053058
Bharat saraswal7092b0e2015-08-24 19:40:59 +053059 int readLen = buf.writerIndex() - 0;
60 testupdateMsg = new byte[readLen];
61 buf.readBytes(testupdateMsg, 0, readLen);
bharat saraswalf7364db2015-08-11 13:39:31 +053062
Priyanka bhaskarda7506b2015-08-27 15:51:00 +053063 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +053064 }
65
Bharat saraswal7092b0e2015-08-24 19:40:59 +053066 /**
67 * This test case checks for SRP(SymbolicPathNameTlv), LSP (StatefulIPv4LspIdentidiersTlv,
68 * SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO, LSPA, Metric-list in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +053069 */
bharat saraswalf7364db2015-08-11 13:39:31 +053070 @Test
71 public void pcepUpdateMsgTest2() throws PcepParseException {
72
bharat saraswalf7364db2015-08-11 13:39:31 +053073 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x94,
74 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
75 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
76 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object // lsp object
77 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, //StatefulIPv4LspIdentidiersTlv
78 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
79 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
80 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
81 0x07, 0x10, 0x00, 0x24, 0x01, 0x08, 0x11, 0x01, //ERO object
82 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
83 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
84 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, 0x01, 0x01, 0x04, 0x00,
85 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
86 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
87 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
88 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
89
90 byte[] testupdateMsg = {0};
91 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
92 buffer.writeBytes(updateMsg);
93
94 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
95 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +053096
Bharat saraswal7092b0e2015-08-24 19:40:59 +053097 message = reader.readFrom(buffer);
Priyanka bhaskarda7506b2015-08-27 15:51:00 +053098 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +053099 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
100 message.writeTo(buf);
101 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530102
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530103 int readLen = buf.writerIndex() - 0;
104 testupdateMsg = new byte[readLen];
105 buf.readBytes(testupdateMsg, 0, readLen);
bharat saraswalf7364db2015-08-11 13:39:31 +0530106
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530107 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530108 }
109
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530110 /**
111 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv),
112 * ERO objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530113 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530114 @Test
115 public void pcepUpdateMsgTest3() throws PcepParseException {
116
bharat saraswalf7364db2015-08-11 13:39:31 +0530117 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x38,
118 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
119 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
120 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
121 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
122 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
123 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
124 0x07, 0x10, 0x00, 0x04 }; //ERO object
125
126 byte[] testupdateMsg = {0};
127 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
128 buffer.writeBytes(updateMsg);
129
130 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
131 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530132
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530133 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530134
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530135 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530136 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
137 message.writeTo(buf);
138 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530139
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530140 int readLen = buf.writerIndex() - 0;
141 testupdateMsg = new byte[readLen];
142 buf.readBytes(testupdateMsg, 0, readLen);
bharat saraswalf7364db2015-08-11 13:39:31 +0530143
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530144 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530145 }
146
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530147 /**
148 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
149 * SymbolicPathNameTlv), ERO objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530150 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530151 @Test
152 public void pcepUpdateMsgTest4() throws PcepParseException {
153
bharat saraswalf7364db2015-08-11 13:39:31 +0530154 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
155 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
156 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
157 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
158 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
159 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
160 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
161 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
162 0x07, 0x10, 0x00, 0x04 }; //ERO object
163
164 byte[] testupdateMsg = {0};
165 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
166 buffer.writeBytes(updateMsg);
167
168 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
169 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530170
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530171 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530172
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530173 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530174 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
175 message.writeTo(buf);
176 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530177
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530178 int readLen = buf.writerIndex() - 0;
179 testupdateMsg = new byte[readLen];
180 buf.readBytes(testupdateMsg, 0, readLen);
bharat saraswalf7364db2015-08-11 13:39:31 +0530181
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530182 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530183 }
184
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530185 /**
186 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
187 * SymbolicPathNameTlv), ERO objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530188 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530189 @Test
190 public void pcepUpdateMsgTest5() throws PcepParseException {
191
bharat saraswalf7364db2015-08-11 13:39:31 +0530192 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40,
193 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
194 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
195 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
196 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
197 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
198 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
199 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
200 0x07, 0x10, 0x00, 0x04 }; //ERO object
201
202 byte[] testupdateMsg = {0};
203 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
204 buffer.writeBytes(updateMsg);
205
206 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
207 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530208
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530209 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530210
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530211 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530212 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
213 message.writeTo(buf);
214 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530215
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530216 int readLen = buf.writerIndex() - 0;
217 testupdateMsg = new byte[readLen];
218 buf.readBytes(testupdateMsg, 0, readLen);
bharat saraswalf7364db2015-08-11 13:39:31 +0530219
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530220 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530221 }
222
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530223 /**
224 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
225 * StatefulLspErrorCodeTlv), ERO objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530226 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530227 @Test
228 public void pcepUpdateMsgTest6() throws PcepParseException {
229
bharat saraswalf7364db2015-08-11 13:39:31 +0530230 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
231 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
232 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
233 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
234 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
235 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
236 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
237 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
238 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
239 0x07, 0x10, 0x00, 0x04 };
240
241 byte[] testupdateMsg = {0};
242 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
243 buffer.writeBytes(updateMsg);
244
245 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
246 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530247
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530248 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530249
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530250 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530251 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
252 message.writeTo(buf);
253 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530254
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530255 int readLen = buf.writerIndex() - 0;
256 testupdateMsg = new byte[readLen];
257 buf.readBytes(testupdateMsg, 0, readLen);
258
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530259 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530260
261 }
262
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530263 /**
264 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
265 * StatefulLspErrorCodeTlv), ERO objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530266 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530267 @Test
268 public void pcepUpdateMsgTest7() throws PcepParseException {
269
bharat saraswalf7364db2015-08-11 13:39:31 +0530270 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
271 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
272 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
273 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
274 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
275 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
276 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
277 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
278 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
279 0x07, 0x10, 0x00, 0x04}; //ERO object
280
281 byte[] testupdateMsg = {0};
282 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
283 buffer.writeBytes(updateMsg);
284
285 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
286 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530287
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530288 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530289
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530290 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530291 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
292 message.writeTo(buf);
293 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530294
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530295 int readLen = buf.writerIndex() - 0;
296 testupdateMsg = new byte[readLen];
297 buf.readBytes(testupdateMsg, 0, readLen);
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530298 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530299 }
300
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530301 /**
302 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
303 * StatefulLspErrorCodeTlv), ERO (IPv4SubObject) objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530304 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530305 @Test
306 public void pcepUpdateMsgTest8() throws PcepParseException {
307
bharat saraswalf7364db2015-08-11 13:39:31 +0530308 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50,
309 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
310 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
311 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
312 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
313 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
314 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
315 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
316 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
317 0x07, 0x10, 0x00, 0x0c, 0x01, 0x08, 0x11, 0x01, //ERO object
318 0x01, 0x01, 0x04, 0x00 };
319
320 byte[] testupdateMsg = {0};
321 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
322 buffer.writeBytes(updateMsg);
323
324 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
325 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530326
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530327 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530328
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530329 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530330 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
331 message.writeTo(buf);
332 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530333
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530334 int readLen = buf.writerIndex() - 0;
335 testupdateMsg = new byte[readLen];
336 buf.readBytes(testupdateMsg, 0, readLen);
337
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530338 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530339 }
340
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530341 /**
342 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
343 * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject) objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530344 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530345 @Test
346 public void pcepUpdateMsgTest9() throws PcepParseException {
347
bharat saraswalf7364db2015-08-11 13:39:31 +0530348 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58,
349 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
350 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
351 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
352 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
353 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
354 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
355 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
356 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
357 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
358 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
359 0x01, 0x01, 0x04, 0x00 };
360
361 byte[] testupdateMsg = {0};
362 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
363 buffer.writeBytes(updateMsg);
364
365 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
366 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530367
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530368 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530369
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530370 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530371 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
372 message.writeTo(buf);
373 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530374
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530375 int readLen = buf.writerIndex() - 0;
376 testupdateMsg = new byte[readLen];
377 buf.readBytes(testupdateMsg, 0, readLen);
378
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530379 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530380 }
381
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530382 /**
383 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
384 * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject), LSPA objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530385 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530386 @Test
387 public void pcepUpdateMsgTest10() throws PcepParseException {
388
bharat saraswalf7364db2015-08-11 13:39:31 +0530389 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x6c,
390 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
391 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
392 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
393 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
394 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
395 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
396 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
397 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
398 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
399 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
400 0x01, 0x01, 0x04, 0x00,
401 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
402 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
403
404 byte[] testupdateMsg = {0};
405 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
406 buffer.writeBytes(updateMsg);
407
408 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
409 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530410
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530411 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530412
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530413 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530414 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
415 message.writeTo(buf);
416 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530417
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530418 int readLen = buf.writerIndex() - 0;
419 testupdateMsg = new byte[readLen];
420 buf.readBytes(testupdateMsg, 0, readLen);
421
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530422 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530423 }
424
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530425 /**
426 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
427 * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530428 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530429 @Test
430 public void pcepUpdateMsgTest11() throws PcepParseException {
431
bharat saraswalf7364db2015-08-11 13:39:31 +0530432 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78,
433 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
434 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
435 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
436 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
437 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
438 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
439 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
440 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
441 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
442 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
443 0x01, 0x01, 0x04, 0x00,
444 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
445 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
446 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
447
448 byte[] testupdateMsg = {0};
449 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
450 buffer.writeBytes(updateMsg);
451
452 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
453 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530454
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530455 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530456
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530457 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530458 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
459 message.writeTo(buf);
460 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530461
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530462 int readLen = buf.writerIndex() - 0;
463 testupdateMsg = new byte[readLen];
464 buf.readBytes(testupdateMsg, 0, readLen);
465
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530466 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530467 }
468
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530469 /**
470 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
471 * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530472 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530473 @Test
474 public void pcepUpdateMsgTest12() throws PcepParseException {
475
bharat saraswalf7364db2015-08-11 13:39:31 +0530476 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70,
477 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
478 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
479 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
480 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
481 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
482 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
483 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
484 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
485 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
486 0x01, 0x01, 0x04, 0x00,
487 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
488 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
489 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
490
491 byte[] testupdateMsg = {0};
492 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
493 buffer.writeBytes(updateMsg);
494
495 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
496 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530497
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530498 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530499
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530500 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530501 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
502 message.writeTo(buf);
503 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530504
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530505 int readLen = buf.writerIndex() - 0;
506 testupdateMsg = new byte[readLen];
507 buf.readBytes(testupdateMsg, 0, readLen);
508
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530509 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530510 }
511
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530512 /**
513 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
514 * StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530515 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530516 @Test
517 public void pcepUpdateMsgTest13() throws PcepParseException {
518
bharat saraswalf7364db2015-08-11 13:39:31 +0530519 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70,
520 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
521 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
522 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
523 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
524 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
525 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
526 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
527 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
528 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
529 0x01, 0x01, 0x04, 0x00,
530 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
531 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
532 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
533
534 byte[] testupdateMsg = {0};
535 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
536 buffer.writeBytes(updateMsg);
537
538 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
539 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530540
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530541 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530542
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530543 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530544 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
545 message.writeTo(buf);
546 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530547
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530548 int readLen = buf.writerIndex() - 0;
549 testupdateMsg = new byte[readLen];
550 buf.readBytes(testupdateMsg, 0, readLen);
551
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530552 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530553 }
554
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530555 /**
556 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
557 * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric Object objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530558 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530559 @Test
560 public void pcepUpdateMsgTest14() throws PcepParseException {
561
bharat saraswalf7364db2015-08-11 13:39:31 +0530562 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
563 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
564 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
565 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
566 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
567 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
568 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
569 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
570 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
571 0x01, 0x01, 0x04, 0x00,
572 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
573 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
574 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
575
576 byte[] testupdateMsg = {0};
577 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
578 buffer.writeBytes(updateMsg);
579
580 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
581 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530582
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530583 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530584
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530585 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530586 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
587 message.writeTo(buf);
588 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530589
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530590 int readLen = buf.writerIndex() - 0;
591 testupdateMsg = new byte[readLen];
592 buf.readBytes(testupdateMsg, 0, readLen);
593
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530594 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530595 }
596
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530597 /**
598 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv),
599 * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530600 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530601 @Test
602 public void pcepUpdateMsgTest15() throws PcepParseException {
603
bharat saraswalf7364db2015-08-11 13:39:31 +0530604 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
605 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
606 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
607 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
608 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
609 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
610 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
611 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
612 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
613 0x01, 0x01, 0x04, 0x00,
614 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
615 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
616 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
617
618 byte[] testupdateMsg = {0};
619 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
620 buffer.writeBytes(updateMsg);
621
622 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
623 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530624
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530625 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530626
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530627 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530628 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
629 message.writeTo(buf);
630 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530631
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530632 int readLen = buf.writerIndex() - 0;
633 testupdateMsg = new byte[readLen];
634 buf.readBytes(testupdateMsg, 0, readLen);
635
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530636 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530637 }
638
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530639 /**
640 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
641 * ERO (IPv4SubObject, IPv4SubObject),LSPA, metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530642 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530643 @Test
644 public void pcepUpdateMsgTest16() throws PcepParseException {
645
bharat saraswalf7364db2015-08-11 13:39:31 +0530646 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60,
647 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
648 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
649 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
650 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
651 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
652 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
653 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
654 0x01, 0x01, 0x04, 0x00,
655 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
656 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
657 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
658
659 byte[] testupdateMsg = {0};
660 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
661 buffer.writeBytes(updateMsg);
662
663 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
664 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530665
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530666 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530667
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530668 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530669 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
670 message.writeTo(buf);
671 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530672
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530673 int readLen = buf.writerIndex() - 0;
674 testupdateMsg = new byte[readLen];
675 buf.readBytes(testupdateMsg, 0, readLen);
676
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530677 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530678 }
679
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530680 /**
681 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
682 * ERO (IPv4SubObject, IPv4SubObject),LSPA objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530683 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530684 @Test
685 public void pcepUpdateMsgTest17() throws PcepParseException {
686
bharat saraswalf7364db2015-08-11 13:39:31 +0530687 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
688 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
689 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x05, //LSP object
690 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
691 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
692 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
693 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
694 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
695 0x01, 0x01, 0x04, 0x00,
696 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
697 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 };
698
699 byte[] testupdateMsg = {0};
700 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
701 buffer.writeBytes(updateMsg);
702
703 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
704 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530705
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530706 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530707
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530708 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530709 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
710 message.writeTo(buf);
711 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530712
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530713 int readLen = buf.writerIndex() - 0;
714 testupdateMsg = new byte[readLen];
715 buf.readBytes(testupdateMsg, 0, readLen);
716
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530717 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530718 }
719
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530720 /**
721 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
722 * ERO (IPv4SubObject, IPv4SubObject),Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530723 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530724 @Test
725 public void pcepUpdateMsgTest18() throws PcepParseException {
726
bharat saraswalf7364db2015-08-11 13:39:31 +0530727 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c,
728 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
729 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
730 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
731 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
732 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
733 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
734 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
735 0x01, 0x01, 0x04, 0x00,
736 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
737
738 byte[] testupdateMsg = {0};
739 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
740 buffer.writeBytes(updateMsg);
741
742 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
743 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530744
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530745 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530746
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530747 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530748 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
749 message.writeTo(buf);
750 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530751
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530752 int readLen = buf.writerIndex() - 0;
753 testupdateMsg = new byte[readLen];
754 buf.readBytes(testupdateMsg, 0, readLen);
755
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530756 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530757 }
758
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530759 /**
760 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
761 * ERO (IPv4SubObject, IPv4SubObject),Metric-list objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530762 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530763 @Test
764 public void pcepUpdateMsgTest19() throws PcepParseException {
765
bharat saraswalf7364db2015-08-11 13:39:31 +0530766 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58,
767 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
768 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
769 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
770 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
771 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
772 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
773 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
774 0x01, 0x01, 0x04, 0x00,
775 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object
776 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01 }; //Metric object
777
778 byte[] testupdateMsg = {0};
779 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
780 buffer.writeBytes(updateMsg);
781
782 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
783 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530784
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530785 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530786
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530787 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530788 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
789 message.writeTo(buf);
790 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530791
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530792 int readLen = buf.writerIndex() - 0;
793 testupdateMsg = new byte[readLen];
794 buf.readBytes(testupdateMsg, 0, readLen);
795
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530796 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530797 }
798
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530799 /**
800 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
801 * StatefulLspErrorCodeTlv),ERO (IPv4SubObject, IPv4SubObject),LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530802 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530803 @Test
804 public void pcepUpdateMsgTest20() throws PcepParseException {
805
bharat saraswalf7364db2015-08-11 13:39:31 +0530806 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80,
807 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
808 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
809 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
810 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
811 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
812 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
813 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
814 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
815 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
816 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
817 0x01, 0x01, 0x04, 0x00,
818 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
819 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
820 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
821 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
822
823 byte[] testupdateMsg = {0};
824 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
825 buffer.writeBytes(updateMsg);
826
827 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
828 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530829
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530830 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530831
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530832 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530833 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
834 message.writeTo(buf);
835 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530836
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530837 int readLen = buf.writerIndex() - 0;
838 testupdateMsg = new byte[readLen];
839 buf.readBytes(testupdateMsg, 0, readLen);
840
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530841 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530842 }
843
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530844 /**
845 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
846 * ERO (IPv4SubObject, IPv4SubObject), Bandwidth objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530847 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530848 @Test
849 public void pcepUpdateMsgTest21() throws PcepParseException {
850
bharat saraswalf7364db2015-08-11 13:39:31 +0530851 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48,
852 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
853 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
854 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
855 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
856 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
857 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
858 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
859 0x01, 0x01, 0x04, 0x00,
860 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
861
862 byte[] testupdateMsg = {0};
863 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
864 buffer.writeBytes(updateMsg);
865
866 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
867 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530868
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530869 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530870
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530871 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530872 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
873 message.writeTo(buf);
874 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530875
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530876 int readLen = buf.writerIndex() - 0;
877 testupdateMsg = new byte[readLen];
878 buf.readBytes(testupdateMsg, 0, readLen);
879
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530880 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530881 }
882
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530883 /**
884 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
885 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530886 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530887 @Test
888 public void pcepUpdateMsgTest22() throws PcepParseException {
889
bharat saraswalf7364db2015-08-11 13:39:31 +0530890 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5C,
891 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
892 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
893 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
894 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
895 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
896 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
897 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
898 0x01, 0x01, 0x04, 0x00,
899 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
900 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
901 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object
902
903 byte[] testupdateMsg = {0};
904 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
905 buffer.writeBytes(updateMsg);
906
907 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
908 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530909
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530910 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530911
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530912 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530913 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
914 message.writeTo(buf);
915 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530916
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530917 int readLen = buf.writerIndex() - 0;
918 testupdateMsg = new byte[readLen];
919 buf.readBytes(testupdateMsg, 0, readLen);
920
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530921 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530922 }
923
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530924 /**
925 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
926 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530927 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530928 @Test
929 public void pcepUpdateMsgTest23() throws PcepParseException {
930
bharat saraswalf7364db2015-08-11 13:39:31 +0530931 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
932 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
933 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
934 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
935 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
936 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
937 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
938 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
939 0x01, 0x01, 0x04, 0x00,
940 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
941 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
942 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
943 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
944
945 byte[] testupdateMsg = {0};
946 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
947 buffer.writeBytes(updateMsg);
948
949 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
950 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530951
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530952 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530953
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530954 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530955 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
956 message.writeTo(buf);
957 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +0530958
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530959 int readLen = buf.writerIndex() - 0;
960 testupdateMsg = new byte[readLen];
961 buf.readBytes(testupdateMsg, 0, readLen);
962
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530963 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +0530964 }
965
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530966 /**
967 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
968 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530969 */
bharat saraswalf7364db2015-08-11 13:39:31 +0530970 @Test
971 public void pcepUpdateMsgTest24() throws PcepParseException {
972
bharat saraswalf7364db2015-08-11 13:39:31 +0530973 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70,
974 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
975 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
976 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
977 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
978 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
979 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
980 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
981 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
982 0x01, 0x01, 0x04, 0x00,
983 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
984 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
985 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
986 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
987
988 byte[] testupdateMsg = {0};
989 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
990 buffer.writeBytes(updateMsg);
991
992 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
993 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +0530994
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530995 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +0530996
Priyanka bhaskarda7506b2015-08-27 15:51:00 +0530997 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +0530998 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
999 message.writeTo(buf);
1000 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301001
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301002 int readLen = buf.writerIndex() - 0;
1003 testupdateMsg = new byte[readLen];
1004 buf.readBytes(testupdateMsg, 0, readLen);
1005
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301006 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301007 }
1008
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301009 /**
1010 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv)
1011 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301012 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301013 @Test
1014 public void pcepUpdateMsgTest25() throws PcepParseException {
1015
bharat saraswalf7364db2015-08-11 13:39:31 +05301016 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x70,
1017 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1018 0x20, 0x10, 0x00, 0x24, 0x00, 0x00, 0x10, 0x03, //LSP object
1019 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1020 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1021 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1022 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1023 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1024 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1025 0x01, 0x01, 0x04, 0x00,
1026 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1027 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1028 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1029 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1030
1031 byte[] testupdateMsg = {0};
1032 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1033 buffer.writeBytes(updateMsg);
1034
1035 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1036 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301037
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301038 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301039
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301040 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301041 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1042 message.writeTo(buf);
1043 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301044
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301045 int readLen = buf.writerIndex() - 0;
1046 testupdateMsg = new byte[readLen];
1047 buf.readBytes(testupdateMsg, 0, readLen);
1048
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301049 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301050 }
1051
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301052 /**
1053 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
1054 * StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth,
1055 * Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301056 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301057 @Test
1058 public void pcepUpdateMsgTest26() throws PcepParseException {
1059
bharat saraswalf7364db2015-08-11 13:39:31 +05301060 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78,
1061 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1062 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
1063 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1064 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1065 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1066 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1067 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
1068 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1069 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1070 0x01, 0x01, 0x04, 0x00,
1071 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1072 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1073 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1074 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1075
1076 byte[] testupdateMsg = {0};
1077 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1078 buffer.writeBytes(updateMsg);
1079
1080 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1081 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301082
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301083 message = reader.readFrom(buffer);
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301084 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301085 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1086 message.writeTo(buf);
1087 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301088
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301089 int readLen = buf.writerIndex() - 0;
1090 testupdateMsg = new byte[readLen];
1091 buf.readBytes(testupdateMsg, 0, readLen);
bharat saraswalf7364db2015-08-11 13:39:31 +05301092
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301093 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301094 }
1095
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301096 /**
1097 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv,
1098 * StatefulLspErrorCodeTlv) ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth,
1099 * Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301100 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301101 @Test
1102 public void pcepUpdateMsgTest27() throws PcepParseException {
1103
bharat saraswalf7364db2015-08-11 13:39:31 +05301104 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x78,
1105 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1106 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
1107 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1108 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1109 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1110 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1111 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
1112 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1113 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1114 0x01, 0x01, 0x04, 0x00,
1115 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1116 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1117 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1118 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1119
1120 byte[] testupdateMsg = {0};
1121 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1122 buffer.writeBytes(updateMsg);
1123
1124 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1125 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301126
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301127 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301128
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301129 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301130 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1131 message.writeTo(buf);
1132 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301133
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301134 int readLen = buf.writerIndex() - 0;
1135 testupdateMsg = new byte[readLen];
1136 buf.readBytes(testupdateMsg, 0, readLen);
1137
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301138 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301139 }
1140
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301141 /**
1142 * This test case checks for SRP, LSP (SymbolicPathNameTlv, StatefulIPv4LspIdentidiersTlv,
1143 * SymbolicPathNameTlv, StatefulLspErrorCodeTlv), ERO (IPv4SubObject, IPv4SubObject),
1144 * LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301145 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301146 @Test
1147 public void pcepUpdateMsgTest28() throws PcepParseException {
1148
bharat saraswalf7364db2015-08-11 13:39:31 +05301149 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x80,
1150 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1151 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1152 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP object
1153 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1154 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1155 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1156 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1157 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
1158 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1159 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1160 0x01, 0x01, 0x04, 0x00,
1161 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1163 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1164 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1165
1166 byte[] testupdateMsg = {0};
1167 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1168 buffer.writeBytes(updateMsg);
1169
1170 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1171 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301172
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301173 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301174
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301175 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301176 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1177 message.writeTo(buf);
1178 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301179
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301180 int readLen = buf.writerIndex() - 0;
1181 testupdateMsg = new byte[readLen];
1182 buf.readBytes(testupdateMsg, 0, readLen);
1183
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301184 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301185 }
1186
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301187 /**
1188 * This test case checks for SRP, LSP (StatefulIPv4LspIdentidiersTlv),
1189 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301190 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301191 @Test
1192 public void pcepUpdateMsgTest29() throws PcepParseException {
1193
bharat saraswalf7364db2015-08-11 13:39:31 +05301194 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68,
1195 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1196 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object
1197 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
1198 (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
1199 (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
1200 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1201 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1202 0x01, 0x01, 0x04, 0x00,
1203 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1204 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1205 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1206 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1207
1208 byte[] testupdateMsg = {0};
1209 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1210 buffer.writeBytes(updateMsg);
1211
1212 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1213 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301214
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301215 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301216
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301217 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301218 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1219 message.writeTo(buf);
1220 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301221
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301222 int readLen = buf.writerIndex() - 0;
1223 testupdateMsg = new byte[readLen];
1224 buf.readBytes(testupdateMsg, 0, readLen);
1225
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301226 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301227 }
1228
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301229 /**
1230 * This test case checks for SRP, LSP,
1231 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301232 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301233 @Test
1234 public void pcepUpdateMsgTest30() throws PcepParseException {
1235
bharat saraswalf7364db2015-08-11 13:39:31 +05301236 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
1237 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1238 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object
1239 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1240 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1241 0x01, 0x01, 0x04, 0x00,
1242 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1243 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1244 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1245 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric object
1246
1247 byte[] testupdateMsg = {0};
1248 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1249 buffer.writeBytes(updateMsg);
1250
1251 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1252 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301253
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301254 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301255
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301256 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301257 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1258 message.writeTo(buf);
1259 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301260
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301261 int readLen = buf.writerIndex() - 0;
1262 testupdateMsg = new byte[readLen];
1263 buf.readBytes(testupdateMsg, 0, readLen);
1264
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301265 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301266 }
1267
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301268 /**
1269 * This test case checks for SRP, LSP (StatefulLspErrorCodeTlv),
1270 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301271 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301272 @Test
1273 public void pcepUpdateMsgTest31() throws PcepParseException {
1274
bharat saraswalf7364db2015-08-11 13:39:31 +05301275 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c,
1276 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1277 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1278 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
1279 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1280 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1281 0x01, 0x01, 0x04, 0x00,
1282 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1283 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1284 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1285 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1286
1287 byte[] testupdateMsg = {0};
1288 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1289 buffer.writeBytes(updateMsg);
1290
1291 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1292 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301293
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301294 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301295
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301296 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301297 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1298 message.writeTo(buf);
1299 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301300
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301301 int readLen = buf.writerIndex() - 0;
1302 testupdateMsg = new byte[readLen];
1303 buf.readBytes(testupdateMsg, 0, readLen);
1304
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301305 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301306 }
1307
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301308 /**
1309 * This test case checks for SRP, LSP,
1310 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301311 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301312 @Test
1313 public void pcepUpdateMsgTest32() throws PcepParseException {
1314
bharat saraswalf7364db2015-08-11 13:39:31 +05301315 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54,
1316 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1317 0x20, 0x10, 0x00, 0x8, 0x00, 0x00, 0x10, 0x03, //LSP object
1318 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1319 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1320 0x01, 0x01, 0x04, 0x00,
1321 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1322 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1323 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1324 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1325
1326 byte[] testupdateMsg = {0};
1327 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1328 buffer.writeBytes(updateMsg);
1329
1330 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1331 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301332
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301333 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301334
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301335 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301336 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1337 message.writeTo(buf);
1338 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301339
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301340 int readLen = buf.writerIndex() - 0;
1341 testupdateMsg = new byte[readLen];
1342 buf.readBytes(testupdateMsg, 0, readLen);
1343
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301344 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301345 }
1346
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301347 /**
1348 * This test case checks for SRP, LSP (SymbolicPathNameTlv),
1349 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301350 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301351 @Test
1352 public void pcepUpdateMsgTest33() throws PcepParseException {
1353
bharat saraswalf7364db2015-08-11 13:39:31 +05301354 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c,
1355 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1356 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1357 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1358 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1359 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1360 0x01, 0x01, 0x04, 0x00,
1361 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1362 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1363 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1364 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1365
1366 byte[] testupdateMsg = {0};
1367 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1368 buffer.writeBytes(updateMsg);
1369
1370 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1371 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301372
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301373 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301374
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301375 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301376 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1377 message.writeTo(buf);
1378 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301379
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301380 int readLen = buf.writerIndex() - 0;
1381 testupdateMsg = new byte[readLen];
1382 buf.readBytes(testupdateMsg, 0, readLen);
1383
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301384 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301385 }
1386
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301387 /**
1388 * This test case checks for SRP, LSP (SymbolicPathNameTlv, SymbolicPathNameTlv),
1389 * ERO (IPv4SubObject, IPv4SubObject), LSPA, Bandwidth, Metric objects in PcUpd message.
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301390 */
bharat saraswalf7364db2015-08-11 13:39:31 +05301391 @Test
1392 public void pcepUpdateMsgTest34() throws PcepParseException {
1393
bharat saraswalf7364db2015-08-11 13:39:31 +05301394 byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64,
1395 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object
1396 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1397 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object
1398 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
1399 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO object
1400 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
1401 0x01, 0x01, 0x04, 0x00,
1402 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object
1403 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00,
1404 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object
1405 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object
1406
1407 byte[] testupdateMsg = {0};
1408 ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
1409 buffer.writeBytes(updateMsg);
1410
1411 PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
1412 PcepMessage message = null;
bharat saraswalf7364db2015-08-11 13:39:31 +05301413
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301414 message = reader.readFrom(buffer);
bharat saraswalf7364db2015-08-11 13:39:31 +05301415
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301416 assertThat(message, sameInstance((PcepUpdateMsg) message));
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301417 ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
1418 message.writeTo(buf);
1419 testupdateMsg = buf.array();
bharat saraswalf7364db2015-08-11 13:39:31 +05301420
Bharat saraswal7092b0e2015-08-24 19:40:59 +05301421 int readLen = buf.writerIndex() - 0;
1422 testupdateMsg = new byte[readLen];
1423 buf.readBytes(testupdateMsg, 0, readLen);
1424
Priyanka bhaskarda7506b2015-08-27 15:51:00 +05301425 assertThat(testupdateMsg, is(updateMsg));
bharat saraswalf7364db2015-08-11 13:39:31 +05301426 }
1427}