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