2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.pcep.impl;
10 import static java.util.Arrays.asList;
11 import static org.junit.Assert.assertEquals;
13 import java.io.IOException;
14 import java.util.ArrayList;
15 import java.util.List;
17 import org.junit.Test;
18 import org.opendaylight.protocol.concepts.IGPMetric;
19 import org.opendaylight.protocol.concepts.IPv4;
20 import org.opendaylight.protocol.concepts.IPv4Address;
21 import org.opendaylight.protocol.concepts.TEMetric;
22 import org.opendaylight.protocol.framework.DeserializerException;
23 import org.opendaylight.protocol.framework.DocumentedException;
24 import org.opendaylight.protocol.pcep.PCEPDeserializerException;
25 import org.opendaylight.protocol.pcep.PCEPDocumentedException;
26 import org.opendaylight.protocol.pcep.PCEPErrors;
27 import org.opendaylight.protocol.pcep.PCEPOFCodes;
28 import org.opendaylight.protocol.pcep.PCEPObject;
29 import org.opendaylight.protocol.pcep.PCEPTlv;
30 import org.opendaylight.protocol.pcep.concepts.LSPSymbolicName;
31 import org.opendaylight.protocol.pcep.concepts.UnnumberedInterfaceIdentifier;
32 import org.opendaylight.protocol.pcep.impl.object.UnknownObject;
33 import org.opendaylight.protocol.pcep.message.PCCreateMessage;
34 import org.opendaylight.protocol.pcep.message.PCEPCloseMessage;
35 import org.opendaylight.protocol.pcep.message.PCEPErrorMessage;
36 import org.opendaylight.protocol.pcep.message.PCEPNotificationMessage;
37 import org.opendaylight.protocol.pcep.message.PCEPOpenMessage;
38 import org.opendaylight.protocol.pcep.message.PCEPReplyMessage;
39 import org.opendaylight.protocol.pcep.message.PCEPReportMessage;
40 import org.opendaylight.protocol.pcep.message.PCEPRequestMessage;
41 import org.opendaylight.protocol.pcep.message.PCEPUpdateRequestMessage;
42 import org.opendaylight.protocol.pcep.object.CompositeErrorObject;
43 import org.opendaylight.protocol.pcep.object.CompositeInstantiationObject;
44 import org.opendaylight.protocol.pcep.object.CompositeNotifyObject;
45 import org.opendaylight.protocol.pcep.object.CompositePathObject;
46 import org.opendaylight.protocol.pcep.object.CompositeReplySvecObject;
47 import org.opendaylight.protocol.pcep.object.CompositeRequestObject;
48 import org.opendaylight.protocol.pcep.object.CompositeRequestSvecObject;
49 import org.opendaylight.protocol.pcep.object.CompositeResponseObject;
50 import org.opendaylight.protocol.pcep.object.CompositeRptPathObject;
51 import org.opendaylight.protocol.pcep.object.CompositeStateReportObject;
52 import org.opendaylight.protocol.pcep.object.CompositeUpdPathObject;
53 import org.opendaylight.protocol.pcep.object.CompositeUpdateRequestObject;
54 import org.opendaylight.protocol.pcep.object.PCEPCloseObject;
55 import org.opendaylight.protocol.pcep.object.PCEPCloseObject.Reason;
56 import org.opendaylight.protocol.pcep.object.PCEPEndPointsObject;
57 import org.opendaylight.protocol.pcep.object.PCEPErrorObject;
58 import org.opendaylight.protocol.pcep.object.PCEPExcludeRouteObject;
59 import org.opendaylight.protocol.pcep.object.PCEPExistingPathBandwidthObject;
60 import org.opendaylight.protocol.pcep.object.PCEPExplicitRouteObject;
61 import org.opendaylight.protocol.pcep.object.PCEPGlobalConstraintsObject;
62 import org.opendaylight.protocol.pcep.object.PCEPIncludeRouteObject;
63 import org.opendaylight.protocol.pcep.object.PCEPLoadBalancingObject;
64 import org.opendaylight.protocol.pcep.object.PCEPLspObject;
65 import org.opendaylight.protocol.pcep.object.PCEPLspaObject;
66 import org.opendaylight.protocol.pcep.object.PCEPMetricObject;
67 import org.opendaylight.protocol.pcep.object.PCEPNoPathObject;
68 import org.opendaylight.protocol.pcep.object.PCEPNotificationObject;
69 import org.opendaylight.protocol.pcep.object.PCEPObjectiveFunctionObject;
70 import org.opendaylight.protocol.pcep.object.PCEPOpenObject;
71 import org.opendaylight.protocol.pcep.object.PCEPReportedRouteObject;
72 import org.opendaylight.protocol.pcep.object.PCEPRequestParameterObject;
73 import org.opendaylight.protocol.pcep.object.PCEPRequestedPathBandwidthObject;
74 import org.opendaylight.protocol.pcep.object.PCEPSvecObject;
75 import org.opendaylight.protocol.pcep.spi.PCEPMessageType;
76 import org.opendaylight.protocol.pcep.spi.RawMessage;
77 import org.opendaylight.protocol.pcep.subobject.EROAsNumberSubobject;
78 import org.opendaylight.protocol.pcep.subobject.EROUnnumberedInterfaceSubobject;
79 import org.opendaylight.protocol.pcep.subobject.ExcludeRouteSubobject;
80 import org.opendaylight.protocol.pcep.subobject.ExplicitRouteSubobject;
81 import org.opendaylight.protocol.pcep.subobject.RROUnnumberedInterfaceSubobject;
82 import org.opendaylight.protocol.pcep.subobject.ReportedRouteSubobject;
83 import org.opendaylight.protocol.pcep.subobject.XROAsNumberSubobject;
84 import org.opendaylight.protocol.pcep.tlv.LSPStateDBVersionTlv;
85 import org.opendaylight.protocol.pcep.tlv.LSPSymbolicNameTlv;
86 import org.opendaylight.protocol.pcep.tlv.PCEStatefulCapabilityTlv;
87 import org.opendaylight.protocol.util.ByteArray;
88 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
89 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nps.concepts.rev130930.Bandwidth;
90 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
91 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
92 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.keepalive.message.KeepaliveMessageBuilder;
94 import com.google.common.collect.Lists;
96 public class PCEPValidatorTest {
98 private static final PCEPLspaObject lspa = new PCEPLspaObject(0L, 0L, 0L, (short) 0, (short) 0, false, false, false, false);
100 private final List<ExplicitRouteSubobject> eroSubobjects = asList(
101 new EROAsNumberSubobject(new AsNumber(0xFFFFL), false),
102 new EROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] { (byte) 0x00, (byte) 0x11, (byte) 0x22, (byte) 0x33 }), new UnnumberedInterfaceIdentifier(0x00FF00FF), false));
104 private final List<ReportedRouteSubobject> rroSubobjects = asList((ReportedRouteSubobject) new RROUnnumberedInterfaceSubobject(new IPv4Address(new byte[] {
105 (byte) 0x00, (byte) 0x11, (byte) 0x22, (byte) 0x33 }), new UnnumberedInterfaceIdentifier(0x00FF00FF)));
107 private final List<Long> requestIds = asList(0x000001L);
109 private final IPv4Address ip4addr = new IPv4Address(new byte[] { (byte) 0xFF, 0x00, 0x00, 0x01 });
111 private final PCEPSvecObject svecObj = new PCEPSvecObject(true, true, true, false, false, PCEPValidatorTest.this.requestIds, true);
113 private final PCEPRequestParameterObject requestParameter = new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, true, false);
115 // private final PCEPEndPointsObject<IPv4Address> endPoints = new
116 // PCEPEndPointsObject<IPv4Address>(this.ip4addr, this.ip4addr);
118 private final PCEPEndPointsObject<IPv4Address> endPoints = new PCEPEndPointsObject<IPv4Address>(this.ip4addr, this.ip4addr);
120 private static final RawPCEPMessageFactory msgFactory = new RawPCEPMessageFactory();
122 // private final PCEPClassTypeObject classType = new
123 // PCEPClassTypeObject((short) 7);
124 // private final PCEPClassTypeObjectProvider classTypeProvider = new
125 // PCEPClassTypeObjectProvider((short) 7, true);
127 private static List<Message> deserMsg(final String srcFile) throws IOException, DeserializerException, DocumentedException,
128 PCEPDeserializerException {
129 final byte[] bytesFromFile = ByteArray.fileToBytes(srcFile);
130 final RawMessage rawMessage = (RawMessage) msgFactory.parse(bytesFromFile).get(0);
132 return PCEPMessageValidator.getValidator(rawMessage.getMsgType()).validate(rawMessage.getAllObjects());
136 public void testOpenMessageValidationFromBin() throws IOException, DeserializerException, DocumentedException,
137 PCEPDeserializerException {
139 deserMsg("src/test/resources/PCEPOpenMessage1.bin").toString(),
141 new PCEPOpenMessage(new PCEPOpenObject(30, 120, 1, asList(new PCEStatefulCapabilityTlv(false, true, true),
142 new LSPStateDBVersionTlv(0x80))))).toString());
144 assertEquals(deserMsg("src/test/resources/Open.1.bin").toString(),
145 asList(new PCEPOpenMessage(new PCEPOpenObject(1, 4, 1))).toString());
148 deserMsg("src/test/resources/Open.3.bin").toString(),
150 new PCEPOpenMessage(new PCEPOpenObject(1, 4, 1, asList(new PCEStatefulCapabilityTlv(false, true, true),
151 new LSPStateDBVersionTlv(53))))).toString());
155 public void testKeepAliveMessageValidationFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
156 DeserializerException, DocumentedException {
157 assertEquals(deserMsg("src/test/resources/PCEPKeepAliveMessage1.bin").toString(),
158 asList(new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build()).toString());
159 assertEquals(deserMsg("src/test/resources/Keepalive.1.bin").toString(),
160 asList(new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build()).build()).toString());
164 public void testCloseMsg() throws PCEPDeserializerException, IOException, PCEPDocumentedException, DeserializerException,
165 DocumentedException {
166 assertEquals(deserMsg("src/test/resources/PCEPCloseMessage1.bin").toString(),
167 asList(new PCEPCloseMessage(new PCEPCloseObject(Reason.TOO_MANY_UNKNOWN_MSG))).toString());
168 assertEquals(deserMsg("src/test/resources/Close.1.bin").toString(),
169 asList(new PCEPCloseMessage(new PCEPCloseObject(Reason.UNKNOWN))).toString());
173 public void testRequestMessageValidationFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
174 DeserializerException, DocumentedException {
175 List<CompositeRequestObject> requests = new ArrayList<CompositeRequestObject>();
176 final byte[] ipAdress = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
177 requests.add(new CompositeRequestObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 5, 0xDEADBEEFL, true, false), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress), new IPv4Address(ipAdress))));
178 PCEPRequestMessage specMessage = new PCEPRequestMessage(requests);
179 List<Message> deserMsgs = deserMsg("src/test/resources/PCEPRequestMessage1.bin");
180 final List<Message> specMessages = Lists.newArrayList();
181 specMessages.add(specMessage);
183 assertEquals(deserMsgs.toString(), specMessages.toString());
185 requests = new ArrayList<CompositeRequestObject>();
186 final byte[] ipAdress2 = { (byte) 0x7F, (byte) 0x00, (byte) 0x00, (byte) 0x01 };
187 requests.add(new CompositeRequestObject(this.requestParameter, new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress2), new IPv4Address(ipAdress2))));
188 specMessage = new PCEPRequestMessage(requests);
189 deserMsgs = deserMsg("src/test/resources/PCReq.1.bin");
190 specMessages.clear();
191 specMessages.add(specMessage);
192 assertEquals(deserMsgs.toString(), specMessages.toString());
194 requests = new ArrayList<CompositeRequestObject>();
195 requests.add(new CompositeRequestObject(this.requestParameter, new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress2), new IPv4Address(ipAdress2)), null, null, null, null, null, null, null, null, new PCEPLoadBalancingObject(3, new Bandwidth(ByteArray.floatToBytes((float) 1024.75)), false)));
196 specMessage = new PCEPRequestMessage(requests);
197 deserMsgs = deserMsg("src/test/resources/PCReq.2.bin");
198 specMessages.clear();
199 specMessages.add(specMessage);
200 assertEquals(deserMsgs.toString(), specMessages.toString());
202 requests = new ArrayList<CompositeRequestObject>();
203 requests.add(new CompositeRequestObject(this.requestParameter, new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress2), new IPv4Address(ipAdress2)), null, new PCEPLspObject(1, false, false, true, false), PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(1000)), false, false), new ArrayList<PCEPMetricObject>() {
204 private static final long serialVersionUID = 1L;
207 this.add(new PCEPMetricObject(true, true, new IGPMetric(53L), false, false));
209 }, new PCEPReportedRouteObject(this.rroSubobjects, false), new PCEPExistingPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new PCEPIncludeRouteObject(this.eroSubobjects, false, false), new PCEPLoadBalancingObject(5, new Bandwidth(ByteArray.floatToBytes(3)), false)));
211 List<CompositeRequestSvecObject> svecList = new ArrayList<CompositeRequestSvecObject>();
212 svecList.add(new CompositeRequestSvecObject(new PCEPSvecObject(true, false, false, false, false, this.requestIds, false)));
214 specMessage = new PCEPRequestMessage(svecList, requests);
215 deserMsgs = deserMsg("src/test/resources/PCReq.3.bin");
216 specMessages.clear();
217 specMessages.add(specMessage);
219 // assertEquals(deserMsgs, specMessages);
221 specMessages.clear();
222 requests = new ArrayList<CompositeRequestObject>();
223 requests.add(new CompositeRequestObject(this.requestParameter, new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress2), new IPv4Address(ipAdress2)), null, null, null, null, null, null, null, null, null));
224 specMessages.add(new PCEPRequestMessage(requests));
226 final byte[] ipAdress3 = { (byte) 0x7F, (byte) 0x00, (byte) 0x30, (byte) 0x01 };
227 requests = new ArrayList<CompositeRequestObject>();
228 requests.add(new CompositeRequestObject(new PCEPRequestParameterObject(false, false, false, false, false, false, false, false, (short) 4, 1, true, false), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress3), new IPv4Address(ipAdress2)), null, null, null, null, null, null, null, null, null));
229 specMessages.add(new PCEPRequestMessage(requests));
231 final byte[] ipAdress4 = { (byte) 0x7F, (byte) 0x30, (byte) 0x00, (byte) 0x01 };
232 requests = new ArrayList<CompositeRequestObject>();
233 requests.add(new CompositeRequestObject(this.requestParameter, new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress2), new IPv4Address(ipAdress4)), null, null, null, null, null, null, null, null, null));
234 specMessages.add(new PCEPRequestMessage(requests));
236 final byte[] ipAdress5 = { (byte) 0x7F, (byte) 0xd0, (byte) 0x00, (byte) 0x01 };
237 requests = new ArrayList<CompositeRequestObject>();
238 requests.add(new CompositeRequestObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 1, true, false), new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress5), new IPv4Address(ipAdress5)), null, null, null, null, null, null, null, null, null));
240 specMessages.add(new PCEPRequestMessage(requests));
241 deserMsgs = deserMsg("src/test/resources/PCReq.4.bin");
242 assertEquals(deserMsgs.toString(), specMessages.toString());
244 specMessages.clear();
245 svecList = new ArrayList<CompositeRequestSvecObject>();
246 svecList.add(new CompositeRequestSvecObject(new PCEPSvecObject(true, false, false, false, false, this.requestIds, false)));
247 svecList.add(new CompositeRequestSvecObject(new PCEPSvecObject(false, true, true, false, false, this.requestIds, false), new PCEPObjectiveFunctionObject(PCEPOFCodes.MCC, true, false), new PCEPGlobalConstraintsObject((short) 0x55, (short) 1, (short) 100, (short) 0x26, true, false), new PCEPExcludeRouteObject(new ArrayList<ExcludeRouteSubobject>() {
248 private static final long serialVersionUID = 1L;
251 this.add(new XROAsNumberSubobject(new AsNumber((long) 0x12), true));
253 }, true, true, false), new ArrayList<PCEPMetricObject>() {
254 private static final long serialVersionUID = 1L;
257 this.add(new PCEPMetricObject(true, true, new TEMetric(123456L), true, false));
261 requests = new ArrayList<CompositeRequestObject>();
262 requests.add(new CompositeRequestObject(this.requestParameter, new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress2), new IPv4Address(ipAdress2)), null, null, PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(1000)), false, false), new ArrayList<PCEPMetricObject>() {
263 private static final long serialVersionUID = 1L;
266 this.add(new PCEPMetricObject(true, true, new IGPMetric(53L), false, false));
267 this.add(new PCEPMetricObject(true, true, new IGPMetric(5335L), false, false));
268 this.add(new PCEPMetricObject(true, true, new IGPMetric(128256), false, false));
270 }, new PCEPReportedRouteObject(this.rroSubobjects, false), new PCEPExistingPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new PCEPIncludeRouteObject(this.eroSubobjects, false, false), new PCEPLoadBalancingObject(5, new Bandwidth(ByteArray.floatToBytes(3)), false)));
272 final byte[] ipAdress6 = { (byte) 0x7F, (byte) 0xF0, (byte) 0x00, (byte) 0x01 };
273 specMessages.add(new PCEPRequestMessage(svecList, requests));
275 requests = new ArrayList<CompositeRequestObject>();
276 requests.add(new CompositeRequestObject(this.requestParameter, new PCEPEndPointsObject<IPv4Address>(new IPv4Address(ipAdress6), new IPv4Address(ipAdress6)), null, null, PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(1000)), false, false), new ArrayList<PCEPMetricObject>() {
277 private static final long serialVersionUID = 1L;
280 this.add(new PCEPMetricObject(true, true, new IGPMetric(53L), false, false));
282 }, new PCEPReportedRouteObject(this.rroSubobjects, false), new PCEPExistingPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new PCEPIncludeRouteObject(this.eroSubobjects, false, false), new PCEPLoadBalancingObject(5, new Bandwidth(ByteArray.floatToBytes(3f)), false)));
283 deserMsgs = deserMsg("src/test/resources/PCReq.5.bin");
284 specMessages.add(new PCEPRequestMessage(svecList, requests));
286 // assertEquals(deserMsgs, specMessages);
288 // FIXME: need construct with invalid processed parameter
289 // assertEquals(deserMsg("src/test/resources/PCReq.6.invalid.bin"),
291 // new PCEPErrorMessage(new CompositeErrorObject(new
292 // PCEPRequestParameterObject(true, false, false, false, false, false,
293 // false, false, (short) 3,
294 // 1L, false, false), new PCEPErrorObject(PCEPErrors.P_FLAG_NOT_SET))),
295 // new PCEPRequestMessage(asList(new
296 // CompositeRequestObject(this.requestParameter, new
297 // PCEPEndPointsObject<IPv4Address>(IPv4Address
298 // .getNetworkAddressFactory().getNetworkAddressForBytes(new byte[] {
299 // 127, 0, 0, 1 }), IPv4Address.getNetworkAddressFactory()
300 // .getNetworkAddressForBytes(new byte[] { 127, 0, 0, 1 })), null, null,
301 // null, null, null, null, null, null, new PCEPLoadBalancingObject(
302 // 3, new Bandwidth(1024.75), false))))));
307 public void testRequestMessageValidationFromRawMsg() throws PCEPDeserializerException {
308 List<PCEPObject> objs = new ArrayList<PCEPObject>();
310 PCEPRequestParameterObject tmpRP;
312 // test unrecognized object in svec list
313 objs.add(this.svecObj);
314 objs.add(new UnknownObject(true, false, PCEPErrors.UNRECOGNIZED_OBJ_CLASS));
315 objs.add(new PCEPSvecObject(true, true, true, false, false, PCEPValidatorTest.this.requestIds, true));
317 msgs = PCEPMessageValidator.getValidator(PCEPMessageType.REQUEST).validate(objs);
319 assertEquals(msgs.get(0).toString(), new PCEPErrorMessage(new ArrayList<PCEPErrorObject>() {
320 private static final long serialVersionUID = 1L;
323 this.add(new PCEPErrorObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS));
327 // test with request p flag not set and ignoracion of more than one
328 // end-points objects
329 objs = new ArrayList<PCEPObject>();
330 objs.add(this.svecObj);
331 objs.add(this.svecObj);
332 tmpRP = new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false);
334 objs.add(this.endPoints);
336 objs.add(this.requestParameter);
337 objs.add(this.endPoints);
338 objs.add(this.endPoints);
339 // FIXME:mv use object constructor with set processed flag
340 // objs.add(this.classTypeProvider);
341 // objs.add(this.requestParameter);
342 // objs.add(this.endPointsProvider);
343 // objs.add(new PCEPClassTypeObjectProvider((short) 7, false));
345 msgs = PCEPMessageValidator.getValidator(PCEPMessageType.REQUEST).validate(objs);
346 // FIXME:mv use object constructor with set processed flag
347 // assertEquals(msgs.get(0), new PCEPErrorMessage(new
348 // CompositeErrorObject(tmpRP, new
349 // PCEPErrorObject(PCEPErrors.P_FLAG_NOT_SET))));
352 // new PCEPRequestMessage(asList(new
353 // CompositeRequestSvecObject(this.svecObj), new
354 // CompositeRequestSvecObject(this.svecObj)), Util
355 // .asList(new CompositeRequestObject(this.requestParameter,
356 // this.endPoints, this.classType, null, null, null, null, null, null,
359 // assertEquals(msgs.get(2), new PCEPErrorMessage(new
360 // CompositeErrorObject(tmpRP, new
361 // PCEPErrorObject(PCEPErrors.P_FLAG_NOT_SET))));
365 public void testReplyMessageValidatorFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
366 DeserializerException, DocumentedException {
368 List<PCEPReplyMessage> specMessages = new ArrayList<PCEPReplyMessage>();
369 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 5, 0xDEADBEEFL, true, true)))));
370 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, true, true, false, false, false, false, false, (short) 7, 0x12345678L, false, false)))));
371 assertEquals(deserMsg("src/test/resources/PCEPReplyMessage1.bin").toString(), specMessages.toString());
373 specMessages = new ArrayList<PCEPReplyMessage>();
374 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false)))));
375 assertEquals(deserMsg("src/test/resources/PCRep.1.bin").toString(), specMessages.toString());
377 specMessages = new ArrayList<PCEPReplyMessage>();
378 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false)))));
379 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(false, false, false, false, false, false, false, false, (short) 5, 2, false, false), new PCEPNoPathObject((short) 0, false, false), null, null, null, null, null, null))));
380 assertEquals(deserMsg("src/test/resources/PCRep.2.bin").toString(), specMessages.toString());
382 specMessages = new ArrayList<PCEPReplyMessage>();
383 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false), new PCEPNoPathObject((short) 1, true, false), new PCEPLspObject(1, true, true, false, true), PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(500)), false, false), new ArrayList<PCEPMetricObject>() {
384 private static final long serialVersionUID = 1L;
387 this.add(new PCEPMetricObject(true, true, new IGPMetric(234), false, false));
389 }, new PCEPIncludeRouteObject(this.eroSubobjects, false, false), new ArrayList<CompositePathObject>() {
390 private static final long serialVersionUID = 1L;
393 this.add(new CompositePathObject(new PCEPExplicitRouteObject(PCEPValidatorTest.this.eroSubobjects, false), lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(500)), false, false), new ArrayList<PCEPMetricObject>() {
394 private static final long serialVersionUID = 1L;
397 this.add(new PCEPMetricObject(true, true, new IGPMetric(234L), false, false));
399 }, new PCEPIncludeRouteObject(PCEPValidatorTest.this.eroSubobjects, false, false)));
403 // assertEquals(deserMsg("src/test/resources/PCRep.3.bin"), specMessages);
405 specMessages = new ArrayList<PCEPReplyMessage>();
406 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 7, 1, false, false)))));
407 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 2, false, false)))));
408 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 2, 4, false, false)))));
409 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(false, false, false, false, false, false, false, false, (short) 3, 4, false, false)))));
410 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(false, false, false, false, false, false, false, false, (short) 6, 5, false, false)))));
411 assertEquals(deserMsg("src/test/resources/PCRep.4.bin").toString(), specMessages.toString());
413 specMessages = new ArrayList<PCEPReplyMessage>();
414 final List<Long> requestIDs = new ArrayList<Long>();
415 requestIDs.add(0x25069045L);
417 final List<PCEPMetricObject> metrics = new ArrayList<PCEPMetricObject>();
418 metrics.add(new PCEPMetricObject(true, true, new IGPMetric(234L), true, false));
420 final List<CompositeReplySvecObject> svecList = new ArrayList<CompositeReplySvecObject>();
421 svecList.add(new CompositeReplySvecObject(new PCEPSvecObject(true, true, true, false, false, requestIDs, true), new PCEPObjectiveFunctionObject(PCEPOFCodes.MCC, true, false), metrics));
423 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false), new PCEPNoPathObject((short) 1, true, false), null, PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(500)), false, false), new ArrayList<PCEPMetricObject>() {
424 private static final long serialVersionUID = 1L;
427 this.add(new PCEPMetricObject(true, true, new IGPMetric(234), false, false));
429 }, new PCEPIncludeRouteObject(this.eroSubobjects, false, false), new ArrayList<CompositePathObject>() {
430 private static final long serialVersionUID = 1L;
433 this.add(new CompositePathObject(new PCEPExplicitRouteObject(PCEPValidatorTest.this.eroSubobjects, false), lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(500)), false, false), new ArrayList<PCEPMetricObject>() {
434 private static final long serialVersionUID = 1L;
437 this.add(new PCEPMetricObject(true, true, new IGPMetric(234L), false, false));
438 this.add(new PCEPMetricObject(true, true, new IGPMetric(5355L), false, false));
439 this.add(new PCEPMetricObject(true, true, new IGPMetric(5353L), false, false));
441 }, new PCEPIncludeRouteObject(PCEPValidatorTest.this.eroSubobjects, false, false)));
444 specMessages.add(new PCEPReplyMessage(asList(new CompositeResponseObject(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false), new PCEPNoPathObject((short) 1, true, false), null, PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(500)), false, false), new ArrayList<PCEPMetricObject>() {
445 private static final long serialVersionUID = 1L;
448 this.add(new PCEPMetricObject(true, true, new IGPMetric(234), false, false));
450 }, new PCEPIncludeRouteObject(this.eroSubobjects, false, false), new ArrayList<CompositePathObject>() {
451 private static final long serialVersionUID = 1L;
454 this.add(new CompositePathObject(new PCEPExplicitRouteObject(PCEPValidatorTest.this.eroSubobjects, false), lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(500)), false, false), new ArrayList<PCEPMetricObject>() {
455 private static final long serialVersionUID = 1L;
458 this.add(new PCEPMetricObject(true, true, new IGPMetric(234L), false, false));
460 }, new PCEPIncludeRouteObject(PCEPValidatorTest.this.eroSubobjects, false, false)));
461 this.add(new CompositePathObject(new PCEPExplicitRouteObject(PCEPValidatorTest.this.eroSubobjects, false), lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(500)), false, false), new ArrayList<PCEPMetricObject>() {
462 private static final long serialVersionUID = 1L;
465 this.add(new PCEPMetricObject(true, true, new IGPMetric(234L), false, false));
467 }, new PCEPIncludeRouteObject(PCEPValidatorTest.this.eroSubobjects, false, false)));
470 assertEquals(deserMsg("src/test/resources/PCRep.5.bin").toString(), specMessages.toString());
474 public void testUpdMessageValidatorFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
475 DeserializerException, DocumentedException {
476 List<Message> specMessages = Lists.newArrayList();
478 List<CompositeUpdateRequestObject> requests = new ArrayList<CompositeUpdateRequestObject>();
479 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true)));
481 specMessages.add(new PCEPUpdateRequestMessage(requests));
482 assertEquals(deserMsg("src/test/resources/PCUpd.1.bin").toString(), specMessages.toString());
484 specMessages = Lists.newArrayList();
485 List<CompositeUpdPathObject> paths = new ArrayList<CompositeUpdPathObject>();
486 paths.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, null, null));
487 requests = new ArrayList<CompositeUpdateRequestObject>();
488 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true), paths));
489 specMessages.add(new PCEPUpdateRequestMessage(requests));
490 assertEquals(deserMsg("src/test/resources/PCUpd.2.bin").toString(), specMessages.toString());
492 specMessages = Lists.newArrayList();
493 paths = new ArrayList<CompositeUpdPathObject>();
494 paths.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new ArrayList<PCEPMetricObject>() {
495 private static final long serialVersionUID = 1L;
498 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
501 requests = new ArrayList<CompositeUpdateRequestObject>();
502 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true), paths));
503 specMessages.add(new PCEPUpdateRequestMessage(requests));
504 assertEquals(deserMsg("src/test/resources/PCUpd.3.bin").toString(), specMessages.toString());
506 specMessages = Lists.newArrayList();
507 requests = new ArrayList<CompositeUpdateRequestObject>();
508 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true)));
509 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true)));
510 specMessages.add(new PCEPUpdateRequestMessage(requests));
511 assertEquals(deserMsg("src/test/resources/PCUpd.4.bin").toString(), specMessages.toString());
513 specMessages = Lists.newArrayList();
514 requests = new ArrayList<CompositeUpdateRequestObject>();
515 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true)));
516 paths = new ArrayList<CompositeUpdPathObject>();
517 paths.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new ArrayList<PCEPMetricObject>() {
518 private static final long serialVersionUID = 1L;
521 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
524 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true), paths));
525 paths = new ArrayList<CompositeUpdPathObject>();
526 paths.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new ArrayList<PCEPMetricObject>() {
527 private static final long serialVersionUID = 1L;
530 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
533 paths.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new ArrayList<PCEPMetricObject>() {
534 private static final long serialVersionUID = 1L;
537 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
540 paths.add(new CompositeUpdPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPRequestedPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new ArrayList<PCEPMetricObject>() {
541 private static final long serialVersionUID = 1L;
544 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
545 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
548 requests.add(new CompositeUpdateRequestObject(new PCEPLspObject(1, true, false, true, true), paths));
549 specMessages.add(new PCEPUpdateRequestMessage(requests));
550 assertEquals(deserMsg("src/test/resources/PCUpd.5.bin").toString(), specMessages.toString());
554 public void testRptMessageValidatorFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
555 DeserializerException, DocumentedException {
556 List<Message> specMessages = Lists.newArrayList();
557 List<CompositeStateReportObject> reports = new ArrayList<CompositeStateReportObject>();
558 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true)));
559 specMessages.add(new PCEPReportMessage(reports));
560 assertEquals(deserMsg("src/test/resources/PCRpt.1.bin").toString(), specMessages.toString());
562 specMessages = Lists.newArrayList();
563 List<CompositeRptPathObject> paths = new ArrayList<CompositeRptPathObject>();
564 paths.add(new CompositeRptPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, null, null, null));
565 reports = new ArrayList<CompositeStateReportObject>();
566 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true), paths));
567 specMessages.add(new PCEPReportMessage(reports));
568 assertEquals(deserMsg("src/test/resources/PCRpt.2.bin").toString(), specMessages.toString());
570 specMessages = Lists.newArrayList();
571 paths = new ArrayList<CompositeRptPathObject>();
572 paths.add(new CompositeRptPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPExistingPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new PCEPReportedRouteObject(this.rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
573 private static final long serialVersionUID = 1L;
576 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
580 reports = new ArrayList<CompositeStateReportObject>();
581 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true), paths));
582 specMessages.add(new PCEPReportMessage(reports));
585 // assertEquals(deserMsg("src/test/resources/PCRpt.3.bin"), specMessages);
587 specMessages = Lists.newArrayList();
588 reports = new ArrayList<CompositeStateReportObject>();
589 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true)));
590 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true)));
591 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true)));
592 specMessages.add(new PCEPReportMessage(reports));
593 assertEquals(deserMsg("src/test/resources/PCRpt.4.bin").toString(), specMessages.toString());
595 specMessages = Lists.newArrayList();
596 reports = new ArrayList<CompositeStateReportObject>();
597 paths = new ArrayList<CompositeRptPathObject>();
598 paths.add(new CompositeRptPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPExistingPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new PCEPReportedRouteObject(this.rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
599 private static final long serialVersionUID = 1L;
602 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
605 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true), paths));
606 paths = new ArrayList<CompositeRptPathObject>();
607 paths.add(new CompositeRptPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPExistingPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new PCEPReportedRouteObject(this.rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
608 private static final long serialVersionUID = 1L;
611 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
612 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
613 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
616 paths.add(new CompositeRptPathObject(new PCEPExplicitRouteObject(this.eroSubobjects, false), PCEPValidatorTest.lspa, new PCEPExistingPathBandwidthObject(new Bandwidth(ByteArray.floatToBytes(5353)), false, false), new PCEPReportedRouteObject(this.rroSubobjects, false), new ArrayList<PCEPMetricObject>() {
617 private static final long serialVersionUID = 1L;
620 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
623 reports.add(new CompositeStateReportObject(new PCEPLspObject(1, true, false, true, true), paths));
624 specMessages.add(new PCEPReportMessage(reports));
626 // assertEquals(deserMsg("src/test/resources/PCRpt.5.bin").toString(), specMessages.toString());
630 public void testPCCreateMessage() throws DeserializerException, DocumentedException, PCEPDeserializerException {
631 final List<CompositeInstantiationObject> insts = new ArrayList<CompositeInstantiationObject>();
632 final List<ExplicitRouteSubobject> subs = new ArrayList<ExplicitRouteSubobject>();
633 subs.add(new EROAsNumberSubobject(new AsNumber((long) 10), false));
634 final List<PCEPTlv> tlvs = new ArrayList<PCEPTlv>();
635 final LSPSymbolicNameTlv tlv = new LSPSymbolicNameTlv(new LSPSymbolicName(new byte[] { 5, 4 }));
637 insts.add(new CompositeInstantiationObject(new PCEPEndPointsObject<IPv4Address>(IPv4.FAMILY.addressForString("127.0.0.2"), IPv4.FAMILY.addressForString("127.0.0.1")), PCEPValidatorTest.lspa, new PCEPExplicitRouteObject(subs, true), null, new ArrayList<PCEPMetricObject>() {
638 private static final long serialVersionUID = 1L;
641 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
642 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
643 this.add(new PCEPMetricObject(true, false, new IGPMetric(4L), false, false));
646 final PCCreateMessage msg = new PCCreateMessage(insts);
648 final byte[] bytes = msgFactory.put(msg);
650 // FIXME: need construct with invalid processed parameter
651 final RawMessage rawMessage = (RawMessage) msgFactory.parse(bytes).get(0);
653 assertEquals(PCEPMessageValidator.getValidator(rawMessage.getMsgType()).validate(rawMessage.getAllObjects()).toString(),
654 asList((Message) msg).toString());
658 public void testNotificationValidatorFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
659 DeserializerException, DocumentedException {
660 List<CompositeNotifyObject> notifications = new ArrayList<CompositeNotifyObject>();
661 List<PCEPNotificationObject> notificationsList = new ArrayList<PCEPNotificationObject>();
662 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 1));
663 notifications.add(new CompositeNotifyObject(notificationsList));
664 PCEPNotificationMessage specMessage = new PCEPNotificationMessage(notifications);
665 assertEquals(deserMsg("src/test/resources/PCNtf.1.bin").toString(), asList((Message) specMessage).toString());
667 notifications = new ArrayList<CompositeNotifyObject>();
668 notificationsList = new ArrayList<PCEPNotificationObject>();
669 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 1));
670 List<PCEPRequestParameterObject> requestsList = new ArrayList<PCEPRequestParameterObject>();
671 requestsList.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false));
672 notifications.add(new CompositeNotifyObject(requestsList, notificationsList));
673 specMessage = new PCEPNotificationMessage(notifications);
674 assertEquals(deserMsg("src/test/resources/PCNtf.2.bin").toString(), asList((Message) specMessage).toString());
676 notifications = new ArrayList<CompositeNotifyObject>();
677 notificationsList = new ArrayList<PCEPNotificationObject>();
678 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 1));
679 requestsList = new ArrayList<PCEPRequestParameterObject>();
680 requestsList.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 10, false, false));
681 notifications.add(new CompositeNotifyObject(requestsList, notificationsList));
682 specMessage = new PCEPNotificationMessage(notifications);
683 assertEquals(deserMsg("src/test/resources/PCNtf.3.bin").toString(), asList((Message) specMessage).toString());
685 notifications = new ArrayList<CompositeNotifyObject>();
686 notificationsList = new ArrayList<PCEPNotificationObject>();
687 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 1));
688 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 2));
689 notificationsList.add(new PCEPNotificationObject((short) 2, (short) 1));
690 notificationsList.add(new PCEPNotificationObject((short) 2, (short) 2));
691 notifications.add(new CompositeNotifyObject(notificationsList));
692 specMessage = new PCEPNotificationMessage(notifications);
693 assertEquals(deserMsg("src/test/resources/PCNtf.4.bin").toString(), asList((Message) specMessage).toString());
695 notifications = new ArrayList<CompositeNotifyObject>();
696 notificationsList = new ArrayList<PCEPNotificationObject>();
697 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 1));
698 requestsList = new ArrayList<PCEPRequestParameterObject>();
699 requestsList.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 10, false, false));
700 notifications.add(new CompositeNotifyObject(requestsList, notificationsList));
701 notificationsList = new ArrayList<PCEPNotificationObject>();
702 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 1));
703 notificationsList.add(new PCEPNotificationObject((short) 1, (short) 1));
704 requestsList = new ArrayList<PCEPRequestParameterObject>();
705 requestsList.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 10, false, false));
706 requestsList.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 10, false, false));
707 notifications.add(new CompositeNotifyObject(requestsList, notificationsList));
708 specMessage = new PCEPNotificationMessage(notifications);
709 assertEquals(deserMsg("src/test/resources/PCNtf.5.bin").toString(), asList((Message) specMessage).toString());
713 public void testErrorMessageValidatoinFromBin() throws IOException, PCEPDeserializerException, PCEPDocumentedException,
714 DeserializerException, DocumentedException {
715 List<PCEPErrorObject> errorsList = new ArrayList<PCEPErrorObject>();
716 errorsList.add(new PCEPErrorObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS));
718 PCEPErrorMessage specMessage = new PCEPErrorMessage(errorsList);
719 assertEquals(deserMsg("src/test/resources/PCErr.1.bin").toString(), asList((Message) specMessage).toString());
721 List<PCEPRequestParameterObject> requests = new ArrayList<PCEPRequestParameterObject>();
722 requests.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 3, 1, false, false));
724 List<CompositeErrorObject> errors = new ArrayList<CompositeErrorObject>();
725 errors.add(new CompositeErrorObject(requests, errorsList));
727 specMessage = new PCEPErrorMessage(errors);
728 assertEquals(deserMsg("src/test/resources/PCErr.2.bin").toString(), asList((Message) specMessage).toString());
730 specMessage = new PCEPErrorMessage(new PCEPOpenObject(0, 0, 0), errorsList, null);
731 assertEquals(deserMsg("src/test/resources/PCErr.3.bin").toString(), asList((Message) specMessage).toString());
733 requests = new ArrayList<PCEPRequestParameterObject>();
734 requests.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 53, false, false));
736 errors = new ArrayList<CompositeErrorObject>();
737 errors.add(new CompositeErrorObject(requests, errorsList));
739 specMessage = new PCEPErrorMessage(errors);
740 assertEquals(deserMsg("src/test/resources/PCErr.3b.bin").toString(), asList((Message) specMessage).toString());
742 errorsList = new ArrayList<PCEPErrorObject>();
743 errorsList.add(new PCEPErrorObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS));
744 errorsList.add(new PCEPErrorObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS));
745 errorsList.add(new PCEPErrorObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS));
747 specMessage = new PCEPErrorMessage(null, errorsList, null);
748 assertEquals(deserMsg("src/test/resources/PCErr.4.bin").toString(), asList((Message) specMessage).toString());
750 requests = new ArrayList<PCEPRequestParameterObject>();
751 requests.add(new PCEPRequestParameterObject(true, false, false, false, false, false, false, false, (short) 1, 53, false, false));
753 errorsList = new ArrayList<PCEPErrorObject>();
754 errorsList.add(new PCEPErrorObject(PCEPErrors.UNRECOGNIZED_OBJ_CLASS));
756 errors = new ArrayList<CompositeErrorObject>();
757 errors.add(new CompositeErrorObject(requests, errorsList));
758 errors.add(new CompositeErrorObject(requests, errorsList));
760 specMessage = new PCEPErrorMessage(errors);
761 assertEquals(deserMsg("src/test/resources/PCErr.5.bin").toString(), asList((Message) specMessage).toString());