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