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