| /* |
| * Copyright 2014-2015 Open Networking Laboratory |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| package org.onosproject.pcepio; |
| |
| import org.jboss.netty.buffer.ChannelBuffer; |
| import org.jboss.netty.buffer.ChannelBuffers; |
| import org.junit.Test; |
| import org.onosproject.pcepio.exceptions.PcepParseException; |
| import org.onosproject.pcepio.protocol.PcepFactories; |
| import org.onosproject.pcepio.protocol.PcepMessage; |
| import org.onosproject.pcepio.protocol.PcepMessageReader; |
| import org.onosproject.pcepio.protocol.PcepReportMsg; |
| |
| import static org.hamcrest.MatcherAssert.assertThat; |
| import static org.hamcrest.Matchers.instanceOf; |
| import static org.hamcrest.core.Is.is; |
| |
| public class PcepReportMsgTest { |
| |
| /** |
| * This test case checks for SRP object, LSP object(Symbolic path name tlv), ERO object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest1() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, 0x24, |
| 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x04}; //ERO Object |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv |
| * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list, IRO object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest2() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7c, |
| 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object // LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // IPv4SubObjects |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| }; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) |
| * ERO Object, LSPA Object, Metric-list, IRO object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest3() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| }; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) |
| * ERO Object, LSPA Object, Metric-list |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest4() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x64, |
| 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv |
| * StatefulLspErrorCodeTlv) ERO Object, IRO object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest5() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x50, |
| 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv |
| * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list. |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest6() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, |
| 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x04, //ERO Object |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| }; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object, ERO Object, LSPA Object, Metric-list, IRO object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest7() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, |
| 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, // Metric objects |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP object, LSP object( StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, |
| * StatefulLspErrorCodeTlv) ERO object, LSPA object, Metric object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest8() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, |
| 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, |
| * StatefulLspErrorCodeTlv ),ERO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest9() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(StatefulIPv4LspIdentidiersTlv)ERO Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest10() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(SymbolicPathNameTlv)ERO Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest11() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object, ERO Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest12() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(StatefulLspErrorCodeTlv)ERO Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest13() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(StatefulRsvpErrorSpecTlv),ERO Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest14() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x60, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path tlv),LSPA Object,ERO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest15() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x7C, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path tlv),BandWidth Object,ERO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest16() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x70, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest17() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object,ERO Object,BandWidth Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest18() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x68, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object,ERO Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest19() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6C, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest20() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x88, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, |
| * StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest21() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xac, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
| * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest22() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xA0, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
| * ERO Object,BandWidth Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest23() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
| * ERO Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest24() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x84, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
| * ERO Object,LSPA Object,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest25() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8c, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
| * ERO Object,LSPA Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest26() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x58, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv) |
| * ERO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest27() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x44, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) |
| * LSPA Object,BandWidth Object,Metric-list,ERO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest28() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x6c, |
| 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest29() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x74, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object |
| * SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest30() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xE4, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object |
| * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) |
| * ERO Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest31() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, 0x00, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object |
| * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) |
| * ERO Object,LSPA Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest32() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x14, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object |
| * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) |
| * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest33() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x01, (byte) 0x1c, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, |
| 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, |
| 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object(symbolic path Tlv),ERO Object,LSPA Object |
| * BandWidth Object,Metric-list,SRP Object,LSP Object(symbolic path tlv) |
| * ERO Object,LSPA Object,BandWidth Object,Metric-list |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest34() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xB4, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x04, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| |
| /** |
| * This test case checks for SRP Object,LSP Object)Symbolic path tlv),ERO Object,SRP Object |
| * LSP Object(symbolic path tlv) ERO Object,LSPA Object, BandWidth Object,Metric-list |
| * in PcRpt message. |
| */ |
| @Test |
| public void reportMessageTest35() throws PcepParseException { |
| |
| byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0x8C, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object |
| 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object |
| 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 0x07, 0x10, 0x00, 0x14, //ERO Object |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, |
| 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, |
| 0x09, 0x10, 0x00, 0x14, //LSPA Object |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object |
| 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object |
| |
| byte[] testReportMsg = {0}; |
| ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| buffer.writeBytes(reportMsg); |
| |
| PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| PcepMessage message = null; |
| |
| message = reader.readFrom(buffer); |
| |
| assertThat(message, instanceOf(PcepReportMsg.class)); |
| ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| message.writeTo(buf); |
| |
| int readLen = buf.writerIndex(); |
| testReportMsg = new byte[readLen]; |
| buf.readBytes(testReportMsg, 0, readLen); |
| |
| assertThat(testReportMsg, is(reportMsg)); |
| } |
| } |