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