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