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