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