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