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