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