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