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