bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [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; |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 17 | |
| 18 | import org.jboss.netty.buffer.ChannelBuffer; |
| 19 | import org.jboss.netty.buffer.ChannelBuffers; |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 20 | import org.junit.Test; |
| 21 | import org.onosproject.pcepio.exceptions.PcepParseException; |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 22 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 23 | import static org.hamcrest.MatcherAssert.assertThat; |
| 24 | import static org.hamcrest.Matchers.instanceOf; |
| 25 | import static org.hamcrest.core.Is.is; |
| 26 | |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 27 | public class PcepTEReportMsgTest { |
| 28 | |
| 29 | /** |
| 30 | * This test case checks for |
| 31 | * TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)). |
| 32 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 33 | */ |
| 34 | @Test |
| 35 | public void teReportMessageTest1() throws PcepParseException { |
| 36 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 37 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 38 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header |
| 39 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 40 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 42 | 0x06, 0x65, 0x00, 0x08, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 43 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 44 | 0x00, 0x00, 0x00, 0x11}; |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 45 | |
| 46 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 47 | buffer.writeBytes(teReportMsg); |
| 48 | |
| 49 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 50 | PcepMessage message = null; |
| 51 | |
| 52 | message = reader.readFrom(buffer); |
| 53 | |
| 54 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 55 | |
| 56 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 57 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 58 | message.writeTo(buf); |
| 59 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 60 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 61 | testReportMsg = new byte[readLen]; |
| 62 | buf.readBytes(testReportMsg, 0, readLen); |
| 63 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 64 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | /** |
| 68 | * This test case checks for |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 69 | * T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 70 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 71 | */ |
| 72 | @Test |
| 73 | public void teReportMessageTest2() throws PcepParseException { |
| 74 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 75 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x28, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 76 | 0x0E, 0x10, 0x00, 0x24, // TE Object Header |
| 77 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 78 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 80 | 0x06, 0x65, 0x00, 0x08, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 81 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 82 | 0x00, 0x00, 0x00, 0x11}; |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 83 | |
| 84 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 85 | buffer.writeBytes(teReportMsg); |
| 86 | |
| 87 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 88 | PcepMessage message = null; |
| 89 | |
| 90 | message = reader.readFrom(buffer); |
| 91 | |
| 92 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 93 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 94 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 95 | message.writeTo(buf); |
| 96 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 97 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 98 | testReportMsg = new byte[readLen]; |
| 99 | buf.readBytes(testReportMsg, 0, readLen); |
| 100 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 101 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | /** |
| 105 | * This test case checks for TE Object (Routing Universe TLV) |
| 106 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 107 | */ |
| 108 | @Test |
| 109 | public void teReportMessageTest3() throws PcepParseException { |
| 110 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 111 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x1c, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 112 | 0x0E, 0x10, 0x00, 0x18, // TE Object Header |
| 113 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 114 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 115 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 116 | |
| 117 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 118 | buffer.writeBytes(teReportMsg); |
| 119 | |
| 120 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 121 | PcepMessage message = null; |
| 122 | |
| 123 | message = reader.readFrom(buffer); |
| 124 | |
| 125 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 126 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 127 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 128 | message.writeTo(buf); |
| 129 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 130 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 131 | testReportMsg = new byte[readLen]; |
| 132 | buf.readBytes(testReportMsg, 0, readLen); |
| 133 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 134 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | /** |
| 138 | * This test case checks for |
| 139 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 140 | * OSPFareaIDsubTlv, RouterIDSubTlv)). |
| 141 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 142 | */ |
| 143 | @Test |
| 144 | public void teReportMessageTest4() throws PcepParseException { |
| 145 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 146 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x44, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 147 | 0x0E, 0x10, 0x00, 0x40, // TE Object Header |
| 148 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 149 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 150 | 0x00, 0x00, 0x00, 0x00, |
| 151 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 152 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 153 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 154 | 0x00, 0x00, 0x00, 0x11, |
| 155 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 156 | 0x00, 0x00, 0x00, 0x11, |
| 157 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 158 | 0x00, 0x00, 0x00, 0x11, |
| 159 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 160 | 0x00, 0x00, 0x00, 0x11, |
| 161 | 0x00, 0x00, 0x00, 0x11}; |
| 162 | |
| 163 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 164 | buffer.writeBytes(teReportMsg); |
| 165 | |
| 166 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 167 | PcepMessage message = null; |
| 168 | |
| 169 | message = reader.readFrom(buffer); |
| 170 | |
| 171 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 172 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 173 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 174 | message.writeTo(buf); |
| 175 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 176 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 177 | testReportMsg = new byte[readLen]; |
| 178 | buf.readBytes(testReportMsg, 0, readLen); |
| 179 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 180 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 181 | } |
| 182 | |
| 183 | /** |
| 184 | * This test case checks for |
| 185 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv |
| 186 | * OSPFareaIDsubTlv, RouterIDSubTlv)) |
| 187 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 188 | */ |
| 189 | @Test |
| 190 | public void teReportMessageTest5() throws PcepParseException { |
| 191 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 192 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x3C, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 193 | 0x0E, 0x10, 0x00, 0x38, // TE Object Header |
| 194 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 195 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 196 | 0x00, 0x00, 0x00, 0x00, |
| 197 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 198 | 0x06, 0x65, 0x00, 0x1C, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 199 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 200 | 0x00, 0x00, 0x00, 0x11, |
| 201 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 202 | 0x00, 0x00, 0x00, 0x11, |
| 203 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 204 | 0x00, 0x00, 0x00, 0x11, |
| 205 | 0x00, 0x00, 0x00, 0x11}; |
| 206 | |
| 207 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 208 | buffer.writeBytes(teReportMsg); |
| 209 | |
| 210 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 211 | PcepMessage message = null; |
| 212 | |
| 213 | message = reader.readFrom(buffer); |
| 214 | |
| 215 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 216 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 217 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 218 | message.writeTo(buf); |
| 219 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 220 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 221 | testReportMsg = new byte[readLen]; |
| 222 | buf.readBytes(testReportMsg, 0, readLen); |
| 223 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 224 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | /** |
| 228 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv, |
| 229 | * RouterIDSubTlv)) |
| 230 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 231 | */ |
| 232 | @Test |
| 233 | public void teReportMessageTest6() throws PcepParseException { |
| 234 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 235 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x34, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 236 | 0x0E, 0x10, 0x00, 0x30, // TE Object Header |
| 237 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 238 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 239 | 0x00, 0x00, 0x00, 0x00, |
| 240 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 241 | 0x06, 0x65, 0x00, 0x14, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 242 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 243 | 0x00, 0x00, 0x00, 0x11, |
| 244 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 245 | 0x00, 0x00, 0x00, 0x11, |
| 246 | 0x00, 0x00, 0x00, 0x11}; |
| 247 | |
| 248 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 249 | buffer.writeBytes(teReportMsg); |
| 250 | |
| 251 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 252 | PcepMessage message = null; |
| 253 | |
| 254 | message = reader.readFrom(buffer); |
| 255 | |
| 256 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 257 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 258 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 259 | message.writeTo(buf); |
| 260 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 261 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 262 | testReportMsg = new byte[readLen]; |
| 263 | buf.readBytes(testReportMsg, 0, readLen); |
| 264 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 265 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 266 | } |
| 267 | |
| 268 | /** |
| 269 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)). |
| 270 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 271 | */ |
| 272 | @Test |
| 273 | public void teReportMessageTest7() throws PcepParseException { |
| 274 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 275 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x2C, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 276 | 0x0E, 0x10, 0x00, 0x28, // TE Object Header |
| 277 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 278 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 279 | 0x00, 0x00, 0x00, 0x00, |
| 280 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 281 | 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 282 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 283 | 0x00, 0x00, 0x00, 0x11, |
| 284 | 0x00, 0x00, 0x00, 0x11}; |
| 285 | |
| 286 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 287 | buffer.writeBytes(teReportMsg); |
| 288 | |
| 289 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 290 | PcepMessage message = null; |
| 291 | |
| 292 | message = reader.readFrom(buffer); |
| 293 | |
| 294 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 295 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 296 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 297 | message.writeTo(buf); |
| 298 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 299 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 300 | testReportMsg = new byte[readLen]; |
| 301 | buf.readBytes(testReportMsg, 0, readLen); |
| 302 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 303 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | /** |
| 307 | * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV) |
| 308 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 309 | */ |
| 310 | @Test |
| 311 | public void teReportMessageTest8() throws PcepParseException { |
| 312 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 313 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x20, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 314 | 0x0E, 0x10, 0x00, 0x1C, // TE Object Header |
| 315 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 316 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 317 | 0x00, 0x00, 0x00, 0x00, |
| 318 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 319 | 0x06, 0x65, 0x00, 0x00 // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 320 | }; |
| 321 | |
| 322 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 323 | buffer.writeBytes(teReportMsg); |
| 324 | |
| 325 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 326 | PcepMessage message = null; |
| 327 | |
| 328 | message = reader.readFrom(buffer); |
| 329 | |
| 330 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 331 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 332 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 333 | message.writeTo(buf); |
| 334 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 335 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 336 | testReportMsg = new byte[readLen]; |
| 337 | buf.readBytes(testReportMsg, 0, readLen); |
| 338 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 339 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | /** |
| 343 | * This test case checks for |
| 344 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 345 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 346 | * OSPFareaIDsubTlv, RouterIDSubTlv)). |
| 347 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 348 | */ |
| 349 | @Test |
| 350 | public void teReportMessageTest9() throws PcepParseException { |
| 351 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 352 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x6C, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 353 | 0x0E, 0x10, 0x00, 0x68, // TE Object Header |
| 354 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 355 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 356 | 0x00, 0x00, 0x00, 0x00, |
| 357 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 358 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 359 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 360 | 0x00, 0x00, 0x00, 0x11, |
| 361 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 362 | 0x00, 0x00, 0x00, 0x11, |
| 363 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 364 | 0x00, 0x00, 0x00, 0x11, |
| 365 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 366 | 0x00, 0x00, 0x00, 0x11, |
| 367 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 368 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 369 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 370 | 0x00, 0x00, 0x00, 0x11, |
| 371 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 372 | 0x00, 0x00, 0x00, 0x11, |
| 373 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 374 | 0x00, 0x00, 0x00, 0x11, |
| 375 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 376 | 0x00, 0x00, 0x00, 0x11, |
| 377 | 0x00, 0x00, 0x00, 0x11 |
| 378 | }; |
| 379 | |
| 380 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 381 | buffer.writeBytes(teReportMsg); |
| 382 | |
| 383 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 384 | PcepMessage message = null; |
| 385 | |
| 386 | message = reader.readFrom(buffer); |
| 387 | |
| 388 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 389 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 390 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 391 | message.writeTo(buf); |
| 392 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 393 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 394 | testReportMsg = new byte[readLen]; |
| 395 | buf.readBytes(testReportMsg, 0, readLen); |
| 396 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 397 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 398 | } |
| 399 | |
| 400 | /** |
| 401 | * This test case checks for |
| 402 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 403 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv |
| 404 | * OSPFareaIDsubTlv, RouterIDSubTlv)) |
| 405 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 406 | */ |
| 407 | @Test |
| 408 | public void teReportMessageTest10() throws PcepParseException { |
| 409 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 410 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x64, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 411 | 0x0E, 0x10, 0x00, 0x60, // TE Object Header |
| 412 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 413 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 414 | 0x00, 0x00, 0x00, 0x00, |
| 415 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 416 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 417 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 418 | 0x00, 0x00, 0x00, 0x11, |
| 419 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 420 | 0x00, 0x00, 0x00, 0x11, |
| 421 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 422 | 0x00, 0x00, 0x00, 0x11, |
| 423 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 424 | 0x00, 0x00, 0x00, 0x11, |
| 425 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 426 | 0x03, (byte) 0xEB, 0x00, 0x1C, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 427 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 428 | 0x00, 0x00, 0x00, 0x11, |
| 429 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 430 | 0x00, 0x00, 0x00, 0x11, |
| 431 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 432 | 0x00, 0x00, 0x00, 0x11, |
| 433 | 0x00, 0x00, 0x00, 0x11 |
| 434 | }; |
| 435 | |
| 436 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 437 | buffer.writeBytes(teReportMsg); |
| 438 | |
| 439 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 440 | PcepMessage message = null; |
| 441 | |
| 442 | message = reader.readFrom(buffer); |
| 443 | |
| 444 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 445 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 446 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 447 | message.writeTo(buf); |
| 448 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 449 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 450 | testReportMsg = new byte[readLen]; |
| 451 | buf.readBytes(testReportMsg, 0, readLen); |
| 452 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 453 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 454 | } |
| 455 | |
| 456 | /** |
| 457 | * This test case checks for |
| 458 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 459 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv)) |
| 460 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 461 | */ |
| 462 | @Test |
| 463 | public void teReportMessageTest11() throws PcepParseException { |
| 464 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 465 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x5C, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 466 | 0x0E, 0x10, 0x00, 0x58, // TE Object Header |
| 467 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 468 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 469 | 0x00, 0x00, 0x00, 0x00, |
| 470 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 471 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 472 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 473 | 0x00, 0x00, 0x00, 0x11, |
| 474 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 475 | 0x00, 0x00, 0x00, 0x11, |
| 476 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 477 | 0x00, 0x00, 0x00, 0x11, |
| 478 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 479 | 0x00, 0x00, 0x00, 0x11, |
| 480 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 481 | 0x03, (byte) 0xEB, 0x00, 0x14, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 482 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 483 | 0x00, 0x00, 0x00, 0x11, |
| 484 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 485 | 0x00, 0x00, 0x00, 0x11, |
| 486 | 0x00, 0x00, 0x00, 0x11 |
| 487 | }; |
| 488 | |
| 489 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 490 | buffer.writeBytes(teReportMsg); |
| 491 | |
| 492 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 493 | PcepMessage message = null; |
| 494 | |
| 495 | message = reader.readFrom(buffer); |
| 496 | |
| 497 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 498 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 499 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 500 | message.writeTo(buf); |
| 501 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 502 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 503 | testReportMsg = new byte[readLen]; |
| 504 | buf.readBytes(testReportMsg, 0, readLen); |
| 505 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 506 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | /** |
| 510 | * This test case checks for |
| 511 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 512 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv)) |
| 513 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 514 | */ |
| 515 | @Test |
| 516 | public void teReportMessageTest12() throws PcepParseException { |
| 517 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 518 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x54, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 519 | 0x0E, 0x10, 0x00, 0x50, // TE Object Header |
| 520 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 521 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 522 | 0x00, 0x00, 0x00, 0x00, |
| 523 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 524 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 525 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 526 | 0x00, 0x00, 0x00, 0x11, |
| 527 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 528 | 0x00, 0x00, 0x00, 0x11, |
| 529 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 530 | 0x00, 0x00, 0x00, 0x11, |
| 531 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 532 | 0x00, 0x00, 0x00, 0x11, |
| 533 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 534 | 0x03, (byte) 0xEB, 0x00, 0x0c, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 535 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 536 | 0x00, 0x00, 0x00, 0x11, |
| 537 | 0x00, 0x00, 0x00, 0x11 |
| 538 | }; |
| 539 | |
| 540 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 541 | buffer.writeBytes(teReportMsg); |
| 542 | |
| 543 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 544 | PcepMessage message = null; |
| 545 | |
| 546 | message = reader.readFrom(buffer); |
| 547 | |
| 548 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 549 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 550 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 551 | message.writeTo(buf); |
| 552 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 553 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 554 | testReportMsg = new byte[readLen]; |
| 555 | buf.readBytes(testReportMsg, 0, readLen); |
| 556 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 557 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | /** |
| 561 | * This test case checks for |
| 562 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 563 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV) |
| 564 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 565 | */ |
| 566 | @Test |
| 567 | public void teReportMessageTest13() throws PcepParseException { |
| 568 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 569 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, 0x48, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 570 | 0x0E, 0x10, 0x00, 0x44, // TE Object Header |
| 571 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 572 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 573 | 0x00, 0x00, 0x00, 0x00, |
| 574 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 575 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 576 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 577 | 0x00, 0x00, 0x00, 0x11, |
| 578 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 579 | 0x00, 0x00, 0x00, 0x11, |
| 580 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 581 | 0x00, 0x00, 0x00, 0x11, |
| 582 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 583 | 0x00, 0x00, 0x00, 0x11, |
| 584 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 585 | 0x03, (byte) 0xEB, 0x00, 0x00, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 586 | }; |
| 587 | |
| 588 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 589 | buffer.writeBytes(teReportMsg); |
| 590 | |
| 591 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 592 | PcepMessage message = null; |
| 593 | |
| 594 | message = reader.readFrom(buffer); |
| 595 | |
| 596 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 597 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 598 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 599 | message.writeTo(buf); |
| 600 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 601 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 602 | testReportMsg = new byte[readLen]; |
| 603 | buf.readBytes(testReportMsg, 0, readLen); |
| 604 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 605 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 606 | } |
| 607 | |
| 608 | /** |
| 609 | * This test case checks for |
| 610 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 611 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 612 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 613 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
| 614 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 615 | */ |
| 616 | @Test |
| 617 | public void teReportMessageTest14() throws PcepParseException { |
| 618 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 619 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x8C, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 620 | 0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header |
| 621 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 622 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 623 | 0x00, 0x00, 0x00, 0x00, |
| 624 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 625 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 626 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 627 | 0x00, 0x00, 0x00, 0x11, |
| 628 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 629 | 0x00, 0x00, 0x00, 0x11, |
| 630 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 631 | 0x00, 0x00, 0x00, 0x11, |
| 632 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 633 | 0x00, 0x00, 0x00, 0x11, |
| 634 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 635 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 636 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 637 | 0x00, 0x00, 0x00, 0x11, |
| 638 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 639 | 0x00, 0x00, 0x00, 0x11, |
| 640 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 641 | 0x00, 0x00, 0x00, 0x11, |
| 642 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 643 | 0x00, 0x00, 0x00, 0x11, |
| 644 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 645 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 646 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 647 | 0x01, 0x11, 0x00, 0x09, |
| 648 | 0x01, 0x21, 0x00, 0x09, |
| 649 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 650 | 0x01, 0x01, 0x01, 0x01, |
| 651 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 652 | 0x01, 0x011, 0x01, 0x10 |
| 653 | }; |
| 654 | |
| 655 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 656 | buffer.writeBytes(teReportMsg); |
| 657 | |
| 658 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 659 | PcepMessage message = null; |
| 660 | |
| 661 | message = reader.readFrom(buffer); |
| 662 | |
| 663 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 664 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 665 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 666 | message.writeTo(buf); |
| 667 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 668 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 669 | testReportMsg = new byte[readLen]; |
| 670 | buf.readBytes(testReportMsg, 0, readLen); |
| 671 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 672 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 673 | } |
| 674 | |
| 675 | /** |
| 676 | * This test case checks for |
| 677 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 678 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 679 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV( |
| 680 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
| 681 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 682 | */ |
| 683 | @Test |
| 684 | public void teReportMessageTest15() throws PcepParseException { |
| 685 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 686 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x80, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 687 | 0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header |
| 688 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 689 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 690 | 0x00, 0x00, 0x00, 0x00, |
| 691 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 692 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 693 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 694 | 0x00, 0x00, 0x00, 0x11, |
| 695 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 696 | 0x00, 0x00, 0x00, 0x11, |
| 697 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 698 | 0x00, 0x00, 0x00, 0x11, |
| 699 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 700 | 0x00, 0x00, 0x00, 0x11, |
| 701 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 702 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 703 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 704 | 0x00, 0x00, 0x00, 0x11, |
| 705 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 706 | 0x00, 0x00, 0x00, 0x11, |
| 707 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 708 | 0x00, 0x00, 0x00, 0x11, |
| 709 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 710 | 0x00, 0x00, 0x00, 0x11, |
| 711 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 712 | 0x04, 0x2E, 0x00, 0x10, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 713 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 714 | 0x01, 0x01, 0x01, 0x01, |
| 715 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 716 | 0x01, 0x011, 0x01, 0x10 |
| 717 | }; |
| 718 | |
| 719 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 720 | buffer.writeBytes(teReportMsg); |
| 721 | |
| 722 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 723 | PcepMessage message = null; |
| 724 | |
| 725 | message = reader.readFrom(buffer); |
| 726 | |
| 727 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 728 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 729 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 730 | message.writeTo(buf); |
| 731 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 732 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 733 | testReportMsg = new byte[readLen]; |
| 734 | buf.readBytes(testReportMsg, 0, readLen); |
| 735 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 736 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 737 | } |
| 738 | |
| 739 | /** |
| 740 | * This test case checks for |
| 741 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 742 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 743 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv)) |
| 744 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 745 | */ |
| 746 | @Test |
| 747 | public void teReportMessageTest16() throws PcepParseException { |
| 748 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 749 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x78, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 750 | 0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header |
| 751 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 752 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 753 | 0x00, 0x00, 0x00, 0x00, |
| 754 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 755 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 756 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 757 | 0x00, 0x00, 0x00, 0x11, |
| 758 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 759 | 0x00, 0x00, 0x00, 0x11, |
| 760 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 761 | 0x00, 0x00, 0x00, 0x11, |
| 762 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 763 | 0x00, 0x00, 0x00, 0x11, |
| 764 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 765 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 766 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 767 | 0x00, 0x00, 0x00, 0x11, |
| 768 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 769 | 0x00, 0x00, 0x00, 0x11, |
| 770 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 771 | 0x00, 0x00, 0x00, 0x11, |
| 772 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 773 | 0x00, 0x00, 0x00, 0x11, |
| 774 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 775 | 0x04, 0x2E, 0x00, 0x08, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 776 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 777 | 0x01, 0x011, 0x01, 0x10 |
| 778 | }; |
| 779 | |
| 780 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 781 | buffer.writeBytes(teReportMsg); |
| 782 | |
| 783 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 784 | PcepMessage message = null; |
| 785 | |
| 786 | message = reader.readFrom(buffer); |
| 787 | |
| 788 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 789 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 790 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 791 | message.writeTo(buf); |
| 792 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 793 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 794 | testReportMsg = new byte[readLen]; |
| 795 | buf.readBytes(testReportMsg, 0, readLen); |
| 796 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 797 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 798 | } |
| 799 | |
| 800 | /** |
| 801 | * This test case checks for |
| 802 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 803 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 804 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV) |
| 805 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 806 | */ |
| 807 | @Test |
| 808 | public void teReportMessageTest17() throws PcepParseException { |
| 809 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 810 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0x70, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 811 | 0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header |
| 812 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 813 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 814 | 0x00, 0x00, 0x00, 0x00, |
| 815 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 816 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 817 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 818 | 0x00, 0x00, 0x00, 0x11, |
| 819 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 820 | 0x00, 0x00, 0x00, 0x11, |
| 821 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 822 | 0x00, 0x00, 0x00, 0x11, |
| 823 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 824 | 0x00, 0x00, 0x00, 0x11, |
| 825 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 826 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 827 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 828 | 0x00, 0x00, 0x00, 0x11, |
| 829 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 830 | 0x00, 0x00, 0x00, 0x11, |
| 831 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 832 | 0x00, 0x00, 0x00, 0x11, |
| 833 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 834 | 0x00, 0x00, 0x00, 0x11, |
| 835 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 836 | 0x04, 0x2E, 0x00, 0x00, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 837 | }; |
| 838 | |
| 839 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 840 | buffer.writeBytes(teReportMsg); |
| 841 | |
| 842 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 843 | PcepMessage message = null; |
| 844 | |
| 845 | message = reader.readFrom(buffer); |
| 846 | |
| 847 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 848 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 849 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 850 | message.writeTo(buf); |
| 851 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 852 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 853 | testReportMsg = new byte[readLen]; |
| 854 | buf.readBytes(testReportMsg, 0, readLen); |
| 855 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 856 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 857 | } |
| 858 | |
| 859 | /** |
| 860 | * This test case checks for |
| 861 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 862 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 863 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 864 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) |
| 865 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 866 | */ |
| 867 | @Test |
| 868 | public void teReportMessageTest18() throws PcepParseException { |
| 869 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 870 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 871 | 0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header |
| 872 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 873 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 874 | 0x00, 0x00, 0x00, 0x00, |
| 875 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 876 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 877 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 878 | 0x00, 0x00, 0x00, 0x11, |
| 879 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 880 | 0x00, 0x00, 0x00, 0x11, |
| 881 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 882 | 0x00, 0x00, 0x00, 0x11, |
| 883 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 884 | 0x00, 0x00, 0x00, 0x11, |
| 885 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 886 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 887 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 888 | 0x00, 0x00, 0x00, 0x11, |
| 889 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 890 | 0x00, 0x00, 0x00, 0x11, |
| 891 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 892 | 0x00, 0x00, 0x00, 0x11, |
| 893 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 894 | 0x00, 0x00, 0x00, 0x11, |
| 895 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 896 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 897 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 898 | 0x01, 0x11, 0x00, 0x09, |
| 899 | 0x01, 0x21, 0x00, 0x09, |
| 900 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 901 | 0x01, 0x01, 0x01, 0x01, |
| 902 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 903 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 904 | 0x04, (byte) 0xF3, 0x00, 0x30, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 905 | 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv |
| 906 | (byte) 0x90, 0x00, 0x00, 0x00, |
| 907 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 908 | 0x01, 0x011, 0x01, 0x10, |
| 909 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 910 | 0x08, 0x00, 0x01, 0x09, |
| 911 | 0x08, 0x00, 0x01, 0x09, |
| 912 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 913 | 0x20, 0x01, 0x22, 0x01, |
| 914 | 0x20, 0x01, 0x22, 0x01, |
| 915 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 916 | 0x00, 0x01, 0x01, 0x02 |
| 917 | }; |
| 918 | |
| 919 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 920 | buffer.writeBytes(teReportMsg); |
| 921 | |
| 922 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 923 | PcepMessage message = null; |
| 924 | |
| 925 | message = reader.readFrom(buffer); |
| 926 | |
| 927 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 928 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 929 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 930 | message.writeTo(buf); |
| 931 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 932 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 933 | testReportMsg = new byte[readLen]; |
| 934 | buf.readBytes(testReportMsg, 0, readLen); |
| 935 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 936 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 937 | } |
| 938 | |
| 939 | /** |
| 940 | * This test case checks for |
| 941 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 942 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 943 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 944 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 945 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
| 946 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 947 | */ |
| 948 | @Test |
| 949 | public void teReportMessageTest19() throws PcepParseException { |
| 950 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 951 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xC0, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 952 | 0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header |
| 953 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 954 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 955 | 0x00, 0x00, 0x00, 0x00, |
| 956 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 957 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 958 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 959 | 0x00, 0x00, 0x00, 0x11, |
| 960 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 961 | 0x00, 0x00, 0x00, 0x11, |
| 962 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 963 | 0x00, 0x00, 0x00, 0x11, |
| 964 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 965 | 0x00, 0x00, 0x00, 0x11, |
| 966 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 967 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 968 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 969 | 0x00, 0x00, 0x00, 0x11, |
| 970 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 971 | 0x00, 0x00, 0x00, 0x11, |
| 972 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 973 | 0x00, 0x00, 0x00, 0x11, |
| 974 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 975 | 0x00, 0x00, 0x00, 0x11, |
| 976 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 977 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 978 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 979 | 0x01, 0x11, 0x00, 0x09, |
| 980 | 0x01, 0x21, 0x00, 0x09, |
| 981 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 982 | 0x01, 0x01, 0x01, 0x01, |
| 983 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 984 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 985 | 0x04, (byte) 0xF3, 0x00, 0x30, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 986 | 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv |
| 987 | (byte) 0x90, 0x00, 0x00, 0x00, |
| 988 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 989 | 0x01, 0x011, 0x01, 0x10, |
| 990 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 991 | 0x08, 0x00, 0x01, 0x09, |
| 992 | 0x08, 0x00, 0x01, 0x09, |
| 993 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 994 | 0x20, 0x01, 0x22, 0x01, |
| 995 | 0x20, 0x01, 0x22, 0x01, |
| 996 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 997 | 0x00, 0x01, 0x01, 0x02 |
| 998 | }; |
| 999 | |
| 1000 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1001 | buffer.writeBytes(teReportMsg); |
| 1002 | |
| 1003 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1004 | PcepMessage message = null; |
| 1005 | |
| 1006 | message = reader.readFrom(buffer); |
| 1007 | |
| 1008 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1009 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1010 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1011 | message.writeTo(buf); |
| 1012 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1013 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1014 | testReportMsg = new byte[readLen]; |
| 1015 | buf.readBytes(testReportMsg, 0, readLen); |
| 1016 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1017 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1018 | } |
| 1019 | |
| 1020 | /** |
| 1021 | * This test case checks for |
| 1022 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1023 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1024 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1025 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1026 | * NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1027 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1028 | */ |
| 1029 | @Test |
| 1030 | public void teReportMessageTest20() throws PcepParseException { |
| 1031 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1032 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xB8, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1033 | 0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header |
| 1034 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1035 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1036 | 0x00, 0x00, 0x00, 0x00, |
| 1037 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1038 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1039 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1040 | 0x00, 0x00, 0x00, 0x11, |
| 1041 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1042 | 0x00, 0x00, 0x00, 0x11, |
| 1043 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1044 | 0x00, 0x00, 0x00, 0x11, |
| 1045 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1046 | 0x00, 0x00, 0x00, 0x11, |
| 1047 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1048 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1049 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1050 | 0x00, 0x00, 0x00, 0x11, |
| 1051 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1052 | 0x00, 0x00, 0x00, 0x11, |
| 1053 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1054 | 0x00, 0x00, 0x00, 0x11, |
| 1055 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1056 | 0x00, 0x00, 0x00, 0x11, |
| 1057 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1058 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1059 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1060 | 0x01, 0x11, 0x00, 0x09, |
| 1061 | 0x01, 0x21, 0x00, 0x09, |
| 1062 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1063 | 0x01, 0x01, 0x01, 0x01, |
| 1064 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1065 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1066 | 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1067 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1068 | 0x01, 0x011, 0x01, 0x10, |
| 1069 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1070 | 0x08, 0x00, 0x01, 0x09, |
| 1071 | 0x08, 0x00, 0x01, 0x09, |
| 1072 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1073 | 0x20, 0x01, 0x22, 0x01, |
| 1074 | 0x20, 0x01, 0x22, 0x01, |
| 1075 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1076 | 0x00, 0x01, 0x01, 0x02 |
| 1077 | }; |
| 1078 | |
| 1079 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1080 | buffer.writeBytes(teReportMsg); |
| 1081 | |
| 1082 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1083 | PcepMessage message = null; |
| 1084 | |
| 1085 | message = reader.readFrom(buffer); |
| 1086 | |
| 1087 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1088 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1089 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1090 | message.writeTo(buf); |
| 1091 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1092 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1093 | testReportMsg = new byte[readLen]; |
| 1094 | buf.readBytes(testReportMsg, 0, readLen); |
| 1095 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1096 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1097 | } |
| 1098 | |
| 1099 | /** |
| 1100 | * This test case checks for |
| 1101 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1102 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1103 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. |
| 1104 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1105 | * ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1106 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1107 | */ |
| 1108 | @Test |
| 1109 | public void teReportMessageTest21() throws PcepParseException { |
| 1110 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1111 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x00, (byte) 0xAC, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1112 | 0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header |
| 1113 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1114 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1115 | 0x00, 0x00, 0x00, 0x00, |
| 1116 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1117 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1118 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1119 | 0x00, 0x00, 0x00, 0x11, |
| 1120 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1121 | 0x00, 0x00, 0x00, 0x11, |
| 1122 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1123 | 0x00, 0x00, 0x00, 0x11, |
| 1124 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1125 | 0x00, 0x00, 0x00, 0x11, |
| 1126 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1127 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1128 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1129 | 0x00, 0x00, 0x00, 0x11, |
| 1130 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1131 | 0x00, 0x00, 0x00, 0x11, |
| 1132 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1133 | 0x00, 0x00, 0x00, 0x11, |
| 1134 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1135 | 0x00, 0x00, 0x00, 0x11, |
| 1136 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1137 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1138 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1139 | 0x01, 0x11, 0x00, 0x09, |
| 1140 | 0x01, 0x21, 0x00, 0x09, |
| 1141 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1142 | 0x01, 0x01, 0x01, 0x01, |
| 1143 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1144 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1145 | 0x04, (byte) 0xF3, 0x00, 0x1C, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1146 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1147 | 0x01, 0x011, 0x01, 0x10, |
| 1148 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1149 | 0x20, 0x01, 0x22, 0x01, |
| 1150 | 0x20, 0x01, 0x22, 0x01, |
| 1151 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1152 | 0x00, 0x01, 0x01, 0x02 |
| 1153 | }; |
| 1154 | |
| 1155 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1156 | buffer.writeBytes(teReportMsg); |
| 1157 | |
| 1158 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1159 | PcepMessage message = null; |
| 1160 | |
| 1161 | message = reader.readFrom(buffer); |
| 1162 | |
| 1163 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1164 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1165 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1166 | message.writeTo(buf); |
| 1167 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1168 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1169 | testReportMsg = new byte[readLen]; |
| 1170 | buf.readBytes(testReportMsg, 0, readLen); |
| 1171 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1172 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1173 | } |
| 1174 | |
| 1175 | /** |
| 1176 | * This test case checks for |
| 1177 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 1178 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. |
| 1179 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. |
| 1180 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv. |
| 1181 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv). |
| 1182 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv. |
| 1183 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv. |
| 1184 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv. |
| 1185 | * OpaqueLinkAttributeTlv, LinkNameTlv)). |
| 1186 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1187 | */ |
| 1188 | @Test |
| 1189 | public void teReportMessageTest22() throws PcepParseException { |
| 1190 | |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1191 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x120, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1192 | 0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header |
| 1193 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1194 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1195 | 0x00, 0x00, 0x00, 0x00, |
| 1196 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1197 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1198 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1199 | 0x00, 0x00, 0x00, 0x11, |
| 1200 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1201 | 0x00, 0x00, 0x00, 0x11, |
| 1202 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1203 | 0x00, 0x00, 0x00, 0x11, |
| 1204 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1205 | 0x00, 0x00, 0x00, 0x11, |
| 1206 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1207 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1208 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1209 | 0x00, 0x00, 0x00, 0x11, |
| 1210 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1211 | 0x00, 0x00, 0x00, 0x11, |
| 1212 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1213 | 0x00, 0x00, 0x00, 0x11, |
| 1214 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1215 | 0x00, 0x00, 0x00, 0x11, |
| 1216 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1217 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1218 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1219 | 0x01, 0x11, 0x00, 0x09, |
| 1220 | 0x01, 0x21, 0x00, 0x09, |
| 1221 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1222 | 0x01, 0x01, 0x01, 0x01, |
| 1223 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1224 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1225 | 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1226 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1227 | 0x01, 0x011, 0x01, 0x10, |
| 1228 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1229 | 0x08, 0x00, 0x01, 0x09, |
| 1230 | 0x08, 0x00, 0x01, 0x09, |
| 1231 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1232 | 0x20, 0x01, 0x22, 0x01, |
| 1233 | 0x20, 0x01, 0x22, 0x01, |
| 1234 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1235 | 0x00, 0x01, 0x01, 0x02, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1236 | 0x07, 0x69, 0x00, 0x64, //TELinkAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1237 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1238 | 0x00, 0x07, 0x08, 0x00, |
| 1239 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1240 | 0x00, 0x09, 0x08, 0x00, |
| 1241 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1242 | 0x00, 0x09, 0x00, 0x00, |
| 1243 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1244 | 0x00, 0x10, 0x00, 0x00, |
| 1245 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1246 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1247 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1248 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1249 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1250 | 0x09, 0x00, 0x00, 0x00, |
| 1251 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1252 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1253 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1254 | 0x09, (byte) 0x89, 0x07, 0x00, |
| 1255 | 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv |
| 1256 | 0x04, 0x47, 0x00, 0x03, |
| 1257 | 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv |
| 1258 | 0x04, 0x49, 0x00, 0x04, |
| 1259 | 0x04, 0x47, 0x00, 0x03, |
| 1260 | 0x04, 0x4A, 0x00, 0x04, //LinkNameTlv |
| 1261 | 0x04, 0x47, 0x00, 0x03 |
| 1262 | }; |
| 1263 | |
| 1264 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1265 | buffer.writeBytes(teReportMsg); |
| 1266 | |
| 1267 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1268 | PcepMessage message = null; |
| 1269 | |
| 1270 | message = reader.readFrom(buffer); |
| 1271 | |
| 1272 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1273 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1274 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1275 | message.writeTo(buf); |
| 1276 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1277 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1278 | testReportMsg = new byte[readLen]; |
| 1279 | buf.readBytes(testReportMsg, 0, readLen); |
| 1280 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1281 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1282 | } |
| 1283 | |
| 1284 | /** |
| 1285 | * This test case checks for |
| 1286 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1287 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1288 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1289 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 1290 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) |
| 1291 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv |
| 1292 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
| 1293 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv |
| 1294 | * OpaqueLinkAttributeTlv)) |
| 1295 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1296 | */ |
| 1297 | @Test |
| 1298 | public void teReportMessageTest23() throws PcepParseException { |
| 1299 | |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1300 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x118, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1301 | 0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header |
| 1302 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1303 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1304 | 0x00, 0x00, 0x00, 0x00, |
| 1305 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1306 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1307 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1308 | 0x00, 0x00, 0x00, 0x11, |
| 1309 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1310 | 0x00, 0x00, 0x00, 0x11, |
| 1311 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1312 | 0x00, 0x00, 0x00, 0x11, |
| 1313 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1314 | 0x00, 0x00, 0x00, 0x11, |
| 1315 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1316 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1317 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1318 | 0x00, 0x00, 0x00, 0x11, |
| 1319 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1320 | 0x00, 0x00, 0x00, 0x11, |
| 1321 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1322 | 0x00, 0x00, 0x00, 0x11, |
| 1323 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1324 | 0x00, 0x00, 0x00, 0x11, |
| 1325 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1326 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1327 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1328 | 0x01, 0x11, 0x00, 0x09, |
| 1329 | 0x01, 0x21, 0x00, 0x09, |
| 1330 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1331 | 0x01, 0x01, 0x01, 0x01, |
| 1332 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1333 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1334 | 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1335 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1336 | 0x01, 0x011, 0x01, 0x10, |
| 1337 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1338 | 0x08, 0x00, 0x01, 0x09, |
| 1339 | 0x08, 0x00, 0x01, 0x09, |
| 1340 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1341 | 0x20, 0x01, 0x22, 0x01, |
| 1342 | 0x20, 0x01, 0x22, 0x01, |
| 1343 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1344 | 0x00, 0x01, 0x01, 0x02, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1345 | 0x07, 0x69, 0x00, 0x5C, //TELinkAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1346 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1347 | 0x00, 0x07, 0x08, 0x00, |
| 1348 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1349 | 0x00, 0x09, 0x08, 0x00, |
| 1350 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1351 | 0x00, 0x09, 0x00, 0x00, |
| 1352 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1353 | 0x00, 0x10, 0x00, 0x00, |
| 1354 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1355 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1356 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1357 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1358 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1359 | 0x09, 0x00, 0x00, 0x00, |
| 1360 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1361 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1362 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1363 | 0x09, (byte) 0x89, 0x07, 0x00, |
| 1364 | 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv |
| 1365 | 0x04, 0x47, 0x00, 0x03, |
| 1366 | 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv |
| 1367 | 0x04, 0x49, 0x00, 0x04, |
| 1368 | 0x04, 0x47, 0x00, 0x03 |
| 1369 | }; |
| 1370 | |
| 1371 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1372 | buffer.writeBytes(teReportMsg); |
| 1373 | |
| 1374 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1375 | PcepMessage message = null; |
| 1376 | |
| 1377 | message = reader.readFrom(buffer); |
| 1378 | |
| 1379 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1380 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1381 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1382 | message.writeTo(buf); |
| 1383 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1384 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1385 | testReportMsg = new byte[readLen]; |
| 1386 | buf.readBytes(testReportMsg, 0, readLen); |
| 1387 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1388 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1389 | } |
| 1390 | |
| 1391 | /** |
| 1392 | * This test case checks for |
| 1393 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1394 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1395 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1396 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 1397 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) |
| 1398 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv |
| 1399 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
| 1400 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv)) |
| 1401 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1402 | */ |
| 1403 | @Test |
| 1404 | public void teReportMessageTest24() throws PcepParseException { |
| 1405 | |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1406 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x110, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1407 | 0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header |
| 1408 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1409 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1410 | 0x00, 0x00, 0x00, 0x00, |
| 1411 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1412 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1413 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1414 | 0x00, 0x00, 0x00, 0x11, |
| 1415 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1416 | 0x00, 0x00, 0x00, 0x11, |
| 1417 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1418 | 0x00, 0x00, 0x00, 0x11, |
| 1419 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1420 | 0x00, 0x00, 0x00, 0x11, |
| 1421 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1422 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1423 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1424 | 0x00, 0x00, 0x00, 0x11, |
| 1425 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1426 | 0x00, 0x00, 0x00, 0x11, |
| 1427 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1428 | 0x00, 0x00, 0x00, 0x11, |
| 1429 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1430 | 0x00, 0x00, 0x00, 0x11, |
| 1431 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1432 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1433 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1434 | 0x01, 0x11, 0x00, 0x09, |
| 1435 | 0x01, 0x21, 0x00, 0x09, |
| 1436 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1437 | 0x01, 0x01, 0x01, 0x01, |
| 1438 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1439 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1440 | 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1441 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1442 | 0x01, 0x011, 0x01, 0x10, |
| 1443 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1444 | 0x08, 0x00, 0x01, 0x09, |
| 1445 | 0x08, 0x00, 0x01, 0x09, |
| 1446 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1447 | 0x20, 0x01, 0x22, 0x01, |
| 1448 | 0x20, 0x01, 0x22, 0x01, |
| 1449 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1450 | 0x00, 0x01, 0x01, 0x02, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1451 | 0x07, 0x69, 0x00, 0x54, //TELinkAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1452 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1453 | 0x00, 0x07, 0x08, 0x00, |
| 1454 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1455 | 0x00, 0x09, 0x08, 0x00, |
| 1456 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1457 | 0x00, 0x09, 0x00, 0x00, |
| 1458 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1459 | 0x00, 0x10, 0x00, 0x00, |
| 1460 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1461 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1462 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1463 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1464 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1465 | 0x09, 0x00, 0x00, 0x00, |
| 1466 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1467 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1468 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1469 | 0x09, (byte) 0x89, 0x07, 0x00, |
| 1470 | 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv |
| 1471 | 0x04, 0x47, 0x00, 0x03, |
| 1472 | 0x04, 0x47, 0x00, 0x03 |
| 1473 | }; |
| 1474 | |
| 1475 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1476 | buffer.writeBytes(teReportMsg); |
| 1477 | |
| 1478 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1479 | PcepMessage message = null; |
| 1480 | |
| 1481 | message = reader.readFrom(buffer); |
| 1482 | |
| 1483 | byte[] testReportMsg = {0}; |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1484 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1485 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1486 | message.writeTo(buf); |
| 1487 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1488 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1489 | testReportMsg = new byte[readLen]; |
| 1490 | buf.readBytes(testReportMsg, 0, readLen); |
| 1491 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1492 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1493 | } |
| 1494 | |
| 1495 | /** |
| 1496 | * This test case checks for |
| 1497 | * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1498 | * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv |
| 1499 | * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv |
| 1500 | * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv |
| 1501 | * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) |
| 1502 | * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv |
| 1503 | * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv |
| 1504 | * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv)) |
| 1505 | * in PcTERpt message. |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1506 | */ |
| 1507 | @Test |
| 1508 | public void teReportMessageTest25() throws PcepParseException { |
| 1509 | |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1510 | byte[] teReportMsg = new byte[]{0x20, 0x0E, 0x01, (byte) 0x104, // common header |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1511 | 0x0E, 0x10, 0x01, 0x00, // TE Object Header |
| 1512 | 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID |
| 1513 | 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV |
| 1514 | 0x00, 0x00, 0x00, 0x00, |
| 1515 | 0x00, 0x00, 0x00, 0x01, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1516 | 0x06, 0x65, 0x00, 0x24, // Local TE Node Descriptors TLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1517 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1518 | 0x00, 0x00, 0x00, 0x11, |
| 1519 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1520 | 0x00, 0x00, 0x00, 0x11, |
| 1521 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1522 | 0x00, 0x00, 0x00, 0x11, |
| 1523 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1524 | 0x00, 0x00, 0x00, 0x11, |
| 1525 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1526 | 0x03, (byte) 0xEB, 0x00, 0x24, //RemoteTENodeDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1527 | 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv |
| 1528 | 0x00, 0x00, 0x00, 0x11, |
| 1529 | 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv |
| 1530 | 0x00, 0x00, 0x00, 0x11, |
| 1531 | 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv |
| 1532 | 0x00, 0x00, 0x00, 0x11, |
| 1533 | 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv |
| 1534 | 0x00, 0x00, 0x00, 0x11, |
| 1535 | 0x00, 0x00, 0x00, 0x11, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1536 | 0x04, 0x2E, 0x00, 0x1C, //TELinkDescriptorsTLV |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1537 | 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv |
| 1538 | 0x01, 0x11, 0x00, 0x09, |
| 1539 | 0x01, 0x21, 0x00, 0x09, |
| 1540 | 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv |
| 1541 | 0x01, 0x01, 0x01, 0x01, |
| 1542 | 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv |
| 1543 | 0x01, 0x011, 0x01, 0x10, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1544 | 0x04, (byte) 0xF3, 0x00, 0x28, //TENodeAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1545 | 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv |
| 1546 | 0x01, 0x011, 0x01, 0x10, |
| 1547 | 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv |
| 1548 | 0x08, 0x00, 0x01, 0x09, |
| 1549 | 0x08, 0x00, 0x01, 0x09, |
| 1550 | 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv |
| 1551 | 0x20, 0x01, 0x22, 0x01, |
| 1552 | 0x20, 0x01, 0x22, 0x01, |
| 1553 | 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv |
| 1554 | 0x00, 0x01, 0x01, 0x02, |
bharat saraswal | b4e5cbe | 2015-09-02 19:33:20 +0530 | [diff] [blame] | 1555 | 0x07, 0x69, 0x00, 0x48, //TELinkAttributesTlv |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1556 | 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv |
| 1557 | 0x00, 0x07, 0x08, 0x00, |
| 1558 | 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv |
| 1559 | 0x00, 0x09, 0x08, 0x00, |
| 1560 | 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv |
| 1561 | 0x00, 0x09, 0x00, 0x00, |
| 1562 | 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv |
| 1563 | 0x00, 0x10, 0x00, 0x00, |
| 1564 | 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv |
| 1565 | 0x00, 0x00, (byte) 0x90, 0x00, |
| 1566 | 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv |
| 1567 | 0x00, (byte) 0x99, 0x09, 0x00, |
| 1568 | 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv |
| 1569 | 0x09, 0x00, 0x00, 0x00, |
| 1570 | 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv |
| 1571 | (byte) 0x80, 0x00, 0x00, 0x00, |
| 1572 | 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv |
| 1573 | 0x09, (byte) 0x89, 0x07, 0x00 |
| 1574 | }; |
| 1575 | |
| 1576 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
| 1577 | buffer.writeBytes(teReportMsg); |
| 1578 | |
| 1579 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
| 1580 | PcepMessage message = null; |
| 1581 | |
| 1582 | message = reader.readFrom(buffer); |
| 1583 | |
| 1584 | byte[] testReportMsg = {0}; |
| 1585 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1586 | assertThat(message, instanceOf(PcepTEReportMsg.class)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1587 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
| 1588 | message.writeTo(buf); |
| 1589 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1590 | int readLen = buf.writerIndex(); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1591 | testReportMsg = new byte[readLen]; |
| 1592 | buf.readBytes(testReportMsg, 0, readLen); |
| 1593 | |
SureshBR | f479bb5 | 2015-08-27 19:06:54 +0530 | [diff] [blame] | 1594 | assertThat(testReportMsg, is(teReportMsg)); |
bharat saraswal | e2e7a00 | 2015-08-21 22:47:30 +0530 | [diff] [blame] | 1595 | } |
| 1596 | } |