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