Sho SHIMIZU | af1dffc | 2015-09-04 15:56:07 -0700 | [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 static org.hamcrest.core.Is.is; |
| 19 | import static org.hamcrest.Matchers.instanceOf; |
| 20 | |
| 21 | import org.jboss.netty.buffer.ChannelBuffer; |
| 22 | import org.jboss.netty.buffer.ChannelBuffers; |
| 23 | |
| 24 | import static org.hamcrest.MatcherAssert.assertThat; |
| 25 | |
| 26 | import org.junit.Test; |
| 27 | import org.onosproject.pcepio.exceptions.PcepParseException; |
| 28 | import org.onosproject.pcepio.protocol.PcepFactories; |
| 29 | import org.onosproject.pcepio.protocol.PcepMessage; |
| 30 | import org.onosproject.pcepio.protocol.PcepMessageReader; |
| 31 | import org.onosproject.pcepio.protocol.PcepUpdateMsg; |
| 32 | |
| 33 | /** |
| 34 | * Test cases for PCEP update message. |
| 35 | */ |
| 36 | public class PcepUpdateMsgExtTest { |
| 37 | |
| 38 | /** |
| 39 | * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object, |
| 40 | * Metric object in PcepUpdate message. |
| 41 | */ |
| 42 | @Test |
| 43 | public void pcepUpdateMsgTest1() throws PcepParseException { |
| 44 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x8c, |
| 45 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 46 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 47 | 0x20, 0x10, 0x00, 0x38, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 48 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| 49 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| 50 | (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 51 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 52 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 53 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 54 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 55 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 56 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 57 | 0x01, 0x01, 0x04, 0x00, |
| 58 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 59 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 60 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 61 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object |
| 62 | |
| 63 | byte[] testupdateMsg = {0}; |
| 64 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 65 | buffer.writeBytes(updateMsg); |
| 66 | |
| 67 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 68 | PcepMessage message = null; |
| 69 | |
| 70 | message = reader.readFrom(buffer); |
| 71 | |
| 72 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 73 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 74 | message.writeTo(buf); |
| 75 | testupdateMsg = buf.array(); |
| 76 | |
| 77 | int readLen = buf.writerIndex() - 0; |
| 78 | testupdateMsg = new byte[readLen]; |
| 79 | buf.readBytes(testupdateMsg, 0, readLen); |
| 80 | |
| 81 | assertThat(testupdateMsg, is(updateMsg)); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, |
| 86 | * LSPA, Bandwidth object in PcepUpdate message. |
| 87 | */ |
| 88 | @Test |
| 89 | public void pcepUpdateMsgTest2() throws PcepParseException { |
| 90 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x68, |
| 91 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 92 | 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 93 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| 94 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| 95 | (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 96 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 97 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 98 | 0x01, 0x01, 0x04, 0x00, |
| 99 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSP object |
| 100 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 101 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 102 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //metric object |
| 103 | |
| 104 | byte[] testupdateMsg = {0}; |
| 105 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 106 | buffer.writeBytes(updateMsg); |
| 107 | |
| 108 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 109 | PcepMessage message = null; |
| 110 | |
| 111 | message = reader.readFrom(buffer); |
| 112 | |
| 113 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 114 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 115 | message.writeTo(buf); |
| 116 | testupdateMsg = buf.array(); |
| 117 | |
| 118 | int readLen = buf.writerIndex() - 0; |
| 119 | testupdateMsg = new byte[readLen]; |
| 120 | buf.readBytes(testupdateMsg, 0, readLen); |
| 121 | |
| 122 | assertThat(testupdateMsg, is(updateMsg)); |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * This test case is for SRP object, LSP object, ERO object, LSPA, bandwidth object |
| 127 | * Metric object in PcepUpdate message. |
| 128 | */ |
| 129 | @Test |
| 130 | public void pcepUpdateMsgTest3() throws PcepParseException { |
| 131 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, |
| 132 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 133 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 134 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 135 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 136 | 0x01, 0x01, 0x04, 0x00, |
| 137 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 138 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 139 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 140 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 141 | |
| 142 | byte[] testupdateMsg = {0}; |
| 143 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 144 | buffer.writeBytes(updateMsg); |
| 145 | |
| 146 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 147 | PcepMessage message = null; |
| 148 | |
| 149 | message = reader.readFrom(buffer); |
| 150 | |
| 151 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 152 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 153 | message.writeTo(buf); |
| 154 | testupdateMsg = buf.array(); |
| 155 | |
| 156 | int readLen = buf.writerIndex() - 0; |
| 157 | testupdateMsg = new byte[readLen]; |
| 158 | buf.readBytes(testupdateMsg, 0, readLen); |
| 159 | |
| 160 | assertThat(testupdateMsg, is(updateMsg)); |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,bandwidth object |
| 165 | * Metric object in PcepUpdate message. |
| 166 | */ |
| 167 | @Test |
| 168 | public void pcepUpdateMsgTest4() throws PcepParseException { |
| 169 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, |
| 170 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 171 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 172 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 173 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 174 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 175 | 0x01, 0x01, 0x04, 0x00, |
| 176 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 177 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 178 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 179 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 180 | |
| 181 | byte[] testupdateMsg = {0}; |
| 182 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 183 | buffer.writeBytes(updateMsg); |
| 184 | |
| 185 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 186 | PcepMessage message = null; |
| 187 | |
| 188 | message = reader.readFrom(buffer); |
| 189 | |
| 190 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 191 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 192 | message.writeTo(buf); |
| 193 | testupdateMsg = buf.array(); |
| 194 | |
| 195 | int readLen = buf.writerIndex() - 0; |
| 196 | testupdateMsg = new byte[readLen]; |
| 197 | buf.readBytes(testupdateMsg, 0, readLen); |
| 198 | |
| 199 | assertThat(testupdateMsg, is(updateMsg)); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,bandwidth object |
| 204 | * Metric object in PcepUpdate message. |
| 205 | */ |
| 206 | @Test |
| 207 | public void pcepUpdateMsgTest5() throws PcepParseException { |
| 208 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, |
| 209 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 210 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 211 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 212 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 213 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 214 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 215 | 0x01, 0x01, 0x04, 0x00, |
| 216 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 217 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 218 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 219 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 220 | |
| 221 | byte[] testupdateMsg = {0}; |
| 222 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 223 | buffer.writeBytes(updateMsg); |
| 224 | |
| 225 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 226 | PcepMessage message = null; |
| 227 | |
| 228 | message = reader.readFrom(buffer); |
| 229 | |
| 230 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 231 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 232 | message.writeTo(buf); |
| 233 | testupdateMsg = buf.array(); |
| 234 | |
| 235 | int readLen = buf.writerIndex() - 0; |
| 236 | testupdateMsg = new byte[readLen]; |
| 237 | buf.readBytes(testupdateMsg, 0, readLen); |
| 238 | |
| 239 | assertThat(testupdateMsg, is(updateMsg)); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, LSPA, bandwidth object |
| 244 | * Metric object in PcepUpdate message. |
| 245 | */ |
| 246 | @Test |
| 247 | public void pcepUpdateMsgTest6() throws PcepParseException { |
| 248 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, |
| 249 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 250 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 251 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 252 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 253 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 254 | 0x01, 0x01, 0x04, 0x00, |
| 255 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 256 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 257 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 258 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 259 | |
| 260 | byte[] testupdateMsg = {0}; |
| 261 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 262 | buffer.writeBytes(updateMsg); |
| 263 | |
| 264 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 265 | PcepMessage message = null; |
| 266 | |
| 267 | message = reader.readFrom(buffer); |
| 268 | |
| 269 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 270 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 271 | message.writeTo(buf); |
| 272 | testupdateMsg = buf.array(); |
| 273 | |
| 274 | int readLen = buf.writerIndex() - 0; |
| 275 | testupdateMsg = new byte[readLen]; |
| 276 | buf.readBytes(testupdateMsg, 0, readLen); |
| 277 | |
| 278 | assertThat(testupdateMsg, is(updateMsg)); |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, |
| 283 | * bandwidth object Metric object in PcepUpdate message. |
| 284 | */ |
| 285 | @Test |
| 286 | public void pcepUpdateMsgTest7() throws PcepParseException { |
| 287 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, |
| 288 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 289 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 290 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 291 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 292 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 293 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 294 | 0x01, 0x01, 0x04, 0x00, |
| 295 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 296 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 297 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 298 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 299 | |
| 300 | byte[] testupdateMsg = {0}; |
| 301 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 302 | buffer.writeBytes(updateMsg); |
| 303 | |
| 304 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 305 | PcepMessage message = null; |
| 306 | |
| 307 | message = reader.readFrom(buffer); |
| 308 | |
| 309 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 310 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 311 | message.writeTo(buf); |
| 312 | testupdateMsg = buf.array(); |
| 313 | |
| 314 | int readLen = buf.writerIndex() - 0; |
| 315 | testupdateMsg = new byte[readLen]; |
| 316 | buf.readBytes(testupdateMsg, 0, readLen); |
| 317 | |
| 318 | assertThat(testupdateMsg, is(updateMsg)); |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA |
| 323 | * bandwidth object in PcepUpdate message. |
| 324 | */ |
| 325 | @Test |
| 326 | public void pcepUpdateMsgTest8() throws PcepParseException { |
| 327 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, |
| 328 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 329 | 0x20, 0x10, 0x00, 0x1C, 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 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 334 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 335 | 0x01, 0x01, 0x04, 0x00, |
| 336 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 337 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 338 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object |
| 339 | |
| 340 | byte[] testupdateMsg = {0}; |
| 341 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 342 | buffer.writeBytes(updateMsg); |
| 343 | |
| 344 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 345 | PcepMessage message = null; |
| 346 | |
| 347 | message = reader.readFrom(buffer); |
| 348 | |
| 349 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 350 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 351 | message.writeTo(buf); |
| 352 | testupdateMsg = buf.array(); |
| 353 | |
| 354 | int readLen = buf.writerIndex() - 0; |
| 355 | testupdateMsg = new byte[readLen]; |
| 356 | buf.readBytes(testupdateMsg, 0, readLen); |
| 357 | |
| 358 | assertThat(testupdateMsg, is(updateMsg)); |
| 359 | } |
| 360 | |
| 361 | /** |
| 362 | * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA |
| 363 | * bandwidth object in PcepUpdate message. |
| 364 | */ |
| 365 | @Test |
| 366 | public void pcepUpdateMsgTest9() throws PcepParseException { |
| 367 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, |
| 368 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 369 | 0x20, 0x10, 0x00, 0x18, 0x00, 0x00, 0x10, 0x03, |
| 370 | 0x00, 0x15, 0x00, 0x0c, //StatefulRsvpErrorSpecTlv |
| 371 | 0x00, 0x0c, 0x06, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x05, |
| 372 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 373 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 374 | 0x01, 0x01, 0x04, 0x00, |
| 375 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 376 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 377 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object |
| 378 | |
| 379 | byte[] testupdateMsg = {0}; |
| 380 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 381 | buffer.writeBytes(updateMsg); |
| 382 | |
| 383 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 384 | PcepMessage message = null; |
| 385 | |
| 386 | message = reader.readFrom(buffer); |
| 387 | |
| 388 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 389 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 390 | message.writeTo(buf); |
| 391 | testupdateMsg = buf.array(); |
| 392 | |
| 393 | int readLen = buf.writerIndex() - 0; |
| 394 | testupdateMsg = new byte[readLen]; |
| 395 | buf.readBytes(testupdateMsg, 0, readLen); |
| 396 | |
| 397 | assertThat(testupdateMsg, is(updateMsg)); |
| 398 | } |
| 399 | |
| 400 | /** |
| 401 | * This test case is for SRP object, LSP object(StatefulRsvpErrorSpecTlv), ERO object,LSPA |
| 402 | * bandwidth object in PcepUpdate message. |
| 403 | */ |
| 404 | @Test |
| 405 | public void pcepUpdateMsgTest10() throws PcepParseException { |
| 406 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, |
| 407 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 408 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 409 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 410 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 411 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 412 | 0x01, 0x01, 0x04, 0x00, |
| 413 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPa object |
| 414 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 415 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object |
| 416 | |
| 417 | byte[] testupdateMsg = {0}; |
| 418 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 419 | buffer.writeBytes(updateMsg); |
| 420 | |
| 421 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 422 | PcepMessage message = null; |
| 423 | |
| 424 | message = reader.readFrom(buffer); |
| 425 | |
| 426 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 427 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 428 | message.writeTo(buf); |
| 429 | testupdateMsg = buf.array(); |
| 430 | |
| 431 | int readLen = buf.writerIndex() - 0; |
| 432 | testupdateMsg = new byte[readLen]; |
| 433 | buf.readBytes(testupdateMsg, 0, readLen); |
| 434 | |
| 435 | assertThat(testupdateMsg, is(updateMsg)); |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA |
| 440 | * bandwidth object in PcepUpdate message. |
| 441 | */ |
| 442 | @Test |
| 443 | public void pcepUpdateMsgTest11() throws PcepParseException { |
| 444 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, |
| 445 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 446 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 447 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 448 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 449 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 450 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 451 | 0x01, 0x01, 0x04, 0x00, |
| 452 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 453 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 454 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00}; //Bandwidth object |
| 455 | |
| 456 | byte[] testupdateMsg = {0}; |
| 457 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 458 | buffer.writeBytes(updateMsg); |
| 459 | |
| 460 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 461 | PcepMessage message = null; |
| 462 | |
| 463 | message = reader.readFrom(buffer); |
| 464 | |
| 465 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 466 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 467 | message.writeTo(buf); |
| 468 | testupdateMsg = buf.array(); |
| 469 | |
| 470 | int readLen = buf.writerIndex() - 0; |
| 471 | testupdateMsg = new byte[readLen]; |
| 472 | buf.readBytes(testupdateMsg, 0, readLen); |
| 473 | |
| 474 | assertThat(testupdateMsg, is(updateMsg)); |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA |
| 479 | * bandwidth object in PcepUpdate message. |
| 480 | */ |
| 481 | @Test |
| 482 | public void pcepUpdateMsgTest12() throws PcepParseException { |
| 483 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, |
| 484 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 485 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 486 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 487 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 488 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 489 | 0x01, 0x01, 0x04, 0x00, |
| 490 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 491 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 492 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object |
| 493 | |
| 494 | byte[] testupdateMsg = {0}; |
| 495 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 496 | buffer.writeBytes(updateMsg); |
| 497 | |
| 498 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 499 | PcepMessage message = null; |
| 500 | |
| 501 | message = reader.readFrom(buffer); |
| 502 | |
| 503 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 504 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 505 | message.writeTo(buf); |
| 506 | testupdateMsg = buf.array(); |
| 507 | |
| 508 | int readLen = buf.writerIndex() - 0; |
| 509 | testupdateMsg = new byte[readLen]; |
| 510 | buf.readBytes(testupdateMsg, 0, readLen); |
| 511 | |
| 512 | assertThat(testupdateMsg, is(updateMsg)); |
| 513 | } |
| 514 | |
| 515 | /** |
| 516 | * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object,LSPA |
| 517 | * bandwidth object in PcepUpdate message. |
| 518 | */ |
| 519 | @Test |
| 520 | public void pcepUpdateMsgTest13() throws PcepParseException { |
| 521 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, |
| 522 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 523 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 524 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 525 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 526 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 527 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 528 | 0x01, 0x01, 0x04, 0x00, |
| 529 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 530 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 531 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object |
| 532 | |
| 533 | byte[] testupdateMsg = {0}; |
| 534 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 535 | buffer.writeBytes(updateMsg); |
| 536 | |
| 537 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 538 | PcepMessage message = null; |
| 539 | |
| 540 | message = reader.readFrom(buffer); |
| 541 | |
| 542 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 543 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 544 | message.writeTo(buf); |
| 545 | testupdateMsg = buf.array(); |
| 546 | |
| 547 | int readLen = buf.writerIndex() - 0; |
| 548 | testupdateMsg = new byte[readLen]; |
| 549 | buf.readBytes(testupdateMsg, 0, readLen); |
| 550 | |
| 551 | assertThat(testupdateMsg, is(updateMsg)); |
| 552 | } |
| 553 | |
| 554 | /** |
| 555 | * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object,LSPA |
| 556 | * metric object in PcepUpdate message. |
| 557 | */ |
| 558 | @Test |
| 559 | public void pcepUpdateMsgTest14() throws PcepParseException { |
| 560 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x60, |
| 561 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 562 | 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 563 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| 564 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| 565 | (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 566 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 567 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 568 | 0x01, 0x01, 0x04, 0x00, |
| 569 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 570 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 571 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 572 | |
| 573 | byte[] testupdateMsg = {0}; |
| 574 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 575 | buffer.writeBytes(updateMsg); |
| 576 | |
| 577 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 578 | PcepMessage message = null; |
| 579 | |
| 580 | message = reader.readFrom(buffer); |
| 581 | |
| 582 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 583 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 584 | message.writeTo(buf); |
| 585 | testupdateMsg = buf.array(); |
| 586 | |
| 587 | int readLen = buf.writerIndex() - 0; |
| 588 | testupdateMsg = new byte[readLen]; |
| 589 | buf.readBytes(testupdateMsg, 0, readLen); |
| 590 | |
| 591 | assertThat(testupdateMsg, is(updateMsg)); |
| 592 | } |
| 593 | |
| 594 | /** |
| 595 | * This test case is for SRP object, LSP object, ERO object,LSPA |
| 596 | * metric object in PcepUpdate message. |
| 597 | */ |
| 598 | @Test |
| 599 | public void pcepUpdateMsgTest15() throws PcepParseException { |
| 600 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, |
| 601 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 602 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 603 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 604 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 605 | 0x01, 0x01, 0x04, 0x00, |
| 606 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //lspa object |
| 607 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 608 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 609 | |
| 610 | byte[] testupdateMsg = {0}; |
| 611 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 612 | buffer.writeBytes(updateMsg); |
| 613 | |
| 614 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 615 | PcepMessage message = null; |
| 616 | |
| 617 | message = reader.readFrom(buffer); |
| 618 | |
| 619 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 620 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 621 | message.writeTo(buf); |
| 622 | testupdateMsg = buf.array(); |
| 623 | |
| 624 | int readLen = buf.writerIndex() - 0; |
| 625 | testupdateMsg = new byte[readLen]; |
| 626 | buf.readBytes(testupdateMsg, 0, readLen); |
| 627 | |
| 628 | assertThat(testupdateMsg, is(updateMsg)); |
| 629 | } |
| 630 | |
| 631 | /** |
| 632 | * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object,LSPA |
| 633 | * metric object in PcepUpdate message. |
| 634 | */ |
| 635 | @Test |
| 636 | public void pcepUpdateMsgTest16() throws PcepParseException { |
| 637 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, |
| 638 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 639 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 640 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 641 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 642 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 643 | 0x01, 0x01, 0x04, 0x00, |
| 644 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 645 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 646 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 647 | |
| 648 | byte[] testupdateMsg = {0}; |
| 649 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 650 | buffer.writeBytes(updateMsg); |
| 651 | |
| 652 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 653 | PcepMessage message = null; |
| 654 | |
| 655 | message = reader.readFrom(buffer); |
| 656 | |
| 657 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 658 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 659 | message.writeTo(buf); |
| 660 | testupdateMsg = buf.array(); |
| 661 | |
| 662 | int readLen = buf.writerIndex() - 0; |
| 663 | testupdateMsg = new byte[readLen]; |
| 664 | buf.readBytes(testupdateMsg, 0, readLen); |
| 665 | |
| 666 | assertThat(testupdateMsg, is(updateMsg)); |
| 667 | } |
| 668 | |
| 669 | /** |
| 670 | * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object,LSPA |
| 671 | * metric object in PcepUpdate message. |
| 672 | */ |
| 673 | @Test |
| 674 | public void pcepUpdateMsgTest17() throws PcepParseException { |
| 675 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x58, |
| 676 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 677 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 678 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 679 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 680 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 681 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 682 | 0x01, 0x01, 0x04, 0x00, |
| 683 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 684 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 685 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 686 | |
| 687 | byte[] testupdateMsg = {0}; |
| 688 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 689 | buffer.writeBytes(updateMsg); |
| 690 | |
| 691 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 692 | PcepMessage message = null; |
| 693 | |
| 694 | message = reader.readFrom(buffer); |
| 695 | |
| 696 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 697 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 698 | message.writeTo(buf); |
| 699 | testupdateMsg = buf.array(); |
| 700 | |
| 701 | int readLen = buf.writerIndex() - 0; |
| 702 | testupdateMsg = new byte[readLen]; |
| 703 | buf.readBytes(testupdateMsg, 0, readLen); |
| 704 | |
| 705 | assertThat(testupdateMsg, is(updateMsg)); |
| 706 | } |
| 707 | |
| 708 | /** |
| 709 | * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object,LSPA |
| 710 | * metric object in PcepUpdate message. |
| 711 | */ |
| 712 | @Test |
| 713 | public void pcepUpdateMsgTest18() throws PcepParseException { |
| 714 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, |
| 715 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 716 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 717 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 718 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 719 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 720 | 0x01, 0x01, 0x04, 0x00, |
| 721 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 722 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 723 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 724 | |
| 725 | byte[] testupdateMsg = {0}; |
| 726 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 727 | buffer.writeBytes(updateMsg); |
| 728 | |
| 729 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 730 | PcepMessage message = null; |
| 731 | |
| 732 | message = reader.readFrom(buffer); |
| 733 | |
| 734 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 735 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 736 | message.writeTo(buf); |
| 737 | testupdateMsg = buf.array(); |
| 738 | |
| 739 | int readLen = buf.writerIndex() - 0; |
| 740 | testupdateMsg = new byte[readLen]; |
| 741 | buf.readBytes(testupdateMsg, 0, readLen); |
| 742 | |
| 743 | assertThat(testupdateMsg, is(updateMsg)); |
| 744 | } |
| 745 | |
| 746 | /** |
| 747 | * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, |
| 748 | * metric object in PcepUpdate message. |
| 749 | */ |
| 750 | @Test |
| 751 | public void pcepUpdateMsgTest19() throws PcepParseException { |
| 752 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x5c, |
| 753 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 754 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 755 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 756 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 757 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 758 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 759 | 0x01, 0x01, 0x04, 0x00, |
| 760 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, |
| 761 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, |
| 762 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 763 | |
| 764 | byte[] testupdateMsg = {0}; |
| 765 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 766 | buffer.writeBytes(updateMsg); |
| 767 | |
| 768 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 769 | PcepMessage message = null; |
| 770 | |
| 771 | message = reader.readFrom(buffer); |
| 772 | |
| 773 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 774 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 775 | message.writeTo(buf); |
| 776 | testupdateMsg = buf.array(); |
| 777 | |
| 778 | int readLen = buf.writerIndex() - 0; |
| 779 | testupdateMsg = new byte[readLen]; |
| 780 | buf.readBytes(testupdateMsg, 0, readLen); |
| 781 | |
| 782 | assertThat(testupdateMsg, is(updateMsg)); |
| 783 | } |
| 784 | |
| 785 | /** |
| 786 | * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, |
| 787 | * Bandwidth , metric object in PcepUpdate message. |
| 788 | */ |
| 789 | @Test |
| 790 | public void pcepUpdateMsgTest20() throws PcepParseException { |
| 791 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, |
| 792 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 793 | 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 794 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| 795 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| 796 | (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 797 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 798 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 799 | 0x01, 0x01, 0x04, 0x00, |
| 800 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 801 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 802 | |
| 803 | byte[] testupdateMsg = {0}; |
| 804 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 805 | buffer.writeBytes(updateMsg); |
| 806 | |
| 807 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 808 | PcepMessage message = null; |
| 809 | |
| 810 | message = reader.readFrom(buffer); |
| 811 | |
| 812 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 813 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 814 | message.writeTo(buf); |
| 815 | testupdateMsg = buf.array(); |
| 816 | |
| 817 | int readLen = buf.writerIndex() - 0; |
| 818 | testupdateMsg = new byte[readLen]; |
| 819 | buf.readBytes(testupdateMsg, 0, readLen); |
| 820 | |
| 821 | assertThat(testupdateMsg, is(updateMsg)); |
| 822 | } |
| 823 | |
| 824 | /** |
| 825 | * This test case is for SRP object, LSP object, ERO object, |
| 826 | * Bandwidth , metric object in PcepUpdate message. |
| 827 | */ |
| 828 | @Test |
| 829 | public void pcepUpdateMsgTest21() throws PcepParseException { |
| 830 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, |
| 831 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 832 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 833 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 834 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 835 | 0x01, 0x01, 0x04, 0x00, |
| 836 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 837 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 838 | |
| 839 | byte[] testupdateMsg = {0}; |
| 840 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 841 | buffer.writeBytes(updateMsg); |
| 842 | |
| 843 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 844 | PcepMessage message = null; |
| 845 | |
| 846 | message = reader.readFrom(buffer); |
| 847 | |
| 848 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 849 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 850 | message.writeTo(buf); |
| 851 | testupdateMsg = buf.array(); |
| 852 | |
| 853 | int readLen = buf.writerIndex() - 0; |
| 854 | testupdateMsg = new byte[readLen]; |
| 855 | buf.readBytes(testupdateMsg, 0, readLen); |
| 856 | |
| 857 | assertThat(testupdateMsg, is(updateMsg)); |
| 858 | } |
| 859 | |
| 860 | /** |
| 861 | * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object, |
| 862 | * Bandwidth , metric object in PcepUpdate message. |
| 863 | */ |
| 864 | @Test |
| 865 | public void pcepUpdateMsgTest22() throws PcepParseException { |
| 866 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, |
| 867 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 868 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 869 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 870 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 871 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 872 | 0x01, 0x01, 0x04, 0x00, |
| 873 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 874 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 875 | |
| 876 | byte[] testupdateMsg = {0}; |
| 877 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 878 | buffer.writeBytes(updateMsg); |
| 879 | |
| 880 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 881 | PcepMessage message = null; |
| 882 | |
| 883 | message = reader.readFrom(buffer); |
| 884 | |
| 885 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 886 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 887 | message.writeTo(buf); |
| 888 | testupdateMsg = buf.array(); |
| 889 | |
| 890 | int readLen = buf.writerIndex() - 0; |
| 891 | testupdateMsg = new byte[readLen]; |
| 892 | buf.readBytes(testupdateMsg, 0, readLen); |
| 893 | |
| 894 | assertThat(testupdateMsg, is(updateMsg)); |
| 895 | } |
| 896 | |
| 897 | /** |
| 898 | * This test case is for SRP object, LSP object(StatefulLspDbVerTlv), ERO object, |
| 899 | * Bandwidth , metric object in PcepUpdate message. |
| 900 | */ |
| 901 | @Test |
| 902 | public void pcepUpdateMsgTest23() throws PcepParseException { |
| 903 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, |
| 904 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 905 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 906 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 907 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 908 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 909 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 910 | 0x01, 0x01, 0x04, 0x00, |
| 911 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 912 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 913 | |
| 914 | byte[] testupdateMsg = {0}; |
| 915 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 916 | buffer.writeBytes(updateMsg); |
| 917 | |
| 918 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 919 | PcepMessage message = null; |
| 920 | |
| 921 | message = reader.readFrom(buffer); |
| 922 | |
| 923 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 924 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 925 | message.writeTo(buf); |
| 926 | testupdateMsg = buf.array(); |
| 927 | |
| 928 | int readLen = buf.writerIndex() - 0; |
| 929 | testupdateMsg = new byte[readLen]; |
| 930 | buf.readBytes(testupdateMsg, 0, readLen); |
| 931 | |
| 932 | assertThat(testupdateMsg, is(updateMsg)); |
| 933 | } |
| 934 | |
| 935 | /** |
| 936 | * This test case is for SRP object, LSP object(SymbolicPathNameTlv), ERO object, |
| 937 | * Bandwidth , metric object in PcepUpdate message. |
| 938 | */ |
| 939 | @Test |
| 940 | public void pcepUpdateMsgTest24() throws PcepParseException { |
| 941 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, |
| 942 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 943 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 944 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 945 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 946 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 947 | 0x01, 0x01, 0x04, 0x00, |
| 948 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 949 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 950 | |
| 951 | byte[] testupdateMsg = {0}; |
| 952 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 953 | buffer.writeBytes(updateMsg); |
| 954 | |
| 955 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 956 | PcepMessage message = null; |
| 957 | |
| 958 | message = reader.readFrom(buffer); |
| 959 | |
| 960 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 961 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 962 | message.writeTo(buf); |
| 963 | testupdateMsg = buf.array(); |
| 964 | |
| 965 | int readLen = buf.writerIndex() - 0; |
| 966 | testupdateMsg = new byte[readLen]; |
| 967 | buf.readBytes(testupdateMsg, 0, readLen); |
| 968 | |
| 969 | assertThat(testupdateMsg, is(updateMsg)); |
| 970 | } |
| 971 | |
| 972 | /** |
| 973 | * This test case is for SRP object(SymbolicPathNameTlv), LSP object(SymbolicPathNameTlv), ERO object, |
| 974 | * Bandwidth , metric object in PcepUpdate message. |
| 975 | */ |
| 976 | @Test |
| 977 | public void pcepUpdateMsgTest25() throws PcepParseException { |
| 978 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x50, |
| 979 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 980 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 981 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 982 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 983 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 984 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 985 | 0x01, 0x01, 0x04, 0x00, |
| 986 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object |
| 987 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 988 | |
| 989 | byte[] testupdateMsg = {0}; |
| 990 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 991 | buffer.writeBytes(updateMsg); |
| 992 | |
| 993 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 994 | PcepMessage message = null; |
| 995 | |
| 996 | message = reader.readFrom(buffer); |
| 997 | |
| 998 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 999 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1000 | message.writeTo(buf); |
| 1001 | testupdateMsg = buf.array(); |
| 1002 | |
| 1003 | int readLen = buf.writerIndex() - 0; |
| 1004 | testupdateMsg = new byte[readLen]; |
| 1005 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1006 | |
| 1007 | assertThat(testupdateMsg, is(updateMsg)); |
| 1008 | } |
| 1009 | |
| 1010 | /** |
| 1011 | * This test case is for SRP object, LSP object(StatefulIPv4LspIdentidiersTlv), ERO object, |
| 1012 | * LSPA object in PcepUpdate message. |
| 1013 | */ |
| 1014 | @Test |
| 1015 | public void pcepUpdateMsgTest26() throws PcepParseException { |
| 1016 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, |
| 1017 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 1018 | 0x20, 0x10, 0x00, 0x1C, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 1019 | 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv |
| 1020 | (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, |
| 1021 | (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, |
| 1022 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 1023 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 1024 | 0x01, 0x01, 0x04, 0x00, |
| 1025 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 1026 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; |
| 1027 | |
| 1028 | byte[] testupdateMsg = {0}; |
| 1029 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1030 | buffer.writeBytes(updateMsg); |
| 1031 | |
| 1032 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1033 | PcepMessage message = null; |
| 1034 | |
| 1035 | message = reader.readFrom(buffer); |
| 1036 | |
| 1037 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 1038 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1039 | message.writeTo(buf); |
| 1040 | testupdateMsg = buf.array(); |
| 1041 | |
| 1042 | int readLen = buf.writerIndex() - 0; |
| 1043 | testupdateMsg = new byte[readLen]; |
| 1044 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1045 | |
| 1046 | assertThat(testupdateMsg, is(updateMsg)); |
| 1047 | } |
| 1048 | |
| 1049 | /** |
| 1050 | * This test case is for SRP object, LSP object, ERO object, |
| 1051 | * bandwidth object in PcepUpdate message. |
| 1052 | */ |
| 1053 | @Test |
| 1054 | public void pcepUpdateMsgTest27() throws PcepParseException { |
| 1055 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x34, |
| 1056 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 1057 | 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 1058 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 1059 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 1060 | 0x01, 0x01, 0x04, 0x00, |
| 1061 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object |
| 1062 | |
| 1063 | byte[] testupdateMsg = {0}; |
| 1064 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1065 | buffer.writeBytes(updateMsg); |
| 1066 | |
| 1067 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1068 | PcepMessage message = null; |
| 1069 | |
| 1070 | message = reader.readFrom(buffer); |
| 1071 | |
| 1072 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 1073 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1074 | message.writeTo(buf); |
| 1075 | testupdateMsg = buf.array(); |
| 1076 | |
| 1077 | int readLen = buf.writerIndex() - 0; |
| 1078 | testupdateMsg = new byte[readLen]; |
| 1079 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1080 | |
| 1081 | assertThat(testupdateMsg, is(updateMsg)); |
| 1082 | } |
| 1083 | |
| 1084 | /** |
| 1085 | * This test case is for SRP object, LSP object(StatefulLspErrorCodeTlv), ERO object, |
| 1086 | * metric object in PcepUpdate message. |
| 1087 | */ |
| 1088 | @Test |
| 1089 | public void pcepUpdateMsgTest28() throws PcepParseException { |
| 1090 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x40, |
| 1091 | 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 1092 | 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 1093 | 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv |
| 1094 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 1095 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 1096 | 0x01, 0x01, 0x04, 0x00, |
| 1097 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 1098 | |
| 1099 | byte[] testupdateMsg = {0}; |
| 1100 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1101 | buffer.writeBytes(updateMsg); |
| 1102 | |
| 1103 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1104 | PcepMessage message = null; |
| 1105 | |
| 1106 | message = reader.readFrom(buffer); |
| 1107 | |
| 1108 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 1109 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1110 | message.writeTo(buf); |
| 1111 | testupdateMsg = buf.array(); |
| 1112 | |
| 1113 | int readLen = buf.writerIndex() - 0; |
| 1114 | testupdateMsg = new byte[readLen]; |
| 1115 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1116 | |
| 1117 | assertThat(testupdateMsg, is(updateMsg)); |
| 1118 | } |
| 1119 | |
| 1120 | /** |
| 1121 | * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, |
| 1122 | * lspa object in PcepUpdate message. |
| 1123 | */ |
| 1124 | @Test |
| 1125 | public void pcepUpdateMsgTest29() throws PcepParseException { |
| 1126 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x54, |
| 1127 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 1128 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 1129 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 1130 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 1131 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 1132 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 1133 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 1134 | 0x01, 0x01, 0x04, 0x00, |
| 1135 | 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object |
| 1136 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00 }; |
| 1137 | |
| 1138 | byte[] testupdateMsg = {0}; |
| 1139 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1140 | buffer.writeBytes(updateMsg); |
| 1141 | |
| 1142 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1143 | PcepMessage message = null; |
| 1144 | |
| 1145 | message = reader.readFrom(buffer); |
| 1146 | |
| 1147 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 1148 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1149 | message.writeTo(buf); |
| 1150 | testupdateMsg = buf.array(); |
| 1151 | |
| 1152 | int readLen = buf.writerIndex() - 0; |
| 1153 | testupdateMsg = new byte[readLen]; |
| 1154 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1155 | |
| 1156 | assertThat(testupdateMsg, is(updateMsg)); |
| 1157 | } |
| 1158 | |
| 1159 | /** |
| 1160 | * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, |
| 1161 | * bandwidth object in PcepUpdate message. |
| 1162 | */ |
| 1163 | @Test |
| 1164 | public void pcepUpdateMsgTest30() throws PcepParseException { |
| 1165 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x48, |
| 1166 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 1167 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 1168 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 1169 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 1170 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 1171 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 1172 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 1173 | 0x01, 0x01, 0x04, 0x00, |
| 1174 | 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00 }; //Bandwidth object |
| 1175 | |
| 1176 | byte[] testupdateMsg = {0}; |
| 1177 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1178 | buffer.writeBytes(updateMsg); |
| 1179 | |
| 1180 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1181 | PcepMessage message = null; |
| 1182 | |
| 1183 | message = reader.readFrom(buffer); |
| 1184 | |
| 1185 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 1186 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1187 | message.writeTo(buf); |
| 1188 | testupdateMsg = buf.array(); |
| 1189 | |
| 1190 | int readLen = buf.writerIndex() - 0; |
| 1191 | testupdateMsg = new byte[readLen]; |
| 1192 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1193 | |
| 1194 | assertThat(testupdateMsg, is(updateMsg)); |
| 1195 | } |
| 1196 | |
| 1197 | /** |
| 1198 | * This test case is for SRP object(SymbolicPathNameTlv), LSP object(StatefulLspErrorCodeTlv), ERO object, |
| 1199 | * metric object in PcepUpdate message. |
| 1200 | */ |
| 1201 | @Test |
| 1202 | public void pcepUpdateMsgTest31() throws PcepParseException { |
| 1203 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x4c, |
| 1204 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 1205 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 1206 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 1207 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 1208 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 1209 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 1210 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 1211 | 0x01, 0x01, 0x04, 0x00, |
| 1212 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 1213 | |
| 1214 | byte[] testupdateMsg = {0}; |
| 1215 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1216 | buffer.writeBytes(updateMsg); |
| 1217 | |
| 1218 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1219 | PcepMessage message = null; |
| 1220 | |
| 1221 | message = reader.readFrom(buffer); |
| 1222 | |
| 1223 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 1224 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1225 | message.writeTo(buf); |
| 1226 | testupdateMsg = buf.array(); |
| 1227 | |
| 1228 | int readLen = buf.writerIndex() - 0; |
| 1229 | testupdateMsg = new byte[readLen]; |
| 1230 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1231 | |
| 1232 | assertThat(testupdateMsg, is(updateMsg)); |
| 1233 | } |
| 1234 | |
| 1235 | /** |
| 1236 | * This test case is for SRP object(symbolic path tlv), LSP object(StatefulLspDbVerTlv), ERO object, |
| 1237 | * Metric object in PcepUpdate message. |
| 1238 | */ |
| 1239 | @Test |
| 1240 | public void pcepUpdateMsgTest32() throws PcepParseException { |
| 1241 | byte[] updateMsg = new byte[] {0x20, 0x0b, 0x00, (byte) 0x64, |
| 1242 | 0x21, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, //SRP object |
| 1243 | 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv |
| 1244 | 0x20, 0x10, 0x00, 0x14, 0x00, 0x00, 0x10, 0x03, //LSP object |
| 1245 | 0x00, 0x17, 0x00, 0x08, //StatefulLspDbVerTlv |
| 1246 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, |
| 1247 | 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, 0x11, 0x01, //ERO Object |
| 1248 | 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, |
| 1249 | 0x01, 0x01, 0x04, 0x00, |
| 1250 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object |
| 1251 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object |
| 1252 | 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric object |
| 1253 | |
| 1254 | byte[] testupdateMsg = {0}; |
| 1255 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1256 | buffer.writeBytes(updateMsg); |
| 1257 | |
| 1258 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1259 | PcepMessage message = null; |
| 1260 | |
| 1261 | message = reader.readFrom(buffer); |
| 1262 | |
| 1263 | assertThat(message, instanceOf(PcepUpdateMsg.class)); |
| 1264 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1265 | message.writeTo(buf); |
| 1266 | testupdateMsg = buf.array(); |
| 1267 | |
| 1268 | int readLen = buf.writerIndex() - 0; |
| 1269 | testupdateMsg = new byte[readLen]; |
| 1270 | buf.readBytes(testupdateMsg, 0, readLen); |
| 1271 | |
| 1272 | assertThat(testupdateMsg, is(updateMsg)); |
| 1273 | } |
| 1274 | } |
| 1275 | |