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