bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1 | /* |
| 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 | */ |
| 16 | package org.onosproject.pcepio; |
| 17 | |
| 18 | import org.jboss.netty.buffer.ChannelBuffer; |
| 19 | import org.jboss.netty.buffer.ChannelBuffers; |
| 20 | import org.junit.Assert; |
| 21 | import org.junit.Test; |
| 22 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| 23 | import org.onosproject.pcepio.protocol.PcepFactories; |
| 24 | import org.onosproject.pcepio.protocol.PcepMessage; |
| 25 | import org.onosproject.pcepio.protocol.PcepMessageReader; |
| 26 | import org.onosproject.pcepio.protocol.PcepTEReportMsg; |
| 27 | |
| 28 | public class PcepTEReportMsgTest { |
| 29 | |
| 30 | /** |
| 31 | * This test case checks for |
| 32 | * TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)). |
| 33 | * in PcTERpt message. |
| 34 | * |
| 35 | * @throws PcepParseException while parsing PCEP message |
| 36 | */ |
| 37 | @Test |
| 38 | public void teReportMessageTest1() throws PcepParseException { |
| 39 | |
| 40 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header |
| 41 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header |
| 42 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 43 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 44 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 45 | 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV |
| 46 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv |
| 47 | 0x00, 0x00, 0x00, 0x11 }; |
| 48 | |
| 49 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 50 | buffer.writeBytes(teReportMsg); |
| 51 | |
| 52 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 53 | PcepMessage message = null; |
| 54 | |
| 55 | message = reader.readFrom(buffer); |
| 56 | |
| 57 | byte[] testReportMsg = {0}; |
| 58 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 59 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 60 | message.writeTo(buf); |
| 61 | |
| 62 | int readLen = buf.writerIndex() - 0; |
| 63 | testReportMsg = new byte[readLen]; |
| 64 | buf.readBytes(testReportMsg, 0, readLen); |
| 65 | |
| 66 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * This test case checks for |
| 71 | *T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID. |
| 72 | * in PcTERpt message. |
| 73 | * |
| 74 | * @throws PcepParseException while parsing PCEP message |
| 75 | */ |
| 76 | @Test |
| 77 | public void teReportMessageTest2() throws PcepParseException { |
| 78 | |
| 79 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header |
| 80 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header |
| 81 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 82 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 83 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
| 84 | 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV |
| 85 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 86 | 0x00, 0x00, 0x00, 0x11 }; |
| 87 | |
| 88 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 89 | buffer.writeBytes(teReportMsg); |
| 90 | |
| 91 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 92 | PcepMessage message = null; |
| 93 | |
| 94 | message = reader.readFrom(buffer); |
| 95 | |
| 96 | byte[] testReportMsg = {0}; |
| 97 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 98 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 99 | message.writeTo(buf); |
| 100 | |
| 101 | int readLen = buf.writerIndex() - 0; |
| 102 | testReportMsg = new byte[readLen]; |
| 103 | buf.readBytes(testReportMsg, 0, readLen); |
| 104 | |
| 105 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * This test case checks for TE Object (Routing Universe TLV) |
| 110 | * in PcTERpt message. |
| 111 | * |
| 112 | * @throws PcepParseException while parsing PCEP message |
| 113 | */ |
| 114 | @Test |
| 115 | public void teReportMessageTest3() throws PcepParseException { |
| 116 | |
| 117 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x1c, // common header |
| 118 | 0x0E, 0x10, 0x00, 0x18, // TE Object Header |
| 119 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 120 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 121 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; |
| 122 | |
| 123 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 124 | buffer.writeBytes(teReportMsg); |
| 125 | |
| 126 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 127 | PcepMessage message = null; |
| 128 | |
| 129 | message = reader.readFrom(buffer); |
| 130 | |
| 131 | byte[] testReportMsg = {0}; |
| 132 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 133 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 134 | message.writeTo(buf); |
| 135 | |
| 136 | int readLen = buf.writerIndex() - 0; |
| 137 | testReportMsg = new byte[readLen]; |
| 138 | buf.readBytes(testReportMsg, 0, readLen); |
| 139 | |
| 140 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * This test case checks for |
| 145 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 146 | * OSPFareaIDsubTlv, RouterIDSubTlv)). |
| 147 | * in PcTERpt message. |
| 148 | * |
| 149 | * @throws PcepParseException while parsing PCEP message |
| 150 | */ |
| 151 | @Test |
| 152 | public void teReportMessageTest4() throws PcepParseException { |
| 153 | |
| 154 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x44, // common header |
| 155 | 0x0E, 0x10, 0x00, 0x40, // TE Object Header |
| 156 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 157 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 158 | 0x00, 0x00, 0x00, 0x00, |
| 159 | 0x00, 0x00, 0x00, 0x01, |
| 160 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 161 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 162 | 0x00, 0x00, 0x00, 0x11, |
| 163 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 164 | 0x00, 0x00, 0x00, 0x11, |
| 165 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 166 | 0x00, 0x00, 0x00, 0x11, |
| 167 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 168 | 0x00, 0x00, 0x00, 0x11, |
| 169 | 0x00, 0x00, 0x00, 0x11}; |
| 170 | |
| 171 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 172 | buffer.writeBytes(teReportMsg); |
| 173 | |
| 174 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 175 | PcepMessage message = null; |
| 176 | |
| 177 | message = reader.readFrom(buffer); |
| 178 | |
| 179 | byte[] testReportMsg = {0}; |
| 180 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 181 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 182 | message.writeTo(buf); |
| 183 | |
| 184 | int readLen = buf.writerIndex() - 0; |
| 185 | testReportMsg = new byte[readLen]; |
| 186 | buf.readBytes(testReportMsg, 0, readLen); |
| 187 | |
| 188 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * This test case checks for |
| 193 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv |
| 194 | * OSPFareaIDsubTlv, RouterIDSubTlv)) |
| 195 | * in PcTERpt message. |
| 196 | * |
| 197 | * @throws PcepParseException while parsing PCEP message |
| 198 | */ |
| 199 | @Test |
| 200 | public void teReportMessageTest5() throws PcepParseException { |
| 201 | |
| 202 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x3C, // common header |
| 203 | 0x0E, 0x10, 0x00, 0x38, // TE Object Header |
| 204 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 205 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 206 | 0x00, 0x00, 0x00, 0x00, |
| 207 | 0x00, 0x00, 0x00, 0x01, |
| 208 | 0x06, 0x65, 0x00, 0x20, // Local TE Node Descriptors TLV |
| 209 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 210 | 0x00, 0x00, 0x00, 0x11, |
| 211 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 212 | 0x00, 0x00, 0x00, 0x11, |
| 213 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 214 | 0x00, 0x00, 0x00, 0x11, |
| 215 | 0x00, 0x00, 0x00, 0x11}; |
| 216 | |
| 217 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 218 | buffer.writeBytes(teReportMsg); |
| 219 | |
| 220 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 221 | PcepMessage message = null; |
| 222 | |
| 223 | message = reader.readFrom(buffer); |
| 224 | |
| 225 | byte[] testReportMsg = {0}; |
| 226 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 227 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 228 | message.writeTo(buf); |
| 229 | |
| 230 | int readLen = buf.writerIndex() - 0; |
| 231 | testReportMsg = new byte[readLen]; |
| 232 | buf.readBytes(testReportMsg, 0, readLen); |
| 233 | |
| 234 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv, |
| 239 | * RouterIDSubTlv)) |
| 240 | * in PcTERpt message. |
| 241 | * |
| 242 | * @throws PcepParseException while parsing PCEP message |
| 243 | */ |
| 244 | @Test |
| 245 | public void teReportMessageTest6() throws PcepParseException { |
| 246 | |
| 247 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x34, // common header |
| 248 | 0x0E, 0x10, 0x00, 0x30, // TE Object Header |
| 249 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 250 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 251 | 0x00, 0x00, 0x00, 0x00, |
| 252 | 0x00, 0x00, 0x00, 0x01, |
| 253 | 0x06, 0x65, 0x00, 0x18, // Local TE Node Descriptors TLV |
| 254 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 255 | 0x00, 0x00, 0x00, 0x11, |
| 256 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 257 | 0x00, 0x00, 0x00, 0x11, |
| 258 | 0x00, 0x00, 0x00, 0x11}; |
| 259 | |
| 260 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 261 | buffer.writeBytes(teReportMsg); |
| 262 | |
| 263 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 264 | PcepMessage message = null; |
| 265 | |
| 266 | message = reader.readFrom(buffer); |
| 267 | |
| 268 | byte[] testReportMsg = {0}; |
| 269 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 270 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 271 | message.writeTo(buf); |
| 272 | |
| 273 | int readLen = buf.writerIndex() - 0; |
| 274 | testReportMsg = new byte[readLen]; |
| 275 | buf.readBytes(testReportMsg, 0, readLen); |
| 276 | |
| 277 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 278 | } |
| 279 | |
| 280 | /** |
| 281 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)). |
| 282 | * in PcTERpt message. |
| 283 | * |
| 284 | * @throws PcepParseException while parsing PCEP message |
| 285 | */ |
| 286 | @Test |
| 287 | public void teReportMessageTest7() throws PcepParseException { |
| 288 | |
| 289 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x2C, // common header |
| 290 | 0x0E, 0x10, 0x00, 0x28, // TE Object Header |
| 291 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 292 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 293 | 0x00, 0x00, 0x00, 0x00, |
| 294 | 0x00, 0x00, 0x00, 0x01, |
| 295 | 0x06, 0x65, 0x00, 0x10, // Local TE Node Descriptors TLV |
| 296 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 297 | 0x00, 0x00, 0x00, 0x11, |
| 298 | 0x00, 0x00, 0x00, 0x11}; |
| 299 | |
| 300 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 301 | buffer.writeBytes(teReportMsg); |
| 302 | |
| 303 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 304 | PcepMessage message = null; |
| 305 | |
| 306 | message = reader.readFrom(buffer); |
| 307 | |
| 308 | byte[] testReportMsg = {0}; |
| 309 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 310 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 311 | message.writeTo(buf); |
| 312 | |
| 313 | int readLen = buf.writerIndex() - 0; |
| 314 | testReportMsg = new byte[readLen]; |
| 315 | buf.readBytes(testReportMsg, 0, readLen); |
| 316 | |
| 317 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 318 | } |
| 319 | |
| 320 | /** |
| 321 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV) |
| 322 | * in PcTERpt message. |
| 323 | * |
| 324 | * @throws PcepParseException while parsing PCEP message |
| 325 | */ |
| 326 | @Test |
| 327 | public void teReportMessageTest8() throws PcepParseException { |
| 328 | |
| 329 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x20, // common header |
| 330 | 0x0E, 0x10, 0x00, 0x1C, // TE Object Header |
| 331 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 332 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 333 | 0x00, 0x00, 0x00, 0x00, |
| 334 | 0x00, 0x00, 0x00, 0x01, |
| 335 | 0x06, 0x65, 0x00, 0x04 // Local TE Node Descriptors TLV |
| 336 | }; |
| 337 | |
| 338 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 339 | buffer.writeBytes(teReportMsg); |
| 340 | |
| 341 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 342 | PcepMessage message = null; |
| 343 | |
| 344 | message = reader.readFrom(buffer); |
| 345 | |
| 346 | byte[] testReportMsg = {0}; |
| 347 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 348 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 349 | message.writeTo(buf); |
| 350 | |
| 351 | int readLen = buf.writerIndex() - 0; |
| 352 | testReportMsg = new byte[readLen]; |
| 353 | buf.readBytes(testReportMsg, 0, readLen); |
| 354 | |
| 355 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 356 | } |
| 357 | |
| 358 | /** |
| 359 | * This test case checks for |
| 360 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 361 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 362 | * OSPFareaIDsubTlv, RouterIDSubTlv)). |
| 363 | * in PcTERpt message. |
| 364 | * |
| 365 | * @throws PcepParseException while parsing PCEP message |
| 366 | */ |
| 367 | @Test |
| 368 | public void teReportMessageTest9() throws PcepParseException { |
| 369 | |
| 370 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x6C, // common header |
| 371 | 0x0E, 0x10, 0x00, 0x68, // TE Object Header |
| 372 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 373 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 374 | 0x00, 0x00, 0x00, 0x00, |
| 375 | 0x00, 0x00, 0x00, 0x01, |
| 376 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 377 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 378 | 0x00, 0x00, 0x00, 0x11, |
| 379 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 380 | 0x00, 0x00, 0x00, 0x11, |
| 381 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 382 | 0x00, 0x00, 0x00, 0x11, |
| 383 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 384 | 0x00, 0x00, 0x00, 0x11, |
| 385 | 0x00, 0x00, 0x00, 0x11, |
| 386 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 387 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 388 | 0x00, 0x00, 0x00, 0x11, |
| 389 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 390 | 0x00, 0x00, 0x00, 0x11, |
| 391 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 392 | 0x00, 0x00, 0x00, 0x11, |
| 393 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 394 | 0x00, 0x00, 0x00, 0x11, |
| 395 | 0x00, 0x00, 0x00, 0x11 |
| 396 | }; |
| 397 | |
| 398 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 399 | buffer.writeBytes(teReportMsg); |
| 400 | |
| 401 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 402 | PcepMessage message = null; |
| 403 | |
| 404 | message = reader.readFrom(buffer); |
| 405 | |
| 406 | byte[] testReportMsg = {0}; |
| 407 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 408 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 409 | message.writeTo(buf); |
| 410 | |
| 411 | int readLen = buf.writerIndex() - 0; |
| 412 | testReportMsg = new byte[readLen]; |
| 413 | buf.readBytes(testReportMsg, 0, readLen); |
| 414 | |
| 415 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 416 | } |
| 417 | |
| 418 | /** |
| 419 | * This test case checks for |
| 420 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 421 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv |
| 422 | * OSPFareaIDsubTlv, RouterIDSubTlv)) |
| 423 | * in PcTERpt message. |
| 424 | * |
| 425 | * @throws PcepParseException while parsing PCEP message |
| 426 | */ |
| 427 | @Test |
| 428 | public void teReportMessageTest10() throws PcepParseException { |
| 429 | |
| 430 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x64, // common header |
| 431 | 0x0E, 0x10, 0x00, 0x60, // TE Object Header |
| 432 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 433 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 434 | 0x00, 0x00, 0x00, 0x00, |
| 435 | 0x00, 0x00, 0x00, 0x01, |
| 436 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 437 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 438 | 0x00, 0x00, 0x00, 0x11, |
| 439 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 440 | 0x00, 0x00, 0x00, 0x11, |
| 441 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 442 | 0x00, 0x00, 0x00, 0x11, |
| 443 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 444 | 0x00, 0x00, 0x00, 0x11, |
| 445 | 0x00, 0x00, 0x00, 0x11, |
| 446 | 0x03, (byte) 0xEB, 0x00, 0x20, //RemoteTENodeDescriptorsTLV |
| 447 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 448 | 0x00, 0x00, 0x00, 0x11, |
| 449 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 450 | 0x00, 0x00, 0x00, 0x11, |
| 451 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 452 | 0x00, 0x00, 0x00, 0x11, |
| 453 | 0x00, 0x00, 0x00, 0x11 |
| 454 | }; |
| 455 | |
| 456 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 457 | buffer.writeBytes(teReportMsg); |
| 458 | |
| 459 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 460 | PcepMessage message = null; |
| 461 | |
| 462 | message = reader.readFrom(buffer); |
| 463 | |
| 464 | byte[] testReportMsg = {0}; |
| 465 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 466 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 467 | message.writeTo(buf); |
| 468 | |
| 469 | int readLen = buf.writerIndex() - 0; |
| 470 | testReportMsg = new byte[readLen]; |
| 471 | buf.readBytes(testReportMsg, 0, readLen); |
| 472 | |
| 473 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 474 | } |
| 475 | |
| 476 | /** |
| 477 | * This test case checks for |
| 478 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 479 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv)) |
| 480 | * in PcTERpt message. |
| 481 | * |
| 482 | * @throws PcepParseException while parsing PCEP message |
| 483 | */ |
| 484 | @Test |
| 485 | public void teReportMessageTest11() throws PcepParseException { |
| 486 | |
| 487 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x5C, // common header |
| 488 | 0x0E, 0x10, 0x00, 0x58, // TE Object Header |
| 489 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 490 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 491 | 0x00, 0x00, 0x00, 0x00, |
| 492 | 0x00, 0x00, 0x00, 0x01, |
| 493 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 494 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 495 | 0x00, 0x00, 0x00, 0x11, |
| 496 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 497 | 0x00, 0x00, 0x00, 0x11, |
| 498 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 499 | 0x00, 0x00, 0x00, 0x11, |
| 500 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 501 | 0x00, 0x00, 0x00, 0x11, |
| 502 | 0x00, 0x00, 0x00, 0x11, |
| 503 | 0x03, (byte) 0xEB, 0x00, 0x18, //RemoteTENodeDescriptorsTLV |
| 504 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 505 | 0x00, 0x00, 0x00, 0x11, |
| 506 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 507 | 0x00, 0x00, 0x00, 0x11, |
| 508 | 0x00, 0x00, 0x00, 0x11 |
| 509 | }; |
| 510 | |
| 511 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 512 | buffer.writeBytes(teReportMsg); |
| 513 | |
| 514 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 515 | PcepMessage message = null; |
| 516 | |
| 517 | message = reader.readFrom(buffer); |
| 518 | |
| 519 | byte[] testReportMsg = {0}; |
| 520 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 521 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 522 | message.writeTo(buf); |
| 523 | |
| 524 | int readLen = buf.writerIndex() - 0; |
| 525 | testReportMsg = new byte[readLen]; |
| 526 | buf.readBytes(testReportMsg, 0, readLen); |
| 527 | |
| 528 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 529 | } |
| 530 | |
| 531 | /** |
| 532 | * This test case checks for |
| 533 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 534 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv)) |
| 535 | * in PcTERpt message. |
| 536 | * |
| 537 | * @throws PcepParseException while parsing PCEP message |
| 538 | */ |
| 539 | @Test |
| 540 | public void teReportMessageTest12() throws PcepParseException { |
| 541 | |
| 542 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x54, // common header |
| 543 | 0x0E, 0x10, 0x00, 0x50, // TE Object Header |
| 544 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 545 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 546 | 0x00, 0x00, 0x00, 0x00, |
| 547 | 0x00, 0x00, 0x00, 0x01, |
| 548 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 549 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 550 | 0x00, 0x00, 0x00, 0x11, |
| 551 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 552 | 0x00, 0x00, 0x00, 0x11, |
| 553 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 554 | 0x00, 0x00, 0x00, 0x11, |
| 555 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 556 | 0x00, 0x00, 0x00, 0x11, |
| 557 | 0x00, 0x00, 0x00, 0x11, |
| 558 | 0x03, (byte) 0xEB, 0x00, 0x10, //RemoteTENodeDescriptorsTLV |
| 559 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 560 | 0x00, 0x00, 0x00, 0x11, |
| 561 | 0x00, 0x00, 0x00, 0x11 |
| 562 | }; |
| 563 | |
| 564 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 565 | buffer.writeBytes(teReportMsg); |
| 566 | |
| 567 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 568 | PcepMessage message = null; |
| 569 | |
| 570 | message = reader.readFrom(buffer); |
| 571 | |
| 572 | byte[] testReportMsg = {0}; |
| 573 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 574 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 575 | message.writeTo(buf); |
| 576 | |
| 577 | int readLen = buf.writerIndex() - 0; |
| 578 | testReportMsg = new byte[readLen]; |
| 579 | buf.readBytes(testReportMsg, 0, readLen); |
| 580 | |
| 581 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 582 | } |
| 583 | |
| 584 | /** |
| 585 | * This test case checks for |
| 586 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 587 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV) |
| 588 | * in PcTERpt message. |
| 589 | * |
| 590 | * @throws PcepParseException while parsing PCEP message |
| 591 | */ |
| 592 | @Test |
| 593 | public void teReportMessageTest13() throws PcepParseException { |
| 594 | |
| 595 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x48, // common header |
| 596 | 0x0E, 0x10, 0x00, 0x44, // TE Object Header |
| 597 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 598 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 599 | 0x00, 0x00, 0x00, 0x00, |
| 600 | 0x00, 0x00, 0x00, 0x01, |
| 601 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 602 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 603 | 0x00, 0x00, 0x00, 0x11, |
| 604 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 605 | 0x00, 0x00, 0x00, 0x11, |
| 606 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 607 | 0x00, 0x00, 0x00, 0x11, |
| 608 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 609 | 0x00, 0x00, 0x00, 0x11, |
| 610 | 0x00, 0x00, 0x00, 0x11, |
| 611 | 0x03, (byte) 0xEB, 0x00, 0x04, //RemoteTENodeDescriptorsTLV |
| 612 | }; |
| 613 | |
| 614 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 615 | buffer.writeBytes(teReportMsg); |
| 616 | |
| 617 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 618 | PcepMessage message = null; |
| 619 | |
| 620 | message = reader.readFrom(buffer); |
| 621 | |
| 622 | byte[] testReportMsg = {0}; |
| 623 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 624 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 625 | message.writeTo(buf); |
| 626 | |
| 627 | int readLen = buf.writerIndex() - 0; |
| 628 | testReportMsg = new byte[readLen]; |
| 629 | buf.readBytes(testReportMsg, 0, readLen); |
| 630 | |
| 631 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 632 | } |
| 633 | |
| 634 | /** |
| 635 | * This test case checks for |
| 636 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 637 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 638 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 639 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
| 640 | * in PcTERpt message. |
| 641 | * |
| 642 | * @throws PcepParseException while parsing PCEP message |
| 643 | */ |
| 644 | @Test |
| 645 | public void teReportMessageTest14() throws PcepParseException { |
| 646 | |
| 647 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x8C, // common header |
| 648 | 0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header |
| 649 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 650 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 651 | 0x00, 0x00, 0x00, 0x00, |
| 652 | 0x00, 0x00, 0x00, 0x01, |
| 653 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 654 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 655 | 0x00, 0x00, 0x00, 0x11, |
| 656 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 657 | 0x00, 0x00, 0x00, 0x11, |
| 658 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 659 | 0x00, 0x00, 0x00, 0x11, |
| 660 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 661 | 0x00, 0x00, 0x00, 0x11, |
| 662 | 0x00, 0x00, 0x00, 0x11, |
| 663 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 664 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 665 | 0x00, 0x00, 0x00, 0x11, |
| 666 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 667 | 0x00, 0x00, 0x00, 0x11, |
| 668 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 669 | 0x00, 0x00, 0x00, 0x11, |
| 670 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 671 | 0x00, 0x00, 0x00, 0x11, |
| 672 | 0x00, 0x00, 0x00, 0x11, |
| 673 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 674 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 675 | 0x01, 0x11, 0x00, 0x09, |
| 676 | 0x01, 0x21, 0x00, 0x09, |
| 677 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 678 | 0x01, 0x01, 0x01, 0x01, |
| 679 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 680 | 0x01, 0x011, 0x01, 0x10 |
| 681 | }; |
| 682 | |
| 683 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 684 | buffer.writeBytes(teReportMsg); |
| 685 | |
| 686 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 687 | PcepMessage message = null; |
| 688 | |
| 689 | message = reader.readFrom(buffer); |
| 690 | |
| 691 | byte[] testReportMsg = {0}; |
| 692 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 693 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 694 | message.writeTo(buf); |
| 695 | |
| 696 | int readLen = buf.writerIndex() - 0; |
| 697 | testReportMsg = new byte[readLen]; |
| 698 | buf.readBytes(testReportMsg, 0, readLen); |
| 699 | |
| 700 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 701 | } |
| 702 | |
| 703 | /** |
| 704 | * This test case checks for |
| 705 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 706 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 707 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV( |
| 708 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
| 709 | * in PcTERpt message. |
| 710 | * |
| 711 | * @throws PcepParseException while parsing PCEP message |
| 712 | */ |
| 713 | @Test |
| 714 | public void teReportMessageTest15() throws PcepParseException { |
| 715 | |
| 716 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x80, // common header |
| 717 | 0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header |
| 718 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 719 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 720 | 0x00, 0x00, 0x00, 0x00, |
| 721 | 0x00, 0x00, 0x00, 0x01, |
| 722 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 723 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 724 | 0x00, 0x00, 0x00, 0x11, |
| 725 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 726 | 0x00, 0x00, 0x00, 0x11, |
| 727 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 728 | 0x00, 0x00, 0x00, 0x11, |
| 729 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 730 | 0x00, 0x00, 0x00, 0x11, |
| 731 | 0x00, 0x00, 0x00, 0x11, |
| 732 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 733 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 734 | 0x00, 0x00, 0x00, 0x11, |
| 735 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 736 | 0x00, 0x00, 0x00, 0x11, |
| 737 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 738 | 0x00, 0x00, 0x00, 0x11, |
| 739 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 740 | 0x00, 0x00, 0x00, 0x11, |
| 741 | 0x00, 0x00, 0x00, 0x11, |
| 742 | 0x04, 0x2E, 0x00, 0x14, //TELinkDescriptorsTLV |
| 743 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 744 | 0x01, 0x01, 0x01, 0x01, |
| 745 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 746 | 0x01, 0x011, 0x01, 0x10 |
| 747 | }; |
| 748 | |
| 749 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 750 | buffer.writeBytes(teReportMsg); |
| 751 | |
| 752 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 753 | PcepMessage message = null; |
| 754 | |
| 755 | message = reader.readFrom(buffer); |
| 756 | |
| 757 | byte[] testReportMsg = {0}; |
| 758 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 759 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 760 | message.writeTo(buf); |
| 761 | |
| 762 | int readLen = buf.writerIndex() - 0; |
| 763 | testReportMsg = new byte[readLen]; |
| 764 | buf.readBytes(testReportMsg, 0, readLen); |
| 765 | |
| 766 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 767 | } |
| 768 | |
| 769 | /** |
| 770 | * This test case checks for |
| 771 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 772 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 773 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv)) |
| 774 | * in PcTERpt message. |
| 775 | * |
| 776 | * @throws PcepParseException while parsing PCEP message |
| 777 | */ |
| 778 | @Test |
| 779 | public void teReportMessageTest16() throws PcepParseException { |
| 780 | |
| 781 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x78, // common header |
| 782 | 0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header |
| 783 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 784 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 785 | 0x00, 0x00, 0x00, 0x00, |
| 786 | 0x00, 0x00, 0x00, 0x01, |
| 787 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 788 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 789 | 0x00, 0x00, 0x00, 0x11, |
| 790 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 791 | 0x00, 0x00, 0x00, 0x11, |
| 792 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 793 | 0x00, 0x00, 0x00, 0x11, |
| 794 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 795 | 0x00, 0x00, 0x00, 0x11, |
| 796 | 0x00, 0x00, 0x00, 0x11, |
| 797 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 798 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 799 | 0x00, 0x00, 0x00, 0x11, |
| 800 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 801 | 0x00, 0x00, 0x00, 0x11, |
| 802 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 803 | 0x00, 0x00, 0x00, 0x11, |
| 804 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 805 | 0x00, 0x00, 0x00, 0x11, |
| 806 | 0x00, 0x00, 0x00, 0x11, |
| 807 | 0x04, 0x2E, 0x00, 0x0C, //TELinkDescriptorsTLV |
| 808 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 809 | 0x01, 0x011, 0x01, 0x10 |
| 810 | }; |
| 811 | |
| 812 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 813 | buffer.writeBytes(teReportMsg); |
| 814 | |
| 815 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 816 | PcepMessage message = null; |
| 817 | |
| 818 | message = reader.readFrom(buffer); |
| 819 | |
| 820 | byte[] testReportMsg = {0}; |
| 821 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 822 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 823 | message.writeTo(buf); |
| 824 | |
| 825 | int readLen = buf.writerIndex() - 0; |
| 826 | testReportMsg = new byte[readLen]; |
| 827 | buf.readBytes(testReportMsg, 0, readLen); |
| 828 | |
| 829 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 830 | } |
| 831 | |
| 832 | /** |
| 833 | * This test case checks for |
| 834 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 835 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 836 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV) |
| 837 | * in PcTERpt message. |
| 838 | * |
| 839 | * @throws PcepParseException while parsing PCEP message |
| 840 | */ |
| 841 | @Test |
| 842 | public void teReportMessageTest17() throws PcepParseException { |
| 843 | |
| 844 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x70, // common header |
| 845 | 0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header |
| 846 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 847 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 848 | 0x00, 0x00, 0x00, 0x00, |
| 849 | 0x00, 0x00, 0x00, 0x01, |
| 850 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 851 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 852 | 0x00, 0x00, 0x00, 0x11, |
| 853 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 854 | 0x00, 0x00, 0x00, 0x11, |
| 855 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 856 | 0x00, 0x00, 0x00, 0x11, |
| 857 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 858 | 0x00, 0x00, 0x00, 0x11, |
| 859 | 0x00, 0x00, 0x00, 0x11, |
| 860 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 861 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 862 | 0x00, 0x00, 0x00, 0x11, |
| 863 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 864 | 0x00, 0x00, 0x00, 0x11, |
| 865 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 866 | 0x00, 0x00, 0x00, 0x11, |
| 867 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 868 | 0x00, 0x00, 0x00, 0x11, |
| 869 | 0x00, 0x00, 0x00, 0x11, |
| 870 | 0x04, 0x2E, 0x00, 0x04, //TELinkDescriptorsTLV |
| 871 | }; |
| 872 | |
| 873 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 874 | buffer.writeBytes(teReportMsg); |
| 875 | |
| 876 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 877 | PcepMessage message = null; |
| 878 | |
| 879 | message = reader.readFrom(buffer); |
| 880 | |
| 881 | byte[] testReportMsg = {0}; |
| 882 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 883 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 884 | message.writeTo(buf); |
| 885 | |
| 886 | int readLen = buf.writerIndex() - 0; |
| 887 | testReportMsg = new byte[readLen]; |
| 888 | buf.readBytes(testReportMsg, 0, readLen); |
| 889 | |
| 890 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 891 | } |
| 892 | |
| 893 | /** |
| 894 | * This test case checks for |
| 895 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 896 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 897 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 898 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
| 899 | * in PcTERpt message. |
| 900 | * |
| 901 | * @throws PcepParseException while parsing PCEP message |
| 902 | */ |
| 903 | @Test |
| 904 | public void teReportMessageTest18() throws PcepParseException { |
| 905 | |
| 906 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header |
| 907 | 0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header |
| 908 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 909 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 910 | 0x00, 0x00, 0x00, 0x00, |
| 911 | 0x00, 0x00, 0x00, 0x01, |
| 912 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 913 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 914 | 0x00, 0x00, 0x00, 0x11, |
| 915 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 916 | 0x00, 0x00, 0x00, 0x11, |
| 917 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 918 | 0x00, 0x00, 0x00, 0x11, |
| 919 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 920 | 0x00, 0x00, 0x00, 0x11, |
| 921 | 0x00, 0x00, 0x00, 0x11, |
| 922 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 923 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 924 | 0x00, 0x00, 0x00, 0x11, |
| 925 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 926 | 0x00, 0x00, 0x00, 0x11, |
| 927 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 928 | 0x00, 0x00, 0x00, 0x11, |
| 929 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 930 | 0x00, 0x00, 0x00, 0x11, |
| 931 | 0x00, 0x00, 0x00, 0x11, |
| 932 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 933 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 934 | 0x01, 0x11, 0x00, 0x09, |
| 935 | 0x01, 0x21, 0x00, 0x09, |
| 936 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 937 | 0x01, 0x01, 0x01, 0x01, |
| 938 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 939 | 0x01, 0x011, 0x01, 0x10, |
| 940 | 0x04, (byte) 0xF3, 0x00, 0x34, //TENodeAttributesTlv |
| 941 | 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv |
| 942 | (byte) 0x90, 0x00, 0x00, 0x00, |
| 943 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 944 | 0x01, 0x011, 0x01, 0x10, |
| 945 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 946 | 0x08, 0x00, 0x01, 0x09, |
| 947 | 0x08, 0x00, 0x01, 0x09, |
| 948 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 949 | 0x20, 0x01, 0x22, 0x01, |
| 950 | 0x20, 0x01, 0x22, 0x01, |
| 951 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 952 | 0x00, 0x01, 0x01, 0x02 |
| 953 | }; |
| 954 | |
| 955 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 956 | buffer.writeBytes(teReportMsg); |
| 957 | |
| 958 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 959 | PcepMessage message = null; |
| 960 | |
| 961 | message = reader.readFrom(buffer); |
| 962 | |
| 963 | byte[] testReportMsg = {0}; |
| 964 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 965 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 966 | message.writeTo(buf); |
| 967 | |
| 968 | int readLen = buf.writerIndex() - 0; |
| 969 | testReportMsg = new byte[readLen]; |
| 970 | buf.readBytes(testReportMsg, 0, readLen); |
| 971 | |
| 972 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 973 | } |
| 974 | |
| 975 | /** |
| 976 | * This test case checks for |
| 977 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 978 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 979 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 980 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 981 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
| 982 | * in PcTERpt message. |
| 983 | * |
| 984 | * @throws PcepParseException while parsing PCEP message |
| 985 | */ |
| 986 | @Test |
| 987 | public void teReportMessageTest19() throws PcepParseException { |
| 988 | |
| 989 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header |
| 990 | 0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header |
| 991 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 992 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 993 | 0x00, 0x00, 0x00, 0x00, |
| 994 | 0x00, 0x00, 0x00, 0x01, |
| 995 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 996 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 997 | 0x00, 0x00, 0x00, 0x11, |
| 998 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 999 | 0x00, 0x00, 0x00, 0x11, |
| 1000 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1001 | 0x00, 0x00, 0x00, 0x11, |
| 1002 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1003 | 0x00, 0x00, 0x00, 0x11, |
| 1004 | 0x00, 0x00, 0x00, 0x11, |
| 1005 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 1006 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1007 | 0x00, 0x00, 0x00, 0x11, |
| 1008 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1009 | 0x00, 0x00, 0x00, 0x11, |
| 1010 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1011 | 0x00, 0x00, 0x00, 0x11, |
| 1012 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1013 | 0x00, 0x00, 0x00, 0x11, |
| 1014 | 0x00, 0x00, 0x00, 0x11, |
| 1015 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 1016 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1017 | 0x01, 0x11, 0x00, 0x09, |
| 1018 | 0x01, 0x21, 0x00, 0x09, |
| 1019 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1020 | 0x01, 0x01, 0x01, 0x01, |
| 1021 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1022 | 0x01, 0x011, 0x01, 0x10, |
| 1023 | 0x04, (byte) 0xF3, 0x00, 0x34, //TENodeAttributesTlv |
| 1024 | 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv |
| 1025 | (byte) 0x90, 0x00, 0x00, 0x00, |
| 1026 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1027 | 0x01, 0x011, 0x01, 0x10, |
| 1028 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1029 | 0x08, 0x00, 0x01, 0x09, |
| 1030 | 0x08, 0x00, 0x01, 0x09, |
| 1031 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1032 | 0x20, 0x01, 0x22, 0x01, |
| 1033 | 0x20, 0x01, 0x22, 0x01, |
| 1034 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1035 | 0x00, 0x01, 0x01, 0x02 |
| 1036 | }; |
| 1037 | |
| 1038 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1039 | buffer.writeBytes(teReportMsg); |
| 1040 | |
| 1041 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1042 | PcepMessage message = null; |
| 1043 | |
| 1044 | message = reader.readFrom(buffer); |
| 1045 | |
| 1046 | byte[] testReportMsg = {0}; |
| 1047 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 1048 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1049 | message.writeTo(buf); |
| 1050 | |
| 1051 | int readLen = buf.writerIndex() - 0; |
| 1052 | testReportMsg = new byte[readLen]; |
| 1053 | buf.readBytes(testReportMsg, 0, readLen); |
| 1054 | |
| 1055 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 1056 | } |
| 1057 | |
| 1058 | /** |
| 1059 | * This test case checks for |
| 1060 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1061 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1062 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1063 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv |
| 1064 | * NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
| 1065 | * in PcTERpt message. |
| 1066 | * |
| 1067 | * @throws PcepParseException while parsing PCEP message |
| 1068 | */ |
| 1069 | @Test |
| 1070 | public void teReportMessageTest20() throws PcepParseException { |
| 1071 | |
| 1072 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xB8, // common header |
| 1073 | 0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header |
| 1074 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1075 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1076 | 0x00, 0x00, 0x00, 0x00, |
| 1077 | 0x00, 0x00, 0x00, 0x01, |
| 1078 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 1079 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1080 | 0x00, 0x00, 0x00, 0x11, |
| 1081 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1082 | 0x00, 0x00, 0x00, 0x11, |
| 1083 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1084 | 0x00, 0x00, 0x00, 0x11, |
| 1085 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1086 | 0x00, 0x00, 0x00, 0x11, |
| 1087 | 0x00, 0x00, 0x00, 0x11, |
| 1088 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 1089 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1090 | 0x00, 0x00, 0x00, 0x11, |
| 1091 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1092 | 0x00, 0x00, 0x00, 0x11, |
| 1093 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1094 | 0x00, 0x00, 0x00, 0x11, |
| 1095 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1096 | 0x00, 0x00, 0x00, 0x11, |
| 1097 | 0x00, 0x00, 0x00, 0x11, |
| 1098 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 1099 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1100 | 0x01, 0x11, 0x00, 0x09, |
| 1101 | 0x01, 0x21, 0x00, 0x09, |
| 1102 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1103 | 0x01, 0x01, 0x01, 0x01, |
| 1104 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1105 | 0x01, 0x011, 0x01, 0x10, |
| 1106 | 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv |
| 1107 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1108 | 0x01, 0x011, 0x01, 0x10, |
| 1109 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1110 | 0x08, 0x00, 0x01, 0x09, |
| 1111 | 0x08, 0x00, 0x01, 0x09, |
| 1112 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1113 | 0x20, 0x01, 0x22, 0x01, |
| 1114 | 0x20, 0x01, 0x22, 0x01, |
| 1115 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1116 | 0x00, 0x01, 0x01, 0x02 |
| 1117 | }; |
| 1118 | |
| 1119 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1120 | buffer.writeBytes(teReportMsg); |
| 1121 | |
| 1122 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1123 | PcepMessage message = null; |
| 1124 | |
| 1125 | message = reader.readFrom(buffer); |
| 1126 | |
| 1127 | byte[] testReportMsg = {0}; |
| 1128 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 1129 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1130 | message.writeTo(buf); |
| 1131 | |
| 1132 | int readLen = buf.writerIndex() - 0; |
| 1133 | testReportMsg = new byte[readLen]; |
| 1134 | buf.readBytes(testReportMsg, 0, readLen); |
| 1135 | |
| 1136 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 1137 | } |
| 1138 | |
| 1139 | /** |
| 1140 | * This test case checks for |
| 1141 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1142 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1143 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. |
| 1144 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv |
| 1145 | * ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
| 1146 | * in PcTERpt message. |
| 1147 | * |
| 1148 | * @throws PcepParseException while parsing PCEP message |
| 1149 | */ |
| 1150 | @Test |
| 1151 | public void teReportMessageTest21() throws PcepParseException { |
| 1152 | |
| 1153 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xAC, // common header |
| 1154 | 0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header |
| 1155 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1156 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1157 | 0x00, 0x00, 0x00, 0x00, |
| 1158 | 0x00, 0x00, 0x00, 0x01, |
| 1159 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 1160 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1161 | 0x00, 0x00, 0x00, 0x11, |
| 1162 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1163 | 0x00, 0x00, 0x00, 0x11, |
| 1164 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1165 | 0x00, 0x00, 0x00, 0x11, |
| 1166 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1167 | 0x00, 0x00, 0x00, 0x11, |
| 1168 | 0x00, 0x00, 0x00, 0x11, |
| 1169 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 1170 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1171 | 0x00, 0x00, 0x00, 0x11, |
| 1172 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1173 | 0x00, 0x00, 0x00, 0x11, |
| 1174 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1175 | 0x00, 0x00, 0x00, 0x11, |
| 1176 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1177 | 0x00, 0x00, 0x00, 0x11, |
| 1178 | 0x00, 0x00, 0x00, 0x11, |
| 1179 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 1180 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1181 | 0x01, 0x11, 0x00, 0x09, |
| 1182 | 0x01, 0x21, 0x00, 0x09, |
| 1183 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1184 | 0x01, 0x01, 0x01, 0x01, |
| 1185 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1186 | 0x01, 0x011, 0x01, 0x10, |
| 1187 | 0x04, (byte) 0xF3, 0x00, 0x20, //TENodeAttributesTlv |
| 1188 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1189 | 0x01, 0x011, 0x01, 0x10, |
| 1190 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1191 | 0x20, 0x01, 0x22, 0x01, |
| 1192 | 0x20, 0x01, 0x22, 0x01, |
| 1193 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1194 | 0x00, 0x01, 0x01, 0x02 |
| 1195 | }; |
| 1196 | |
| 1197 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1198 | buffer.writeBytes(teReportMsg); |
| 1199 | |
| 1200 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1201 | PcepMessage message = null; |
| 1202 | |
| 1203 | message = reader.readFrom(buffer); |
| 1204 | |
| 1205 | byte[] testReportMsg = {0}; |
| 1206 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 1207 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1208 | message.writeTo(buf); |
| 1209 | |
| 1210 | int readLen = buf.writerIndex() - 0; |
| 1211 | testReportMsg = new byte[readLen]; |
| 1212 | buf.readBytes(testReportMsg, 0, readLen); |
| 1213 | |
| 1214 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 1215 | } |
| 1216 | |
| 1217 | /** |
| 1218 | * This test case checks for |
| 1219 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 1220 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 1221 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. |
| 1222 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv. |
| 1223 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv). |
| 1224 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv. |
| 1225 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv. |
| 1226 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv. |
| 1227 | * OpaqueLinkAttributeTlv, LinkNameTlv)). |
| 1228 | * in PcTERpt message. |
| 1229 | * |
| 1230 | * @throws PcepParseException while parsing PCEP message |
| 1231 | */ |
| 1232 | @Test |
| 1233 | public void teReportMessageTest22() throws PcepParseException { |
| 1234 | |
| 1235 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x20, // common header |
| 1236 | 0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header |
| 1237 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1238 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1239 | 0x00, 0x00, 0x00, 0x00, |
| 1240 | 0x00, 0x00, 0x00, 0x01, |
| 1241 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 1242 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1243 | 0x00, 0x00, 0x00, 0x11, |
| 1244 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1245 | 0x00, 0x00, 0x00, 0x11, |
| 1246 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1247 | 0x00, 0x00, 0x00, 0x11, |
| 1248 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1249 | 0x00, 0x00, 0x00, 0x11, |
| 1250 | 0x00, 0x00, 0x00, 0x11, |
| 1251 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 1252 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1253 | 0x00, 0x00, 0x00, 0x11, |
| 1254 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1255 | 0x00, 0x00, 0x00, 0x11, |
| 1256 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1257 | 0x00, 0x00, 0x00, 0x11, |
| 1258 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1259 | 0x00, 0x00, 0x00, 0x11, |
| 1260 | 0x00, 0x00, 0x00, 0x11, |
| 1261 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 1262 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1263 | 0x01, 0x11, 0x00, 0x09, |
| 1264 | 0x01, 0x21, 0x00, 0x09, |
| 1265 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1266 | 0x01, 0x01, 0x01, 0x01, |
| 1267 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1268 | 0x01, 0x011, 0x01, 0x10, |
| 1269 | 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv |
| 1270 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1271 | 0x01, 0x011, 0x01, 0x10, |
| 1272 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1273 | 0x08, 0x00, 0x01, 0x09, |
| 1274 | 0x08, 0x00, 0x01, 0x09, |
| 1275 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1276 | 0x20, 0x01, 0x22, 0x01, |
| 1277 | 0x20, 0x01, 0x22, 0x01, |
| 1278 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1279 | 0x00, 0x01, 0x01, 0x02, |
| 1280 | 0x07, 0x69, 0x00, 0x68, //TELinkAttributesTlv |
| 1281 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1282 | 0x00, 0x07, 0x08, 0x00, |
| 1283 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1284 | 0x00, 0x09, 0x08, 0x00, |
| 1285 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1286 | 0x00, 0x09, 0x00, 0x00, |
| 1287 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1288 | 0x00, 0x10, 0x00, 0x00, |
| 1289 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1290 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1291 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1292 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1293 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1294 | 0x09, 0x00, 0x00, 0x00, |
| 1295 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1296 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1297 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1298 | 0x09, (byte) 0x89, 0x07, 0x00, |
| 1299 | 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv |
| 1300 | 0x04, 0x47, 0x00, 0x03, |
| 1301 | 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv |
| 1302 | 0x04, 0x49, 0x00, 0x04, |
| 1303 | 0x04, 0x47, 0x00, 0x03, |
| 1304 | 0x04, 0x4A, 0x00, 0x04, //LinkNameTlv |
| 1305 | 0x04, 0x47, 0x00, 0x03 |
| 1306 | }; |
| 1307 | |
| 1308 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1309 | buffer.writeBytes(teReportMsg); |
| 1310 | |
| 1311 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1312 | PcepMessage message = null; |
| 1313 | |
| 1314 | message = reader.readFrom(buffer); |
| 1315 | |
| 1316 | byte[] testReportMsg = {0}; |
| 1317 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 1318 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1319 | message.writeTo(buf); |
| 1320 | |
| 1321 | int readLen = buf.writerIndex() - 0; |
| 1322 | testReportMsg = new byte[readLen]; |
| 1323 | buf.readBytes(testReportMsg, 0, readLen); |
| 1324 | |
| 1325 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 1326 | } |
| 1327 | |
| 1328 | /** |
| 1329 | * This test case checks for |
| 1330 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1331 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1332 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1333 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 1334 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) |
| 1335 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv |
| 1336 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
| 1337 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv |
| 1338 | * OpaqueLinkAttributeTlv)) |
| 1339 | * in PcTERpt message. |
| 1340 | * |
| 1341 | * @throws PcepParseException while parsing PCEP message |
| 1342 | */ |
| 1343 | @Test |
| 1344 | public void teReportMessageTest23() throws PcepParseException { |
| 1345 | |
| 1346 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x18, // common header |
| 1347 | 0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header |
| 1348 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1349 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1350 | 0x00, 0x00, 0x00, 0x00, |
| 1351 | 0x00, 0x00, 0x00, 0x01, |
| 1352 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 1353 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1354 | 0x00, 0x00, 0x00, 0x11, |
| 1355 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1356 | 0x00, 0x00, 0x00, 0x11, |
| 1357 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1358 | 0x00, 0x00, 0x00, 0x11, |
| 1359 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1360 | 0x00, 0x00, 0x00, 0x11, |
| 1361 | 0x00, 0x00, 0x00, 0x11, |
| 1362 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 1363 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1364 | 0x00, 0x00, 0x00, 0x11, |
| 1365 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1366 | 0x00, 0x00, 0x00, 0x11, |
| 1367 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1368 | 0x00, 0x00, 0x00, 0x11, |
| 1369 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1370 | 0x00, 0x00, 0x00, 0x11, |
| 1371 | 0x00, 0x00, 0x00, 0x11, |
| 1372 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 1373 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1374 | 0x01, 0x11, 0x00, 0x09, |
| 1375 | 0x01, 0x21, 0x00, 0x09, |
| 1376 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1377 | 0x01, 0x01, 0x01, 0x01, |
| 1378 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1379 | 0x01, 0x011, 0x01, 0x10, |
| 1380 | 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv |
| 1381 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1382 | 0x01, 0x011, 0x01, 0x10, |
| 1383 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1384 | 0x08, 0x00, 0x01, 0x09, |
| 1385 | 0x08, 0x00, 0x01, 0x09, |
| 1386 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1387 | 0x20, 0x01, 0x22, 0x01, |
| 1388 | 0x20, 0x01, 0x22, 0x01, |
| 1389 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1390 | 0x00, 0x01, 0x01, 0x02, |
| 1391 | 0x07, 0x69, 0x00, 0x60, //TELinkAttributesTlv |
| 1392 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1393 | 0x00, 0x07, 0x08, 0x00, |
| 1394 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1395 | 0x00, 0x09, 0x08, 0x00, |
| 1396 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1397 | 0x00, 0x09, 0x00, 0x00, |
| 1398 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1399 | 0x00, 0x10, 0x00, 0x00, |
| 1400 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1401 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1402 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1403 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1404 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1405 | 0x09, 0x00, 0x00, 0x00, |
| 1406 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1407 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1408 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1409 | 0x09, (byte) 0x89, 0x07, 0x00, |
| 1410 | 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv |
| 1411 | 0x04, 0x47, 0x00, 0x03, |
| 1412 | 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv |
| 1413 | 0x04, 0x49, 0x00, 0x04, |
| 1414 | 0x04, 0x47, 0x00, 0x03 |
| 1415 | }; |
| 1416 | |
| 1417 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1418 | buffer.writeBytes(teReportMsg); |
| 1419 | |
| 1420 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1421 | PcepMessage message = null; |
| 1422 | |
| 1423 | message = reader.readFrom(buffer); |
| 1424 | |
| 1425 | byte[] testReportMsg = {0}; |
| 1426 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 1427 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1428 | message.writeTo(buf); |
| 1429 | |
| 1430 | int readLen = buf.writerIndex() - 0; |
| 1431 | testReportMsg = new byte[readLen]; |
| 1432 | buf.readBytes(testReportMsg, 0, readLen); |
| 1433 | |
| 1434 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 1435 | } |
| 1436 | |
| 1437 | /** |
| 1438 | * This test case checks for |
| 1439 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1440 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1441 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1442 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 1443 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) |
| 1444 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv |
| 1445 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
| 1446 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv)) |
| 1447 | * in PcTERpt message. |
| 1448 | * |
| 1449 | * @throws PcepParseException while parsing PCEP message |
| 1450 | */ |
| 1451 | @Test |
| 1452 | public void teReportMessageTest24() throws PcepParseException { |
| 1453 | |
| 1454 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x10, // common header |
| 1455 | 0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header |
| 1456 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1457 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1458 | 0x00, 0x00, 0x00, 0x00, |
| 1459 | 0x00, 0x00, 0x00, 0x01, |
| 1460 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 1461 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1462 | 0x00, 0x00, 0x00, 0x11, |
| 1463 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1464 | 0x00, 0x00, 0x00, 0x11, |
| 1465 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1466 | 0x00, 0x00, 0x00, 0x11, |
| 1467 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1468 | 0x00, 0x00, 0x00, 0x11, |
| 1469 | 0x00, 0x00, 0x00, 0x11, |
| 1470 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 1471 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1472 | 0x00, 0x00, 0x00, 0x11, |
| 1473 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1474 | 0x00, 0x00, 0x00, 0x11, |
| 1475 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1476 | 0x00, 0x00, 0x00, 0x11, |
| 1477 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1478 | 0x00, 0x00, 0x00, 0x11, |
| 1479 | 0x00, 0x00, 0x00, 0x11, |
| 1480 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 1481 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1482 | 0x01, 0x11, 0x00, 0x09, |
| 1483 | 0x01, 0x21, 0x00, 0x09, |
| 1484 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1485 | 0x01, 0x01, 0x01, 0x01, |
| 1486 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1487 | 0x01, 0x011, 0x01, 0x10, |
| 1488 | 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv |
| 1489 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1490 | 0x01, 0x011, 0x01, 0x10, |
| 1491 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1492 | 0x08, 0x00, 0x01, 0x09, |
| 1493 | 0x08, 0x00, 0x01, 0x09, |
| 1494 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1495 | 0x20, 0x01, 0x22, 0x01, |
| 1496 | 0x20, 0x01, 0x22, 0x01, |
| 1497 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1498 | 0x00, 0x01, 0x01, 0x02, |
| 1499 | 0x07, 0x69, 0x00, 0x58, //TELinkAttributesTlv |
| 1500 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1501 | 0x00, 0x07, 0x08, 0x00, |
| 1502 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1503 | 0x00, 0x09, 0x08, 0x00, |
| 1504 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1505 | 0x00, 0x09, 0x00, 0x00, |
| 1506 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1507 | 0x00, 0x10, 0x00, 0x00, |
| 1508 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1509 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1510 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1511 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1512 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1513 | 0x09, 0x00, 0x00, 0x00, |
| 1514 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1515 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1516 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1517 | 0x09, (byte) 0x89, 0x07, 0x00, |
| 1518 | 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv |
| 1519 | 0x04, 0x47, 0x00, 0x03, |
| 1520 | 0x04, 0x47, 0x00, 0x03 |
| 1521 | }; |
| 1522 | |
| 1523 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1524 | buffer.writeBytes(teReportMsg); |
| 1525 | |
| 1526 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1527 | PcepMessage message = null; |
| 1528 | |
| 1529 | message = reader.readFrom(buffer); |
| 1530 | |
| 1531 | byte[] testReportMsg = {0}; |
| 1532 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 1533 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1534 | message.writeTo(buf); |
| 1535 | |
| 1536 | int readLen = buf.writerIndex() - 0; |
| 1537 | testReportMsg = new byte[readLen]; |
| 1538 | buf.readBytes(testReportMsg, 0, readLen); |
| 1539 | |
| 1540 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 1541 | } |
| 1542 | |
| 1543 | /** |
| 1544 | * This test case checks for |
| 1545 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1546 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1547 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1548 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 1549 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) |
| 1550 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv |
| 1551 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
| 1552 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv)) |
| 1553 | * in PcTERpt message. |
| 1554 | * |
| 1555 | * @throws PcepParseException while parsing PCEP message |
| 1556 | */ |
| 1557 | @Test |
| 1558 | public void teReportMessageTest25() throws PcepParseException { |
| 1559 | |
| 1560 | byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, 0x04, // common header |
| 1561 | 0x0E, 0x10, 0x01, 0x00, // TE Object Header |
| 1562 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1563 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1564 | 0x00, 0x00, 0x00, 0x00, |
| 1565 | 0x00, 0x00, 0x00, 0x01, |
| 1566 | 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV |
| 1567 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1568 | 0x00, 0x00, 0x00, 0x11, |
| 1569 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1570 | 0x00, 0x00, 0x00, 0x11, |
| 1571 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1572 | 0x00, 0x00, 0x00, 0x11, |
| 1573 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1574 | 0x00, 0x00, 0x00, 0x11, |
| 1575 | 0x00, 0x00, 0x00, 0x11, |
| 1576 | 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV |
| 1577 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1578 | 0x00, 0x00, 0x00, 0x11, |
| 1579 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1580 | 0x00, 0x00, 0x00, 0x11, |
| 1581 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1582 | 0x00, 0x00, 0x00, 0x11, |
| 1583 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1584 | 0x00, 0x00, 0x00, 0x11, |
| 1585 | 0x00, 0x00, 0x00, 0x11, |
| 1586 | 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV |
| 1587 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1588 | 0x01, 0x11, 0x00, 0x09, |
| 1589 | 0x01, 0x21, 0x00, 0x09, |
| 1590 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1591 | 0x01, 0x01, 0x01, 0x01, |
| 1592 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1593 | 0x01, 0x011, 0x01, 0x10, |
| 1594 | 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv |
| 1595 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1596 | 0x01, 0x011, 0x01, 0x10, |
| 1597 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1598 | 0x08, 0x00, 0x01, 0x09, |
| 1599 | 0x08, 0x00, 0x01, 0x09, |
| 1600 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1601 | 0x20, 0x01, 0x22, 0x01, |
| 1602 | 0x20, 0x01, 0x22, 0x01, |
| 1603 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1604 | 0x00, 0x01, 0x01, 0x02, |
| 1605 | 0x07, 0x69, 0x00, 0x4C, //TELinkAttributesTlv |
| 1606 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1607 | 0x00, 0x07, 0x08, 0x00, |
| 1608 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1609 | 0x00, 0x09, 0x08, 0x00, |
| 1610 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1611 | 0x00, 0x09, 0x00, 0x00, |
| 1612 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1613 | 0x00, 0x10, 0x00, 0x00, |
| 1614 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1615 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1616 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1617 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1618 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1619 | 0x09, 0x00, 0x00, 0x00, |
| 1620 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1621 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1622 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1623 | 0x09, (byte) 0x89, 0x07, 0x00 |
| 1624 | }; |
| 1625 | |
| 1626 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1627 | buffer.writeBytes(teReportMsg); |
| 1628 | |
| 1629 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1630 | PcepMessage message = null; |
| 1631 | |
| 1632 | message = reader.readFrom(buffer); |
| 1633 | |
| 1634 | byte[] testReportMsg = {0}; |
| 1635 | |
| 1636 | Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); |
| 1637 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1638 | message.writeTo(buf); |
| 1639 | |
| 1640 | int readLen = buf.writerIndex() - 0; |
| 1641 | testReportMsg = new byte[readLen]; |
| 1642 | buf.readBytes(testReportMsg, 0, readLen); |
| 1643 | |
| 1644 | Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); |
| 1645 | } |
| 1646 | } |