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