+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.protocol.pcep;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.opendaylight.protocol.framework.DocumentedException;
-
-/**
- * There are several errors documented in RFC5440 or in draft, that have
- * specific meaning for the PCE. This exception is used, when any of those
- * errors occurs.
- */
-public class PCEPDocumentedException extends DocumentedException {
-
- private static final long serialVersionUID = 5146586011100522025L;
-
- private final PCEPErrors error;
-
- private static final Logger logger = LoggerFactory.getLogger(PCEPDocumentedException.class);
-
- /**
- * Used when an error occured that is described in rfc or draft
- *
- * @param message
- * message bound with this exception
- * @param error
- * specific documented error
- */
- public PCEPDocumentedException(String message, PCEPErrors error) {
- super(message);
- this.error = error;
- logger.error("Error = " + error, this);
- }
-
- /**
- * Returns specific documented error
- *
- * @return documented error
- */
- public PCEPErrors getError() {
- return this.error;
- }
-}
import org.junit.Test;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
public class APITest {
assertEquals("Some error message.", e1.getErrorMessage());
assertTrue(e1.getCause() instanceof IllegalArgumentException);
}
-
- @Test
- public void testDocumentedException() throws PCEPDocumentedException {
- final PCEPDocumentedException de = new PCEPDocumentedException("", PCEPErrors.C_BIT_SET);
- assertEquals(PCEPErrors.C_BIT_SET, de.getError());
- }
}
import javax.annotation.concurrent.GuardedBy;
import org.opendaylight.protocol.framework.AbstractSessionNegotiator;
-import org.opendaylight.protocol.pcep.PCEPErrors;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.OpenBuilder;
import org.opendaylight.protocol.framework.AbstractProtocolSession;
import org.opendaylight.protocol.pcep.PCEPCloseTermination;
-import org.opendaylight.protocol.pcep.PCEPErrors;
import org.opendaylight.protocol.pcep.PCEPSession;
import org.opendaylight.protocol.pcep.PCEPSessionListener;
import org.opendaylight.protocol.pcep.TerminationReason;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.CloseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
import org.opendaylight.protocol.concepts.Ipv4Util;
import org.opendaylight.protocol.concepts.Ipv6Util;
-import org.opendaylight.protocol.pcep.PCEPErrorMapping;
-import org.opendaylight.protocol.pcep.PCEPErrorMapping.PCEPErrorIdentifier;
-import org.opendaylight.protocol.pcep.PCEPErrors;
+import org.opendaylight.protocol.pcep.spi.PCEPErrorMapping;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
+import org.opendaylight.protocol.pcep.spi.PCEPErrorMapping.PCEPErrorIdentifier;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
import java.util.List;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrorMapping;
-import org.opendaylight.protocol.pcep.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.MessageParser;
import org.opendaylight.protocol.pcep.spi.MessageSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
import org.opendaylight.protocol.pcep.spi.ObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
+import org.opendaylight.protocol.pcep.spi.PCEPErrorMapping;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.primitives.UnsignedBytes;
public abstract class AbstractMessageParser implements MessageParser, MessageSerializer {
- private static final Logger LOG = LoggerFactory.getLogger(AbstractMessageParser.class);
private static final int COMMON_OBJECT_HEADER_LENGTH = 4;
maping.getFromErrorsEnum(e).value).build()).build())).build()).build();
}
- // FIXME: remove PCEPDocumentedException
- abstract protected Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException, PCEPDocumentedException;
+ abstract protected Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException;
@Override
public final Message parseMessage(final byte[] buffer, final List<Message> errors) throws PCEPDeserializerException {
final List<Object> objs = parseObjects(buffer);
// Run validation
- try {
- return validate(objs, errors);
- } catch (PCEPDocumentedException e) {
- LOG.info("Message failed to validate", e);
- errors.add(createErrorMsg(e.getError()));
- return null;
- }
+ return validate(objs, errors);
}
}
import java.util.List;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.UnknownObject;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
}
@Override
- protected PcerrMessage validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException, PCEPDocumentedException {
+ protected PcerrMessage validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
if (objects == null) {
throw new IllegalArgumentException("Passed list can't be null.");
}
objects.remove(0);
} else if (obj instanceof Rp) {
final Rp o = ((Rp) obj);
- if (o.isProcessingRule()) {
- throw new PCEPDocumentedException("Invalid setting of P flag.", PCEPErrors.P_FLAG_NOT_SET);
- }
requestParameters.add(new RpsBuilder().setRp(o).build());
state = State.RpIn;
objects.remove(0);
state = State.Error;
if (obj instanceof Rp) {
final Rp o = ((Rp) obj);
- if (o.isProcessingRule()) {
- throw new PCEPDocumentedException("Invalid setting of P flag.", PCEPErrors.P_FLAG_NOT_SET);
- }
requestParameters.add(new RpsBuilder().setRp(o).build());
state = State.RpIn;
break;
import io.netty.buffer.ByteBuf;
-import java.util.Arrays;
import java.util.List;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrorMapping;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.UnknownObject;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcntfBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.PcntfMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.notification.object.CNotification;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessageBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.PcntfMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.Notifications;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.NotificationsBuilder;
throw new PCEPDeserializerException("Notification message cannot be empty.");
}
- final PCEPErrorMapping maping = PCEPErrorMapping.getInstance();
-
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.Notifications> compositeNotifications = Lists.newArrayList();
while (!objects.isEmpty()) {
org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.Notifications comObj;
- try {
- comObj = getValidNotificationComposite(objects);
- } catch (final PCEPDocumentedException e) {
- final PcerrMessageBuilder b = new PcerrMessageBuilder();
- b.setErrors(Arrays.asList(new ErrorsBuilder().setErrorObject(
- new ErrorObjectBuilder().setType(maping.getFromErrorsEnum(e.getError()).type).setValue(
- maping.getFromErrorsEnum(e.getError()).value).build()).build()));
- return new PcerrBuilder().setPcerrMessage(b.build()).build();
- }
+ comObj = getValidNotificationComposite(objects);
if (comObj == null) {
break;
}
-
compositeNotifications.add(comObj);
}
}
private static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.Notifications getValidNotificationComposite(
- final List<Object> objects) throws PCEPDocumentedException {
+ final List<Object> objects) {
final List<Rps> requestParameters = Lists.newArrayList();
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcntf.message.pcntf.message.notifications.Notifications> notifications = Lists.newArrayList();
Object obj;
State state = State.Init;
while (!objects.isEmpty() && !state.equals(State.End)) {
obj = objects.get(0);
-
- if (obj instanceof UnknownObject) {
- throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
- }
-
switch (state) {
case Init:
state = State.RpIn;
if (obj instanceof Rp) {
final Rp rp = (Rp) obj;
- if (rp.isProcessingRule()) {
- throw new PCEPDocumentedException("Invalid setting of P flag.", PCEPErrors.P_FLAG_NOT_SET);
- }
requestParameters.add(new RpsBuilder().setRp(rp).build());
state = State.Init;
break;
import java.util.List;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.UnknownObject;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcrep;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcrepBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
}
@Override
- protected Pcrep validate(final List<Object> objects, final List<Message> errors) throws PCEPDocumentedException {
+ protected Pcrep validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
+ if (objects == null) {
+ throw new IllegalArgumentException("Passed list can't be null.");
+ }
+ if (objects.isEmpty()) {
+ throw new PCEPDeserializerException("Pcrep message cannot be empty.");
+ }
final List<Replies> replies = Lists.newArrayList();
while (!objects.isEmpty()) {
- replies.add(this.getValidReply(objects));
+ final Replies r = this.getValidReply(objects, errors);
+ if (r != null) {
+ replies.add(r);
+ }
+ }
+ if (!objects.isEmpty()) {
+ throw new PCEPDeserializerException("Unprocessed Objects: " + objects);
}
return new PcrepBuilder().setPcrepMessage(new PcrepMessageBuilder().setReplies(replies).build()).build();
}
- private Replies getValidReply(final List<Object> objects) throws PCEPDocumentedException {
+ private Replies getValidReply(final List<Object> objects, final List<Message> errors) {
if (!(objects.get(0) instanceof Rp)) {
- throw new PCEPDocumentedException("Pcrep message must contain at least one RP object.", PCEPErrors.RP_MISSING);
+ errors.add(createErrorMsg(PCEPErrors.RP_MISSING));
+ return null;
}
final Rp rp = (Rp) objects.get(0);
objects.remove(0);
return new RepliesBuilder().setRp(rp).setResult(res).build();
}
- private void parseAttributes(final FailureBuilder builder, final List<Object> objects) throws PCEPDocumentedException {
+ private void parseAttributes(final FailureBuilder builder, final List<Object> objects) {
final List<Metrics> pathMetrics = Lists.newArrayList();
Object obj;
break;
case End:
break;
- default:
- throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
}
if (!state.equals(State.End)) {
objects.remove(0);
builder.setMetrics(pathMetrics);
}
- private void parsePath(final PathsBuilder builder, final List<Object> objects) throws PCEPDocumentedException {
+ private void parsePath(final PathsBuilder builder, final List<Object> objects) {
final List<Metrics> pathMetrics = Lists.newArrayList();
Object obj;
break;
case End:
break;
- default:
- throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
}
if (!state.equals(State.End)) {
objects.remove(0);
import java.util.List;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.UnknownObject;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcrpt;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcrptBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
}
@Override
- public Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException, PCEPDocumentedException {
+ public Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
if (objects == null) {
throw new IllegalArgumentException("Passed list can't be null.");
}
final List<Reports> reports = Lists.newArrayList();
while (!objects.isEmpty()) {
- final Reports report = getValidReports(objects);
+ final Reports report = getValidReports(objects, errors);
if (reports != null) {
reports.add(report);
}
}
-
- if (!objects.isEmpty()) {
- if (objects.get(0) instanceof UnknownObject) {
- throw new PCEPDocumentedException("Unknown object encountered", ((UnknownObject) objects.get(0)).getError());
- }
- throw new PCEPDeserializerException("Unprocessed Objects: " + objects);
- }
return new PcrptBuilder().setPcrptMessage(new PcrptMessageBuilder().setReports(reports).build()).build();
}
- private Reports getValidReports(final List<Object> objects) throws PCEPDocumentedException {
+ private Reports getValidReports(final List<Object> objects, final List<Message> errors) {
final ReportsBuilder builder = new ReportsBuilder();
if (objects.get(0) instanceof Srp) {
builder.setSrp((Srp) objects.get(0));
builder.setLsp((Lsp) objects.get(0));
objects.remove(0);
} else {
- throw new PCEPDocumentedException("LSP object missing", PCEPErrors.LSP_MISSING);
+ errors.add(createErrorMsg(PCEPErrors.LSP_MISSING));
+ return null;
}
if (!objects.isEmpty()) {
final PathBuilder pBuilder = new PathBuilder();
return builder.build();
}
- private void parsePath(final List<Object> objects, final PathBuilder builder) throws PCEPDocumentedException {
+ private void parsePath(final List<Object> objects, final PathBuilder builder) {
final List<Metrics> pathMetrics = Lists.newArrayList();
Object obj;
State state = State.Init;
break;
case End:
break;
- default:
- if (obj instanceof UnknownObject) {
- throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
- }
}
if (!state.equals(State.End)) {
objects.remove(0);
import java.util.List;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.UnknownObject;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcupd;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcupdBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
}
@Override
- protected Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException, PCEPDocumentedException {
+ protected Message validate(final List<Object> objects, final List<Message> errors) throws PCEPDeserializerException {
if (objects == null) {
throw new IllegalArgumentException("Passed list can't be null.");
}
final List<Updates> updateRequests = Lists.newArrayList();
while (!objects.isEmpty()) {
- final Updates update = getValidUpdates(objects);
+ final Updates update = getValidUpdates(objects, errors);
if (update != null) {
updateRequests.add(update);
}
}
if (!objects.isEmpty()) {
- if (objects.get(0) instanceof UnknownObject) {
- throw new PCEPDocumentedException("Unknown object encountered", ((UnknownObject) objects.get(0)).getError());
- }
throw new PCEPDeserializerException("Unprocessed Objects: " + objects);
}
return new PcupdBuilder().setPcupdMessage(new PcupdMessageBuilder().setUpdates(updateRequests).build()).build();
}
- private Updates getValidUpdates(final List<Object> objects) throws PCEPDocumentedException {
+ private Updates getValidUpdates(final List<Object> objects, final List<Message> errors) {
final UpdatesBuilder builder = new UpdatesBuilder();
if (objects.get(0) instanceof Srp) {
builder.setSrp((Srp) objects.get(0));
objects.remove(0);
} else {
- throw new PCEPDocumentedException("Srp object missing.", PCEPErrors.SRP_MISSING);
+ errors.add(createErrorMsg(PCEPErrors.SRP_MISSING));
+ return null;
}
if (objects.get(0) instanceof Lsp) {
builder.setLsp((Lsp) objects.get(0));
objects.remove(0);
} else {
- throw new PCEPDocumentedException("Lsp object missing.", PCEPErrors.LSP_MISSING);
+ errors.add(createErrorMsg(PCEPErrors.LSP_MISSING));
+ return null;
}
if (!objects.isEmpty()) {
final PathBuilder pBuilder = new PathBuilder();
pBuilder.setEro((Ero) objects.get(0));
objects.remove(0);
} else {
- throw new PCEPDocumentedException("Ero object missing.", PCEPErrors.ERO_MISSING);
+ errors.add(createErrorMsg(PCEPErrors.ERO_MISSING));
+ return null;
}
parsePath(objects, pBuilder);
builder.setPath(pBuilder.build());
return builder.build();
}
- private void parsePath(final List<Object> objects, final PathBuilder pBuilder) throws PCEPDocumentedException {
+ private void parsePath(final List<Object> objects, final PathBuilder pBuilder) {
final List<Metrics> pathMetrics = Lists.newArrayList();
Object obj;
State state = State.Init;
break;
case End:
break;
- default:
- if (obj instanceof UnknownObject) {
- throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
- }
}
if (!state.equals(State.End)) {
objects.remove(0);
import io.netty.buffer.ByteBuf;
-import java.util.Arrays;
import java.util.List;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
-import org.opendaylight.protocol.pcep.PCEPErrorMapping;
-import org.opendaylight.protocol.pcep.UnknownObject;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcerrBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Pcinitiate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.PcinitiateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lsp.object.Lsp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.Lspa;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.metric.object.Metric;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcep.error.object.ErrorObjectBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.PcerrMessageBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcerr.message.pcerr.message.ErrorsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.PcinitiateMessageBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.Requests;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.pcinitiate.message.pcinitiate.message.RequestsBuilder;
throw new IllegalArgumentException("Passed list can't be null.");
}
final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder();
- final PCEPErrorMapping maping = PCEPErrorMapping.getInstance();
final List<Requests> reqs = Lists.newArrayList();
Requests req = null;
while (!objects.isEmpty()) {
- try {
- req = this.getValidRequest(objects);
- if (req == null) {
- break;
- }
- } catch (final PCEPDocumentedException e) {
- final PcerrMessageBuilder b = new PcerrMessageBuilder();
- b.setErrors(Arrays.asList(new ErrorsBuilder().setErrorObject(
- new ErrorObjectBuilder().setType(maping.getFromErrorsEnum(e.getError()).type).setValue(
- maping.getFromErrorsEnum(e.getError()).value).build()).build()));
- return new PcerrBuilder().setPcerrMessage(b.build()).build();
+ req = this.getValidRequest(objects);
+ if (req == null) {
+ break;
}
reqs.add(req);
}
return new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build();
}
- private Requests getValidRequest(final List<Object> objects) throws PCEPDocumentedException {
+ private Requests getValidRequest(final List<Object> objects) {
final RequestsBuilder builder = new RequestsBuilder();
builder.setSrp((Srp) objects.get(0));
objects.remove(0);
break;
case End:
break;
- default:
- throw new PCEPDocumentedException("Unknown object", ((UnknownObject) obj).getError());
}
if (!state.equals(State.End)) {
objects.remove(0);
package org.opendaylight.protocol.pcep.impl.object;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.UnknownObject;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
package org.opendaylight.protocol.pcep.impl.object;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPErrors;
-import org.opendaylight.protocol.pcep.UnknownObject;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.TlvHandlerRegistry;
+import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
import org.mockito.MockitoAnnotations;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
-import org.opendaylight.protocol.pcep.PCEPErrorMapping;
-import org.opendaylight.protocol.pcep.PCEPErrors;
+import org.opendaylight.protocol.pcep.spi.PCEPErrorMapping;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Open;
import java.util.ArrayList;
import java.util.List;
-import org.opendaylight.protocol.pcep.PCEPErrors;
import org.opendaylight.protocol.pcep.PCEPSession;
import org.opendaylight.protocol.pcep.PCEPSessionListener;
import org.opendaylight.protocol.pcep.PCEPTerminationReason;
+import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.Open;
import org.slf4j.Logger;
import org.opendaylight.protocol.concepts.Ipv4Util;
import org.opendaylight.protocol.concepts.Ipv6Util;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.impl.object.PCEPBandwidthObjectParser;
import org.opendaylight.protocol.pcep.impl.object.PCEPClassTypeObjectParser;
import org.opendaylight.protocol.pcep.impl.object.PCEPCloseObjectParser;
}
@Test
- public void testOpenObjectWithTLV() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+ public void testOpenObjectWithTLV() throws PCEPDeserializerException, IOException {
final PCEPOpenObjectParser parser = new PCEPOpenObjectParser(this.tlvRegistry);
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPOpenObject1.bin");
}
@Test
- public void testCloseObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testCloseObject() throws IOException, PCEPDeserializerException {
final PCEPCloseObjectParser parser = new PCEPCloseObjectParser(this.tlvRegistry);
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPCloseObject1.bin");
}
@Test
- public void testLoadBalancingObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testLoadBalancingObject() throws IOException, PCEPDeserializerException {
final PCEPLoadBalancingObjectParser parser = new PCEPLoadBalancingObjectParser(this.tlvRegistry);
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPLoadBalancingObject1.bin");
}
@Test
- public void testLspObjectWithTLV() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testLspObjectWithTLV() throws IOException, PCEPDeserializerException {
final PCEPLspObjectParser parser = new PCEPLspObjectParser(this.tlvRegistry);
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPLspObject1WithTLV.bin");
}
@Test
- public void testBandwidthObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testBandwidthObject() throws IOException, PCEPDeserializerException {
final PCEPBandwidthObjectParser parser = new PCEPBandwidthObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPBandwidthObject1LowerBounds.bin");
}
@Test
- public void testEndPointsObjectIPv4() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testEndPointsObjectIPv4() throws IOException, PCEPDeserializerException {
final byte[] srcIPBytes = { (byte) 0xA2, (byte) 0xF5, (byte) 0x11, (byte) 0x0E };
final byte[] destIPBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF };
}
@Test
- public void testEndPointsObjectIPv6() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testEndPointsObjectIPv6() throws IOException, PCEPDeserializerException {
final byte[] destIPBytes = { (byte) 0x00, (byte) 0x02, (byte) 0x5D, (byte) 0xD2, (byte) 0xFF, (byte) 0xEC, (byte) 0xA1,
(byte) 0xB6, (byte) 0x58, (byte) 0x1E, (byte) 0x9F, (byte) 0x50, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, };
final byte[] srcIPBytes = { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
}
@Test
- public void testErrorObjectWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+ public void testErrorObjectWithTlv() throws PCEPDeserializerException, IOException {
final PCEPErrorObjectParser parser = new PCEPErrorObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPErrorObject1.bin");
}
@Test
- public void testLspaObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testLspaObject() throws IOException, PCEPDeserializerException {
final PCEPLspaObjectParser parser = new PCEPLspaObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPLspaObject1LowerBounds.bin");
}
@Test
- public void testMetricObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testMetricObject() throws IOException, PCEPDeserializerException {
final PCEPMetricObjectParser parser = new PCEPMetricObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPMetricObject1LowerBounds.bin");
}
@Test
- public void testNoPathObjectWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+ public void testNoPathObjectWithTlv() throws PCEPDeserializerException, IOException {
final PCEPNoPathObjectParser parser = new PCEPNoPathObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPNoPathObject1WithoutTLV.bin");
}
@Test
- public void testNotifyObjectWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+ public void testNotifyObjectWithTlv() throws PCEPDeserializerException, IOException {
final PCEPNotificationObjectParser parser = new PCEPNotificationObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPNotificationObject2WithoutTlv.bin");
}
@Test
- public void testRPObjectWithTlv() throws PCEPDeserializerException, IOException, PCEPDocumentedException {
+ public void testRPObjectWithTlv() throws PCEPDeserializerException, IOException {
final PCEPRequestParameterObjectParser parser = new PCEPRequestParameterObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPRPObject1.bin");
}
@Test
- public void testSvecObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testSvecObject() throws IOException, PCEPDeserializerException {
final PCEPSvecObjectParser parser = new PCEPSvecObjectParser(this.tlvRegistry);
byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPSvecObject2.bin");
}
@Test
- public void testClassTypeObject() throws PCEPDeserializerException, PCEPDocumentedException {
+ public void testClassTypeObject() throws PCEPDeserializerException {
final PCEPClassTypeObjectParser parser = new PCEPClassTypeObjectParser(this.tlvRegistry);
final byte[] result = new byte[] { 0, 0, 0, (byte) 0x04 };
}
@Test
- public void testSrpObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testSrpObject() throws IOException, PCEPDeserializerException {
final PCEPSrpObjectParser parser = new PCEPSrpObjectParser(this.tlvRegistry);
final byte[] result = new byte[] { 0, 0, 0, 0, 0, 0, 0, (byte) 0x01 };
}
@Test
- public void testObjectiveFunctionObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testObjectiveFunctionObject() throws IOException, PCEPDeserializerException {
final PCEPObjectiveFunctionObjectParser parser = new PCEPObjectiveFunctionObjectParser(this.tlvRegistry);
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPObjectiveFunctionObject.1.bin");
}
@Test
- public void testGlobalConstraintsObject() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testGlobalConstraintsObject() throws IOException, PCEPDeserializerException {
final PCEPGlobalConstraintsObjectParser parser = new PCEPGlobalConstraintsObjectParser(this.tlvRegistry);
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPGlobalConstraintsObject.1.bin");
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.protocol.pcep.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.PCEPDocumentedException;
import org.opendaylight.protocol.pcep.impl.message.PCEPCloseMessageParser;
import org.opendaylight.protocol.pcep.impl.message.PCEPErrorMessageParser;
import org.opendaylight.protocol.pcep.impl.message.PCEPKeepAliveMessageParser;
}
@Test
- public void testOpenMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testOpenMsg() throws IOException, PCEPDeserializerException {
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPOpenMessage1.bin");
final PCEPOpenMessageParser parser = new PCEPOpenMessageParser(this.objectRegistry);
final OpenMessageBuilder builder = new OpenMessageBuilder();
tlv1).setLspDbVersion(tlv2).build());
builder.setOpen(b.build());
- assertEquals(new OpenBuilder().setOpenMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new OpenBuilder().setOpenMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
final ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(new OpenBuilder().setOpenMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
}
@Test
- public void testKeepAliveMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
- final byte[] result = new byte[] { };
+ public void testKeepAliveMsg() throws IOException, PCEPDeserializerException {
+ final byte[] result = new byte[] {};
final PCEPKeepAliveMessageParser parser = new PCEPKeepAliveMessageParser(this.objectRegistry);
final KeepaliveBuilder builder = new KeepaliveBuilder().setKeepaliveMessage(new KeepaliveMessageBuilder().build());
- assertEquals(builder.build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(builder.build(), parser.parseMessage(result, Collections.<Message> emptyList()));
final ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(builder.build(), buf);
assertArrayEquals(result, buf.array());
}
@Test
- public void testCloseMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testCloseMsg() throws IOException, PCEPDeserializerException {
final byte[] result = ByteArray.fileToBytes("src/test/resources/PCEPCloseMessage1.bin");
final PCEPCloseMessageParser parser = new PCEPCloseMessageParser(this.objectRegistry);
final CloseBuilder builder = new CloseBuilder().setCCloseMessage(new CCloseMessageBuilder().setCClose(
new CCloseBuilder().setIgnore(false).setProcessingRule(false).setReason((short) 5).build()).build());
- assertEquals(builder.build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(builder.build(), parser.parseMessage(result, Collections.<Message> emptyList()));
final ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(builder.build(), buf);
assertArrayEquals(result, buf.array());
//
@Test
- public void testReplyMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testReplyMsg() throws IOException, PCEPDeserializerException {
// only RP
byte[] result = ByteArray.fileToBytes("src/test/resources/PCRep.1.bin");
replies1.add(rBuilder.build());
builder.setReplies(replies1);
- assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
replies2.add(rBuilder2.build());
builder.setReplies(replies2);
- assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
replies3.add(rBuilder.build());
builder.setReplies(replies3);
- assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
replies4.add(rBuilder.build());
builder.setReplies(replies4);
- assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrepBuilder().setPcrepMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrepBuilder().setPcrepMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
}
@Test
- public void testUpdMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testUpdMsg() throws IOException, PCEPDeserializerException {
byte[] result = ByteArray.fileToBytes("src/test/resources/PCUpd.2.bin");
final PCEPUpdateRequestMessageParser parser = new PCEPUpdateRequestMessageParser(this.objectRegistry);
updates.add(new UpdatesBuilder().setSrp(this.srp).setLsp(this.lsp).setPath(pBuilder.build()).build());
builder.setUpdates(updates);
- assertEquals(new PcupdBuilder().setPcupdMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcupdBuilder().setPcupdMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcupdBuilder().setPcupdMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
updates1.add(new UpdatesBuilder().setSrp(this.srp).setLsp(this.lsp).setPath(pBuilder1.build()).build());
builder.setUpdates(updates1);
- assertEquals(new PcupdBuilder().setPcupdMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcupdBuilder().setPcupdMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcupdBuilder().setPcupdMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
}
@Test
- public void testRptMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testRptMsg() throws IOException, PCEPDeserializerException {
byte[] result = ByteArray.fileToBytes("src/test/resources/PCRpt.1.bin");
final PCEPReportMessageParser parser = new PCEPReportMessageParser(this.objectRegistry);
reports.add(new ReportsBuilder().setLsp(this.lsp).build());
builder.setReports(reports);
- assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrptBuilder().setPcrptMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
reports1.add(new ReportsBuilder().setLsp(this.lsp).setPath(new PathBuilder().setEro(this.ero).setLspa(this.lspa).build()).build());
builder.setReports(reports1);
- assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrptBuilder().setPcrptMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
reports2.add(new ReportsBuilder().setSrp(this.srp).setLsp(this.lsp).setPath(pBuilder.build()).build());
builder.setReports(reports2);
- assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrptBuilder().setPcrptMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
reports3.add(new ReportsBuilder().setSrp(this.srp).setLsp(this.lsp).setPath(pBuilder1.build()).build());
builder.setReports(reports3);
- assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcrptBuilder().setPcrptMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
}
@Test
- public void testPcinitMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testPcinitMsg() throws IOException, PCEPDeserializerException {
final byte[] result = ByteArray.fileToBytes("src/test/resources/Pcinit.bin");
final PcinitiateMessageParser parser = new PcinitiateMessageParser(this.objectRegistry);
reqs.add(rBuilder.build());
builder.setRequests(reqs);
- assertEquals(new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
final ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
}
@Test
- public void testNotificationMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testNotificationMsg() throws IOException, PCEPDeserializerException {
final CNotification cn1 = new CNotificationBuilder().setIgnore(false).setProcessingRule(false).setType((short) 1).setValue(
(short) 1).build();
nots.add(b.build());
builder.setNotifications(nots);
- assertEquals(new PcntfBuilder().setPcntfMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcntfBuilder().setPcntfMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
final ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcntfBuilder().setPcntfMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
}
@Test
- public void testErrorMsg() throws IOException, PCEPDeserializerException, PCEPDocumentedException {
+ public void testErrorMsg() throws IOException, PCEPDeserializerException {
byte[] result = ByteArray.fileToBytes("src/test/resources/PCErr.3.bin");
final ErrorObject error1 = new ErrorObjectBuilder().setIgnore(false).setProcessingRule(false).setType((short) 3).setValue((short) 1).build();
builder.setErrors(innerErr);
builder.setErrorType(new SessionBuilder().setOpen(this.open).build());
- assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
ByteBuf buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcerrBuilder().setPcerrMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
builder.setErrors(innerErr);
builder.setErrorType(new RequestBuilder().setRps(rps).build());
- assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(), parser.parseMessage(result, Collections.<Message>emptyList()));
+ assertEquals(new PcerrBuilder().setPcerrMessage(builder.build()).build(),
+ parser.parseMessage(result, Collections.<Message> emptyList()));
buf = Unpooled.buffer(result.length);
parser.serializeMessage(new PcerrBuilder().setPcerrMessage(builder.build()).build(), buf);
assertArrayEquals(result, buf.array());
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.pcep;
+package org.opendaylight.protocol.pcep.spi;
import java.util.HashMap;
import java.util.Map;
import org.slf4j.LoggerFactory;
/**
- * Bidirectional mapping of {@link org.opendaylight.protocol.pcep.PCEPErrors PCEPErrors} and
+ * Bidirectional mapping of {@link org.opendaylight.protocol.pcep.spi.PCEPErrors PCEPErrors} and
* {@link org.opendaylight.protocol.pcep.impl.object.PCEPErrorObjectParser.PCEPErrorIdentifier ErrorIdentifier}
*/
public final class PCEPErrorMapping {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.pcep;
+package org.opendaylight.protocol.pcep.spi;
/**
* Possible errors listed in RFC5440, RFC 5455 and stateful draft.
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-package org.opendaylight.protocol.pcep;
+package org.opendaylight.protocol.pcep.spi;
import java.util.Arrays;
import java.util.List;
package org.opendaylight.protocol.pcep.spi.pojo;
import org.opendaylight.protocol.concepts.HandlerRegistry;
-import org.opendaylight.protocol.pcep.UnknownObject;
import org.opendaylight.protocol.pcep.spi.ObjectHandlerRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
+import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.util.Util;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;