Committed by
Gerrit Code Review
UT test cases for PCEP report, Label update, TE report messages and tlvs.
Change-Id: I7b22766e330c7e5936323d44e78d63fd653a6e45
Showing
20 changed files
with
4426 additions
and
116 deletions
... | @@ -78,7 +78,7 @@ public final class PcepFactories { | ... | @@ -78,7 +78,7 @@ public final class PcepFactories { |
78 | factory = org.onosproject.pcepio.protocol.ver1.PcepFactoryVer1.INSTANCE; | 78 | factory = org.onosproject.pcepio.protocol.ver1.PcepFactoryVer1.INSTANCE; |
79 | break; | 79 | break; |
80 | default: | 80 | default: |
81 | - throw new IllegalArgumentException("Unknown Packet version: " + packetVersion); | 81 | + throw new PcepParseException("Unknown Packet version: " + packetVersion); |
82 | } | 82 | } |
83 | return factory.getReader().readFrom(bb); | 83 | return factory.getReader().readFrom(bb); |
84 | } | 84 | } | ... | ... |
... | @@ -27,8 +27,15 @@ import org.onosproject.pcepio.protocol.PcepError; | ... | @@ -27,8 +27,15 @@ import org.onosproject.pcepio.protocol.PcepError; |
27 | import org.onosproject.pcepio.protocol.PcepErrorMsg; | 27 | import org.onosproject.pcepio.protocol.PcepErrorMsg; |
28 | import org.onosproject.pcepio.protocol.PcepErrorObject; | 28 | import org.onosproject.pcepio.protocol.PcepErrorObject; |
29 | import org.onosproject.pcepio.protocol.PcepFactory; | 29 | import org.onosproject.pcepio.protocol.PcepFactory; |
30 | +import org.onosproject.pcepio.protocol.PcepFecObjectIPv4Adjacency; | ||
30 | import org.onosproject.pcepio.protocol.PcepInitiateMsg; | 31 | import org.onosproject.pcepio.protocol.PcepInitiateMsg; |
32 | +import org.onosproject.pcepio.protocol.PcepIroObject; | ||
31 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; | 33 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; |
34 | +import org.onosproject.pcepio.protocol.PcepLabelObject; | ||
35 | +import org.onosproject.pcepio.protocol.PcepLabelRangeObject; | ||
36 | +import org.onosproject.pcepio.protocol.PcepLabelRangeResvMsg; | ||
37 | +import org.onosproject.pcepio.protocol.PcepLabelUpdate; | ||
38 | +import org.onosproject.pcepio.protocol.PcepLabelUpdateMsg; | ||
32 | import org.onosproject.pcepio.protocol.PcepLspObject; | 39 | import org.onosproject.pcepio.protocol.PcepLspObject; |
33 | import org.onosproject.pcepio.protocol.PcepLspaObject; | 40 | import org.onosproject.pcepio.protocol.PcepLspaObject; |
34 | import org.onosproject.pcepio.protocol.PcepMessage; | 41 | import org.onosproject.pcepio.protocol.PcepMessage; |
... | @@ -37,7 +44,10 @@ import org.onosproject.pcepio.protocol.PcepMetricObject; | ... | @@ -37,7 +44,10 @@ import org.onosproject.pcepio.protocol.PcepMetricObject; |
37 | import org.onosproject.pcepio.protocol.PcepMsgPath; | 44 | import org.onosproject.pcepio.protocol.PcepMsgPath; |
38 | import org.onosproject.pcepio.protocol.PcepOpenMsg; | 45 | import org.onosproject.pcepio.protocol.PcepOpenMsg; |
39 | import org.onosproject.pcepio.protocol.PcepOpenObject; | 46 | import org.onosproject.pcepio.protocol.PcepOpenObject; |
47 | +import org.onosproject.pcepio.protocol.PcepReportMsg; | ||
48 | +import org.onosproject.pcepio.protocol.PcepRroObject; | ||
40 | import org.onosproject.pcepio.protocol.PcepSrpObject; | 49 | import org.onosproject.pcepio.protocol.PcepSrpObject; |
50 | +import org.onosproject.pcepio.protocol.PcepStateReport; | ||
41 | import org.onosproject.pcepio.protocol.PcepUpdateMsg; | 51 | import org.onosproject.pcepio.protocol.PcepUpdateMsg; |
42 | import org.onosproject.pcepio.protocol.PcepUpdateRequest; | 52 | import org.onosproject.pcepio.protocol.PcepUpdateRequest; |
43 | import org.onosproject.pcepio.protocol.PcepVersion; | 53 | import org.onosproject.pcepio.protocol.PcepVersion; |
... | @@ -72,9 +82,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -72,9 +82,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
72 | } | 82 | } |
73 | 83 | ||
74 | @Override | 84 | @Override |
75 | - public org.onosproject.pcepio.protocol.PcepReportMsg.Builder buildReportMsg() { | 85 | + public PcepReportMsg.Builder buildReportMsg() { |
76 | - // TODO Auto-generated method stub | 86 | + return new PcepReportMsgVer1.Builder(); |
77 | - return null; | ||
78 | } | 87 | } |
79 | 88 | ||
80 | @Override | 89 | @Override |
... | @@ -113,9 +122,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -113,9 +122,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
113 | } | 122 | } |
114 | 123 | ||
115 | @Override | 124 | @Override |
116 | - public org.onosproject.pcepio.protocol.PcepRroObject.Builder buildRroObject() { | 125 | + public PcepRroObject.Builder buildRroObject() { |
117 | - // TODO Auto-generated method stub | 126 | + return new PcepRroObjectVer1.Builder(); |
118 | - return null; | ||
119 | } | 127 | } |
120 | 128 | ||
121 | @Override | 129 | @Override |
... | @@ -124,9 +132,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -124,9 +132,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
124 | } | 132 | } |
125 | 133 | ||
126 | @Override | 134 | @Override |
127 | - public org.onosproject.pcepio.protocol.PcepIroObject.Builder buildIroObject() { | 135 | + public PcepIroObject.Builder buildIroObject() { |
128 | - // TODO Auto-generated method stub | 136 | + return new PcepIroObjectVer1.Builder(); |
129 | - return null; | ||
130 | } | 137 | } |
131 | 138 | ||
132 | @Override | 139 | @Override |
... | @@ -145,9 +152,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -145,9 +152,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
145 | } | 152 | } |
146 | 153 | ||
147 | @Override | 154 | @Override |
148 | - public org.onosproject.pcepio.protocol.PcepStateReport.Builder buildPcepStateReport() { | 155 | + public PcepStateReport.Builder buildPcepStateReport() { |
149 | - // TODO Auto-generated method stub | 156 | + return new PcepStateReportVer1.Builder(); |
150 | - return null; | ||
151 | } | 157 | } |
152 | 158 | ||
153 | @Override | 159 | @Override |
... | @@ -166,21 +172,18 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -166,21 +172,18 @@ public class PcepFactoryVer1 implements PcepFactory { |
166 | } | 172 | } |
167 | 173 | ||
168 | @Override | 174 | @Override |
169 | - public org.onosproject.pcepio.protocol.PcepLabelUpdateMsg.Builder buildPcepLabelUpdateMsg() { | 175 | + public PcepLabelUpdateMsg.Builder buildPcepLabelUpdateMsg() { |
170 | - // TODO Auto-generated method stub | 176 | + return new PcepLabelUpdateMsgVer1.Builder(); |
171 | - return null; | ||
172 | } | 177 | } |
173 | 178 | ||
174 | @Override | 179 | @Override |
175 | - public org.onosproject.pcepio.protocol.PcepLabelUpdate.Builder buildPcepLabelUpdateObject() { | 180 | + public PcepLabelUpdate.Builder buildPcepLabelUpdateObject() { |
176 | - // TODO Auto-generated method stub | 181 | + return new PcepLabelUpdateVer1.Builder(); |
177 | - return null; | ||
178 | } | 182 | } |
179 | 183 | ||
180 | @Override | 184 | @Override |
181 | - public org.onosproject.pcepio.protocol.PcepLabelObject.Builder buildLabelObject() { | 185 | + public PcepLabelObject.Builder buildLabelObject() { |
182 | - // TODO Auto-generated method stub | 186 | + return new PcepLabelObjectVer1.Builder(); |
183 | - return null; | ||
184 | } | 187 | } |
185 | 188 | ||
186 | @Override | 189 | @Override |
... | @@ -194,9 +197,8 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -194,9 +197,8 @@ public class PcepFactoryVer1 implements PcepFactory { |
194 | } | 197 | } |
195 | 198 | ||
196 | @Override | 199 | @Override |
197 | - public org.onosproject.pcepio.protocol.PcepFecObjectIPv4Adjacency.Builder buildFecIpv4Adjacency() { | 200 | + public PcepFecObjectIPv4Adjacency.Builder buildFecIpv4Adjacency() { |
198 | - // TODO Auto-generated method stub | 201 | + return new PcepFecObjectIPv4AdjacencyVer1.Builder(); |
199 | - return null; | ||
200 | } | 202 | } |
201 | 203 | ||
202 | @Override | 204 | @Override |
... | @@ -210,15 +212,13 @@ public class PcepFactoryVer1 implements PcepFactory { | ... | @@ -210,15 +212,13 @@ public class PcepFactoryVer1 implements PcepFactory { |
210 | } | 212 | } |
211 | 213 | ||
212 | @Override | 214 | @Override |
213 | - public org.onosproject.pcepio.protocol.PcepLabelRangeObject.Builder buildPcepLabelRangeObject() { | 215 | + public PcepLabelRangeObject.Builder buildPcepLabelRangeObject() { |
214 | - // TODO Auto-generated method stub | 216 | + return new PcepLabelRangeObjectVer1.Builder(); |
215 | - return null; | ||
216 | } | 217 | } |
217 | 218 | ||
218 | @Override | 219 | @Override |
219 | - public org.onosproject.pcepio.protocol.PcepLabelRangeResvMsg.Builder buildPcepLabelRangeResvMsg() { | 220 | + public PcepLabelRangeResvMsg.Builder buildPcepLabelRangeResvMsg() { |
220 | - // TODO Auto-generated method stub | 221 | + return new PcepLabelRangeResvMsgVer1.Builder(); |
221 | - return null; | ||
222 | } | 222 | } |
223 | 223 | ||
224 | } | 224 | } | ... | ... |
... | @@ -42,6 +42,7 @@ public abstract class PcepMessageVer1 { | ... | @@ -42,6 +42,7 @@ public abstract class PcepMessageVer1 { |
42 | static final byte CLOSE_MSG_TYPE = 0x7; | 42 | static final byte CLOSE_MSG_TYPE = 0x7; |
43 | static final byte ERROR_MSG_TYPE = 0x6; | 43 | static final byte ERROR_MSG_TYPE = 0x6; |
44 | static final byte LABEL_UPDATE_MSG_TYPE = 0xD; | 44 | static final byte LABEL_UPDATE_MSG_TYPE = 0xD; |
45 | + static final byte LABEL_RANGE_RESV_MSG_TYPE = 0xF; | ||
45 | public static final int SHIFT_FLAG = 5; | 46 | public static final int SHIFT_FLAG = 5; |
46 | static final int MINIMUM_COMMON_HEADER_LENGTH = 4; | 47 | static final int MINIMUM_COMMON_HEADER_LENGTH = 4; |
47 | 48 | ||
... | @@ -86,7 +87,7 @@ public abstract class PcepMessageVer1 { | ... | @@ -86,7 +87,7 @@ public abstract class PcepMessageVer1 { |
86 | log.debug("REPORT MESSAGE is received"); | 87 | log.debug("REPORT MESSAGE is received"); |
87 | // message type value 10 means it is Report message | 88 | // message type value 10 means it is Report message |
88 | // return | 89 | // return |
89 | - // TODO: Read Report message from channel buffer. | 90 | + return PcepReportMsgVer1.READER.readFrom(cb.readBytes(length)); |
90 | case UPDATE_MSG_TYPE: | 91 | case UPDATE_MSG_TYPE: |
91 | log.debug("UPDATE MESSAGE is received"); | 92 | log.debug("UPDATE MESSAGE is received"); |
92 | //message type value 11 means it is Update message | 93 | //message type value 11 means it is Update message |
... | @@ -103,12 +104,17 @@ public abstract class PcepMessageVer1 { | ... | @@ -103,12 +104,17 @@ public abstract class PcepMessageVer1 { |
103 | log.debug("TE REPORT MESSAGE is received"); | 104 | log.debug("TE REPORT MESSAGE is received"); |
104 | // message type value 14 means it is TE REPORT message | 105 | // message type value 14 means it is TE REPORT message |
105 | // return | 106 | // return |
106 | - // TODO: Read TE Report message from channel buffer. | 107 | + return PcepTEReportMsgVer1.READER.readFrom(cb.readBytes(length)); |
107 | case LABEL_UPDATE_MSG_TYPE: | 108 | case LABEL_UPDATE_MSG_TYPE: |
108 | log.debug("LABEL UPDATE MESSAGE is received"); | 109 | log.debug("LABEL UPDATE MESSAGE is received"); |
109 | // message type value 13 means it is LABEL UPDATE message | 110 | // message type value 13 means it is LABEL UPDATE message |
110 | // return | 111 | // return |
111 | - // TODO: Read Label update message from channel buffer. | 112 | + return PcepLabelUpdateMsgVer1.READER.readFrom(cb.readBytes(length)); |
113 | + case LABEL_RANGE_RESV_MSG_TYPE: | ||
114 | + log.debug("LABEL RANGE RESERVE MESSAGE is received"); | ||
115 | + // message type value 15 means it is LABEL RANGE RESERVE message | ||
116 | + // return | ||
117 | + return PcepLabelRangeResvMsgVer1.READER.readFrom(cb.readBytes(length)); | ||
112 | default: | 118 | default: |
113 | throw new PcepParseException("ERROR: UNKNOWN MESSAGE is received. Msg Type: " + type); | 119 | throw new PcepParseException("ERROR: UNKNOWN MESSAGE is received. Msg Type: " + type); |
114 | } | 120 | } | ... | ... |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import com.google.common.testing.EqualsTester; | ||
19 | + | ||
20 | +import org.junit.Test; | ||
21 | +import org.onosproject.pcepio.types.IPv4SubObject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Test of the IPv4SubObject. | ||
25 | + */ | ||
26 | +public class IPv4SubObjectTest { | ||
27 | + | ||
28 | + private final IPv4SubObject subObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); | ||
29 | + private final IPv4SubObject sameAsSubObj1 = IPv4SubObject.of(2, (byte) 16, (byte) 0); | ||
30 | + private final IPv4SubObject subObj2 = IPv4SubObject.of(3, (byte) 16, (byte) 0); | ||
31 | + | ||
32 | + @Test | ||
33 | + public void basics() { | ||
34 | + new EqualsTester() | ||
35 | + .addEqualityGroup(subObj1, sameAsSubObj1) | ||
36 | + .addEqualityGroup(subObj2) | ||
37 | + .testEquals(); | ||
38 | + } | ||
39 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import com.google.common.testing.EqualsTester; | ||
19 | + | ||
20 | +import org.junit.Test; | ||
21 | +import org.onosproject.pcepio.types.IPv6SubObject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Test of the IPv6SubObject. | ||
25 | + */ | ||
26 | +public class IPv6SubObjectTest { | ||
27 | + | ||
28 | + private final byte[] b1 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, | ||
29 | + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x29, 0x00, 0x02, 0x00, 0x00}; | ||
30 | + private final byte[] b2 = new byte[] {(byte) 0xFE, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, | ||
31 | + (byte) 0xB3, (byte) 0xFF, (byte) 0xFE, 0x1E, (byte) 0x83, 0x30, 0x00, 0x02, 0x00, 0x00 }; | ||
32 | + | ||
33 | + private final IPv6SubObject subObj1 = IPv6SubObject.of(b1); | ||
34 | + private final IPv6SubObject sameAsSubObj1 = IPv6SubObject.of(b1); | ||
35 | + private final IPv6SubObject subObj2 = IPv6SubObject.of(b2); | ||
36 | + | ||
37 | + @Test | ||
38 | + public void basics() { | ||
39 | + new EqualsTester().addEqualityGroup(subObj1, sameAsSubObj1).addEqualityGroup(subObj2).testEquals(); | ||
40 | + } | ||
41 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import com.google.common.testing.EqualsTester; | ||
19 | + | ||
20 | +import org.junit.Test; | ||
21 | +import org.onosproject.pcepio.types.LabelSubObject; | ||
22 | + | ||
23 | +/** | ||
24 | + * Test of the LabelSubObject. | ||
25 | + */ | ||
26 | +public class LabelSubObjectTest { | ||
27 | + | ||
28 | + private final LabelSubObject subObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); | ||
29 | + private final LabelSubObject sameAsSubObj1 = LabelSubObject.of((byte) 0, (byte) 1, 20); | ||
30 | + private final LabelSubObject subObj2 = LabelSubObject.of((byte) 0, (byte) 1, 30); | ||
31 | + | ||
32 | + @Test | ||
33 | + public void basics() { | ||
34 | + new EqualsTester() | ||
35 | + .addEqualityGroup(subObj1, sameAsSubObj1) | ||
36 | + .addEqualityGroup(subObj2) | ||
37 | + .testEquals(); | ||
38 | + } | ||
39 | +} |
1 | +/* * Copyright 2015 Open Networking Laboratory * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.onosproject.pcepio; import com.google.common.testing.EqualsTester; import org.junit.Test; import java.util.LinkedList; import org.onosproject.pcepio.types.LocalTENodeDescriptorsTLV;import org.onosproject.pcepio.types.AutonomousSystemTlv;import org.onosproject.pcepio.types.BGPLSidentifierTlv;import org.onosproject.pcepio.types.PcepValueType; /** * Test of the LocalTENodeDescriptorsTlv. */public class LocalTENodeDescriptorsTlvTest { private final AutonomousSystemTlv baAutoSysTlvRawValue1 = new AutonomousSystemTlv(1); private final BGPLSidentifierTlv baBgplsIdRawValue1 = new BGPLSidentifierTlv(1); private final AutonomousSystemTlv baAutoSysTlvRawValue2 = new AutonomousSystemTlv(2); private final BGPLSidentifierTlv baBgplsIdRawValue2 = new BGPLSidentifierTlv(2); private final LinkedList<PcepValueType> llNodeDescriptorSubTLVs1 = new LinkedList<PcepValueType>(); private final boolean a = llNodeDescriptorSubTLVs1.add(baAutoSysTlvRawValue1); private final boolean b = llNodeDescriptorSubTLVs1.add(baBgplsIdRawValue1); private final LinkedList<PcepValueType> llNodeDescriptorSubTLVs2 = new LinkedList<PcepValueType>(); private final boolean c = llNodeDescriptorSubTLVs2.add(baAutoSysTlvRawValue2); private final boolean d = llNodeDescriptorSubTLVs2.add(baBgplsIdRawValue2); private final LocalTENodeDescriptorsTLV tlv1 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs1); private final LocalTENodeDescriptorsTLV sameAstlv1 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs1); private final LocalTENodeDescriptorsTLV tlv2 = LocalTENodeDescriptorsTLV.of(llNodeDescriptorSubTLVs2); @Test public void basics() { new EqualsTester().addEqualityGroup(tlv1, sameAstlv1).addEqualityGroup(tlv2).testEquals(); }} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -17,9 +17,7 @@ package org.onosproject.pcepio; | ... | @@ -17,9 +17,7 @@ package org.onosproject.pcepio; |
17 | 17 | ||
18 | import org.jboss.netty.buffer.ChannelBuffer; | 18 | import org.jboss.netty.buffer.ChannelBuffer; |
19 | import org.jboss.netty.buffer.ChannelBuffers; | 19 | import org.jboss.netty.buffer.ChannelBuffers; |
20 | -import org.junit.After; | ||
21 | import org.junit.Assert; | 20 | import org.junit.Assert; |
22 | -import org.junit.Before; | ||
23 | import org.junit.Test; | 21 | import org.junit.Test; |
24 | import org.onosproject.pcepio.exceptions.PcepParseException; | 22 | import org.onosproject.pcepio.exceptions.PcepParseException; |
25 | import org.onosproject.pcepio.protocol.PcepFactories; | 23 | import org.onosproject.pcepio.protocol.PcepFactories; |
... | @@ -27,58 +25,36 @@ import org.onosproject.pcepio.protocol.PcepMessage; | ... | @@ -27,58 +25,36 @@ import org.onosproject.pcepio.protocol.PcepMessage; |
27 | import org.onosproject.pcepio.protocol.PcepMessageReader; | 25 | import org.onosproject.pcepio.protocol.PcepMessageReader; |
28 | import org.onosproject.pcepio.protocol.PcepCloseMsg; | 26 | import org.onosproject.pcepio.protocol.PcepCloseMsg; |
29 | 27 | ||
30 | -import java.util.Arrays; | ||
31 | - | ||
32 | -import org.slf4j.Logger; | ||
33 | -import org.slf4j.LoggerFactory; | ||
34 | - | ||
35 | public class PcepCloseMsgTest { | 28 | public class PcepCloseMsgTest { |
36 | - protected static final Logger log = LoggerFactory.getLogger(PcepCloseMsgTest.class); | ||
37 | - | ||
38 | - @Before | ||
39 | - public void startUp() { | ||
40 | - } | ||
41 | - | ||
42 | - @After | ||
43 | - public void tearDown() { | ||
44 | - | ||
45 | - } | ||
46 | 29 | ||
30 | + /** | ||
31 | + * Common header, reason to close. | ||
32 | + * | ||
33 | + * @throws PcepParseException while parsing the PCEP message. | ||
34 | + */ | ||
47 | @Test | 35 | @Test |
48 | public void closeMessageTest1() throws PcepParseException { | 36 | public void closeMessageTest1() throws PcepParseException { |
49 | - byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, /* common header */ | 37 | + |
38 | + byte[] closeMsg = new byte[] {0x20, 0x07, 0x00, 0x0C, | ||
50 | 0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 }; | 39 | 0x0f, 0x10, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02 }; |
51 | 40 | ||
52 | - byte[] testCloseMsg = {0}; | 41 | + byte[] testCloseMsg = {0 }; |
53 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 42 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
54 | buffer.writeBytes(closeMsg); | 43 | buffer.writeBytes(closeMsg); |
55 | 44 | ||
56 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 45 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
57 | PcepMessage message = null; | 46 | PcepMessage message = null; |
58 | - try { | 47 | + |
59 | message = reader.readFrom(buffer); | 48 | message = reader.readFrom(buffer); |
60 | - } catch (PcepParseException e) { | 49 | + Assert.assertTrue("PcepMessage is not instance of PcepCloseMsg", message instanceof PcepCloseMsg); |
61 | - e.printStackTrace(); | ||
62 | - } | ||
63 | 50 | ||
64 | - if (message instanceof PcepCloseMsg) { | ||
65 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 51 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
66 | message.writeTo(buf); | 52 | message.writeTo(buf); |
67 | testCloseMsg = buf.array(); | 53 | testCloseMsg = buf.array(); |
68 | 54 | ||
69 | - int iReadLen = buf.writerIndex() - 0; | 55 | + int readLen = buf.writerIndex() - 0; |
70 | - testCloseMsg = new byte[iReadLen]; | 56 | + testCloseMsg = new byte[readLen]; |
71 | - buf.readBytes(testCloseMsg, 0, iReadLen); | 57 | + buf.readBytes(testCloseMsg, 0, readLen); |
72 | - if (Arrays.equals(closeMsg, testCloseMsg)) { | 58 | + Assert.assertArrayEquals("PcTERpt messages are not equal", closeMsg, testCloseMsg); |
73 | - Assert.assertArrayEquals(closeMsg, testCloseMsg); | ||
74 | - log.debug("CloseMsg are equal :" + closeMsg); | ||
75 | - } else { | ||
76 | - Assert.fail("test case failed"); | ||
77 | - log.debug("not equal"); | ||
78 | - } | ||
79 | - } else { | ||
80 | - Assert.fail("test case failed"); | ||
81 | - log.debug("not equal"); | ||
82 | - } | ||
83 | } | 59 | } |
84 | } | 60 | } | ... | ... |
... | @@ -15,54 +15,38 @@ | ... | @@ -15,54 +15,38 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.pcepio; | 16 | package org.onosproject.pcepio; |
17 | 17 | ||
18 | -import java.util.Arrays; | ||
19 | - | ||
20 | import org.jboss.netty.buffer.ChannelBuffer; | 18 | import org.jboss.netty.buffer.ChannelBuffer; |
21 | import org.jboss.netty.buffer.ChannelBuffers; | 19 | import org.jboss.netty.buffer.ChannelBuffers; |
22 | -import org.junit.After; | ||
23 | import org.junit.Assert; | 20 | import org.junit.Assert; |
24 | -import org.junit.Before; | ||
25 | import org.junit.Test; | 21 | import org.junit.Test; |
26 | import org.onosproject.pcepio.exceptions.PcepParseException; | 22 | import org.onosproject.pcepio.exceptions.PcepParseException; |
27 | import org.onosproject.pcepio.protocol.PcepFactories; | 23 | import org.onosproject.pcepio.protocol.PcepFactories; |
28 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; | 24 | import org.onosproject.pcepio.protocol.PcepKeepaliveMsg; |
29 | import org.onosproject.pcepio.protocol.PcepMessage; | 25 | import org.onosproject.pcepio.protocol.PcepMessage; |
30 | import org.onosproject.pcepio.protocol.PcepMessageReader; | 26 | import org.onosproject.pcepio.protocol.PcepMessageReader; |
31 | -import org.slf4j.Logger; | ||
32 | -import org.slf4j.LoggerFactory; | ||
33 | 27 | ||
34 | public class PcepKeepaliveMsgTest { | 28 | public class PcepKeepaliveMsgTest { |
35 | 29 | ||
36 | - protected static final Logger log = LoggerFactory.getLogger(PcepKeepaliveMsgTest.class); | 30 | + /** |
37 | - | 31 | + * Common header for keep alive message. |
38 | - @Before | 32 | + * |
39 | - public void startUp() { | 33 | + * @throws PcepParseException while parsing the PCEP message. |
40 | - | 34 | + */ |
41 | - } | ||
42 | - | ||
43 | - @After | ||
44 | - public void tearDown() { | ||
45 | - | ||
46 | - } | ||
47 | - | ||
48 | @Test | 35 | @Test |
49 | public void keepaliveMessageTest1() throws PcepParseException { | 36 | public void keepaliveMessageTest1() throws PcepParseException { |
50 | 37 | ||
51 | byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 }; | 38 | byte[] keepaliveMsg = new byte[] {0x20, 0x02, 0x00, 0x04 }; |
52 | 39 | ||
53 | - byte[] testKeepaliveMsg = {0}; | 40 | + byte[] testKeepaliveMsg = {0 }; |
54 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | 41 | ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); |
55 | buffer.writeBytes(keepaliveMsg); | 42 | buffer.writeBytes(keepaliveMsg); |
56 | 43 | ||
57 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | 44 | PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); |
58 | PcepMessage message = null; | 45 | PcepMessage message = null; |
59 | - try { | 46 | + |
60 | message = reader.readFrom(buffer); | 47 | message = reader.readFrom(buffer); |
61 | - } catch (PcepParseException e) { | 48 | + Assert.assertTrue("PcepMessage is not instance of PcepKeepaliveMsg", message instanceof PcepKeepaliveMsg); |
62 | - e.printStackTrace(); | ||
63 | - } | ||
64 | 49 | ||
65 | - if (message instanceof PcepKeepaliveMsg) { | ||
66 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | 50 | ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); |
67 | message.writeTo(buf); | 51 | message.writeTo(buf); |
68 | testKeepaliveMsg = buf.array(); | 52 | testKeepaliveMsg = buf.array(); |
... | @@ -71,16 +55,6 @@ public class PcepKeepaliveMsgTest { | ... | @@ -71,16 +55,6 @@ public class PcepKeepaliveMsgTest { |
71 | testKeepaliveMsg = new byte[iReadLen]; | 55 | testKeepaliveMsg = new byte[iReadLen]; |
72 | buf.readBytes(testKeepaliveMsg, 0, iReadLen); | 56 | buf.readBytes(testKeepaliveMsg, 0, iReadLen); |
73 | 57 | ||
74 | - if (Arrays.equals(keepaliveMsg, testKeepaliveMsg)) { | 58 | + Assert.assertArrayEquals("PcTERpt messages are not equal", keepaliveMsg, testKeepaliveMsg); |
75 | - Assert.assertArrayEquals(keepaliveMsg, testKeepaliveMsg); | ||
76 | - log.debug("keepaliveMsg are equal :" + keepaliveMsg); | ||
77 | - } else { | ||
78 | - Assert.fail("test case failed"); | ||
79 | - log.debug("not equal"); | ||
80 | - } | ||
81 | - } else { | ||
82 | - Assert.fail("test case failed"); | ||
83 | - log.debug("not equal"); | ||
84 | - } | ||
85 | } | 59 | } |
86 | } | 60 | } | ... | ... |
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
19 | +import org.jboss.netty.buffer.ChannelBuffers; | ||
20 | +import org.junit.Assert; | ||
21 | +import org.junit.Test; | ||
22 | +import org.onosproject.pcepio.exceptions.PcepParseException; | ||
23 | +import org.onosproject.pcepio.protocol.PcepFactories; | ||
24 | +import org.onosproject.pcepio.protocol.PcepMessage; | ||
25 | +import org.onosproject.pcepio.protocol.PcepMessageReader; | ||
26 | +import org.onosproject.pcepio.protocol.PcepLabelUpdateMsg; | ||
27 | + | ||
28 | +public class PcepLabelUpdateMsgTest { | ||
29 | + | ||
30 | + /** | ||
31 | + * This test case checks for | ||
32 | + * <pce-label-download> SRP, LSP, LABEL Object. | ||
33 | + * in PcepLabelUpdate message. | ||
34 | + * | ||
35 | + * @throws PcepParseException while parsing PCEP message | ||
36 | + */ | ||
37 | + @Test | ||
38 | + public void labelUpdateMessageTest1() throws PcepParseException { | ||
39 | + | ||
40 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x24, // common header | ||
41 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
42 | + 0x00, 0x00, 0x00, 0x00, | ||
43 | + 0x00, 0x00, 0x00, 0x10, | ||
44 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
45 | + 0x00, 0x01, 0x00, 0x00, | ||
46 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
47 | + 0x00, 0x00, 0x00, 0x00, | ||
48 | + 0x00, 0x00, 0x00, 0x66}; | ||
49 | + | ||
50 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
51 | + buffer.writeBytes(labelUpdate); | ||
52 | + | ||
53 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
54 | + PcepMessage message = null; | ||
55 | + | ||
56 | + message = reader.readFrom(buffer); | ||
57 | + | ||
58 | + byte[] testLabelUpdateMsg = {0}; | ||
59 | + | ||
60 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
61 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
62 | + message.writeTo(buf); | ||
63 | + | ||
64 | + int readLen = buf.writerIndex() - 0; | ||
65 | + testLabelUpdateMsg = new byte[readLen]; | ||
66 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
67 | + | ||
68 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * This test case checks for | ||
73 | + * <pce-label-download> SRP, LSP, LABEL Object, LABEL Object. | ||
74 | + * in PcepLabelUpdate message. | ||
75 | + * | ||
76 | + * @throws PcepParseException while parsing PCEP message | ||
77 | + */ | ||
78 | + @Test | ||
79 | + public void labelUpdateMessageTest2() throws PcepParseException { | ||
80 | + | ||
81 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x30, // common header | ||
82 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
83 | + 0x00, 0x00, 0x00, 0x00, | ||
84 | + 0x00, 0x00, 0x00, 0x10, | ||
85 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
86 | + 0x00, 0x01, 0x00, 0x00, | ||
87 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
88 | + 0x00, 0x00, 0x00, 0x00, | ||
89 | + 0x00, 0x00, 0x00, 0x66, | ||
90 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
91 | + 0x00, 0x00, 0x00, 0x00, | ||
92 | + 0x00, 0x00, 0x00, 0x77}; | ||
93 | + | ||
94 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
95 | + buffer.writeBytes(labelUpdate); | ||
96 | + | ||
97 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
98 | + PcepMessage message = null; | ||
99 | + | ||
100 | + message = reader.readFrom(buffer); | ||
101 | + | ||
102 | + byte[] testLabelUpdateMsg = {0}; | ||
103 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
104 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
105 | + message.writeTo(buf); | ||
106 | + | ||
107 | + int readLen = buf.writerIndex() - 0; | ||
108 | + testLabelUpdateMsg = new byte[readLen]; | ||
109 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
110 | + | ||
111 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
112 | + } | ||
113 | + | ||
114 | + /** | ||
115 | + * This test case checks for | ||
116 | + * <pce-label-map> SRP, LABEL, FEC Object. | ||
117 | + * in PcepLabelUpdate message. | ||
118 | + * | ||
119 | + * @throws PcepParseException while parsing PCEP message | ||
120 | + */ | ||
121 | + @Test | ||
122 | + public void labelUpdateMessageTest3() throws PcepParseException { | ||
123 | + | ||
124 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x24, // common header | ||
125 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
126 | + 0x00, 0x00, 0x00, 0x00, | ||
127 | + 0x00, 0x00, 0x00, 0x10, | ||
128 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
129 | + 0x00, 0x00, 0x00, 0x00, | ||
130 | + 0x00, 0x00, 0x00, 0x66, | ||
131 | + 0x24, 0x10, 0x00, 0x08, // FEC Object Header | ||
132 | + 0x0A, 0x0A, 0x0B, 0x0B}; | ||
133 | + | ||
134 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
135 | + buffer.writeBytes(labelUpdate); | ||
136 | + | ||
137 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
138 | + PcepMessage message = null; | ||
139 | + | ||
140 | + message = reader.readFrom(buffer); | ||
141 | + | ||
142 | + byte[] testLabelUpdateMsg = {0}; | ||
143 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
144 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
145 | + message.writeTo(buf); | ||
146 | + | ||
147 | + int readLen = buf.writerIndex() - 0; | ||
148 | + testLabelUpdateMsg = new byte[readLen]; | ||
149 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
150 | + | ||
151 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
152 | + } | ||
153 | + | ||
154 | + /** | ||
155 | + * This test case checks for | ||
156 | + * <pce-label-download> SRP, LSP, LABEL, LABEL, <pce-label-download> SRP, LSP, LABEL | ||
157 | + * in PcepLabelUpdate message. | ||
158 | + * | ||
159 | + * @throws PcepParseException while parsing PCEP message | ||
160 | + */ | ||
161 | + @Test | ||
162 | + public void labelUpdateMessageTest4() throws PcepParseException { | ||
163 | + | ||
164 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x50, // common header | ||
165 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
166 | + 0x00, 0x00, 0x00, 0x00, | ||
167 | + 0x00, 0x00, 0x00, 0x10, | ||
168 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
169 | + 0x00, 0x01, 0x00, 0x00, | ||
170 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
171 | + 0x00, 0x00, 0x00, 0x00, | ||
172 | + 0x00, 0x00, 0x00, 0x66, | ||
173 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
174 | + 0x00, 0x00, 0x00, 0x00, | ||
175 | + 0x00, 0x00, 0x00, 0x77, | ||
176 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
177 | + 0x00, 0x00, 0x00, 0x00, | ||
178 | + 0x00, 0x00, 0x00, 0x11, | ||
179 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
180 | + 0x00, 0x02, 0x00, 0x00, | ||
181 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
182 | + 0x00, 0x00, 0x00, 0x00, | ||
183 | + 0x00, 0x00, 0x00, 0x44}; | ||
184 | + | ||
185 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
186 | + buffer.writeBytes(labelUpdate); | ||
187 | + | ||
188 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
189 | + PcepMessage message = null; | ||
190 | + | ||
191 | + message = reader.readFrom(buffer); | ||
192 | + | ||
193 | + byte[] testLabelUpdateMsg = {0}; | ||
194 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
195 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
196 | + message.writeTo(buf); | ||
197 | + | ||
198 | + int readLen = buf.writerIndex() - 0; | ||
199 | + testLabelUpdateMsg = new byte[readLen]; | ||
200 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
201 | + | ||
202 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * This test case checks for | ||
207 | + * <pce-label-map> SRP, LABEL, FEC, <pce-label-map> SRP, LABEL, FEC. | ||
208 | + * in PcepLabelUpdate message. | ||
209 | + * | ||
210 | + * @throws PcepParseException while parsing PCEP message | ||
211 | + */ | ||
212 | + @Test | ||
213 | + public void labelUpdateMessageTest5() throws PcepParseException { | ||
214 | + | ||
215 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x44, // common header | ||
216 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
217 | + 0x00, 0x00, 0x00, 0x00, | ||
218 | + 0x00, 0x00, 0x00, 0x10, | ||
219 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
220 | + 0x00, 0x00, 0x00, 0x01, | ||
221 | + 0x00, 0x00, 0x00, 0x66, | ||
222 | + 0x24, 0x10, 0x00, 0x08, // FEC Object Header | ||
223 | + 0x0A, 0x0A, 0x0B, 0x0B, | ||
224 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
225 | + 0x00, 0x00, 0x00, 0x00, | ||
226 | + 0x00, 0x00, 0x00, 0x11, | ||
227 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
228 | + 0x00, 0x00, 0x00, 0x00, | ||
229 | + 0x00, 0x00, 0x00, 0x66, | ||
230 | + 0x24, 0x10, 0x00, 0x08, // FEC Object Header | ||
231 | + 0x0A, 0x0A, 0x0C, 0x0C}; | ||
232 | + | ||
233 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
234 | + buffer.writeBytes(labelUpdate); | ||
235 | + | ||
236 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
237 | + PcepMessage message = null; | ||
238 | + | ||
239 | + message = reader.readFrom(buffer); | ||
240 | + | ||
241 | + byte[] testLabelUpdateMsg = {0}; | ||
242 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
243 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
244 | + message.writeTo(buf); | ||
245 | + | ||
246 | + int readLen = buf.writerIndex() - 0; | ||
247 | + testLabelUpdateMsg = new byte[readLen]; | ||
248 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
249 | + | ||
250 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
251 | + } | ||
252 | + | ||
253 | + /** | ||
254 | + * This test case checks for | ||
255 | + * <pce-label-download> SRP, LSP, LABEL, LABEL, <pce-label-download> SRP, LABEL, FEC. | ||
256 | + * in PcepLabelUpdate message. | ||
257 | + * | ||
258 | + * @throws PcepParseException while parsing PCEP message | ||
259 | + */ | ||
260 | + @Test | ||
261 | + public void labelUpdateMessageTest6() throws PcepParseException { | ||
262 | + | ||
263 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x50, // common header | ||
264 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
265 | + 0x00, 0x00, 0x00, 0x00, | ||
266 | + 0x00, 0x00, 0x00, 0x10, | ||
267 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
268 | + 0x00, 0x01, 0x00, 0x00, | ||
269 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
270 | + 0x00, 0x00, 0x00, 0x00, | ||
271 | + 0x00, 0x00, 0x00, 0x66, | ||
272 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
273 | + 0x00, 0x00, 0x00, 0x00, | ||
274 | + 0x00, 0x00, 0x00, 0x77, | ||
275 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
276 | + 0x00, 0x00, 0x00, 0x00, | ||
277 | + 0x00, 0x00, 0x00, 0x12, | ||
278 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
279 | + 0x00, 0x00, 0x00, 0x00, | ||
280 | + 0x00, 0x00, 0x00, 0x66, | ||
281 | + 0x24, 0x10, 0x00, 0x08, // FEC Object Header | ||
282 | + 0x0A, 0x0A, 0x0D, 0x0D}; | ||
283 | + | ||
284 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
285 | + buffer.writeBytes(labelUpdate); | ||
286 | + | ||
287 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
288 | + PcepMessage message = null; | ||
289 | + | ||
290 | + message = reader.readFrom(buffer); | ||
291 | + | ||
292 | + byte[] testLabelUpdateMsg = {0}; | ||
293 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
294 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
295 | + message.writeTo(buf); | ||
296 | + | ||
297 | + int readLen = buf.writerIndex() - 0; | ||
298 | + testLabelUpdateMsg = new byte[readLen]; | ||
299 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
300 | + | ||
301 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
302 | + } | ||
303 | + | ||
304 | + /** | ||
305 | + * This test case checks for | ||
306 | + * <pce-label-download> SRP, LABEL, FEC, <pce-label-download> SRP, LSP, LABEL, LABEL. | ||
307 | + * in PcepLabelUpdate message. | ||
308 | + * | ||
309 | + * @throws PcepParseException while parsing PCEP message | ||
310 | + */ | ||
311 | + @Test | ||
312 | + public void labelUpdateMessageTest7() throws PcepParseException { | ||
313 | + | ||
314 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x50, // common header | ||
315 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
316 | + 0x00, 0x00, 0x00, 0x00, | ||
317 | + 0x00, 0x00, 0x00, 0x12, | ||
318 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
319 | + 0x00, 0x00, 0x00, 0x00, | ||
320 | + 0x00, 0x00, 0x00, 0x66, | ||
321 | + 0x24, 0x10, 0x00, 0x08, // FEC Object Header | ||
322 | + 0x0A, 0x0A, 0x0D, 0x0D, | ||
323 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
324 | + 0x00, 0x00, 0x00, 0x00, | ||
325 | + 0x00, 0x00, 0x00, 0x10, | ||
326 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
327 | + 0x00, 0x01, 0x00, 0x00, | ||
328 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
329 | + 0x00, 0x00, 0x00, 0x00, | ||
330 | + 0x00, 0x00, 0x00, 0x66, | ||
331 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
332 | + 0x00, 0x00, 0x00, 0x00, | ||
333 | + 0x00, 0x00, 0x00, 0x77}; | ||
334 | + | ||
335 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
336 | + buffer.writeBytes(labelUpdate); | ||
337 | + | ||
338 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
339 | + PcepMessage message = null; | ||
340 | + | ||
341 | + message = reader.readFrom(buffer); | ||
342 | + | ||
343 | + byte[] testLabelUpdateMsg = {0}; | ||
344 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
345 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
346 | + message.writeTo(buf); | ||
347 | + | ||
348 | + int readLen = buf.writerIndex() - 0; | ||
349 | + testLabelUpdateMsg = new byte[readLen]; | ||
350 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
351 | + | ||
352 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
353 | + } | ||
354 | + | ||
355 | + /** | ||
356 | + * This test case checks for | ||
357 | + * <pce-label-download> SRP, LABEL, FEC, <pce-label-download> SRP, LSP, LABEL, LABEL. | ||
358 | + * <pce-label-download> SRP, LSP, LABEL, LABEL. | ||
359 | + * in PcepLabelUpdate message. | ||
360 | + * | ||
361 | + * @throws PcepParseException while parsing PCEP message | ||
362 | + */ | ||
363 | + @Test | ||
364 | + public void labelUpdateMessageTest8() throws PcepParseException { | ||
365 | + | ||
366 | + byte[] labelUpdate = new byte[] {0x20, 0x0D, 0x00, 0x7C, // common header | ||
367 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
368 | + 0x00, 0x00, 0x00, 0x00, | ||
369 | + 0x00, 0x00, 0x00, 0x12, | ||
370 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
371 | + 0x00, 0x00, 0x00, 0x00, | ||
372 | + 0x00, 0x00, 0x00, 0x66, | ||
373 | + 0x24, 0x10, 0x00, 0x08, // FEC Object Header | ||
374 | + 0x0A, 0x0A, 0x0D, 0x0D, | ||
375 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
376 | + 0x00, 0x00, 0x00, 0x00, | ||
377 | + 0x00, 0x00, 0x00, 0x10, | ||
378 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
379 | + 0x00, 0x01, 0x00, 0x00, | ||
380 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
381 | + 0x00, 0x00, 0x00, 0x00, | ||
382 | + 0x00, 0x00, 0x00, 0x66, | ||
383 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
384 | + 0x00, 0x00, 0x00, 0x00, | ||
385 | + 0x00, 0x00, 0x00, 0x77, | ||
386 | + 0x21, 0x10, 0x00, 0x0C, // SRP Object Header | ||
387 | + 0x00, 0x00, 0x00, 0x00, | ||
388 | + 0x00, 0x00, 0x00, 0x10, | ||
389 | + 0x20, 0x10, 0x00, 0x08, // LSP Object Header | ||
390 | + 0x00, 0x01, 0x00, 0x00, | ||
391 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
392 | + 0x00, 0x00, 0x00, 0x00, | ||
393 | + 0x00, 0x00, 0x00, 0x66, | ||
394 | + 0x23, 0x10, 0x00, 0x0C, // LABEL Object Header | ||
395 | + 0x00, 0x00, 0x00, 0x00, | ||
396 | + 0x00, 0x00, 0x00, 0x77}; | ||
397 | + | ||
398 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
399 | + buffer.writeBytes(labelUpdate); | ||
400 | + | ||
401 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
402 | + PcepMessage message = null; | ||
403 | + | ||
404 | + message = reader.readFrom(buffer); | ||
405 | + | ||
406 | + byte[] testLabelUpdateMsg = {0}; | ||
407 | + | ||
408 | + Assert.assertTrue("PcepMessage is not instance of PcepLabelUpdate", message instanceof PcepLabelUpdateMsg); | ||
409 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
410 | + message.writeTo(buf); | ||
411 | + | ||
412 | + int readLen = buf.writerIndex() - 0; | ||
413 | + testLabelUpdateMsg = new byte[readLen]; | ||
414 | + buf.readBytes(testLabelUpdateMsg, 0, readLen); | ||
415 | + | ||
416 | + Assert.assertArrayEquals("PcepLabelUpdate messages are not equal", labelUpdate, testLabelUpdateMsg); | ||
417 | + } | ||
418 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.PcepNaiIpv4NodeId; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class PcepNaiIpv4NodeIdTest { | ||
24 | + | ||
25 | + private final PcepNaiIpv4NodeId tlv1 = PcepNaiIpv4NodeId.of(1); | ||
26 | + private final PcepNaiIpv4NodeId tlv2 = PcepNaiIpv4NodeId.of(1); | ||
27 | + private final PcepNaiIpv4NodeId tlv3 = PcepNaiIpv4NodeId.of(3); | ||
28 | + | ||
29 | + @Test | ||
30 | + public void basics() { | ||
31 | + new EqualsTester() | ||
32 | + .addEqualityGroup(tlv1, tlv2) | ||
33 | + .addEqualityGroup(tlv3) | ||
34 | + .testEquals(); | ||
35 | + } | ||
36 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.PcepNaiIpv6Adjacency; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class PcepNaiIpv6AdjacencyTest { | ||
24 | + private final byte[] localIpv6Addr1 = {(byte) 0x01010101 }; | ||
25 | + private final byte[] remoteIpv6Addr1 = {(byte) 0x02020202 }; | ||
26 | + private final byte[] localIpv6Addr2 = {(byte) 0x01010101 }; | ||
27 | + private final byte[] remoteIpv6Addr2 = {(byte) 0x02020202 }; | ||
28 | + private final byte[] localIpv6Addr3 = {(byte) 0x05050505 }; | ||
29 | + private final byte[] remoteIpv6Addr3 = {(byte) 0x06060606 }; | ||
30 | + | ||
31 | + private final PcepNaiIpv6Adjacency tlv1 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); | ||
32 | + private final PcepNaiIpv6Adjacency tlv2 = PcepNaiIpv6Adjacency.of(localIpv6Addr1, remoteIpv6Addr1); | ||
33 | + private final PcepNaiIpv6Adjacency tlv3 = PcepNaiIpv6Adjacency.of(localIpv6Addr3, remoteIpv6Addr3); | ||
34 | + | ||
35 | + @Test | ||
36 | + public void basics() { | ||
37 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
38 | + } | ||
39 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.PcepNaiUnnumberedAdjacencyIpv4; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class PcepNaiUnnumberedAdjacencyIpv4Test { | ||
24 | + | ||
25 | + private final int localNodeId1 = 1; | ||
26 | + private final int localInterfaceId1 = 1; | ||
27 | + private final int remoteNodeId1 = 1; | ||
28 | + private final int remoteInterfaceId1 = 1; | ||
29 | + private final PcepNaiUnnumberedAdjacencyIpv4 tlv1 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId1, | ||
30 | + localInterfaceId1, remoteNodeId1, remoteInterfaceId1); | ||
31 | + | ||
32 | + private final int localNodeId2 = 1; | ||
33 | + private final int localInterfaceId2 = 1; | ||
34 | + private final int remoteNodeId2 = 1; | ||
35 | + private final int remoteInterfaceId2 = 1; | ||
36 | + private final PcepNaiUnnumberedAdjacencyIpv4 tlv2 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId2, | ||
37 | + localInterfaceId2, remoteNodeId2, remoteInterfaceId2); | ||
38 | + | ||
39 | + private final int localNodeId3 = 2; | ||
40 | + private final int localInterfaceId3 = 2; | ||
41 | + private final int remoteNodeId3 = 2; | ||
42 | + private final int remoteInterfaceId3 = 2; | ||
43 | + | ||
44 | + private final PcepNaiUnnumberedAdjacencyIpv4 tlv3 = PcepNaiUnnumberedAdjacencyIpv4.of(localNodeId3, | ||
45 | + localInterfaceId3, remoteNodeId3, remoteInterfaceId3); | ||
46 | + | ||
47 | + @Test | ||
48 | + public void basics() { | ||
49 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
50 | + } | ||
51 | +} |
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
19 | +import org.jboss.netty.buffer.ChannelBuffers; | ||
20 | +import org.junit.Assert; | ||
21 | +import org.junit.Test; | ||
22 | +import org.onosproject.pcepio.exceptions.PcepParseException; | ||
23 | +import org.onosproject.pcepio.protocol.PcepFactories; | ||
24 | +import org.onosproject.pcepio.protocol.PcepMessage; | ||
25 | +import org.onosproject.pcepio.protocol.PcepMessageReader; | ||
26 | +import org.onosproject.pcepio.protocol.PcepReportMsg; | ||
27 | + | ||
28 | +public class PcepReportMsgTest { | ||
29 | + | ||
30 | + /** | ||
31 | + * This test case checks for SRP object, LSP object(Symbolic path name tlv), ERO object | ||
32 | + * in PcRpt message. | ||
33 | + * | ||
34 | + * @throws PcepParseException while parsing PCEP message | ||
35 | + */ | ||
36 | + @Test | ||
37 | + public void reportMessageTest1() throws PcepParseException { | ||
38 | + | ||
39 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, 0x24, | ||
40 | + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
41 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
42 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
43 | + 0x07, 0x10, 0x00, 0x04 }; //ERO Object | ||
44 | + | ||
45 | + byte[] testReportMsg = {0}; | ||
46 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
47 | + buffer.writeBytes(reportMsg); | ||
48 | + | ||
49 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
50 | + PcepMessage message = null; | ||
51 | + | ||
52 | + message = reader.readFrom(buffer); | ||
53 | + | ||
54 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
55 | + | ||
56 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
57 | + message.writeTo(buf); | ||
58 | + | ||
59 | + int readLen = buf.writerIndex() - 0; | ||
60 | + testReportMsg = new byte[readLen]; | ||
61 | + buf.readBytes(testReportMsg, 0, readLen); | ||
62 | + | ||
63 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
64 | + } | ||
65 | + | ||
66 | + /** | ||
67 | + * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv | ||
68 | + * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list, IRO object | ||
69 | + * in PcRpt message. | ||
70 | + * | ||
71 | + * @throws PcepParseException while parsing PCEP message | ||
72 | + */ | ||
73 | + @Test | ||
74 | + public void reportMessageTest2() throws PcepParseException { | ||
75 | + | ||
76 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x7c, | ||
77 | + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
78 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object // LSP Object | ||
79 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
80 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
81 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
82 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
83 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
84 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
85 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, // IPv4SubObjects | ||
86 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
87 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
88 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
89 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Object | ||
90 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
91 | + }; | ||
92 | + | ||
93 | + byte[] testReportMsg = {0}; | ||
94 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
95 | + buffer.writeBytes(reportMsg); | ||
96 | + | ||
97 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
98 | + PcepMessage message = null; | ||
99 | + | ||
100 | + message = reader.readFrom(buffer); | ||
101 | + | ||
102 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
103 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
104 | + message.writeTo(buf); | ||
105 | + | ||
106 | + int readLen = buf.writerIndex() - 0; | ||
107 | + testReportMsg = new byte[readLen]; | ||
108 | + buf.readBytes(testReportMsg, 0, readLen); | ||
109 | + | ||
110 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
111 | + } | ||
112 | + | ||
113 | + /** | ||
114 | + * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) | ||
115 | + * ERO Object, LSPA Object, Metric-list, IRO object | ||
116 | + * in PcRpt message. | ||
117 | + * | ||
118 | + * @throws PcepParseException while parsing PCEP message | ||
119 | + */ | ||
120 | + @Test | ||
121 | + public void reportMessageTest3() throws PcepParseException { | ||
122 | + | ||
123 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70, | ||
124 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | ||
125 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
126 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
127 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
128 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
129 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
130 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
131 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, //Ipv4SubObjects | ||
132 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
133 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
134 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
135 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric Objects | ||
136 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
137 | + }; | ||
138 | + | ||
139 | + byte[] testReportMsg = {0}; | ||
140 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
141 | + buffer.writeBytes(reportMsg); | ||
142 | + | ||
143 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
144 | + PcepMessage message = null; | ||
145 | + | ||
146 | + message = reader.readFrom(buffer); | ||
147 | + | ||
148 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
149 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
150 | + message.writeTo(buf); | ||
151 | + | ||
152 | + int readLen = buf.writerIndex() - 0; | ||
153 | + testReportMsg = new byte[readLen]; | ||
154 | + buf.readBytes(testReportMsg, 0, readLen); | ||
155 | + | ||
156 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
157 | + } | ||
158 | + | ||
159 | + /** | ||
160 | + * This test case checks for LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv,StatefulLspErrorCodeTlv) | ||
161 | + * ERO Object, LSPA Object, Metric-list | ||
162 | + * in PcRpt message. | ||
163 | + * | ||
164 | + * @throws PcepParseException while parsing PCEP message | ||
165 | + */ | ||
166 | + @Test | ||
167 | + public void reportMessageTest4() throws PcepParseException { | ||
168 | + | ||
169 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x64, | ||
170 | + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
171 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | ||
172 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
173 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
174 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
175 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
176 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
177 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
178 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
179 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
180 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
181 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
182 | + | ||
183 | + byte[] testReportMsg = {0}; | ||
184 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
185 | + buffer.writeBytes(reportMsg); | ||
186 | + | ||
187 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
188 | + PcepMessage message = null; | ||
189 | + | ||
190 | + message = reader.readFrom(buffer); | ||
191 | + | ||
192 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
193 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
194 | + message.writeTo(buf); | ||
195 | + | ||
196 | + int readLen = buf.writerIndex() - 0; | ||
197 | + testReportMsg = new byte[readLen]; | ||
198 | + buf.readBytes(testReportMsg, 0, readLen); | ||
199 | + | ||
200 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
201 | + } | ||
202 | + | ||
203 | + /** | ||
204 | + * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv | ||
205 | + * StatefulLspErrorCodeTlv) ERO Object, IRO object | ||
206 | + * in PcRpt message. | ||
207 | + * | ||
208 | + * @throws PcepParseException while parsing PCEP message | ||
209 | + */ | ||
210 | + @Test | ||
211 | + public void reportMessageTest5() throws PcepParseException { | ||
212 | + | ||
213 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x50, | ||
214 | + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
215 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | ||
216 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
217 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
218 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
219 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
220 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
221 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
222 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
223 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 }; | ||
224 | + | ||
225 | + byte[] testReportMsg = {0}; | ||
226 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
227 | + buffer.writeBytes(reportMsg); | ||
228 | + | ||
229 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
230 | + PcepMessage message = null; | ||
231 | + | ||
232 | + message = reader.readFrom(buffer); | ||
233 | + | ||
234 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
235 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
236 | + message.writeTo(buf); | ||
237 | + | ||
238 | + int readLen = buf.writerIndex() - 0; | ||
239 | + testReportMsg = new byte[readLen]; | ||
240 | + buf.readBytes(testReportMsg, 0, readLen); | ||
241 | + | ||
242 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
243 | + } | ||
244 | + | ||
245 | + /** | ||
246 | + * This test case checks for SRP Object, LSP Object(StatefulIPv4LspIdentidiersTlv,SymbolicPathNameTlv | ||
247 | + * StatefulLspErrorCodeTlv) ERO Object, LSPA Object, Metric-list. | ||
248 | + * in PcRpt message. | ||
249 | + * | ||
250 | + * @throws PcepParseException while parsing PCEP message | ||
251 | + */ | ||
252 | + @Test | ||
253 | + public void reportMessageTest6() throws PcepParseException { | ||
254 | + | ||
255 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6c, | ||
256 | + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
257 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
258 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
259 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
260 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
261 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
262 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
263 | + 0x07, 0x10, 0x00, 0x04, //ERO Object | ||
264 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
265 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
266 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, //Metric object | ||
267 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
268 | + }; | ||
269 | + | ||
270 | + byte[] testReportMsg = {0}; | ||
271 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
272 | + buffer.writeBytes(reportMsg); | ||
273 | + | ||
274 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
275 | + PcepMessage message = null; | ||
276 | + | ||
277 | + message = reader.readFrom(buffer); | ||
278 | + | ||
279 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
280 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
281 | + message.writeTo(buf); | ||
282 | + | ||
283 | + int readLen = buf.writerIndex() - 0; | ||
284 | + testReportMsg = new byte[readLen]; | ||
285 | + buf.readBytes(testReportMsg, 0, readLen); | ||
286 | + | ||
287 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
288 | + } | ||
289 | + | ||
290 | + /** | ||
291 | + * This test case checks for LSP Object, ERO Object, LSPA Object, Metric-list, IRO object | ||
292 | + * in PcRpt message. | ||
293 | + * | ||
294 | + * @throws PcepParseException while parsing PCEP message | ||
295 | + */ | ||
296 | + @Test | ||
297 | + public void reportMessageTest7() throws PcepParseException { | ||
298 | + | ||
299 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x58, | ||
300 | + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
301 | + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
302 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
303 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
304 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
305 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
306 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
307 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, // Metric objects | ||
308 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; | ||
309 | + | ||
310 | + byte[] testReportMsg = {0}; | ||
311 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
312 | + buffer.writeBytes(reportMsg); | ||
313 | + | ||
314 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
315 | + PcepMessage message = null; | ||
316 | + | ||
317 | + message = reader.readFrom(buffer); | ||
318 | + | ||
319 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
320 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
321 | + message.writeTo(buf); | ||
322 | + | ||
323 | + int readLen = buf.writerIndex() - 0; | ||
324 | + testReportMsg = new byte[readLen]; | ||
325 | + buf.readBytes(testReportMsg, 0, readLen); | ||
326 | + | ||
327 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
328 | + } | ||
329 | + | ||
330 | + /** | ||
331 | + * This test case checks for SRP object, LSP object( StatefulIPv4LspIdentidiersTlv, SymbolicPathNameTlv, | ||
332 | + * StatefulLspErrorCodeTlv) ERO object, LSPA object, Metric object | ||
333 | + * in PcRpt message. | ||
334 | + * | ||
335 | + * @throws PcepParseException while parsing PCEP message | ||
336 | + */ | ||
337 | + @Test | ||
338 | + public void reportMessageTest8() throws PcepParseException { | ||
339 | + | ||
340 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70, | ||
341 | + 0x21, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
342 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
343 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
344 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
345 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
346 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
347 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
348 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
349 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
350 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
351 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
352 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
353 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20}; //Metric Object | ||
354 | + | ||
355 | + byte[] testReportMsg = {0}; | ||
356 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
357 | + buffer.writeBytes(reportMsg); | ||
358 | + | ||
359 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
360 | + PcepMessage message = null; | ||
361 | + | ||
362 | + message = reader.readFrom(buffer); | ||
363 | + | ||
364 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
365 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
366 | + message.writeTo(buf); | ||
367 | + | ||
368 | + int readLen = buf.writerIndex() - 0; | ||
369 | + testReportMsg = new byte[readLen]; | ||
370 | + buf.readBytes(testReportMsg, 0, readLen); | ||
371 | + | ||
372 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
373 | + } | ||
374 | + | ||
375 | + /** | ||
376 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, | ||
377 | + * StatefulLspErrorCodeTlv ),ERO Object | ||
378 | + * in PcRpt message. | ||
379 | + * | ||
380 | + * @throws PcepParseException while parsing PCEP message | ||
381 | + */ | ||
382 | + @Test | ||
383 | + public void reportMessageTest9() throws PcepParseException { | ||
384 | + | ||
385 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x44, | ||
386 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object //LSP Object | ||
387 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
388 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
389 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
390 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
391 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
392 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
393 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
394 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 }; | ||
395 | + | ||
396 | + byte[] testReportMsg = {0}; | ||
397 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
398 | + buffer.writeBytes(reportMsg); | ||
399 | + | ||
400 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
401 | + PcepMessage message = null; | ||
402 | + | ||
403 | + message = reader.readFrom(buffer); | ||
404 | + | ||
405 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
406 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
407 | + message.writeTo(buf); | ||
408 | + | ||
409 | + int readLen = buf.writerIndex() - 0; | ||
410 | + testReportMsg = new byte[readLen]; | ||
411 | + buf.readBytes(testReportMsg, 0, readLen); | ||
412 | + | ||
413 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
414 | + } | ||
415 | + | ||
416 | + /** | ||
417 | + * This test case checks for SRP Object,LSP Object(StatefulIPv4LspIdentidiersTlv)ERO Object,RRO Object | ||
418 | + * in PcRpt message. | ||
419 | + * | ||
420 | + * @throws PcepParseException while parsing PCEP message | ||
421 | + */ | ||
422 | + @Test | ||
423 | + public void reportMessageTest10() throws PcepParseException { | ||
424 | + | ||
425 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74, | ||
426 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
427 | + 0x20, 0x10, 0x00, 0x1c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
428 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
429 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
430 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
431 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
432 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
433 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
434 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
435 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
436 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
437 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
438 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
439 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
440 | + | ||
441 | + byte[] testReportMsg = {0}; | ||
442 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
443 | + buffer.writeBytes(reportMsg); | ||
444 | + | ||
445 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
446 | + PcepMessage message = null; | ||
447 | + | ||
448 | + message = reader.readFrom(buffer); | ||
449 | + | ||
450 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
451 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
452 | + message.writeTo(buf); | ||
453 | + | ||
454 | + int readLen = buf.writerIndex() - 0; | ||
455 | + testReportMsg = new byte[readLen]; | ||
456 | + buf.readBytes(testReportMsg, 0, readLen); | ||
457 | + | ||
458 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
459 | + } | ||
460 | + | ||
461 | + /** | ||
462 | + * This test case checks for SRP Object,LSP Object(SymbolicPathNameTlv)ERO Object,RRO Object | ||
463 | + * in PcRpt message. | ||
464 | + * | ||
465 | + * @throws PcepParseException while parsing PCEP message | ||
466 | + */ | ||
467 | + @Test | ||
468 | + public void reportMessageTest11() throws PcepParseException { | ||
469 | + | ||
470 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68, | ||
471 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
472 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
473 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
474 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
475 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
476 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
477 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
478 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
479 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
480 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
481 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
482 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
483 | + | ||
484 | + byte[] testReportMsg = {0}; | ||
485 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
486 | + buffer.writeBytes(reportMsg); | ||
487 | + | ||
488 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
489 | + PcepMessage message = null; | ||
490 | + | ||
491 | + message = reader.readFrom(buffer); | ||
492 | + | ||
493 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
494 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
495 | + message.writeTo(buf); | ||
496 | + | ||
497 | + int readLen = buf.writerIndex() - 0; | ||
498 | + testReportMsg = new byte[readLen]; | ||
499 | + buf.readBytes(testReportMsg, 0, readLen); | ||
500 | + | ||
501 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
502 | + } | ||
503 | + | ||
504 | + /** | ||
505 | + * This test case checks for SRP Object,LSP Object, ERO Object,RRO Object | ||
506 | + * in PcRpt message. | ||
507 | + * | ||
508 | + * @throws PcepParseException while parsing PCEP message | ||
509 | + */ | ||
510 | + @Test | ||
511 | + public void reportMessageTest12() throws PcepParseException { | ||
512 | + | ||
513 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x60, | ||
514 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
515 | + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
516 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
517 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
518 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
519 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
520 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
521 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
522 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
523 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
524 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
525 | + | ||
526 | + byte[] testReportMsg = {0}; | ||
527 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
528 | + buffer.writeBytes(reportMsg); | ||
529 | + | ||
530 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
531 | + PcepMessage message = null; | ||
532 | + | ||
533 | + message = reader.readFrom(buffer); | ||
534 | + | ||
535 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
536 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
537 | + message.writeTo(buf); | ||
538 | + | ||
539 | + int readLen = buf.writerIndex() - 0; | ||
540 | + testReportMsg = new byte[readLen]; | ||
541 | + buf.readBytes(testReportMsg, 0, readLen); | ||
542 | + | ||
543 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
544 | + } | ||
545 | + | ||
546 | + /** | ||
547 | + * This test case checks for SRP Object,LSP Object(StatefulLspErrorCodeTlv)ERO Object,RRO Object | ||
548 | + * in PcRpt message. | ||
549 | + * | ||
550 | + * @throws PcepParseException while parsing PCEP message | ||
551 | + */ | ||
552 | + @Test | ||
553 | + public void reportMessageTest13() throws PcepParseException { | ||
554 | + | ||
555 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68, | ||
556 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
557 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
558 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
559 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
560 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
561 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
562 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
563 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
564 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
565 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
566 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
567 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
568 | + | ||
569 | + byte[] testReportMsg = {0}; | ||
570 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
571 | + buffer.writeBytes(reportMsg); | ||
572 | + | ||
573 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
574 | + PcepMessage message = null; | ||
575 | + | ||
576 | + message = reader.readFrom(buffer); | ||
577 | + | ||
578 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
579 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
580 | + message.writeTo(buf); | ||
581 | + | ||
582 | + int readLen = buf.writerIndex() - 0; | ||
583 | + testReportMsg = new byte[readLen]; | ||
584 | + buf.readBytes(testReportMsg, 0, readLen); | ||
585 | + | ||
586 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
587 | + } | ||
588 | + | ||
589 | + /** | ||
590 | + * This test case checks for SRP Object,LSP Object(StatefulRsvpErrorSpecTlv),ERO Object,RRO Object | ||
591 | + * in PcRpt message. | ||
592 | + * | ||
593 | + * @throws PcepParseException while parsing PCEP message | ||
594 | + */ | ||
595 | + @Test | ||
596 | + public void reportMessageTest14() throws PcepParseException { | ||
597 | + | ||
598 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x60, | ||
599 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
600 | + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
601 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
602 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
603 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
604 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
605 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
606 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
607 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
608 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
609 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
610 | + | ||
611 | + byte[] testReportMsg = {0}; | ||
612 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
613 | + buffer.writeBytes(reportMsg); | ||
614 | + | ||
615 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
616 | + PcepMessage message = null; | ||
617 | + | ||
618 | + message = reader.readFrom(buffer); | ||
619 | + | ||
620 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
621 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
622 | + message.writeTo(buf); | ||
623 | + | ||
624 | + int readLen = buf.writerIndex() - 0; | ||
625 | + testReportMsg = new byte[readLen]; | ||
626 | + buf.readBytes(testReportMsg, 0, readLen); | ||
627 | + | ||
628 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
629 | + } | ||
630 | + | ||
631 | + /** | ||
632 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),LSPA Object,ERO Object | ||
633 | + * in PcRpt message. | ||
634 | + * | ||
635 | + * @throws PcepParseException while parsing PCEP message | ||
636 | + */ | ||
637 | + @Test | ||
638 | + public void reportMessageTest15() throws PcepParseException { | ||
639 | + | ||
640 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x7C, | ||
641 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
642 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
643 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
644 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
645 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
646 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
647 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
648 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
649 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
650 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
651 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
652 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
653 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
654 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
655 | + | ||
656 | + byte[] testReportMsg = {0}; | ||
657 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
658 | + buffer.writeBytes(reportMsg); | ||
659 | + | ||
660 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
661 | + PcepMessage message = null; | ||
662 | + | ||
663 | + message = reader.readFrom(buffer); | ||
664 | + | ||
665 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
666 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
667 | + message.writeTo(buf); | ||
668 | + | ||
669 | + int readLen = buf.writerIndex() - 0; | ||
670 | + testReportMsg = new byte[readLen]; | ||
671 | + buf.readBytes(testReportMsg, 0, readLen); | ||
672 | + | ||
673 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
674 | + } | ||
675 | + | ||
676 | + /** | ||
677 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),BandWidth Object,ERO Object | ||
678 | + * in PcRpt message. | ||
679 | + * | ||
680 | + * @throws PcepParseException while parsing PCEP message | ||
681 | + */ | ||
682 | + @Test | ||
683 | + public void reportMessageTest16() throws PcepParseException { | ||
684 | + | ||
685 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x70, | ||
686 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
687 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
688 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
689 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
690 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
691 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
692 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
693 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
694 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
695 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
696 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
697 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
698 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
699 | + | ||
700 | + byte[] testReportMsg = {0}; | ||
701 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
702 | + buffer.writeBytes(reportMsg); | ||
703 | + | ||
704 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
705 | + PcepMessage message = null; | ||
706 | + | ||
707 | + message = reader.readFrom(buffer); | ||
708 | + | ||
709 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
710 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
711 | + message.writeTo(buf); | ||
712 | + | ||
713 | + int readLen = buf.writerIndex() - 0; | ||
714 | + testReportMsg = new byte[readLen]; | ||
715 | + buf.readBytes(testReportMsg, 0, readLen); | ||
716 | + | ||
717 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
718 | + } | ||
719 | + | ||
720 | + /** | ||
721 | + * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,RRO Object | ||
722 | + * in PcRpt message. | ||
723 | + * | ||
724 | + * @throws PcepParseException while parsing PCEP message | ||
725 | + */ | ||
726 | + @Test | ||
727 | + public void reportMessageTest17() throws PcepParseException { | ||
728 | + | ||
729 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74, | ||
730 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
731 | + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
732 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
733 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
734 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
735 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
736 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
737 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
738 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
739 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
740 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
741 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
742 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
743 | + | ||
744 | + byte[] testReportMsg = {0}; | ||
745 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
746 | + buffer.writeBytes(reportMsg); | ||
747 | + | ||
748 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
749 | + PcepMessage message = null; | ||
750 | + | ||
751 | + message = reader.readFrom(buffer); | ||
752 | + | ||
753 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
754 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
755 | + message.writeTo(buf); | ||
756 | + | ||
757 | + int readLen = buf.writerIndex() - 0; | ||
758 | + testReportMsg = new byte[readLen]; | ||
759 | + buf.readBytes(testReportMsg, 0, readLen); | ||
760 | + | ||
761 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
762 | + } | ||
763 | + | ||
764 | + /** | ||
765 | + * This test case checks for SRP Object,LSP Object,ERO Object,BandWidth Object,RRO Object | ||
766 | + * in PcRpt message. | ||
767 | + * | ||
768 | + * @throws PcepParseException while parsing PCEP message | ||
769 | + */ | ||
770 | + @Test | ||
771 | + public void reportMessageTest18() throws PcepParseException { | ||
772 | + | ||
773 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x68, | ||
774 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
775 | + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
776 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
777 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
778 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
779 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
780 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
781 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
782 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
783 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
784 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
785 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
786 | + | ||
787 | + byte[] testReportMsg = {0}; | ||
788 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
789 | + buffer.writeBytes(reportMsg); | ||
790 | + | ||
791 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
792 | + PcepMessage message = null; | ||
793 | + | ||
794 | + message = reader.readFrom(buffer); | ||
795 | + | ||
796 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
797 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
798 | + message.writeTo(buf); | ||
799 | + | ||
800 | + int readLen = buf.writerIndex() - 0; | ||
801 | + testReportMsg = new byte[readLen]; | ||
802 | + buf.readBytes(testReportMsg, 0, readLen); | ||
803 | + | ||
804 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
805 | + } | ||
806 | + | ||
807 | + /** | ||
808 | + * This test case checks for SRP Object,LSP Object,ERO Object,Metric-list,RRO Object | ||
809 | + * in PcRpt message. | ||
810 | + * | ||
811 | + * @throws PcepParseException while parsing PCEP message | ||
812 | + */ | ||
813 | + @Test | ||
814 | + public void reportMessageTest19() throws PcepParseException { | ||
815 | + | ||
816 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6C, | ||
817 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
818 | + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
819 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
820 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
821 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
822 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
823 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
824 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
825 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
826 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
827 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
828 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
829 | + | ||
830 | + byte[] testReportMsg = {0}; | ||
831 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
832 | + buffer.writeBytes(reportMsg); | ||
833 | + | ||
834 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
835 | + PcepMessage message = null; | ||
836 | + | ||
837 | + message = reader.readFrom(buffer); | ||
838 | + | ||
839 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
840 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
841 | + message.writeTo(buf); | ||
842 | + | ||
843 | + int readLen = buf.writerIndex() - 0; | ||
844 | + testReportMsg = new byte[readLen]; | ||
845 | + buf.readBytes(testReportMsg, 0, readLen); | ||
846 | + | ||
847 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
848 | + } | ||
849 | + | ||
850 | + /** | ||
851 | + * This test case checks for SRP Object,LSP Object,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | ||
852 | + * in PcRpt message. | ||
853 | + * | ||
854 | + * @throws PcepParseException while parsing PCEP message | ||
855 | + */ | ||
856 | + @Test | ||
857 | + public void reportMessageTest20() throws PcepParseException { | ||
858 | + | ||
859 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x88, | ||
860 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
861 | + 0x20, 0x10, 0x00, 0x08, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
862 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
863 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
864 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
865 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | ||
866 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
867 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
868 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
869 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
870 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
871 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
872 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
873 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
874 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
875 | + | ||
876 | + byte[] testReportMsg = {0}; | ||
877 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
878 | + buffer.writeBytes(reportMsg); | ||
879 | + | ||
880 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
881 | + PcepMessage message = null; | ||
882 | + | ||
883 | + message = reader.readFrom(buffer); | ||
884 | + | ||
885 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
886 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
887 | + message.writeTo(buf); | ||
888 | + | ||
889 | + int readLen = buf.writerIndex() - 0; | ||
890 | + testReportMsg = new byte[readLen]; | ||
891 | + buf.readBytes(testReportMsg, 0, readLen); | ||
892 | + | ||
893 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
894 | + } | ||
895 | + | ||
896 | + /** | ||
897 | + * This test case checks for SRP Object,LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv, | ||
898 | + * StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | ||
899 | + * in PcRpt message. | ||
900 | + * @throws PcepParseException while parsing PCEP message | ||
901 | + */ | ||
902 | + @Test | ||
903 | + public void reportMessageTest21() throws PcepParseException { | ||
904 | + | ||
905 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xac, | ||
906 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
907 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
908 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
909 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
910 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
911 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
912 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
913 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
914 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
915 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
916 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
917 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
918 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
919 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
920 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
921 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
922 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
923 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
924 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
925 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
926 | + | ||
927 | + byte[] testReportMsg = {0}; | ||
928 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
929 | + buffer.writeBytes(reportMsg); | ||
930 | + | ||
931 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
932 | + PcepMessage message = null; | ||
933 | + | ||
934 | + message = reader.readFrom(buffer); | ||
935 | + | ||
936 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
937 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
938 | + message.writeTo(buf); | ||
939 | + | ||
940 | + int readLen = buf.writerIndex() - 0; | ||
941 | + testReportMsg = new byte[readLen]; | ||
942 | + buf.readBytes(testReportMsg, 0, readLen); | ||
943 | + | ||
944 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
945 | + } | ||
946 | + | ||
947 | + /** | ||
948 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | ||
949 | + * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | ||
950 | + * in PcRpt message. | ||
951 | + * | ||
952 | + * @throws PcepParseException while parsing PCEP message | ||
953 | + */ | ||
954 | + @Test | ||
955 | + public void reportMessageTest22() throws PcepParseException { | ||
956 | + | ||
957 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xA0, | ||
958 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
959 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
960 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
961 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
962 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
963 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
964 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
965 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
966 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
967 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | ||
968 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
969 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
970 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
971 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
972 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
973 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
974 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
975 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
976 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
977 | + | ||
978 | + byte[] testReportMsg = {0}; | ||
979 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
980 | + buffer.writeBytes(reportMsg); | ||
981 | + | ||
982 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
983 | + PcepMessage message = null; | ||
984 | + | ||
985 | + message = reader.readFrom(buffer); | ||
986 | + | ||
987 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
988 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
989 | + message.writeTo(buf); | ||
990 | + | ||
991 | + int readLen = buf.writerIndex() - 0; | ||
992 | + testReportMsg = new byte[readLen]; | ||
993 | + buf.readBytes(testReportMsg, 0, readLen); | ||
994 | + | ||
995 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
996 | + } | ||
997 | + | ||
998 | + /** | ||
999 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | ||
1000 | + * ERO Object,BandWidth Object,Metric-list,RRO Object | ||
1001 | + * in PcRpt message. | ||
1002 | + * | ||
1003 | + * @throws PcepParseException while parsing PCEP message | ||
1004 | + */ | ||
1005 | + @Test | ||
1006 | + public void reportMessageTest23() throws PcepParseException { | ||
1007 | + | ||
1008 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c, | ||
1009 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1010 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
1011 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
1012 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
1013 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1014 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
1015 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1016 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1017 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1018 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1019 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1020 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1021 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1022 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1023 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1024 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1025 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1026 | + | ||
1027 | + byte[] testReportMsg = {0}; | ||
1028 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1029 | + buffer.writeBytes(reportMsg); | ||
1030 | + | ||
1031 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1032 | + PcepMessage message = null; | ||
1033 | + | ||
1034 | + message = reader.readFrom(buffer); | ||
1035 | + | ||
1036 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1037 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1038 | + message.writeTo(buf); | ||
1039 | + | ||
1040 | + int readLen = buf.writerIndex() - 0; | ||
1041 | + testReportMsg = new byte[readLen]; | ||
1042 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1043 | + | ||
1044 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1045 | + } | ||
1046 | + | ||
1047 | + /** | ||
1048 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | ||
1049 | + * ERO Object,Metric-list,RRO Object | ||
1050 | + * in PcRpt message. | ||
1051 | + * | ||
1052 | + * @throws PcepParseException while parsing PCEP message | ||
1053 | + */ | ||
1054 | + @Test | ||
1055 | + public void reportMessageTest24() throws PcepParseException { | ||
1056 | + | ||
1057 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x84, | ||
1058 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1059 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
1060 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
1061 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
1062 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1063 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
1064 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1065 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1066 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1067 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1068 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1069 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1070 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1071 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1072 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1073 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1074 | + | ||
1075 | + byte[] testReportMsg = {0}; | ||
1076 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1077 | + buffer.writeBytes(reportMsg); | ||
1078 | + | ||
1079 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1080 | + PcepMessage message = null; | ||
1081 | + | ||
1082 | + message = reader.readFrom(buffer); | ||
1083 | + | ||
1084 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1085 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1086 | + message.writeTo(buf); | ||
1087 | + | ||
1088 | + int readLen = buf.writerIndex() - 0; | ||
1089 | + testReportMsg = new byte[readLen]; | ||
1090 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1091 | + | ||
1092 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1093 | + } | ||
1094 | + | ||
1095 | + /** | ||
1096 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | ||
1097 | + * ERO Object,LSPA Object,RRO Object | ||
1098 | + * in PcRpt message. | ||
1099 | + * | ||
1100 | + * @throws PcepParseException while parsing PCEP message | ||
1101 | + */ | ||
1102 | + @Test | ||
1103 | + public void reportMessageTest25() throws PcepParseException { | ||
1104 | + | ||
1105 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c, | ||
1106 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1107 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
1108 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
1109 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
1110 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1111 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
1112 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1113 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1114 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1115 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object | ||
1116 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1117 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1118 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1119 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1120 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1121 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1122 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1123 | + | ||
1124 | + byte[] testReportMsg = {0}; | ||
1125 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1126 | + buffer.writeBytes(reportMsg); | ||
1127 | + | ||
1128 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1129 | + PcepMessage message = null; | ||
1130 | + | ||
1131 | + message = reader.readFrom(buffer); | ||
1132 | + | ||
1133 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1134 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1135 | + message.writeTo(buf); | ||
1136 | + | ||
1137 | + int readLen = buf.writerIndex() - 0; | ||
1138 | + testReportMsg = new byte[readLen]; | ||
1139 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1140 | + | ||
1141 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1142 | + } | ||
1143 | + | ||
1144 | + /** | ||
1145 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | ||
1146 | + * ERO Object,LSPA Object | ||
1147 | + * in PcRpt message. | ||
1148 | + * | ||
1149 | + * @throws PcepParseException while parsing PCEP message | ||
1150 | + */ | ||
1151 | + @Test | ||
1152 | + public void reportMessageTest26() throws PcepParseException { | ||
1153 | + | ||
1154 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x58, | ||
1155 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1156 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
1157 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
1158 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
1159 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1160 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
1161 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1162 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1163 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1164 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA Object | ||
1165 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
1166 | + | ||
1167 | + byte[] testReportMsg = {0}; | ||
1168 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1169 | + buffer.writeBytes(reportMsg); | ||
1170 | + | ||
1171 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1172 | + PcepMessage message = null; | ||
1173 | + | ||
1174 | + message = reader.readFrom(buffer); | ||
1175 | + | ||
1176 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1177 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1178 | + message.writeTo(buf); | ||
1179 | + | ||
1180 | + int readLen = buf.writerIndex() - 0; | ||
1181 | + testReportMsg = new byte[readLen]; | ||
1182 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1183 | + | ||
1184 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1185 | + } | ||
1186 | + | ||
1187 | + /** | ||
1188 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv) | ||
1189 | + * ERO Object | ||
1190 | + * in PcRpt message. | ||
1191 | + * | ||
1192 | + * @throws PcepParseException while parsing PCEP message | ||
1193 | + */ | ||
1194 | + @Test | ||
1195 | + public void reportMessageTest27() throws PcepParseException { | ||
1196 | + | ||
1197 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x44, | ||
1198 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1199 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
1200 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
1201 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
1202 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1203 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
1204 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1205 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1206 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00 }; | ||
1207 | + | ||
1208 | + byte[] testReportMsg = {0}; | ||
1209 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1210 | + buffer.writeBytes(reportMsg); | ||
1211 | + | ||
1212 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1213 | + PcepMessage message = null; | ||
1214 | + | ||
1215 | + message = reader.readFrom(buffer); | ||
1216 | + | ||
1217 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1218 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1219 | + message.writeTo(buf); | ||
1220 | + | ||
1221 | + int readLen = buf.writerIndex() - 0; | ||
1222 | + testReportMsg = new byte[readLen]; | ||
1223 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1224 | + | ||
1225 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1226 | + } | ||
1227 | + | ||
1228 | + /** | ||
1229 | + * This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) | ||
1230 | + * LSPA Object,BandWidth Object,Metric-list,ERO Object | ||
1231 | + * in PcRpt message. | ||
1232 | + * | ||
1233 | + * @throws PcepParseException while parsing PCEP message | ||
1234 | + */ | ||
1235 | + @Test | ||
1236 | + public void reportMessageTest28() throws PcepParseException { | ||
1237 | + | ||
1238 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x6c, | ||
1239 | + 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1240 | + 0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv | ||
1241 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, | ||
1242 | + (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, | ||
1243 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1244 | + 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv | ||
1245 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1246 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1247 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1248 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | ||
1249 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1250 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1251 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; | ||
1252 | + | ||
1253 | + byte[] testReportMsg = {0}; | ||
1254 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1255 | + buffer.writeBytes(reportMsg); | ||
1256 | + | ||
1257 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1258 | + PcepMessage message = null; | ||
1259 | + | ||
1260 | + message = reader.readFrom(buffer); | ||
1261 | + | ||
1262 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1263 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1264 | + message.writeTo(buf); | ||
1265 | + | ||
1266 | + int readLen = buf.writerIndex() - 0; | ||
1267 | + testReportMsg = new byte[readLen]; | ||
1268 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1269 | + | ||
1270 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1271 | + } | ||
1272 | + | ||
1273 | + /** | ||
1274 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object | ||
1275 | + * in PcRpt message. | ||
1276 | + * | ||
1277 | + * @throws PcepParseException while parsing PCEP message | ||
1278 | + */ | ||
1279 | + @Test | ||
1280 | + public void reportMessageTest29() throws PcepParseException { | ||
1281 | + | ||
1282 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x74, | ||
1283 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1284 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1285 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1286 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1287 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1288 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1289 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1290 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1291 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1292 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1293 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1294 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1295 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1296 | + | ||
1297 | + byte[] testReportMsg = {0}; | ||
1298 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1299 | + buffer.writeBytes(reportMsg); | ||
1300 | + | ||
1301 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1302 | + PcepMessage message = null; | ||
1303 | + | ||
1304 | + message = reader.readFrom(buffer); | ||
1305 | + | ||
1306 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1307 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1308 | + message.writeTo(buf); | ||
1309 | + | ||
1310 | + int readLen = buf.writerIndex() - 0; | ||
1311 | + testReportMsg = new byte[readLen]; | ||
1312 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1313 | + | ||
1314 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1315 | + } | ||
1316 | + | ||
1317 | + /** | ||
1318 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object | ||
1319 | + * SRP Object,LSP Object(symbolic path tlv),ERO Object,Metric-list,RRO Object | ||
1320 | + * in PcRpt message. | ||
1321 | + * | ||
1322 | + * @throws PcepParseException while parsing PCEP message | ||
1323 | + */ | ||
1324 | + @Test | ||
1325 | + public void reportMessageTest30() throws PcepParseException { | ||
1326 | + | ||
1327 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xE4, | ||
1328 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1329 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1330 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1331 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1332 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1333 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1334 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1335 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1336 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1337 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1338 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1339 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1340 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, | ||
1341 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1342 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1343 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1344 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1345 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1346 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1347 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1348 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1349 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1350 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1351 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1352 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1353 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1354 | + | ||
1355 | + byte[] testReportMsg = {0}; | ||
1356 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1357 | + buffer.writeBytes(reportMsg); | ||
1358 | + | ||
1359 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1360 | + PcepMessage message = null; | ||
1361 | + | ||
1362 | + message = reader.readFrom(buffer); | ||
1363 | + | ||
1364 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1365 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1366 | + message.writeTo(buf); | ||
1367 | + | ||
1368 | + int readLen = buf.writerIndex() - 0; | ||
1369 | + testReportMsg = new byte[readLen]; | ||
1370 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1371 | + | ||
1372 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1373 | + } | ||
1374 | + | ||
1375 | + /** | ||
1376 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object | ||
1377 | + * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) | ||
1378 | + * ERO Object,Metric-list,RRO Object | ||
1379 | + * in PcRpt message. | ||
1380 | + * | ||
1381 | + * @throws PcepParseException while parsing PCEP message | ||
1382 | + */ | ||
1383 | + @Test | ||
1384 | + public void reportMessageTest31() throws PcepParseException { | ||
1385 | + | ||
1386 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, 0x00, | ||
1387 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1388 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1389 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1390 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1391 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1392 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1393 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
1394 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1395 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1396 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1397 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1398 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1399 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1400 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1401 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1402 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, | ||
1403 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1404 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1405 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1406 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1407 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1408 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1409 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1410 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1411 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1412 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1413 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1414 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1415 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1416 | + | ||
1417 | + byte[] testReportMsg = {0}; | ||
1418 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1419 | + buffer.writeBytes(reportMsg); | ||
1420 | + | ||
1421 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1422 | + PcepMessage message = null; | ||
1423 | + | ||
1424 | + message = reader.readFrom(buffer); | ||
1425 | + | ||
1426 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1427 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1428 | + message.writeTo(buf); | ||
1429 | + | ||
1430 | + int readLen = buf.writerIndex() - 0; | ||
1431 | + testReportMsg = new byte[readLen]; | ||
1432 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1433 | + | ||
1434 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1435 | + } | ||
1436 | + | ||
1437 | + /** | ||
1438 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object | ||
1439 | + * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) | ||
1440 | + * ERO Object,LSPA Object,Metric-list,RRO Object | ||
1441 | + * in PcRpt message. | ||
1442 | + * | ||
1443 | + * @throws PcepParseException while parsing PCEP message | ||
1444 | + */ | ||
1445 | + @Test | ||
1446 | + public void reportMessageTest32() throws PcepParseException { | ||
1447 | + | ||
1448 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, (byte) 0x14, | ||
1449 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1450 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1451 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1452 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1453 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1454 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1455 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
1456 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1457 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1458 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1459 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1460 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1461 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1462 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1463 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1464 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, | ||
1465 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1466 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1467 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1468 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1469 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1470 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1471 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
1472 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1473 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1474 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1475 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1476 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1477 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1478 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1479 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1480 | + | ||
1481 | + byte[] testReportMsg = {0}; | ||
1482 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1483 | + buffer.writeBytes(reportMsg); | ||
1484 | + | ||
1485 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1486 | + PcepMessage message = null; | ||
1487 | + | ||
1488 | + message = reader.readFrom(buffer); | ||
1489 | + | ||
1490 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1491 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1492 | + message.writeTo(buf); | ||
1493 | + | ||
1494 | + int readLen = buf.writerIndex() - 0; | ||
1495 | + testReportMsg = new byte[readLen]; | ||
1496 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1497 | + | ||
1498 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1499 | + } | ||
1500 | + | ||
1501 | + /** | ||
1502 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object | ||
1503 | + * BandWidth Object,Metric-list,RRO Object,SRP Object,LSP Object(symbolic path tlv) | ||
1504 | + * ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | ||
1505 | + * in PcRpt message. | ||
1506 | + * | ||
1507 | + * @throws PcepParseException while parsing PCEP message | ||
1508 | + */ | ||
1509 | + @Test | ||
1510 | + public void reportMessageTest33() throws PcepParseException { | ||
1511 | + | ||
1512 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x01, (byte) 0x1c, | ||
1513 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1514 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1515 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1516 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1517 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1518 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1519 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
1520 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1521 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1522 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1523 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1524 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1525 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1526 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1527 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1528 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00, | ||
1529 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1530 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1531 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1532 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1533 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1534 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1535 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, | ||
1536 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1537 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1538 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1539 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object | ||
1540 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
1541 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
1542 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1543 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
1544 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00 }; | ||
1545 | + | ||
1546 | + byte[] testReportMsg = {0}; | ||
1547 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1548 | + buffer.writeBytes(reportMsg); | ||
1549 | + | ||
1550 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1551 | + PcepMessage message = null; | ||
1552 | + | ||
1553 | + message = reader.readFrom(buffer); | ||
1554 | + | ||
1555 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1556 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1557 | + message.writeTo(buf); | ||
1558 | + | ||
1559 | + int readLen = buf.writerIndex() - 0; | ||
1560 | + testReportMsg = new byte[readLen]; | ||
1561 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1562 | + | ||
1563 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1564 | + } | ||
1565 | + | ||
1566 | + /** | ||
1567 | + * This test case checks for SRP Object,LSP Object(symbolic path Tlv),ERO Object,LSPA Object | ||
1568 | + * BandWidth Object,Metric-list,SRP Object,LSP Object(symbolic path tlv) | ||
1569 | + * ERO Object,LSPA Object,BandWidth Object,Metric-list | ||
1570 | + * in PcRpt message. | ||
1571 | + * | ||
1572 | + * @throws PcepParseException while parsing PCEP message | ||
1573 | + */ | ||
1574 | + @Test | ||
1575 | + public void reportMessageTest34() throws PcepParseException { | ||
1576 | + | ||
1577 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xB4, | ||
1578 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1579 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1580 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1581 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1582 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1583 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1584 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
1585 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1586 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1587 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object | ||
1588 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1589 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x04, //LSP Object | ||
1590 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1591 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1592 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1593 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1594 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA Object | ||
1595 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1596 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1597 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric Object | ||
1598 | + | ||
1599 | + byte[] testReportMsg = {0}; | ||
1600 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1601 | + buffer.writeBytes(reportMsg); | ||
1602 | + | ||
1603 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1604 | + PcepMessage message = null; | ||
1605 | + | ||
1606 | + message = reader.readFrom(buffer); | ||
1607 | + | ||
1608 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1609 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1610 | + message.writeTo(buf); | ||
1611 | + | ||
1612 | + int readLen = buf.writerIndex() - 0; | ||
1613 | + testReportMsg = new byte[readLen]; | ||
1614 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1615 | + | ||
1616 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1617 | + } | ||
1618 | + | ||
1619 | + /** | ||
1620 | + * This test case checks for SRP Object,LSP Object)Symbolic path tlv),ERO Object,SRP Object | ||
1621 | + * LSP Object(symbolic path tlv) ERO Object,LSPA Object, BandWidth Object,Metric-list | ||
1622 | + * in PcRpt message. | ||
1623 | + * | ||
1624 | + * @throws PcepParseException while parsing PCEP message | ||
1625 | + */ | ||
1626 | + @Test | ||
1627 | + public void reportMessageTest35() throws PcepParseException { | ||
1628 | + | ||
1629 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8C, | ||
1630 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1631 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1632 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1633 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1634 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1635 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1636 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP Object | ||
1637 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, 0x03, //LSP Object | ||
1638 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv | ||
1639 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
1640 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
1641 | + 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
1642 | + 0x09, 0x10, 0x00, 0x14, //LSPA Object | ||
1643 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1644 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
1645 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object | ||
1646 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20 }; //Metric Object | ||
1647 | + | ||
1648 | + byte[] testReportMsg = {0}; | ||
1649 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1650 | + buffer.writeBytes(reportMsg); | ||
1651 | + | ||
1652 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1653 | + PcepMessage message = null; | ||
1654 | + | ||
1655 | + message = reader.readFrom(buffer); | ||
1656 | + | ||
1657 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
1658 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1659 | + message.writeTo(buf); | ||
1660 | + | ||
1661 | + int readLen = buf.writerIndex() - 0; | ||
1662 | + testReportMsg = new byte[readLen]; | ||
1663 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1664 | + | ||
1665 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
1666 | + } | ||
1667 | +} |
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
19 | +import org.jboss.netty.buffer.ChannelBuffers; | ||
20 | +import org.junit.Assert; | ||
21 | +import org.junit.Test; | ||
22 | +import org.onosproject.pcepio.exceptions.PcepParseException; | ||
23 | +import org.onosproject.pcepio.protocol.PcepFactories; | ||
24 | +import org.onosproject.pcepio.protocol.PcepMessage; | ||
25 | +import org.onosproject.pcepio.protocol.PcepMessageReader; | ||
26 | +import org.onosproject.pcepio.protocol.PcepReportMsg; | ||
27 | + | ||
28 | +public class PcepReportMsgTest2 { | ||
29 | + | ||
30 | + /** | ||
31 | + * This test case checks forSRP Object,LSP Object(symbolic path tlv),ERO Object | ||
32 | + * SRP Object,LSP Object(symbolic path tlv,ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object | ||
33 | + * in PcRpt message. | ||
34 | + * | ||
35 | + * @throws PcepParseException while parsing PCEP message | ||
36 | + */ | ||
37 | + @Test | ||
38 | + public void reportMessageTest39() throws PcepParseException { | ||
39 | + | ||
40 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x98, | ||
41 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
42 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
43 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
44 | + 0x07, 0x10, 0x00, 0x14, //ERO Object | ||
45 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
46 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
47 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
48 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
49 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
50 | + 0x07, 0x10, 0x00, 0x14, //ERO object | ||
51 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
52 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
53 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object | ||
54 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
55 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
56 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
57 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
58 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; | ||
59 | + | ||
60 | + byte[] testReportMsg = {0}; | ||
61 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
62 | + buffer.writeBytes(reportMsg); | ||
63 | + | ||
64 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
65 | + PcepMessage message = null; | ||
66 | + | ||
67 | + message = reader.readFrom(buffer); | ||
68 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
69 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
70 | + message.writeTo(buf); | ||
71 | + | ||
72 | + int readLen = buf.writerIndex() - 0; | ||
73 | + testReportMsg = new byte[readLen]; | ||
74 | + buf.readBytes(testReportMsg, 0, readLen); | ||
75 | + | ||
76 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
77 | + } | ||
78 | + | ||
79 | + /** | ||
80 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object | ||
81 | + * SRP Object,LSP Object(symbolic path tlv),ERO Object | ||
82 | + * in PcRpt message. | ||
83 | + * | ||
84 | + * @throws PcepParseException while parsing PCEP message | ||
85 | + */ | ||
86 | + @Test | ||
87 | + public void reportMessageTest40() throws PcepParseException { | ||
88 | + | ||
89 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x64, | ||
90 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
91 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
92 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
93 | + 0x07, 0x10, 0x00, 0x14, //ERO object | ||
94 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
95 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
96 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
97 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
98 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
99 | + 0x07, 0x10, 0x00, 0x14, //ERO object | ||
100 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
101 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00}; | ||
102 | + | ||
103 | + byte[] testReportMsg = {0}; | ||
104 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
105 | + buffer.writeBytes(reportMsg); | ||
106 | + | ||
107 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
108 | + PcepMessage message = null; | ||
109 | + | ||
110 | + message = reader.readFrom(buffer); | ||
111 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
112 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
113 | + message.writeTo(buf); | ||
114 | + | ||
115 | + int readLen = buf.writerIndex() - 0; | ||
116 | + testReportMsg = new byte[readLen]; | ||
117 | + buf.readBytes(testReportMsg, 0, readLen); | ||
118 | + | ||
119 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
120 | + } | ||
121 | + | ||
122 | + /** | ||
123 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object | ||
124 | + * SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object | ||
125 | + * in PcRpt message. | ||
126 | + * | ||
127 | + * @throws PcepParseException while parsing PCEP message | ||
128 | + */ | ||
129 | + @Test | ||
130 | + public void reportMessageTest41() throws PcepParseException { | ||
131 | + | ||
132 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0x8c, | ||
133 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
134 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
135 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
136 | + 0x07, 0x10, 0x00, 0x14, //ERO object | ||
137 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
138 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
139 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object | ||
140 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
141 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
142 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
143 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
144 | + 0x07, 0x10, 0x00, 0x14, //ERO object | ||
145 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
146 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
147 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, //LSPA object | ||
148 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | ||
149 | + | ||
150 | + byte[] testReportMsg = {0}; | ||
151 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
152 | + buffer.writeBytes(reportMsg); | ||
153 | + | ||
154 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
155 | + PcepMessage message = null; | ||
156 | + | ||
157 | + message = reader.readFrom(buffer); | ||
158 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
159 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
160 | + message.writeTo(buf); | ||
161 | + | ||
162 | + int readLen = buf.writerIndex() - 0; | ||
163 | + testReportMsg = new byte[readLen]; | ||
164 | + buf.readBytes(testReportMsg, 0, readLen); | ||
165 | + | ||
166 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
167 | + } | ||
168 | + | ||
169 | + /** | ||
170 | + * This test case checks for SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object, | ||
171 | + * Metric-list SRP Object,LSP Object(symbolic path tlv),ERO Object,LSPA Object,BandWidth Object,Metric-list, | ||
172 | + * RRO Object | ||
173 | + * in PcRpt message. | ||
174 | + * | ||
175 | + * @throws PcepParseException while parsing PCEP message | ||
176 | + */ | ||
177 | + @Test | ||
178 | + public void reportMessageTest42() throws PcepParseException { | ||
179 | + | ||
180 | + byte[] reportMsg = new byte[] {0x20, 0x0a, 0x00, (byte) 0xE8, | ||
181 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
182 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
183 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
184 | + 0x07, 0x10, 0x00, 0x14, //ERO object | ||
185 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
186 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
187 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object | ||
188 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
189 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object | ||
190 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object | ||
191 | + 0x21, 0x10, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, //SRP object | ||
192 | + 0x20, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10, (byte) 0x83, //LSP object | ||
193 | + 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //symbolic path tlv | ||
194 | + 0x07, 0x10, 0x00, 0x14, //ERO object | ||
195 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, | ||
196 | + (byte) 0x81, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, | ||
197 | + 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, //LSPA object | ||
198 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||
199 | + 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth object | ||
200 | + 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric object | ||
201 | + 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO object | ||
202 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, | ||
203 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, | ||
204 | + 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
205 | + 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, | ||
206 | + 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; | ||
207 | + | ||
208 | + byte[] testReportMsg = {0}; | ||
209 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
210 | + buffer.writeBytes(reportMsg); | ||
211 | + | ||
212 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
213 | + PcepMessage message = null; | ||
214 | + | ||
215 | + message = reader.readFrom(buffer); | ||
216 | + | ||
217 | + Assert.assertTrue("PcepMessage is not instance of PcRpt", message instanceof PcepReportMsg); | ||
218 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
219 | + message.writeTo(buf); | ||
220 | + | ||
221 | + int readLen = buf.writerIndex() - 0; | ||
222 | + testReportMsg = new byte[readLen]; | ||
223 | + buf.readBytes(testReportMsg, 0, readLen); | ||
224 | + | ||
225 | + Assert.assertArrayEquals("PcRpt messages are not equal", reportMsg, testReportMsg); | ||
226 | + } | ||
227 | +} |
1 | +/* | ||
2 | + * Copyright 2014-2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.jboss.netty.buffer.ChannelBuffer; | ||
19 | +import org.jboss.netty.buffer.ChannelBuffers; | ||
20 | +import org.junit.Assert; | ||
21 | +import org.junit.Test; | ||
22 | +import org.onosproject.pcepio.exceptions.PcepParseException; | ||
23 | +import org.onosproject.pcepio.protocol.PcepFactories; | ||
24 | +import org.onosproject.pcepio.protocol.PcepMessage; | ||
25 | +import org.onosproject.pcepio.protocol.PcepMessageReader; | ||
26 | +import org.onosproject.pcepio.protocol.PcepTEReportMsg; | ||
27 | + | ||
28 | +public class PcepTEReportMsgTest { | ||
29 | + | ||
30 | + /** | ||
31 | + * This test case checks for | ||
32 | + * TE Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)). | ||
33 | + * in PcTERpt message. | ||
34 | + * | ||
35 | + * @throws PcepParseException while parsing PCEP message | ||
36 | + */ | ||
37 | + @Test | ||
38 | + public void teReportMessageTest1() throws PcepParseException { | ||
39 | + | ||
40 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header | ||
41 | + 0x0E, 0x10, 0x00, 0x24, // TE Object Header | ||
42 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
43 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
44 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
45 | + 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV | ||
46 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystem Tlv | ||
47 | + 0x00, 0x00, 0x00, 0x11 }; | ||
48 | + | ||
49 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
50 | + buffer.writeBytes(teReportMsg); | ||
51 | + | ||
52 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
53 | + PcepMessage message = null; | ||
54 | + | ||
55 | + message = reader.readFrom(buffer); | ||
56 | + | ||
57 | + byte[] testReportMsg = {0}; | ||
58 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
59 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
60 | + message.writeTo(buf); | ||
61 | + | ||
62 | + int readLen = buf.writerIndex() - 0; | ||
63 | + testReportMsg = new byte[readLen]; | ||
64 | + buf.readBytes(testReportMsg, 0, readLen); | ||
65 | + | ||
66 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * This test case checks for | ||
71 | + *T E Object (Routing Universe TLV, Local TE Node Descriptors TLV(AutonomousSystemTlv)) with different TE-ID. | ||
72 | + * in PcTERpt message. | ||
73 | + * | ||
74 | + * @throws PcepParseException while parsing PCEP message | ||
75 | + */ | ||
76 | + @Test | ||
77 | + public void teReportMessageTest2() throws PcepParseException { | ||
78 | + | ||
79 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x28, // common header | ||
80 | + 0x0E, 0x10, 0x00, 0x24, // TE Object Header | ||
81 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
82 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
83 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, | ||
84 | + 0x06, 0x65, 0x00, 0x0C, // Local TE Node Descriptors TLV | ||
85 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
86 | + 0x00, 0x00, 0x00, 0x11 }; | ||
87 | + | ||
88 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
89 | + buffer.writeBytes(teReportMsg); | ||
90 | + | ||
91 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
92 | + PcepMessage message = null; | ||
93 | + | ||
94 | + message = reader.readFrom(buffer); | ||
95 | + | ||
96 | + byte[] testReportMsg = {0}; | ||
97 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
98 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
99 | + message.writeTo(buf); | ||
100 | + | ||
101 | + int readLen = buf.writerIndex() - 0; | ||
102 | + testReportMsg = new byte[readLen]; | ||
103 | + buf.readBytes(testReportMsg, 0, readLen); | ||
104 | + | ||
105 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * This test case checks for TE Object (Routing Universe TLV) | ||
110 | + * in PcTERpt message. | ||
111 | + * | ||
112 | + * @throws PcepParseException while parsing PCEP message | ||
113 | + */ | ||
114 | + @Test | ||
115 | + public void teReportMessageTest3() throws PcepParseException { | ||
116 | + | ||
117 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x1c, // common header | ||
118 | + 0x0E, 0x10, 0x00, 0x18, // TE Object Header | ||
119 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
120 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
121 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; | ||
122 | + | ||
123 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
124 | + buffer.writeBytes(teReportMsg); | ||
125 | + | ||
126 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
127 | + PcepMessage message = null; | ||
128 | + | ||
129 | + message = reader.readFrom(buffer); | ||
130 | + | ||
131 | + byte[] testReportMsg = {0}; | ||
132 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
133 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
134 | + message.writeTo(buf); | ||
135 | + | ||
136 | + int readLen = buf.writerIndex() - 0; | ||
137 | + testReportMsg = new byte[readLen]; | ||
138 | + buf.readBytes(testReportMsg, 0, readLen); | ||
139 | + | ||
140 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
141 | + } | ||
142 | + | ||
143 | + /** | ||
144 | + * This test case checks for | ||
145 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. | ||
146 | + * OSPFareaIDsubTlv, RouterIDSubTlv)). | ||
147 | + * in PcTERpt message. | ||
148 | + * | ||
149 | + * @throws PcepParseException while parsing PCEP message | ||
150 | + */ | ||
151 | + @Test | ||
152 | + public void teReportMessageTest4() throws PcepParseException { | ||
153 | + | ||
154 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x44, // common header | ||
155 | + 0x0E, 0x10, 0x00, 0x40, // TE Object Header | ||
156 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
157 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
158 | + 0x00, 0x00, 0x00, 0x00, | ||
159 | + 0x00, 0x00, 0x00, 0x01, | ||
160 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
161 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
162 | + 0x00, 0x00, 0x00, 0x11, | ||
163 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
164 | + 0x00, 0x00, 0x00, 0x11, | ||
165 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
166 | + 0x00, 0x00, 0x00, 0x11, | ||
167 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
168 | + 0x00, 0x00, 0x00, 0x11, | ||
169 | + 0x00, 0x00, 0x00, 0x11}; | ||
170 | + | ||
171 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
172 | + buffer.writeBytes(teReportMsg); | ||
173 | + | ||
174 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
175 | + PcepMessage message = null; | ||
176 | + | ||
177 | + message = reader.readFrom(buffer); | ||
178 | + | ||
179 | + byte[] testReportMsg = {0}; | ||
180 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
181 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
182 | + message.writeTo(buf); | ||
183 | + | ||
184 | + int readLen = buf.writerIndex() - 0; | ||
185 | + testReportMsg = new byte[readLen]; | ||
186 | + buf.readBytes(testReportMsg, 0, readLen); | ||
187 | + | ||
188 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
189 | + } | ||
190 | + | ||
191 | + /** | ||
192 | + * This test case checks for | ||
193 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(BGPLSidentifierTlv | ||
194 | + * OSPFareaIDsubTlv, RouterIDSubTlv)) | ||
195 | + * in PcTERpt message. | ||
196 | + * | ||
197 | + * @throws PcepParseException while parsing PCEP message | ||
198 | + */ | ||
199 | + @Test | ||
200 | + public void teReportMessageTest5() throws PcepParseException { | ||
201 | + | ||
202 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x3C, // common header | ||
203 | + 0x0E, 0x10, 0x00, 0x38, // TE Object Header | ||
204 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
205 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
206 | + 0x00, 0x00, 0x00, 0x00, | ||
207 | + 0x00, 0x00, 0x00, 0x01, | ||
208 | + 0x06, 0x65, 0x00, 0x20, // Local TE Node Descriptors TLV | ||
209 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
210 | + 0x00, 0x00, 0x00, 0x11, | ||
211 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
212 | + 0x00, 0x00, 0x00, 0x11, | ||
213 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
214 | + 0x00, 0x00, 0x00, 0x11, | ||
215 | + 0x00, 0x00, 0x00, 0x11}; | ||
216 | + | ||
217 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
218 | + buffer.writeBytes(teReportMsg); | ||
219 | + | ||
220 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
221 | + PcepMessage message = null; | ||
222 | + | ||
223 | + message = reader.readFrom(buffer); | ||
224 | + | ||
225 | + byte[] testReportMsg = {0}; | ||
226 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
227 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
228 | + message.writeTo(buf); | ||
229 | + | ||
230 | + int readLen = buf.writerIndex() - 0; | ||
231 | + testReportMsg = new byte[readLen]; | ||
232 | + buf.readBytes(testReportMsg, 0, readLen); | ||
233 | + | ||
234 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
235 | + } | ||
236 | + | ||
237 | + /** | ||
238 | + * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(OSPFareaIDsubTlv, | ||
239 | + * RouterIDSubTlv)) | ||
240 | + * in PcTERpt message. | ||
241 | + * | ||
242 | + * @throws PcepParseException while parsing PCEP message | ||
243 | + */ | ||
244 | + @Test | ||
245 | + public void teReportMessageTest6() throws PcepParseException { | ||
246 | + | ||
247 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x34, // common header | ||
248 | + 0x0E, 0x10, 0x00, 0x30, // TE Object Header | ||
249 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
250 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
251 | + 0x00, 0x00, 0x00, 0x00, | ||
252 | + 0x00, 0x00, 0x00, 0x01, | ||
253 | + 0x06, 0x65, 0x00, 0x18, // Local TE Node Descriptors TLV | ||
254 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
255 | + 0x00, 0x00, 0x00, 0x11, | ||
256 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
257 | + 0x00, 0x00, 0x00, 0x11, | ||
258 | + 0x00, 0x00, 0x00, 0x11}; | ||
259 | + | ||
260 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
261 | + buffer.writeBytes(teReportMsg); | ||
262 | + | ||
263 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
264 | + PcepMessage message = null; | ||
265 | + | ||
266 | + message = reader.readFrom(buffer); | ||
267 | + | ||
268 | + byte[] testReportMsg = {0}; | ||
269 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
270 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
271 | + message.writeTo(buf); | ||
272 | + | ||
273 | + int readLen = buf.writerIndex() - 0; | ||
274 | + testReportMsg = new byte[readLen]; | ||
275 | + buf.readBytes(testReportMsg, 0, readLen); | ||
276 | + | ||
277 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
278 | + } | ||
279 | + | ||
280 | + /** | ||
281 | + * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(RouterIDSubTlv)). | ||
282 | + * in PcTERpt message. | ||
283 | + * | ||
284 | + * @throws PcepParseException while parsing PCEP message | ||
285 | + */ | ||
286 | + @Test | ||
287 | + public void teReportMessageTest7() throws PcepParseException { | ||
288 | + | ||
289 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x2C, // common header | ||
290 | + 0x0E, 0x10, 0x00, 0x28, // TE Object Header | ||
291 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
292 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
293 | + 0x00, 0x00, 0x00, 0x00, | ||
294 | + 0x00, 0x00, 0x00, 0x01, | ||
295 | + 0x06, 0x65, 0x00, 0x10, // Local TE Node Descriptors TLV | ||
296 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
297 | + 0x00, 0x00, 0x00, 0x11, | ||
298 | + 0x00, 0x00, 0x00, 0x11}; | ||
299 | + | ||
300 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
301 | + buffer.writeBytes(teReportMsg); | ||
302 | + | ||
303 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
304 | + PcepMessage message = null; | ||
305 | + | ||
306 | + message = reader.readFrom(buffer); | ||
307 | + | ||
308 | + byte[] testReportMsg = {0}; | ||
309 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
310 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
311 | + message.writeTo(buf); | ||
312 | + | ||
313 | + int readLen = buf.writerIndex() - 0; | ||
314 | + testReportMsg = new byte[readLen]; | ||
315 | + buf.readBytes(testReportMsg, 0, readLen); | ||
316 | + | ||
317 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
318 | + } | ||
319 | + | ||
320 | + /** | ||
321 | + * This test case checks for TE Object (Routing Universe TLV,Local TE Node Descriptors TLV) | ||
322 | + * in PcTERpt message. | ||
323 | + * | ||
324 | + * @throws PcepParseException while parsing PCEP message | ||
325 | + */ | ||
326 | + @Test | ||
327 | + public void teReportMessageTest8() throws PcepParseException { | ||
328 | + | ||
329 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x20, // common header | ||
330 | + 0x0E, 0x10, 0x00, 0x1C, // TE Object Header | ||
331 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
332 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
333 | + 0x00, 0x00, 0x00, 0x00, | ||
334 | + 0x00, 0x00, 0x00, 0x01, | ||
335 | + 0x06, 0x65, 0x00, 0x04 // Local TE Node Descriptors TLV | ||
336 | + }; | ||
337 | + | ||
338 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
339 | + buffer.writeBytes(teReportMsg); | ||
340 | + | ||
341 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
342 | + PcepMessage message = null; | ||
343 | + | ||
344 | + message = reader.readFrom(buffer); | ||
345 | + | ||
346 | + byte[] testReportMsg = {0}; | ||
347 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
348 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
349 | + message.writeTo(buf); | ||
350 | + | ||
351 | + int readLen = buf.writerIndex() - 0; | ||
352 | + testReportMsg = new byte[readLen]; | ||
353 | + buf.readBytes(testReportMsg, 0, readLen); | ||
354 | + | ||
355 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
356 | + } | ||
357 | + | ||
358 | + /** | ||
359 | + * This test case checks for | ||
360 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. | ||
361 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. | ||
362 | + * OSPFareaIDsubTlv, RouterIDSubTlv)). | ||
363 | + * in PcTERpt message. | ||
364 | + * | ||
365 | + * @throws PcepParseException while parsing PCEP message | ||
366 | + */ | ||
367 | + @Test | ||
368 | + public void teReportMessageTest9() throws PcepParseException { | ||
369 | + | ||
370 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x6C, // common header | ||
371 | + 0x0E, 0x10, 0x00, 0x68, // TE Object Header | ||
372 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
373 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
374 | + 0x00, 0x00, 0x00, 0x00, | ||
375 | + 0x00, 0x00, 0x00, 0x01, | ||
376 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
377 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
378 | + 0x00, 0x00, 0x00, 0x11, | ||
379 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
380 | + 0x00, 0x00, 0x00, 0x11, | ||
381 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
382 | + 0x00, 0x00, 0x00, 0x11, | ||
383 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
384 | + 0x00, 0x00, 0x00, 0x11, | ||
385 | + 0x00, 0x00, 0x00, 0x11, | ||
386 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
387 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
388 | + 0x00, 0x00, 0x00, 0x11, | ||
389 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
390 | + 0x00, 0x00, 0x00, 0x11, | ||
391 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
392 | + 0x00, 0x00, 0x00, 0x11, | ||
393 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
394 | + 0x00, 0x00, 0x00, 0x11, | ||
395 | + 0x00, 0x00, 0x00, 0x11 | ||
396 | + }; | ||
397 | + | ||
398 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
399 | + buffer.writeBytes(teReportMsg); | ||
400 | + | ||
401 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
402 | + PcepMessage message = null; | ||
403 | + | ||
404 | + message = reader.readFrom(buffer); | ||
405 | + | ||
406 | + byte[] testReportMsg = {0}; | ||
407 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
408 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
409 | + message.writeTo(buf); | ||
410 | + | ||
411 | + int readLen = buf.writerIndex() - 0; | ||
412 | + testReportMsg = new byte[readLen]; | ||
413 | + buf.readBytes(testReportMsg, 0, readLen); | ||
414 | + | ||
415 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
416 | + } | ||
417 | + | ||
418 | + /** | ||
419 | + * This test case checks for | ||
420 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
421 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(BGPLSidentifierTlv | ||
422 | + * OSPFareaIDsubTlv, RouterIDSubTlv)) | ||
423 | + * in PcTERpt message. | ||
424 | + * | ||
425 | + * @throws PcepParseException while parsing PCEP message | ||
426 | + */ | ||
427 | + @Test | ||
428 | + public void teReportMessageTest10() throws PcepParseException { | ||
429 | + | ||
430 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x64, // common header | ||
431 | + 0x0E, 0x10, 0x00, 0x60, // TE Object Header | ||
432 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
433 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
434 | + 0x00, 0x00, 0x00, 0x00, | ||
435 | + 0x00, 0x00, 0x00, 0x01, | ||
436 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
437 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
438 | + 0x00, 0x00, 0x00, 0x11, | ||
439 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
440 | + 0x00, 0x00, 0x00, 0x11, | ||
441 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
442 | + 0x00, 0x00, 0x00, 0x11, | ||
443 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
444 | + 0x00, 0x00, 0x00, 0x11, | ||
445 | + 0x00, 0x00, 0x00, 0x11, | ||
446 | + 0x03, (byte) 0xEB, 0x00, 0x20, //RemoteTENodeDescriptorsTLV | ||
447 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
448 | + 0x00, 0x00, 0x00, 0x11, | ||
449 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
450 | + 0x00, 0x00, 0x00, 0x11, | ||
451 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
452 | + 0x00, 0x00, 0x00, 0x11, | ||
453 | + 0x00, 0x00, 0x00, 0x11 | ||
454 | + }; | ||
455 | + | ||
456 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
457 | + buffer.writeBytes(teReportMsg); | ||
458 | + | ||
459 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
460 | + PcepMessage message = null; | ||
461 | + | ||
462 | + message = reader.readFrom(buffer); | ||
463 | + | ||
464 | + byte[] testReportMsg = {0}; | ||
465 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
466 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
467 | + message.writeTo(buf); | ||
468 | + | ||
469 | + int readLen = buf.writerIndex() - 0; | ||
470 | + testReportMsg = new byte[readLen]; | ||
471 | + buf.readBytes(testReportMsg, 0, readLen); | ||
472 | + | ||
473 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
474 | + } | ||
475 | + | ||
476 | + /** | ||
477 | + * This test case checks for | ||
478 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
479 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(OSPFareaIDsubTlv, RouterIDSubTlv)) | ||
480 | + * in PcTERpt message. | ||
481 | + * | ||
482 | + * @throws PcepParseException while parsing PCEP message | ||
483 | + */ | ||
484 | + @Test | ||
485 | + public void teReportMessageTest11() throws PcepParseException { | ||
486 | + | ||
487 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x5C, // common header | ||
488 | + 0x0E, 0x10, 0x00, 0x58, // TE Object Header | ||
489 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
490 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
491 | + 0x00, 0x00, 0x00, 0x00, | ||
492 | + 0x00, 0x00, 0x00, 0x01, | ||
493 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
494 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
495 | + 0x00, 0x00, 0x00, 0x11, | ||
496 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
497 | + 0x00, 0x00, 0x00, 0x11, | ||
498 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
499 | + 0x00, 0x00, 0x00, 0x11, | ||
500 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
501 | + 0x00, 0x00, 0x00, 0x11, | ||
502 | + 0x00, 0x00, 0x00, 0x11, | ||
503 | + 0x03, (byte) 0xEB, 0x00, 0x18, //RemoteTENodeDescriptorsTLV | ||
504 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
505 | + 0x00, 0x00, 0x00, 0x11, | ||
506 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
507 | + 0x00, 0x00, 0x00, 0x11, | ||
508 | + 0x00, 0x00, 0x00, 0x11 | ||
509 | + }; | ||
510 | + | ||
511 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
512 | + buffer.writeBytes(teReportMsg); | ||
513 | + | ||
514 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
515 | + PcepMessage message = null; | ||
516 | + | ||
517 | + message = reader.readFrom(buffer); | ||
518 | + | ||
519 | + byte[] testReportMsg = {0}; | ||
520 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
521 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
522 | + message.writeTo(buf); | ||
523 | + | ||
524 | + int readLen = buf.writerIndex() - 0; | ||
525 | + testReportMsg = new byte[readLen]; | ||
526 | + buf.readBytes(testReportMsg, 0, readLen); | ||
527 | + | ||
528 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
529 | + } | ||
530 | + | ||
531 | + /** | ||
532 | + * This test case checks for | ||
533 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
534 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(RouterIDSubTlv)) | ||
535 | + * in PcTERpt message. | ||
536 | + * | ||
537 | + * @throws PcepParseException while parsing PCEP message | ||
538 | + */ | ||
539 | + @Test | ||
540 | + public void teReportMessageTest12() throws PcepParseException { | ||
541 | + | ||
542 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x54, // common header | ||
543 | + 0x0E, 0x10, 0x00, 0x50, // TE Object Header | ||
544 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
545 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
546 | + 0x00, 0x00, 0x00, 0x00, | ||
547 | + 0x00, 0x00, 0x00, 0x01, | ||
548 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
549 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
550 | + 0x00, 0x00, 0x00, 0x11, | ||
551 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
552 | + 0x00, 0x00, 0x00, 0x11, | ||
553 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
554 | + 0x00, 0x00, 0x00, 0x11, | ||
555 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
556 | + 0x00, 0x00, 0x00, 0x11, | ||
557 | + 0x00, 0x00, 0x00, 0x11, | ||
558 | + 0x03, (byte) 0xEB, 0x00, 0x10, //RemoteTENodeDescriptorsTLV | ||
559 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
560 | + 0x00, 0x00, 0x00, 0x11, | ||
561 | + 0x00, 0x00, 0x00, 0x11 | ||
562 | + }; | ||
563 | + | ||
564 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
565 | + buffer.writeBytes(teReportMsg); | ||
566 | + | ||
567 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
568 | + PcepMessage message = null; | ||
569 | + | ||
570 | + message = reader.readFrom(buffer); | ||
571 | + | ||
572 | + byte[] testReportMsg = {0}; | ||
573 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
574 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
575 | + message.writeTo(buf); | ||
576 | + | ||
577 | + int readLen = buf.writerIndex() - 0; | ||
578 | + testReportMsg = new byte[readLen]; | ||
579 | + buf.readBytes(testReportMsg, 0, readLen); | ||
580 | + | ||
581 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
582 | + } | ||
583 | + | ||
584 | + /** | ||
585 | + * This test case checks for | ||
586 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
587 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV) | ||
588 | + * in PcTERpt message. | ||
589 | + * | ||
590 | + * @throws PcepParseException while parsing PCEP message | ||
591 | + */ | ||
592 | + @Test | ||
593 | + public void teReportMessageTest13() throws PcepParseException { | ||
594 | + | ||
595 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, 0x48, // common header | ||
596 | + 0x0E, 0x10, 0x00, 0x44, // TE Object Header | ||
597 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
598 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
599 | + 0x00, 0x00, 0x00, 0x00, | ||
600 | + 0x00, 0x00, 0x00, 0x01, | ||
601 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
602 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
603 | + 0x00, 0x00, 0x00, 0x11, | ||
604 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
605 | + 0x00, 0x00, 0x00, 0x11, | ||
606 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
607 | + 0x00, 0x00, 0x00, 0x11, | ||
608 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
609 | + 0x00, 0x00, 0x00, 0x11, | ||
610 | + 0x00, 0x00, 0x00, 0x11, | ||
611 | + 0x03, (byte) 0xEB, 0x00, 0x04, //RemoteTENodeDescriptorsTLV | ||
612 | + }; | ||
613 | + | ||
614 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
615 | + buffer.writeBytes(teReportMsg); | ||
616 | + | ||
617 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
618 | + PcepMessage message = null; | ||
619 | + | ||
620 | + message = reader.readFrom(buffer); | ||
621 | + | ||
622 | + byte[] testReportMsg = {0}; | ||
623 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
624 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
625 | + message.writeTo(buf); | ||
626 | + | ||
627 | + int readLen = buf.writerIndex() - 0; | ||
628 | + testReportMsg = new byte[readLen]; | ||
629 | + buf.readBytes(testReportMsg, 0, readLen); | ||
630 | + | ||
631 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
632 | + } | ||
633 | + | ||
634 | + /** | ||
635 | + * This test case checks for | ||
636 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
637 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
638 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | ||
639 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) | ||
640 | + * in PcTERpt message. | ||
641 | + * | ||
642 | + * @throws PcepParseException while parsing PCEP message | ||
643 | + */ | ||
644 | + @Test | ||
645 | + public void teReportMessageTest14() throws PcepParseException { | ||
646 | + | ||
647 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x8C, // common header | ||
648 | + 0x0E, 0x10, 0x00, (byte) 0x88, // TE Object Header | ||
649 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
650 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
651 | + 0x00, 0x00, 0x00, 0x00, | ||
652 | + 0x00, 0x00, 0x00, 0x01, | ||
653 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
654 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
655 | + 0x00, 0x00, 0x00, 0x11, | ||
656 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
657 | + 0x00, 0x00, 0x00, 0x11, | ||
658 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
659 | + 0x00, 0x00, 0x00, 0x11, | ||
660 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
661 | + 0x00, 0x00, 0x00, 0x11, | ||
662 | + 0x00, 0x00, 0x00, 0x11, | ||
663 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
664 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
665 | + 0x00, 0x00, 0x00, 0x11, | ||
666 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
667 | + 0x00, 0x00, 0x00, 0x11, | ||
668 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
669 | + 0x00, 0x00, 0x00, 0x11, | ||
670 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
671 | + 0x00, 0x00, 0x00, 0x11, | ||
672 | + 0x00, 0x00, 0x00, 0x11, | ||
673 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
674 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
675 | + 0x01, 0x11, 0x00, 0x09, | ||
676 | + 0x01, 0x21, 0x00, 0x09, | ||
677 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
678 | + 0x01, 0x01, 0x01, 0x01, | ||
679 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
680 | + 0x01, 0x011, 0x01, 0x10 | ||
681 | + }; | ||
682 | + | ||
683 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
684 | + buffer.writeBytes(teReportMsg); | ||
685 | + | ||
686 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
687 | + PcepMessage message = null; | ||
688 | + | ||
689 | + message = reader.readFrom(buffer); | ||
690 | + | ||
691 | + byte[] testReportMsg = {0}; | ||
692 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
693 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
694 | + message.writeTo(buf); | ||
695 | + | ||
696 | + int readLen = buf.writerIndex() - 0; | ||
697 | + testReportMsg = new byte[readLen]; | ||
698 | + buf.readBytes(testReportMsg, 0, readLen); | ||
699 | + | ||
700 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
701 | + } | ||
702 | + | ||
703 | + /** | ||
704 | + * This test case checks for | ||
705 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
706 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
707 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV( | ||
708 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) | ||
709 | + * in PcTERpt message. | ||
710 | + * | ||
711 | + * @throws PcepParseException while parsing PCEP message | ||
712 | + */ | ||
713 | + @Test | ||
714 | + public void teReportMessageTest15() throws PcepParseException { | ||
715 | + | ||
716 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x80, // common header | ||
717 | + 0x0E, 0x10, 0x00, (byte) 0x7C, // TE Object Header | ||
718 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
719 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
720 | + 0x00, 0x00, 0x00, 0x00, | ||
721 | + 0x00, 0x00, 0x00, 0x01, | ||
722 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
723 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
724 | + 0x00, 0x00, 0x00, 0x11, | ||
725 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
726 | + 0x00, 0x00, 0x00, 0x11, | ||
727 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
728 | + 0x00, 0x00, 0x00, 0x11, | ||
729 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
730 | + 0x00, 0x00, 0x00, 0x11, | ||
731 | + 0x00, 0x00, 0x00, 0x11, | ||
732 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
733 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
734 | + 0x00, 0x00, 0x00, 0x11, | ||
735 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
736 | + 0x00, 0x00, 0x00, 0x11, | ||
737 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
738 | + 0x00, 0x00, 0x00, 0x11, | ||
739 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
740 | + 0x00, 0x00, 0x00, 0x11, | ||
741 | + 0x00, 0x00, 0x00, 0x11, | ||
742 | + 0x04, 0x2E, 0x00, 0x14, //TELinkDescriptorsTLV | ||
743 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
744 | + 0x01, 0x01, 0x01, 0x01, | ||
745 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
746 | + 0x01, 0x011, 0x01, 0x10 | ||
747 | + }; | ||
748 | + | ||
749 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
750 | + buffer.writeBytes(teReportMsg); | ||
751 | + | ||
752 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
753 | + PcepMessage message = null; | ||
754 | + | ||
755 | + message = reader.readFrom(buffer); | ||
756 | + | ||
757 | + byte[] testReportMsg = {0}; | ||
758 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
759 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
760 | + message.writeTo(buf); | ||
761 | + | ||
762 | + int readLen = buf.writerIndex() - 0; | ||
763 | + testReportMsg = new byte[readLen]; | ||
764 | + buf.readBytes(testReportMsg, 0, readLen); | ||
765 | + | ||
766 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
767 | + } | ||
768 | + | ||
769 | + /** | ||
770 | + * This test case checks for | ||
771 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
772 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
773 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(IPv4NeighborAddressTlv)) | ||
774 | + * in PcTERpt message. | ||
775 | + * | ||
776 | + * @throws PcepParseException while parsing PCEP message | ||
777 | + */ | ||
778 | + @Test | ||
779 | + public void teReportMessageTest16() throws PcepParseException { | ||
780 | + | ||
781 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x78, // common header | ||
782 | + 0x0E, 0x10, 0x00, (byte) 0x74, // TE Object Header | ||
783 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
784 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
785 | + 0x00, 0x00, 0x00, 0x00, | ||
786 | + 0x00, 0x00, 0x00, 0x01, | ||
787 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
788 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
789 | + 0x00, 0x00, 0x00, 0x11, | ||
790 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
791 | + 0x00, 0x00, 0x00, 0x11, | ||
792 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
793 | + 0x00, 0x00, 0x00, 0x11, | ||
794 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
795 | + 0x00, 0x00, 0x00, 0x11, | ||
796 | + 0x00, 0x00, 0x00, 0x11, | ||
797 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
798 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
799 | + 0x00, 0x00, 0x00, 0x11, | ||
800 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
801 | + 0x00, 0x00, 0x00, 0x11, | ||
802 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
803 | + 0x00, 0x00, 0x00, 0x11, | ||
804 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
805 | + 0x00, 0x00, 0x00, 0x11, | ||
806 | + 0x00, 0x00, 0x00, 0x11, | ||
807 | + 0x04, 0x2E, 0x00, 0x0C, //TELinkDescriptorsTLV | ||
808 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
809 | + 0x01, 0x011, 0x01, 0x10 | ||
810 | + }; | ||
811 | + | ||
812 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
813 | + buffer.writeBytes(teReportMsg); | ||
814 | + | ||
815 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
816 | + PcepMessage message = null; | ||
817 | + | ||
818 | + message = reader.readFrom(buffer); | ||
819 | + | ||
820 | + byte[] testReportMsg = {0}; | ||
821 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
822 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
823 | + message.writeTo(buf); | ||
824 | + | ||
825 | + int readLen = buf.writerIndex() - 0; | ||
826 | + testReportMsg = new byte[readLen]; | ||
827 | + buf.readBytes(testReportMsg, 0, readLen); | ||
828 | + | ||
829 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
830 | + } | ||
831 | + | ||
832 | + /** | ||
833 | + * This test case checks for | ||
834 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
835 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
836 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV) | ||
837 | + * in PcTERpt message. | ||
838 | + * | ||
839 | + * @throws PcepParseException while parsing PCEP message | ||
840 | + */ | ||
841 | + @Test | ||
842 | + public void teReportMessageTest17() throws PcepParseException { | ||
843 | + | ||
844 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0x70, // common header | ||
845 | + 0x0E, 0x10, 0x00, (byte) 0x6C, // TE Object Header | ||
846 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
847 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
848 | + 0x00, 0x00, 0x00, 0x00, | ||
849 | + 0x00, 0x00, 0x00, 0x01, | ||
850 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
851 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
852 | + 0x00, 0x00, 0x00, 0x11, | ||
853 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
854 | + 0x00, 0x00, 0x00, 0x11, | ||
855 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
856 | + 0x00, 0x00, 0x00, 0x11, | ||
857 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
858 | + 0x00, 0x00, 0x00, 0x11, | ||
859 | + 0x00, 0x00, 0x00, 0x11, | ||
860 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
861 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
862 | + 0x00, 0x00, 0x00, 0x11, | ||
863 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
864 | + 0x00, 0x00, 0x00, 0x11, | ||
865 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
866 | + 0x00, 0x00, 0x00, 0x11, | ||
867 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
868 | + 0x00, 0x00, 0x00, 0x11, | ||
869 | + 0x00, 0x00, 0x00, 0x11, | ||
870 | + 0x04, 0x2E, 0x00, 0x04, //TELinkDescriptorsTLV | ||
871 | + }; | ||
872 | + | ||
873 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
874 | + buffer.writeBytes(teReportMsg); | ||
875 | + | ||
876 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
877 | + PcepMessage message = null; | ||
878 | + | ||
879 | + message = reader.readFrom(buffer); | ||
880 | + | ||
881 | + byte[] testReportMsg = {0}; | ||
882 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
883 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
884 | + message.writeTo(buf); | ||
885 | + | ||
886 | + int readLen = buf.writerIndex() - 0; | ||
887 | + testReportMsg = new byte[readLen]; | ||
888 | + buf.readBytes(testReportMsg, 0, readLen); | ||
889 | + | ||
890 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
891 | + } | ||
892 | + | ||
893 | + /** | ||
894 | + * This test case checks for | ||
895 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
896 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
897 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | ||
898 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv)) | ||
899 | + * in PcTERpt message. | ||
900 | + * | ||
901 | + * @throws PcepParseException while parsing PCEP message | ||
902 | + */ | ||
903 | + @Test | ||
904 | + public void teReportMessageTest18() throws PcepParseException { | ||
905 | + | ||
906 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header | ||
907 | + 0x0E, 0x10, 0x00, (byte) 0xbC, // TE Object Header | ||
908 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
909 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
910 | + 0x00, 0x00, 0x00, 0x00, | ||
911 | + 0x00, 0x00, 0x00, 0x01, | ||
912 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
913 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
914 | + 0x00, 0x00, 0x00, 0x11, | ||
915 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
916 | + 0x00, 0x00, 0x00, 0x11, | ||
917 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
918 | + 0x00, 0x00, 0x00, 0x11, | ||
919 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
920 | + 0x00, 0x00, 0x00, 0x11, | ||
921 | + 0x00, 0x00, 0x00, 0x11, | ||
922 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
923 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
924 | + 0x00, 0x00, 0x00, 0x11, | ||
925 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
926 | + 0x00, 0x00, 0x00, 0x11, | ||
927 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
928 | + 0x00, 0x00, 0x00, 0x11, | ||
929 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
930 | + 0x00, 0x00, 0x00, 0x11, | ||
931 | + 0x00, 0x00, 0x00, 0x11, | ||
932 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
933 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
934 | + 0x01, 0x11, 0x00, 0x09, | ||
935 | + 0x01, 0x21, 0x00, 0x09, | ||
936 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
937 | + 0x01, 0x01, 0x01, 0x01, | ||
938 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
939 | + 0x01, 0x011, 0x01, 0x10, | ||
940 | + 0x04, (byte) 0xF3, 0x00, 0x34, //TENodeAttributesTlv | ||
941 | + 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv | ||
942 | + (byte) 0x90, 0x00, 0x00, 0x00, | ||
943 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
944 | + 0x01, 0x011, 0x01, 0x10, | ||
945 | + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv | ||
946 | + 0x08, 0x00, 0x01, 0x09, | ||
947 | + 0x08, 0x00, 0x01, 0x09, | ||
948 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
949 | + 0x20, 0x01, 0x22, 0x01, | ||
950 | + 0x20, 0x01, 0x22, 0x01, | ||
951 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
952 | + 0x00, 0x01, 0x01, 0x02 | ||
953 | + }; | ||
954 | + | ||
955 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
956 | + buffer.writeBytes(teReportMsg); | ||
957 | + | ||
958 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
959 | + PcepMessage message = null; | ||
960 | + | ||
961 | + message = reader.readFrom(buffer); | ||
962 | + | ||
963 | + byte[] testReportMsg = {0}; | ||
964 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
965 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
966 | + message.writeTo(buf); | ||
967 | + | ||
968 | + int readLen = buf.writerIndex() - 0; | ||
969 | + testReportMsg = new byte[readLen]; | ||
970 | + buf.readBytes(testReportMsg, 0, readLen); | ||
971 | + | ||
972 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
973 | + } | ||
974 | + | ||
975 | + /** | ||
976 | + * This test case checks for | ||
977 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
978 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
979 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | ||
980 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv | ||
981 | + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) | ||
982 | + * in PcTERpt message. | ||
983 | + * | ||
984 | + * @throws PcepParseException while parsing PCEP message | ||
985 | + */ | ||
986 | + @Test | ||
987 | + public void teReportMessageTest19() throws PcepParseException { | ||
988 | + | ||
989 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xC0, // common header | ||
990 | + 0x0E, 0x10, 0x00, (byte) 0xBC, // TE Object Header | ||
991 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
992 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
993 | + 0x00, 0x00, 0x00, 0x00, | ||
994 | + 0x00, 0x00, 0x00, 0x01, | ||
995 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
996 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
997 | + 0x00, 0x00, 0x00, 0x11, | ||
998 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
999 | + 0x00, 0x00, 0x00, 0x11, | ||
1000 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1001 | + 0x00, 0x00, 0x00, 0x11, | ||
1002 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1003 | + 0x00, 0x00, 0x00, 0x11, | ||
1004 | + 0x00, 0x00, 0x00, 0x11, | ||
1005 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
1006 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1007 | + 0x00, 0x00, 0x00, 0x11, | ||
1008 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1009 | + 0x00, 0x00, 0x00, 0x11, | ||
1010 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1011 | + 0x00, 0x00, 0x00, 0x11, | ||
1012 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1013 | + 0x00, 0x00, 0x00, 0x11, | ||
1014 | + 0x00, 0x00, 0x00, 0x11, | ||
1015 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
1016 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
1017 | + 0x01, 0x11, 0x00, 0x09, | ||
1018 | + 0x01, 0x21, 0x00, 0x09, | ||
1019 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
1020 | + 0x01, 0x01, 0x01, 0x01, | ||
1021 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
1022 | + 0x01, 0x011, 0x01, 0x10, | ||
1023 | + 0x04, (byte) 0xF3, 0x00, 0x34, //TENodeAttributesTlv | ||
1024 | + 0x00, 0x0E, 0x00, 0x01, //NodeFlagBitsTlv | ||
1025 | + (byte) 0x90, 0x00, 0x00, 0x00, | ||
1026 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
1027 | + 0x01, 0x011, 0x01, 0x10, | ||
1028 | + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv | ||
1029 | + 0x08, 0x00, 0x01, 0x09, | ||
1030 | + 0x08, 0x00, 0x01, 0x09, | ||
1031 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
1032 | + 0x20, 0x01, 0x22, 0x01, | ||
1033 | + 0x20, 0x01, 0x22, 0x01, | ||
1034 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
1035 | + 0x00, 0x01, 0x01, 0x02 | ||
1036 | + }; | ||
1037 | + | ||
1038 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1039 | + buffer.writeBytes(teReportMsg); | ||
1040 | + | ||
1041 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1042 | + PcepMessage message = null; | ||
1043 | + | ||
1044 | + message = reader.readFrom(buffer); | ||
1045 | + | ||
1046 | + byte[] testReportMsg = {0}; | ||
1047 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
1048 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1049 | + message.writeTo(buf); | ||
1050 | + | ||
1051 | + int readLen = buf.writerIndex() - 0; | ||
1052 | + testReportMsg = new byte[readLen]; | ||
1053 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1054 | + | ||
1055 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
1056 | + } | ||
1057 | + | ||
1058 | + /** | ||
1059 | + * This test case checks for | ||
1060 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1061 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1062 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | ||
1063 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv | ||
1064 | + * NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) | ||
1065 | + * in PcTERpt message. | ||
1066 | + * | ||
1067 | + * @throws PcepParseException while parsing PCEP message | ||
1068 | + */ | ||
1069 | + @Test | ||
1070 | + public void teReportMessageTest20() throws PcepParseException { | ||
1071 | + | ||
1072 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xB8, // common header | ||
1073 | + 0x0E, 0x10, 0x00, (byte) 0xB4, // TE Object Header | ||
1074 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
1075 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
1076 | + 0x00, 0x00, 0x00, 0x00, | ||
1077 | + 0x00, 0x00, 0x00, 0x01, | ||
1078 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
1079 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1080 | + 0x00, 0x00, 0x00, 0x11, | ||
1081 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1082 | + 0x00, 0x00, 0x00, 0x11, | ||
1083 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1084 | + 0x00, 0x00, 0x00, 0x11, | ||
1085 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1086 | + 0x00, 0x00, 0x00, 0x11, | ||
1087 | + 0x00, 0x00, 0x00, 0x11, | ||
1088 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
1089 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1090 | + 0x00, 0x00, 0x00, 0x11, | ||
1091 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1092 | + 0x00, 0x00, 0x00, 0x11, | ||
1093 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1094 | + 0x00, 0x00, 0x00, 0x11, | ||
1095 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1096 | + 0x00, 0x00, 0x00, 0x11, | ||
1097 | + 0x00, 0x00, 0x00, 0x11, | ||
1098 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
1099 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
1100 | + 0x01, 0x11, 0x00, 0x09, | ||
1101 | + 0x01, 0x21, 0x00, 0x09, | ||
1102 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
1103 | + 0x01, 0x01, 0x01, 0x01, | ||
1104 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
1105 | + 0x01, 0x011, 0x01, 0x10, | ||
1106 | + 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv | ||
1107 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
1108 | + 0x01, 0x011, 0x01, 0x10, | ||
1109 | + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv | ||
1110 | + 0x08, 0x00, 0x01, 0x09, | ||
1111 | + 0x08, 0x00, 0x01, 0x09, | ||
1112 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
1113 | + 0x20, 0x01, 0x22, 0x01, | ||
1114 | + 0x20, 0x01, 0x22, 0x01, | ||
1115 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
1116 | + 0x00, 0x01, 0x01, 0x02 | ||
1117 | + }; | ||
1118 | + | ||
1119 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1120 | + buffer.writeBytes(teReportMsg); | ||
1121 | + | ||
1122 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1123 | + PcepMessage message = null; | ||
1124 | + | ||
1125 | + message = reader.readFrom(buffer); | ||
1126 | + | ||
1127 | + byte[] testReportMsg = {0}; | ||
1128 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
1129 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1130 | + message.writeTo(buf); | ||
1131 | + | ||
1132 | + int readLen = buf.writerIndex() - 0; | ||
1133 | + testReportMsg = new byte[readLen]; | ||
1134 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1135 | + | ||
1136 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
1137 | + } | ||
1138 | + | ||
1139 | + /** | ||
1140 | + * This test case checks for | ||
1141 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1142 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1143 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. | ||
1144 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(OpaqueNodeAttributeTlv | ||
1145 | + * ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv)) | ||
1146 | + * in PcTERpt message. | ||
1147 | + * | ||
1148 | + * @throws PcepParseException while parsing PCEP message | ||
1149 | + */ | ||
1150 | + @Test | ||
1151 | + public void teReportMessageTest21() throws PcepParseException { | ||
1152 | + | ||
1153 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x00, (byte) 0xAC, // common header | ||
1154 | + 0x0E, 0x10, 0x00, (byte) 0xA8, // TE Object Header | ||
1155 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
1156 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
1157 | + 0x00, 0x00, 0x00, 0x00, | ||
1158 | + 0x00, 0x00, 0x00, 0x01, | ||
1159 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
1160 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1161 | + 0x00, 0x00, 0x00, 0x11, | ||
1162 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1163 | + 0x00, 0x00, 0x00, 0x11, | ||
1164 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1165 | + 0x00, 0x00, 0x00, 0x11, | ||
1166 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1167 | + 0x00, 0x00, 0x00, 0x11, | ||
1168 | + 0x00, 0x00, 0x00, 0x11, | ||
1169 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
1170 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1171 | + 0x00, 0x00, 0x00, 0x11, | ||
1172 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1173 | + 0x00, 0x00, 0x00, 0x11, | ||
1174 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1175 | + 0x00, 0x00, 0x00, 0x11, | ||
1176 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1177 | + 0x00, 0x00, 0x00, 0x11, | ||
1178 | + 0x00, 0x00, 0x00, 0x11, | ||
1179 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
1180 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
1181 | + 0x01, 0x11, 0x00, 0x09, | ||
1182 | + 0x01, 0x21, 0x00, 0x09, | ||
1183 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
1184 | + 0x01, 0x01, 0x01, 0x01, | ||
1185 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
1186 | + 0x01, 0x011, 0x01, 0x10, | ||
1187 | + 0x04, (byte) 0xF3, 0x00, 0x20, //TENodeAttributesTlv | ||
1188 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
1189 | + 0x01, 0x011, 0x01, 0x10, | ||
1190 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
1191 | + 0x20, 0x01, 0x22, 0x01, | ||
1192 | + 0x20, 0x01, 0x22, 0x01, | ||
1193 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
1194 | + 0x00, 0x01, 0x01, 0x02 | ||
1195 | + }; | ||
1196 | + | ||
1197 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1198 | + buffer.writeBytes(teReportMsg); | ||
1199 | + | ||
1200 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1201 | + PcepMessage message = null; | ||
1202 | + | ||
1203 | + message = reader.readFrom(buffer); | ||
1204 | + | ||
1205 | + byte[] testReportMsg = {0}; | ||
1206 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
1207 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1208 | + message.writeTo(buf); | ||
1209 | + | ||
1210 | + int readLen = buf.writerIndex() - 0; | ||
1211 | + testReportMsg = new byte[readLen]; | ||
1212 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1213 | + | ||
1214 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
1215 | + } | ||
1216 | + | ||
1217 | + /** | ||
1218 | + * This test case checks for | ||
1219 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv. | ||
1220 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv. | ||
1221 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv. | ||
1222 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv. | ||
1223 | + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv). | ||
1224 | + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv. | ||
1225 | + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv. | ||
1226 | + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv. | ||
1227 | + * OpaqueLinkAttributeTlv, LinkNameTlv)). | ||
1228 | + * in PcTERpt message. | ||
1229 | + * | ||
1230 | + * @throws PcepParseException while parsing PCEP message | ||
1231 | + */ | ||
1232 | + @Test | ||
1233 | + public void teReportMessageTest22() throws PcepParseException { | ||
1234 | + | ||
1235 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x20, // common header | ||
1236 | + 0x0E, 0x10, 0x01, (byte) 0x1C, // TE Object Header | ||
1237 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
1238 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
1239 | + 0x00, 0x00, 0x00, 0x00, | ||
1240 | + 0x00, 0x00, 0x00, 0x01, | ||
1241 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
1242 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1243 | + 0x00, 0x00, 0x00, 0x11, | ||
1244 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1245 | + 0x00, 0x00, 0x00, 0x11, | ||
1246 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1247 | + 0x00, 0x00, 0x00, 0x11, | ||
1248 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1249 | + 0x00, 0x00, 0x00, 0x11, | ||
1250 | + 0x00, 0x00, 0x00, 0x11, | ||
1251 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
1252 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1253 | + 0x00, 0x00, 0x00, 0x11, | ||
1254 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1255 | + 0x00, 0x00, 0x00, 0x11, | ||
1256 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1257 | + 0x00, 0x00, 0x00, 0x11, | ||
1258 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1259 | + 0x00, 0x00, 0x00, 0x11, | ||
1260 | + 0x00, 0x00, 0x00, 0x11, | ||
1261 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
1262 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
1263 | + 0x01, 0x11, 0x00, 0x09, | ||
1264 | + 0x01, 0x21, 0x00, 0x09, | ||
1265 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
1266 | + 0x01, 0x01, 0x01, 0x01, | ||
1267 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
1268 | + 0x01, 0x011, 0x01, 0x10, | ||
1269 | + 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv | ||
1270 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
1271 | + 0x01, 0x011, 0x01, 0x10, | ||
1272 | + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv | ||
1273 | + 0x08, 0x00, 0x01, 0x09, | ||
1274 | + 0x08, 0x00, 0x01, 0x09, | ||
1275 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
1276 | + 0x20, 0x01, 0x22, 0x01, | ||
1277 | + 0x20, 0x01, 0x22, 0x01, | ||
1278 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
1279 | + 0x00, 0x01, 0x01, 0x02, | ||
1280 | + 0x07, 0x69, 0x00, 0x68, //TELinkAttributesTlv | ||
1281 | + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv | ||
1282 | + 0x00, 0x07, 0x08, 0x00, | ||
1283 | + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv | ||
1284 | + 0x00, 0x09, 0x08, 0x00, | ||
1285 | + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv | ||
1286 | + 0x00, 0x09, 0x00, 0x00, | ||
1287 | + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv | ||
1288 | + 0x00, 0x10, 0x00, 0x00, | ||
1289 | + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv | ||
1290 | + 0x00, 0x00, (byte) 0x90, 0x00, | ||
1291 | + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv | ||
1292 | + 0x00, (byte) 0x99, 0x09, 0x00, | ||
1293 | + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv | ||
1294 | + 0x09, 0x00, 0x00, 0x00, | ||
1295 | + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv | ||
1296 | + (byte) 0x80, 0x00, 0x00, 0x00, | ||
1297 | + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv | ||
1298 | + 0x09, (byte) 0x89, 0x07, 0x00, | ||
1299 | + 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv | ||
1300 | + 0x04, 0x47, 0x00, 0x03, | ||
1301 | + 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv | ||
1302 | + 0x04, 0x49, 0x00, 0x04, | ||
1303 | + 0x04, 0x47, 0x00, 0x03, | ||
1304 | + 0x04, 0x4A, 0x00, 0x04, //LinkNameTlv | ||
1305 | + 0x04, 0x47, 0x00, 0x03 | ||
1306 | + }; | ||
1307 | + | ||
1308 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1309 | + buffer.writeBytes(teReportMsg); | ||
1310 | + | ||
1311 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1312 | + PcepMessage message = null; | ||
1313 | + | ||
1314 | + message = reader.readFrom(buffer); | ||
1315 | + | ||
1316 | + byte[] testReportMsg = {0}; | ||
1317 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
1318 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1319 | + message.writeTo(buf); | ||
1320 | + | ||
1321 | + int readLen = buf.writerIndex() - 0; | ||
1322 | + testReportMsg = new byte[readLen]; | ||
1323 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1324 | + | ||
1325 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
1326 | + } | ||
1327 | + | ||
1328 | + /** | ||
1329 | + * This test case checks for | ||
1330 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1331 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1332 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | ||
1333 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv | ||
1334 | + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) | ||
1335 | + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv | ||
1336 | + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv | ||
1337 | + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv | ||
1338 | + * OpaqueLinkAttributeTlv)) | ||
1339 | + * in PcTERpt message. | ||
1340 | + * | ||
1341 | + * @throws PcepParseException while parsing PCEP message | ||
1342 | + */ | ||
1343 | + @Test | ||
1344 | + public void teReportMessageTest23() throws PcepParseException { | ||
1345 | + | ||
1346 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x18, // common header | ||
1347 | + 0x0E, 0x10, 0x01, (byte) 0x14, // TE Object Header | ||
1348 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
1349 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
1350 | + 0x00, 0x00, 0x00, 0x00, | ||
1351 | + 0x00, 0x00, 0x00, 0x01, | ||
1352 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
1353 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1354 | + 0x00, 0x00, 0x00, 0x11, | ||
1355 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1356 | + 0x00, 0x00, 0x00, 0x11, | ||
1357 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1358 | + 0x00, 0x00, 0x00, 0x11, | ||
1359 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1360 | + 0x00, 0x00, 0x00, 0x11, | ||
1361 | + 0x00, 0x00, 0x00, 0x11, | ||
1362 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
1363 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1364 | + 0x00, 0x00, 0x00, 0x11, | ||
1365 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1366 | + 0x00, 0x00, 0x00, 0x11, | ||
1367 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1368 | + 0x00, 0x00, 0x00, 0x11, | ||
1369 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1370 | + 0x00, 0x00, 0x00, 0x11, | ||
1371 | + 0x00, 0x00, 0x00, 0x11, | ||
1372 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
1373 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
1374 | + 0x01, 0x11, 0x00, 0x09, | ||
1375 | + 0x01, 0x21, 0x00, 0x09, | ||
1376 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
1377 | + 0x01, 0x01, 0x01, 0x01, | ||
1378 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
1379 | + 0x01, 0x011, 0x01, 0x10, | ||
1380 | + 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv | ||
1381 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
1382 | + 0x01, 0x011, 0x01, 0x10, | ||
1383 | + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv | ||
1384 | + 0x08, 0x00, 0x01, 0x09, | ||
1385 | + 0x08, 0x00, 0x01, 0x09, | ||
1386 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
1387 | + 0x20, 0x01, 0x22, 0x01, | ||
1388 | + 0x20, 0x01, 0x22, 0x01, | ||
1389 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
1390 | + 0x00, 0x01, 0x01, 0x02, | ||
1391 | + 0x07, 0x69, 0x00, 0x60, //TELinkAttributesTlv | ||
1392 | + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv | ||
1393 | + 0x00, 0x07, 0x08, 0x00, | ||
1394 | + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv | ||
1395 | + 0x00, 0x09, 0x08, 0x00, | ||
1396 | + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv | ||
1397 | + 0x00, 0x09, 0x00, 0x00, | ||
1398 | + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv | ||
1399 | + 0x00, 0x10, 0x00, 0x00, | ||
1400 | + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv | ||
1401 | + 0x00, 0x00, (byte) 0x90, 0x00, | ||
1402 | + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv | ||
1403 | + 0x00, (byte) 0x99, 0x09, 0x00, | ||
1404 | + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv | ||
1405 | + 0x09, 0x00, 0x00, 0x00, | ||
1406 | + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv | ||
1407 | + (byte) 0x80, 0x00, 0x00, 0x00, | ||
1408 | + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv | ||
1409 | + 0x09, (byte) 0x89, 0x07, 0x00, | ||
1410 | + 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv | ||
1411 | + 0x04, 0x47, 0x00, 0x03, | ||
1412 | + 0x04, 0x47, 0x00, 0x03, //OpaqueLinkAttributeTlv | ||
1413 | + 0x04, 0x49, 0x00, 0x04, | ||
1414 | + 0x04, 0x47, 0x00, 0x03 | ||
1415 | + }; | ||
1416 | + | ||
1417 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1418 | + buffer.writeBytes(teReportMsg); | ||
1419 | + | ||
1420 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1421 | + PcepMessage message = null; | ||
1422 | + | ||
1423 | + message = reader.readFrom(buffer); | ||
1424 | + | ||
1425 | + byte[] testReportMsg = {0}; | ||
1426 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
1427 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1428 | + message.writeTo(buf); | ||
1429 | + | ||
1430 | + int readLen = buf.writerIndex() - 0; | ||
1431 | + testReportMsg = new byte[readLen]; | ||
1432 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1433 | + | ||
1434 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
1435 | + } | ||
1436 | + | ||
1437 | + /** | ||
1438 | + * This test case checks for | ||
1439 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1440 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1441 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | ||
1442 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv | ||
1443 | + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) | ||
1444 | + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv | ||
1445 | + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv | ||
1446 | + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv:, SharedRiskLinkGroupTlv)) | ||
1447 | + * in PcTERpt message. | ||
1448 | + * | ||
1449 | + * @throws PcepParseException while parsing PCEP message | ||
1450 | + */ | ||
1451 | + @Test | ||
1452 | + public void teReportMessageTest24() throws PcepParseException { | ||
1453 | + | ||
1454 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, (byte) 0x10, // common header | ||
1455 | + 0x0E, 0x10, 0x01, (byte) 0x0C, // TE Object Header | ||
1456 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
1457 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
1458 | + 0x00, 0x00, 0x00, 0x00, | ||
1459 | + 0x00, 0x00, 0x00, 0x01, | ||
1460 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
1461 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1462 | + 0x00, 0x00, 0x00, 0x11, | ||
1463 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1464 | + 0x00, 0x00, 0x00, 0x11, | ||
1465 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1466 | + 0x00, 0x00, 0x00, 0x11, | ||
1467 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1468 | + 0x00, 0x00, 0x00, 0x11, | ||
1469 | + 0x00, 0x00, 0x00, 0x11, | ||
1470 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
1471 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1472 | + 0x00, 0x00, 0x00, 0x11, | ||
1473 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1474 | + 0x00, 0x00, 0x00, 0x11, | ||
1475 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1476 | + 0x00, 0x00, 0x00, 0x11, | ||
1477 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1478 | + 0x00, 0x00, 0x00, 0x11, | ||
1479 | + 0x00, 0x00, 0x00, 0x11, | ||
1480 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
1481 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
1482 | + 0x01, 0x11, 0x00, 0x09, | ||
1483 | + 0x01, 0x21, 0x00, 0x09, | ||
1484 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
1485 | + 0x01, 0x01, 0x01, 0x01, | ||
1486 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
1487 | + 0x01, 0x011, 0x01, 0x10, | ||
1488 | + 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv | ||
1489 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
1490 | + 0x01, 0x011, 0x01, 0x10, | ||
1491 | + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv | ||
1492 | + 0x08, 0x00, 0x01, 0x09, | ||
1493 | + 0x08, 0x00, 0x01, 0x09, | ||
1494 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
1495 | + 0x20, 0x01, 0x22, 0x01, | ||
1496 | + 0x20, 0x01, 0x22, 0x01, | ||
1497 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
1498 | + 0x00, 0x01, 0x01, 0x02, | ||
1499 | + 0x07, 0x69, 0x00, 0x58, //TELinkAttributesTlv | ||
1500 | + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv | ||
1501 | + 0x00, 0x07, 0x08, 0x00, | ||
1502 | + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv | ||
1503 | + 0x00, 0x09, 0x08, 0x00, | ||
1504 | + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv | ||
1505 | + 0x00, 0x09, 0x00, 0x00, | ||
1506 | + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv | ||
1507 | + 0x00, 0x10, 0x00, 0x00, | ||
1508 | + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv | ||
1509 | + 0x00, 0x00, (byte) 0x90, 0x00, | ||
1510 | + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv | ||
1511 | + 0x00, (byte) 0x99, 0x09, 0x00, | ||
1512 | + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv | ||
1513 | + 0x09, 0x00, 0x00, 0x00, | ||
1514 | + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv | ||
1515 | + (byte) 0x80, 0x00, 0x00, 0x00, | ||
1516 | + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv | ||
1517 | + 0x09, (byte) 0x89, 0x07, 0x00, | ||
1518 | + 0x04, 0x48, 0x00, 0x08, //SharedRiskLinkGroupTlv | ||
1519 | + 0x04, 0x47, 0x00, 0x03, | ||
1520 | + 0x04, 0x47, 0x00, 0x03 | ||
1521 | + }; | ||
1522 | + | ||
1523 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1524 | + buffer.writeBytes(teReportMsg); | ||
1525 | + | ||
1526 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1527 | + PcepMessage message = null; | ||
1528 | + | ||
1529 | + message = reader.readFrom(buffer); | ||
1530 | + | ||
1531 | + byte[] testReportMsg = {0}; | ||
1532 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
1533 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1534 | + message.writeTo(buf); | ||
1535 | + | ||
1536 | + int readLen = buf.writerIndex() - 0; | ||
1537 | + testReportMsg = new byte[readLen]; | ||
1538 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1539 | + | ||
1540 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
1541 | + } | ||
1542 | + | ||
1543 | + /** | ||
1544 | + * This test case checks for | ||
1545 | + * TE Object (Routing Universe TLV,Local TE Node Descriptors TLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1546 | + * OSPFareaIDsubTlv, RouterIDSubTlv), RemoteTENodeDescriptorsTLV(AutonomousSystemTlv, BGPLSidentifierTlv | ||
1547 | + * OSPFareaIDsubTlv, RouterIDSubTlv), TELinkDescriptorsTLV(LinkLocalRemoteIdentifiersTlv | ||
1548 | + * IPv4InterfaceAddressTlv, IPv4NeighborAddressTlv), TENodeAttributesTlv(NodeFlagBitsTlv | ||
1549 | + * OpaqueNodeAttributeTlv, NodeNameTlv, ISISAreaIdentifierTlv, IPv4TERouterIdOfLocalNodeTlv) | ||
1550 | + * TELinkAttributesTlv(IPv4TERouterIdOfRemoteNodeTlv, IPv6TERouterIdofRemoteNodeTlv, AdministrativeGroupTlv | ||
1551 | + * MaximumLinkBandwidthTlv, MaximumReservableLinkBandwidthTlv, UnreservedBandwidthTlv, TEDefaultMetricTlv | ||
1552 | + * LinkProtectionTypeTlv, MPLSProtocolMaskTlv, IGPMetricTlv)) | ||
1553 | + * in PcTERpt message. | ||
1554 | + * | ||
1555 | + * @throws PcepParseException while parsing PCEP message | ||
1556 | + */ | ||
1557 | + @Test | ||
1558 | + public void teReportMessageTest25() throws PcepParseException { | ||
1559 | + | ||
1560 | + byte[] teReportMsg = new byte[] {0x20, 0x0E, 0x01, 0x04, // common header | ||
1561 | + 0x0E, 0x10, 0x01, 0x00, // TE Object Header | ||
1562 | + 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x10, // TE-ID | ||
1563 | + 0x00, 0x0E, 0x00, 0x08, // Routing Universe TLV | ||
1564 | + 0x00, 0x00, 0x00, 0x00, | ||
1565 | + 0x00, 0x00, 0x00, 0x01, | ||
1566 | + 0x06, 0x65, 0x00, 0x28, // Local TE Node Descriptors TLV | ||
1567 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1568 | + 0x00, 0x00, 0x00, 0x11, | ||
1569 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1570 | + 0x00, 0x00, 0x00, 0x11, | ||
1571 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1572 | + 0x00, 0x00, 0x00, 0x11, | ||
1573 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1574 | + 0x00, 0x00, 0x00, 0x11, | ||
1575 | + 0x00, 0x00, 0x00, 0x11, | ||
1576 | + 0x03, (byte) 0xEB, 0x00, 0x28, //RemoteTENodeDescriptorsTLV | ||
1577 | + 0x00, 0x64, 0x00, 0x04, //AutonomousSystemTlv | ||
1578 | + 0x00, 0x00, 0x00, 0x11, | ||
1579 | + 0x00, 0x11, 0x00, 0x04, //BGPLSidentifierTlv | ||
1580 | + 0x00, 0x00, 0x00, 0x11, | ||
1581 | + 0x02, 0x58, 0x00, 0x04, //OSPFareaIDsubTlv | ||
1582 | + 0x00, 0x00, 0x00, 0x11, | ||
1583 | + 0x03, (byte) 0xE8, 0x00, 0x08, //RouterIDSubTlv | ||
1584 | + 0x00, 0x00, 0x00, 0x11, | ||
1585 | + 0x00, 0x00, 0x00, 0x11, | ||
1586 | + 0x04, 0x2E, 0x00, 0x20, //TELinkDescriptorsTLV | ||
1587 | + 0x00, 0x04, 0x00, 0x08, //LinkLocalRemoteIdentifiersTlv | ||
1588 | + 0x01, 0x11, 0x00, 0x09, | ||
1589 | + 0x01, 0x21, 0x00, 0x09, | ||
1590 | + 0x00, 0x06, 0x00, 0x04, //IPv4InterfaceAddressTlv | ||
1591 | + 0x01, 0x01, 0x01, 0x01, | ||
1592 | + 0x00, 0x08, 0x00, 0x04, //IPv4NeighborAddressTlv | ||
1593 | + 0x01, 0x011, 0x01, 0x10, | ||
1594 | + 0x04, (byte) 0xF3, 0x00, 0x2C, //TENodeAttributesTlv | ||
1595 | + 0x03, (byte) 0xE9, 0x00, 0x04, //OpaqueNodeAttributeTlv | ||
1596 | + 0x01, 0x011, 0x01, 0x10, | ||
1597 | + 0x03, (byte) 0xEF, 0x00, 0x08, //NodeNameTlv | ||
1598 | + 0x08, 0x00, 0x01, 0x09, | ||
1599 | + 0x08, 0x00, 0x01, 0x09, | ||
1600 | + 0x00, 0x6B, 0x00, 0x08, //ISISAreaIdentifierTlv | ||
1601 | + 0x20, 0x01, 0x22, 0x01, | ||
1602 | + 0x20, 0x01, 0x22, 0x01, | ||
1603 | + 0x00, (byte) 0x86, 0x00, 0x04, //IPv4TERouterIdOfLocalNodeTlv | ||
1604 | + 0x00, 0x01, 0x01, 0x02, | ||
1605 | + 0x07, 0x69, 0x00, 0x4C, //TELinkAttributesTlv | ||
1606 | + 0x05, 0x3C, 0x00, 0x04, //IPv4TERouterIdOfRemoteNodeTlv | ||
1607 | + 0x00, 0x07, 0x08, 0x00, | ||
1608 | + 0x00, 0x03, 0x00, 0x04, //AdministrativeGroupTlv | ||
1609 | + 0x00, 0x09, 0x08, 0x00, | ||
1610 | + 0x00, 0x09, 0x00, 0x04, //MaximumLinkBandwidthTlv | ||
1611 | + 0x00, 0x09, 0x00, 0x00, | ||
1612 | + 0x00, 0x0a, 0x00, 0x04, //MaximumReservableLinkBandwidthTlv | ||
1613 | + 0x00, 0x10, 0x00, 0x00, | ||
1614 | + 0x00, 0x0b, 0x00, 0x04, //UnreservedBandwidthTlv | ||
1615 | + 0x00, 0x00, (byte) 0x90, 0x00, | ||
1616 | + 0x34, 0x58, 0x00, 0x04, //TEDefaultMetricTlv | ||
1617 | + 0x00, (byte) 0x99, 0x09, 0x00, | ||
1618 | + 0x00, 0x14, 0x00, 0x02, //LinkProtectionTypeTlv | ||
1619 | + 0x09, 0x00, 0x00, 0x00, | ||
1620 | + 0x04, 0x46, 0x00, 0x01, //MPLSProtocolMaskTlv | ||
1621 | + (byte) 0x80, 0x00, 0x00, 0x00, | ||
1622 | + 0x04, 0x47, 0x00, 0x03, //IGPMetricTlv | ||
1623 | + 0x09, (byte) 0x89, 0x07, 0x00 | ||
1624 | + }; | ||
1625 | + | ||
1626 | + ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); | ||
1627 | + buffer.writeBytes(teReportMsg); | ||
1628 | + | ||
1629 | + PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); | ||
1630 | + PcepMessage message = null; | ||
1631 | + | ||
1632 | + message = reader.readFrom(buffer); | ||
1633 | + | ||
1634 | + byte[] testReportMsg = {0}; | ||
1635 | + | ||
1636 | + Assert.assertTrue("PcepMessage is not instance of PcTERpt", message instanceof PcepTEReportMsg); | ||
1637 | + ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); | ||
1638 | + message.writeTo(buf); | ||
1639 | + | ||
1640 | + int readLen = buf.writerIndex() - 0; | ||
1641 | + testReportMsg = new byte[readLen]; | ||
1642 | + buf.readBytes(testReportMsg, 0, readLen); | ||
1643 | + | ||
1644 | + Assert.assertArrayEquals("PcTERpt messages are not equal", teReportMsg, testReportMsg); | ||
1645 | + } | ||
1646 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.protocol.PcepNai; | ||
20 | +import org.onosproject.pcepio.types.SrEroSubObject; | ||
21 | + | ||
22 | +import com.google.common.testing.EqualsTester; | ||
23 | + | ||
24 | +public class SrEroSubObjectTest { | ||
25 | + | ||
26 | + private final boolean bFFlag = false; | ||
27 | + private final boolean bSFlag = false; | ||
28 | + private final boolean bCFlag = false; | ||
29 | + private final boolean bMFlag = false; | ||
30 | + private final byte st = 1; | ||
31 | + private final int sID = 1; | ||
32 | + private final PcepNai nai = null; | ||
33 | + | ||
34 | + private final SrEroSubObject tlv1 = SrEroSubObject.of(st, bFFlag, bSFlag, bCFlag, bMFlag, sID, nai); | ||
35 | + | ||
36 | + private final boolean bFFlag1 = false; | ||
37 | + private final boolean bSFlag1 = false; | ||
38 | + private final boolean bCFlag1 = false; | ||
39 | + private final boolean bMFlag1 = false; | ||
40 | + private final byte st1 = 1; | ||
41 | + private final int sID1 = 1; | ||
42 | + private final PcepNai nai1 = null; | ||
43 | + | ||
44 | + private final SrEroSubObject tlv2 = SrEroSubObject.of(st1, bFFlag1, bSFlag1, bCFlag1, bMFlag1, sID1, nai1); | ||
45 | + | ||
46 | + private final boolean bFFlag2 = true; | ||
47 | + private final boolean bSFlag2 = true; | ||
48 | + private final boolean bCFlag2 = true; | ||
49 | + private final boolean bMFlag2 = true; | ||
50 | + private final byte st2 = 2; | ||
51 | + private final int sID2 = 2; | ||
52 | + private final PcepNai nai2 = null; | ||
53 | + | ||
54 | + private final SrEroSubObject tlv3 = SrEroSubObject.of(st2, bFFlag2, bSFlag2, bCFlag2, bMFlag2, sID2, nai2); | ||
55 | + | ||
56 | + @Test | ||
57 | + public void basics() { | ||
58 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
59 | + } | ||
60 | + | ||
61 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.StatefulIPv4LspIdentidiersTlv; | ||
20 | + | ||
21 | +import com.google.common.testing.EqualsTester; | ||
22 | + | ||
23 | +public class StatefulIPv4LspIdentidiersTlvTest { | ||
24 | + | ||
25 | + private final int ipv4IngressAddress = 1; | ||
26 | + private final short lspId = 1; | ||
27 | + private final short tunnelId = 1; | ||
28 | + private final int extendedTunnelId = 1; | ||
29 | + private final int ipv4EgressAddress = 1; | ||
30 | + | ||
31 | + private final StatefulIPv4LspIdentidiersTlv tlv1 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress, lspId, | ||
32 | + tunnelId, extendedTunnelId, ipv4EgressAddress); | ||
33 | + | ||
34 | + private final int ipv4IngressAddress1 = 1; | ||
35 | + private final short lspId1 = 1; | ||
36 | + private final short tunnelId1 = 1; | ||
37 | + private final int extendedTunnelId1 = 1; | ||
38 | + private final int ipv4EgressAddress1 = 1; | ||
39 | + | ||
40 | + private final StatefulIPv4LspIdentidiersTlv tlv2 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress1, lspId1, | ||
41 | + tunnelId1, extendedTunnelId1, ipv4EgressAddress1); | ||
42 | + | ||
43 | + private final int ipv4IngressAddress2 = 2; | ||
44 | + private final short lspId2 = 2; | ||
45 | + private final short tunnelId2 = 2; | ||
46 | + private final int extendedTunnelId2 = 2; | ||
47 | + private final int ipv4EgressAddress2 = 2; | ||
48 | + | ||
49 | + private final StatefulIPv4LspIdentidiersTlv tlv3 = StatefulIPv4LspIdentidiersTlv.of(ipv4IngressAddress2, lspId2, | ||
50 | + tunnelId2, extendedTunnelId2, ipv4EgressAddress2); | ||
51 | + | ||
52 | + @Test | ||
53 | + public void basics() { | ||
54 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
55 | + | ||
56 | + } | ||
57 | +} |
1 | +/* | ||
2 | + * Copyright 2015 Open Networking Laboratory | ||
3 | + * | ||
4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
5 | + * you may not use this file except in compliance with the License. | ||
6 | + * You may obtain a copy of the License at | ||
7 | + * | ||
8 | + * http://www.apache.org/licenses/LICENSE-2.0 | ||
9 | + * | ||
10 | + * Unless required by applicable law or agreed to in writing, software | ||
11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
13 | + * See the License for the specific language governing permissions and | ||
14 | + * limitations under the License. | ||
15 | + */ | ||
16 | +package org.onosproject.pcepio; | ||
17 | + | ||
18 | +import org.junit.Test; | ||
19 | +import org.onosproject.pcepio.types.StatefulLspErrorCodeTlv; | ||
20 | +import com.google.common.testing.EqualsTester; | ||
21 | + | ||
22 | +public class StatefulLspErrorCodeTlvTest { | ||
23 | + | ||
24 | + private final StatefulLspErrorCodeTlv tlv1 = StatefulLspErrorCodeTlv.of(1); | ||
25 | + private final StatefulLspErrorCodeTlv tlv2 = StatefulLspErrorCodeTlv.of(1); | ||
26 | + private final StatefulLspErrorCodeTlv tlv3 = StatefulLspErrorCodeTlv.of(2); | ||
27 | + | ||
28 | + @Test | ||
29 | + public void basics() { | ||
30 | + new EqualsTester().addEqualityGroup(tlv1, tlv2).addEqualityGroup(tlv3).testEquals(); | ||
31 | + } | ||
32 | +} |
... | @@ -25,17 +25,17 @@ import com.google.common.testing.EqualsTester; | ... | @@ -25,17 +25,17 @@ import com.google.common.testing.EqualsTester; |
25 | */ | 25 | */ |
26 | public class SymbolicPathNameTlvTest { | 26 | public class SymbolicPathNameTlvTest { |
27 | 27 | ||
28 | - byte[] value1 = {0x41 }; | 28 | + private final byte[] value1 = {0x41 }; |
29 | - Short length1 = new Short((short) 2); | 29 | + private final Short length1 = new Short((short) 2); |
30 | - final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1); | 30 | + private final SymbolicPathNameTlv tlv1 = SymbolicPathNameTlv.of(value1, length1); |
31 | 31 | ||
32 | - byte[] value2 = {0x41 }; | 32 | + private final byte[] value2 = {0x41 }; |
33 | - Short length2 = new Short((short) 2); | 33 | + private final Short length2 = new Short((short) 2); |
34 | - final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2); | 34 | + private final SymbolicPathNameTlv tlv2 = SymbolicPathNameTlv.of(value1, length2); |
35 | 35 | ||
36 | - byte[] value3 = {0x41, 0x43 }; | 36 | + private final byte[] value3 = {0x41, 0x43 }; |
37 | - Short length3 = new Short((short) 3); | 37 | + private final Short length3 = new Short((short) 3); |
38 | - final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3); | 38 | + private final SymbolicPathNameTlv tlv3 = SymbolicPathNameTlv.of(value3, length3); |
39 | 39 | ||
40 | @Test | 40 | @Test |
41 | public void basics() { | 41 | public void basics() { | ... | ... |
-
Please register or login to post a comment