<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-buffer</artifactId>
+ </dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
* 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.spi;
+package org.opendaylight.protocol.pcep;
import io.netty.buffer.ByteBuf;
import java.util.List;
* 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.spi;
+package org.opendaylight.protocol.pcep;
/**
* Used when something occurs during parsing bytes to java objects.
package org.opendaylight.protocol.pcep.auto.bandwidth.extension;
+import static com.google.common.base.Preconditions.checkArgument;
import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.bandwidth.usage.object.BandwidthUsage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.bandwidth.usage.object.BandwidthUsageBuilder;
@Override
public BandwidthUsage parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
- Preconditions.checkArgument(bytes != null && bytes.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (bytes.readableBytes() % BW_LENGTH != 0) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + bytes.readableBytes()
+ "; Expected multiple of " + BW_LENGTH + ".");
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof BandwidthUsage,
+ checkArgument(object instanceof BandwidthUsage,
"Wrong instance of PCEPObject. Passed %s. Needed BandwidthUsage.", object.getClass());
final List<Bandwidth> bwSample = ((BandwidthUsage) object).getBwSample();
final ByteBuf body = Unpooled.buffer(bwSample.size() * BW_LENGTH);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.bandwidth.usage.object.BandwidthUsage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.bandwidth.usage.object.BandwidthUsageBuilder;
import javax.xml.bind.DatatypeConverter;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulActivator;
import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.rev181109.Bandwidth1;
@Before
public void setUp() {
- new BaseParserExtensionActivator().start(this.ctx);
- new StatefulActivator().start(this.ctx);
- new org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator().start(this.ctx);
+ new BaseParserExtensionActivator().start(ctx);
+ new StatefulActivator().start(ctx);
+ new org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator().start(ctx);
}
@Test
public void testGetValidReportsPositive() {
- final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
+ final PcRptMessageCodec codec = new PcRptMessageCodec(ctx.getObjectHandlerRegistry());
final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
final Ipv4Builder builder = new Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4AddressNoZone("127.0.1.1"));
@Test
public void testGetValidReportsNegative() {
- final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
+ final PcRptMessageCodec codec = new PcRptMessageCodec(ctx.getObjectHandlerRegistry());
final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
final Ipv4Builder builder = new Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4AddressNoZone("127.0.1.1"));
@Test
public void testserializeObject() {
- final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
+ final PcRptMessageCodec codec = new PcRptMessageCodec(ctx.getObjectHandlerRegistry());
final ByteBuf buffer = Unpooled.buffer();
codec.serializeObject(new BandwidthBuilder()
.addAugmentation(new Bandwidth1Builder().setBwSample(BW).build())
+ "000d2004008490a0000d40a0000d4001f0006000005dd700000000710001401080a000706200001080a0000d420"
+ "000910001400000000000000000000000005050100051000084998968005500008513a43b70810002401080a000"
+ "0d42020030801010000000001080a00070620000308010100000000");
- final Pcrpt msg = (Pcrpt) this.ctx.getMessageHandlerRegistry().parseMessage(10,
+ final Pcrpt msg = (Pcrpt) ctx.getMessageHandlerRegistry().parseMessage(10,
Unpooled.wrappedBuffer(parseHexBinary), Collections.emptyList());
assertNotNull(msg.getPcrptMessage().getReports().get(0).getPath()
.getBandwidth().augmentation(Bandwidth1.class));
import io.netty.buffer.Unpooled;
import java.util.List;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Close;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.CloseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.CloseMessage;
import static com.google.common.base.Preconditions.checkArgument;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcerrBuilder;
@Override
public void serializeMessage(final Message message, final ByteBuf out) {
- Preconditions.checkArgument(message instanceof PcerrMessage,
+ checkArgument(message instanceof PcerrMessage,
"Wrong instance of Message. Passed instance of %s. Need PcerrMessage.", message.getClass());
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.pcerr.message
.PcerrMessage err = ((PcerrMessage) message).getPcerrMessage();
- Preconditions.checkArgument(err.getErrors() != null && !err.nonnullErrors().isEmpty(),
+ checkArgument(err.getErrors() != null && !err.nonnullErrors().isEmpty(),
"Errors should not be empty.");
final ByteBuf buffer = Unpooled.buffer();
serializeCases(err, buffer);
if (first instanceof ErrorObject) {
errorObjects.add(new ErrorsBuilder().setErrorObject((ErrorObject) first).build());
initialState = State.ERROR_IN;
- } else if (first instanceof Rp) {
- final Rp rp = (Rp) first;
+ } else if (first instanceof Rp rp) {
if (rp.getProcessingRule()) {
errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.empty()));
return null;
final List<Rps> requestParameters, final PcerrMessageBuilder msgBuilder) {
switch (state) {
case RP_IN:
- if (obj instanceof Rp) {
- final Rp o = (Rp) obj;
+ if (obj instanceof Rp o) {
requestParameters.add(new RpsBuilder().setRp(o).build());
return State.RP_IN;
}
// fallthrough
case ERROR_IN:
- if (obj instanceof ErrorObject) {
- final ErrorObject o = (ErrorObject) obj;
+ if (obj instanceof ErrorObject o) {
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR_IN;
}
}
// fallthrough
case ERROR:
- if (obj instanceof ErrorObject) {
- final ErrorObject o = (ErrorObject) obj;
+ if (obj instanceof ErrorObject o) {
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR;
}
*/
package org.opendaylight.protocol.pcep.parser.message;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.KeepaliveBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.KeepaliveMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
@Override
public void serializeMessage(final Message message, final ByteBuf out) {
- Preconditions.checkArgument(message instanceof KeepaliveMessage,
+ checkArgument(message instanceof KeepaliveMessage,
"Wrong instance of Message. Passed instance of %s. Need KeepaliveMessage.", message.getClass());
MessageUtil.formatMessage(TYPE, Unpooled.EMPTY_BUFFER, out);
}
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.util.Util;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcmonrep;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcmonrepBuilder;
* 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.parser.message;
+import static com.google.common.base.Preconditions.checkArgument;
+
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcmonreq;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcmonreqBuilder;
@Override
public void serializeMessage(final Message message, final ByteBuf out) {
- Preconditions.checkArgument(message instanceof Pcmonreq,
+ checkArgument(message instanceof Pcmonreq,
"Wrong instance of Message. Passed instance of %s. Need Pcmonreq.", message.getClass());
final PcreqMessage msg = ((Pcmonreq) message).getPcreqMessage();
- Preconditions.checkArgument(msg.getMonitoringRequest() != null, "MONITORING object MUST be present.");
+ checkArgument(msg.getMonitoringRequest() != null, "MONITORING object MUST be present.");
final ByteBuf buffer = Unpooled.buffer();
serializeMonitoringRequest(msg.getMonitoringRequest(), buffer);
if (msg.getSvec() != null) {
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcntfBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
throw new PCEPDeserializerException("Notification message cannot be empty.");
}
- final List<Notifications> compositeNotifications = new ArrayList<>();
-
+ final var compositeNotifications = new ArrayList<Notifications>();
while (!objects.isEmpty()) {
final Notifications comObj = getValidNotificationComposite(objects, errors);
if (comObj == null) {
.message.pcntf.message.notifications.Notifications> notifications) {
switch (state) {
case INIT:
- if (obj instanceof Rp) {
- final Rp rp = (Rp) obj;
+ if (obj instanceof Rp rp) {
if (rp.getProcessingRule()) {
errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.empty()));
return null;
}
// fallthrough
case RP_IN:
- if (obj instanceof CNotification) {
- final CNotification n = (CNotification) obj;
+ if (obj instanceof CNotification n) {
notifications.add(new NotificationsBuilder().setCNotification(n).build());
return State.RP_IN;
}
import io.netty.buffer.Unpooled;
import java.util.List;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.OpenBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.util.Util;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcrep;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcrepBuilder;
}
final List<Replies> replies = new ArrayList<>();
while (!objects.isEmpty()) {
- final Replies r = this.getValidReply(objects, errors);
+ final Replies r = getValidReply(objects, errors);
if (r != null) {
replies.add(r);
}
private Result handleNoPath(final NoPath noPath, final Queue<Object> objects) {
final FailureCaseBuilder builder = new FailureCaseBuilder().setNoPath(noPath);
for (Object obj = objects.peek(); obj != null && !(obj instanceof PceId); obj = objects.peek()) {
- this.parseAttributes(builder, objects);
+ parseAttributes(builder, objects);
}
return builder.build();
}
if (!vendorInfoObjects.isEmpty()) {
builder.setVendorInformationObject(vendorInfoObjects);
}
- this.parsePath(pBuilder, objects);
+ parsePath(pBuilder, objects);
paths.add(pBuilder.build());
}
builder.setPaths(paths);
import static com.google.common.base.Preconditions.checkArgument;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcreq;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.PcreqBuilder;
@Override
protected Message validate(final Queue<Object> objects, final List<Message> errors)
throws PCEPDeserializerException {
- Preconditions.checkArgument(objects != null, "Passed list can't be null.");
+ checkArgument(objects != null, "Passed list can't be null.");
if (objects.isEmpty()) {
throw new PCEPDeserializerException("Pcrep message cannot be empty.");
}
}
// fallthrough
case OF_IN:
- if (obj instanceof ClassType) {
- final ClassType classType = (ClassType) obj;
+ if (obj instanceof ClassType classType) {
if (!classType.getProcessingRule()) {
errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.of(rp)));
} else {
*/
package org.opendaylight.protocol.pcep.parser.message;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.StarttlsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
@Override
public void serializeMessage(final Message message, final ByteBuf out) {
- Preconditions.checkArgument(message instanceof StartTlsMessage,
+ checkArgument(message instanceof StartTlsMessage,
"Wrong instance of Message. Passed instance of %s. Need StartTlsMessage.", message.getClass());
MessageUtil.formatMessage(TYPE, Unpooled.EMPTY_BUFFER, out);
}
*/
package org.opendaylight.protocol.pcep.parser.object;
+import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Values;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
import org.slf4j.Logger;
protected List<Subobject> parseSubobjects(final ByteBuf buffer) throws PCEPDeserializerException {
// Explicit approval of empty ERO
- Preconditions.checkArgument(buffer != null, "Array of bytes is mandatory. Can't be null.");
+ checkArgument(buffer != null, "Array of bytes is mandatory. Can't be null.");
final List<Subobject> subs = new ArrayList<>();
while (buffer.isReadable()) {
final boolean loose = (buffer.getUnsignedByte(buffer.readerIndex()) & 1 << Values.FIRST_BIT_OFFSET) != 0;
"Wrong length specified. Passed: " + length + "; Expected: <= " + buffer.readableBytes());
}
LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(buffer));
- final Subobject sub = this.subobjReg.parseSubobject(type, buffer.readSlice(length), loose);
+ final Subobject sub = subobjReg.parseSubobject(type, buffer.readSlice(length), loose);
if (sub == null) {
LOG.warn("Parsing failed for subobject type: {}. Ignoring subobject.", type);
} else {
protected final void serializeSubobject(final List<Subobject> subobjects, final ByteBuf buffer) {
if (subobjects != null) {
for (final Subobject subobject : subobjects) {
- this.subobjReg.serializeSubobject(subobject, buffer);
+ subobjReg.serializeSubobject(subobject, buffer);
}
}
}
*/
package org.opendaylight.protocol.pcep.parser.object;
+import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.Subobject;
import org.slf4j.Logger;
}
protected List<Subobject> parseSubobjects(final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final List<Subobject> subs = new ArrayList<>();
while (buffer.isReadable()) {
final int type = buffer.readUnsignedByte();
"Wrong length specified. Passed: " + length + "; Expected: <= " + buffer.readableBytes());
}
LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(buffer));
- final Subobject sub = this.subobjReg.parseSubobject(type, buffer.readSlice(length));
+ final Subobject sub = subobjReg.parseSubobject(type, buffer.readSlice(length));
if (sub == null) {
LOG.warn("Parsing failed for subobject type: {}. Ignoring subobject.", type);
} else {
}
protected final void serializeSubobject(final List<Subobject> subobjects, final ByteBuf buffer) {
- Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(),
- "RRO must contain at least one subobject.");
+ checkArgument(subobjects != null && !subobjects.isEmpty(), "RRO must contain at least one subobject.");
for (final Subobject subobject : subobjects) {
- this.subobjReg.serializeSubobject(subobject, buffer);
+ subobjReg.serializeSubobject(subobject, buffer);
}
}
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.EnterpriseSpecificInformationParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
*/
package org.opendaylight.protocol.pcep.parser.object;
+import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import com.google.common.primitives.UnsignedBytes;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectRegistry;
import org.opendaylight.protocol.util.Values;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
}
protected List<Subobject> parseSubobjects(final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final List<Subobject> subs = new ArrayList<>();
while (buffer.isReadable()) {
final boolean mandatory =
+ buffer.readableBytes());
}
LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(buffer));
- final Subobject sub = this.subobjReg.parseSubobject(type, buffer.readSlice(length), mandatory);
+ final Subobject sub = subobjReg.parseSubobject(type, buffer.readSlice(length), mandatory);
if (sub == null) {
LOG.warn("Parsing failed for subobject type: {}. Ignoring subobject.", type);
} else {
}
protected final void serializeSubobject(final List<Subobject> subobjects, final ByteBuf buffer) {
- Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(),
- "XRO must contain at least one subobject.");
+ checkArgument(subobjects != null && !subobjects.isEmpty(), "XRO must contain at least one subobject.");
for (final Subobject subobject : subobjects) {
- this.subobjReg.serializeSubobject(subobject, buffer);
+ subobjReg.serializeSubobject(subobject, buffer);
}
}
}
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.bandwidth.object.Bandwidth;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
*/
package org.opendaylight.protocol.pcep.parser.object;
+import static com.google.common.base.Preconditions.checkArgument;
import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeFloat32;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reoptimization.bandwidth.object.ReoptimizationBandwidth;
@Override
public ReoptimizationBandwidth parseObject(final ObjectHeader header, final ByteBuf bytes)
throws PCEPDeserializerException {
- Preconditions.checkArgument(bytes != null && bytes.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (bytes.readableBytes() != PCEPBandwidthObjectParser.BANDWIDTH_F_LENGTH) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + bytes.readableBytes()
+ "; Expected: " + PCEPBandwidthObjectParser.BANDWIDTH_F_LENGTH + ".");
public void serializeObject(
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object object,
final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof ReoptimizationBandwidth,
+ checkArgument(object instanceof ReoptimizationBandwidth,
"Wrong instance of PCEPObject. Passed " + "%s. Needed ReoptimizationBandwidthObject.",
object.getClass());
final ByteBuf body = Unpooled.buffer();
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.Ero;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
*/
package org.opendaylight.protocol.pcep.parser.object;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.include.route.object.Iro;
@Override
public Iro parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
- Preconditions.checkArgument(bytes != null && bytes.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final List<Subobject> subs = new ArrayList<>();
for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit
.route.object.ero.Subobject s : parseSubobjects(bytes)) {
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof Iro,
- "Wrong instance of PCEPObject. Passed %s. Needed IroObject.", object.getClass());
+ checkArgument(object instanceof Iro, "Wrong instance of PCEPObject. Passed %s. Needed IroObject.",
+ object.getClass());
final Iro iro = (Iro) object;
final ByteBuf body = Unpooled.buffer();
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.util.BitArray;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.BitArray;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ieee754.rev130819.Float32;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.util.BitArray;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.util.BitArray;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.overload.object.Overload;
*/
package org.opendaylight.protocol.pcep.parser.object;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
@Override
public PathKey parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
- Preconditions.checkArgument(bytes != null && bytes.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final List<PathKeys> pk = new ArrayList<>();
final List<Subobject> subs = parseSubobjects(bytes);
for (final Subobject sub : subs) {
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof PathKey,
- "Wrong instance of PCEPObject. Passed %s. Needed PathKeyObject.", object.getClass());
+ checkArgument(object instanceof PathKey, "Wrong instance of PCEPObject. Passed %s. Needed PathKeyObject.",
+ object.getClass());
final PathKey pkey = (PathKey) object;
final ByteBuf body = Unpooled.buffer();
final List<Subobject> subs = new ArrayList<>();
import static com.google.common.base.Preconditions.checkArgument;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import static com.google.common.base.Preconditions.checkArgument;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv6Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import static com.google.common.base.Preconditions.checkArgument;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import static com.google.common.base.Preconditions.checkArgument;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv6Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.BitArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
*/
package org.opendaylight.protocol.pcep.parser.object;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
@Override
public Rro parseObject(final ObjectHeader header, final ByteBuf bytes) throws PCEPDeserializerException {
- Preconditions.checkArgument(bytes != null && bytes.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
return new RroBuilder()
.setIgnore(header.getIgnore())
.setProcessingRule(header.getProcessingRule())
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof Rro,
- "Wrong instance of PCEPObject. Passed %s. Needed RroObject.", object.getClass());
+ checkArgument(object instanceof Rro, "Wrong instance of PCEPObject. Passed %s. Needed RroObject.",
+ object.getClass());
final Rro obj = (Rro) object;
final ByteBuf body = Unpooled.buffer();
serializeSubobject(obj.getSubobject(), body);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.util.BitArray;
* 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.parser.object;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
import java.util.stream.Collectors;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
@Override
public Sero parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(), EMPTY_ARRAY_ERROR);
+ checkArgument(buffer != null && buffer.isReadable(), EMPTY_ARRAY_ERROR);
final SeroBuilder builder = new SeroBuilder();
builder.setIgnore(header.getIgnore());
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof Sero,
+ checkArgument(object instanceof Sero,
"Wrong instance of PCEPObject. Passed %s. Needed EroObject.", object.getClass());
final Sero sero = (Sero) object;
final ByteBuf body = Unpooled.buffer();
* 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.parser.object;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
import java.util.stream.Collectors;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
@Override
public Srro parseObject(final ObjectHeader header, final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(), EMPTY_ARRAY_ERROR);
+ checkArgument(buffer != null && buffer.isReadable(), EMPTY_ARRAY_ERROR);
final SrroBuilder builder = new SrroBuilder();
builder.setIgnore(header.getIgnore());
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof Srro,
+ checkArgument(object instanceof Srro,
"Wrong instance of PCEPObject. Passed %s. Needed EroObject.", object.getClass());
final Srro sero = (Srro) object;
final ByteBuf body = Unpooled.buffer();
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.Set;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.BitArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
*/
package org.opendaylight.protocol.pcep.parser.object.bnc;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.object.AbstractEROWithSubobjectsParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.branch.node.object.BranchNodeList;
@Override
public BranchNodeList parseObject(final ObjectHeader header, final ByteBuf bytes)
- throws PCEPDeserializerException {
- Preconditions.checkArgument(bytes != null && bytes.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ throws PCEPDeserializerException {
+ checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
return new BranchNodeListBuilder()
.setIgnore(header.getIgnore())
.setProcessingRule(header.getProcessingRule())
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof BranchNodeList,
+ checkArgument(object instanceof BranchNodeList,
"Wrong instance of PCEPObject. Passed %s. Needed BranchNodeList.", object.getClass());
final BranchNodeList nbnc = (BranchNodeList) object;
final ByteBuf body = Unpooled.buffer();
*/
package org.opendaylight.protocol.pcep.parser.object.bnc;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.object.AbstractEROWithSubobjectsParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.non.branch.node.object.NonBranchNodeList;
@Override
public NonBranchNodeList parseObject(final ObjectHeader header, final ByteBuf bytes)
- throws PCEPDeserializerException {
- Preconditions.checkArgument(bytes != null && bytes.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ throws PCEPDeserializerException {
+ checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
return new NonBranchNodeListBuilder()
.setIgnore(header.getIgnore())
.setProcessingRule(header.getProcessingRule())
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
- Preconditions.checkArgument(object instanceof NonBranchNodeList,
+ checkArgument(object instanceof NonBranchNodeList,
"Wrong instance of PCEPObject. Passed %s. Needed NonBranchNodeList.", object.getClass());
final NonBranchNodeList nbnc = (NonBranchNodeList) object;
final ByteBuf body = Unpooled.buffer();
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.util.Ipv4Util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.util.Ipv6Util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.Set;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.util.Ipv4Util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.Set;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.util.Ipv6Util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.Set;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
@Override
public UnreachDestinationObj parseObject(final ObjectHeader header, final ByteBuf bytes)
- throws PCEPDeserializerException {
+ throws PCEPDeserializerException {
checkArgument(bytes != null && bytes.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (bytes.readableBytes() % Ipv4Util.IP4_LENGTH != 0) {
throw new PCEPDeserializerException("Wrong length of array of bytes.");
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.Set;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.CommonObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv6Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.AsNumberSubobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCase;
*/
package org.opendaylight.protocol.pcep.parser.subobject;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCase;
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
- Preconditions.checkArgument(subobject.getSubobjectType() instanceof AsNumberCase,
+ checkArgument(subobject.getSubobjectType() instanceof AsNumberCase,
"Unknown subobject instance. Passed %s. Needed AsNumberCase.", subobject.getSubobjectType().getClass());
final ByteBuf body = AsNumberCaseParser.serializeSubobject((AsNumberCase) subobject.getSubobjectType());
EROSubobjectUtil.formatSubobject(TYPE, subobject.getLoose(), body, buffer);
*/
package org.opendaylight.protocol.pcep.parser.subobject;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectRegistry;
import org.opendaylight.protocol.util.Values;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
@Override
public Subobject parseSubobject(final ByteBuf buffer, final boolean loose) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude
.route.object.xro.Subobject> xros = parseSubobject(buffer);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit
private List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude
.route.object.xro.Subobject> parseSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(),
+ checkArgument(buffer != null && buffer.isReadable(),
"Array of bytes is mandatory. Can't be null or empty.");
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude
.route.object.xro.Subobject> xros = new ArrayList<>();
throw new PCEPDeserializerException("Wrong length specified. Passed: " + length + "; Expected: <= "
+ buffer.readableBytes());
}
- xros.add(this.registry.parseSubobject(type, buffer.readSlice(length), mandatory));
+ xros.add(registry.parseSubobject(type, buffer.readSlice(length), mandatory));
}
return xros;
}
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
- Preconditions.checkArgument(subobject.getSubobjectType() instanceof ExrsCase,
+ checkArgument(subobject.getSubobjectType() instanceof ExrsCase,
"Unknown subobject instance. Passed %s. Needed Exrs.", subobject.getSubobjectType().getClass());
final Exrs exrs = ((ExrsCase) subobject.getSubobjectType()).getExrs();
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude
.route.object.xro.Subobject> subobjects, final ByteBuf body) {
for (final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude
.route.object.xro.Subobject subobject : subobjects) {
- this.registry.serializeSubobject(subobject, body);
+ registry.serializeSubobject(subobject, body);
}
}
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.util.Ipv6Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
import org.opendaylight.protocol.pcep.spi.LabelRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.BitArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
private final LabelRegistry registry;
public EROLabelSubobjectParser(final LabelRegistry labelReg) {
- this.registry = requireNonNull(labelReg);
+ registry = requireNonNull(labelReg);
}
@Override
final BitArray reserved = BitArray.valueOf(buffer, FLAGS_SIZE);
final short cType = buffer.readUnsignedByte();
- final LabelType labelType = this.registry.parseLabel(cType, buffer.slice());
+ final LabelType labelType = registry.parseLabel(cType, buffer.slice());
if (labelType == null) {
LOG.warn("Ignoring ERO label subobject with unknown C-TYPE: {}", cType);
return null;
"Unknown subobject instance. Passed %s. Needed LabelCase.", subobject.getSubobjectType().getClass());
final Label label = ((LabelCase) subobject.getSubobjectType()).getLabel();
final ByteBuf body = Unpooled.buffer();
- this.registry.serializeLabel(label.getUniDirectional(), false, label.getLabelType(), body);
+ registry.serializeLabel(label.getUniDirectional(), false, label.getLabelType(), body);
EROSubobjectUtil.formatSubobject(TYPE, subobject.getLoose(), body, buffer);
}
}
package org.opendaylight.protocol.pcep.parser.subobject;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractEROPathKeySubobjectParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
public final class EROPathKey128SubobjectParser extends AbstractEROPathKeySubobjectParser {
package org.opendaylight.protocol.pcep.parser.subobject;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractEROPathKeySubobjectParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
public final class EROPathKey32SubobjectParser extends AbstractEROPathKeySubobjectParser {
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.UnnumberedSubobject;
*/
package org.opendaylight.protocol.pcep.parser.subobject;
+import static com.google.common.base.Preconditions.checkArgument;
+
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.LabelParser;
import org.opendaylight.protocol.pcep.spi.LabelSerializer;
import org.opendaylight.protocol.pcep.spi.LabelUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCase;
@Override
public LabelType parseLabel(final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
return new GeneralizedLabelCaseBuilder()
.setGeneralizedLabel(
new GeneralizedLabelBuilder().setGeneralizedLabel(ByteArray.readAllBytes(buffer)).build())
@Override
public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType subobject,
final ByteBuf buffer) {
- Preconditions.checkArgument(subobject instanceof GeneralizedLabelCase,
+ checkArgument(subobject instanceof GeneralizedLabelCase,
"Unknown Label Subobject instance. Passed {}. Needed GeneralizedLabelCase.", subobject.getClass());
final GeneralizedLabel gl = ((GeneralizedLabelCase) subobject).getGeneralizedLabel();
Preconditions.checkArgument(gl != null, "GeneralizedLabel is mandatory.");
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
*/
package org.opendaylight.protocol.pcep.parser.subobject;
+import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.LabelRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
private final LabelRegistry registry;
public RROLabelSubobjectParser(final LabelRegistry labelReg) {
- this.registry = requireNonNull(labelReg);
+ registry = requireNonNull(labelReg);
}
@Override
public Subobject parseSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
- Preconditions.checkArgument(buffer != null && buffer.isReadable(),
- "Array of bytes is mandatory. Can't be null or empty.");
+ checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() < HEADER_LENGTH) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes()
+ "; Expected: >" + HEADER_LENGTH + ".");
final short cType = buffer.readUnsignedByte();
- final LabelType labelType = this.registry.parseLabel(cType, buffer.slice());
+ final LabelType labelType = registry.parseLabel(cType, buffer.slice());
if (labelType == null) {
LOG.warn("Ignoring RRO label subobject with unknown C-TYPE: {}", cType);
return null;
requireNonNull(subobject.getSubobjectType(), "Subobject type cannot be empty.");
final Label label = ((LabelCase) subobject.getSubobjectType()).getLabel();
final ByteBuf body = Unpooled.buffer();
- this.registry.serializeLabel(label.getUniDirectional(), label.getGlobal(), label.getLabelType(), body);
+ registry.serializeLabel(label.getUniDirectional(), label.getGlobal(), label.getLabelType(), body);
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
import org.opendaylight.protocol.util.ByteArray;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.LabelParser;
import org.opendaylight.protocol.pcep.spi.LabelSerializer;
import org.opendaylight.protocol.pcep.spi.LabelUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCaseBuilder;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.LabelParser;
import org.opendaylight.protocol.pcep.spi.LabelSerializer;
import org.opendaylight.protocol.pcep.spi.LabelUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.WavebandSwitchingLabelCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.WavebandSwitchingLabelCaseBuilder;
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil;
import org.opendaylight.protocol.util.ByteArray;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EnterpriseSpecificInformationParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
*/
package org.opendaylight.protocol.pcep.parser.tlv;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
- Preconditions.checkArgument(tlv instanceof NoPathVector, "NoPathVectorTlv is mandatory.");
+ checkArgument(tlv instanceof NoPathVector, "NoPathVectorTlv is mandatory.");
final NoPathVector noPath = (NoPathVector) tlv;
final ByteBuf body = Unpooled.buffer();
final BitArray flags = new BitArray(FLAGS_SIZE);
import com.google.common.collect.ImmutableSet;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.Unpooled;
import java.util.HashSet;
import java.util.Set;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
package org.opendaylight.protocol.pcep.parser.util;
import java.util.Queue;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.metrics.MetricPce;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.monitoring.metrics.MetricPceBuilder;
}
public static MetricPce validateMonitoringMetrics(final Queue<Object> objects) throws PCEPDeserializerException {
- final Object pceId = objects.poll();
- if (!(pceId instanceof PceId)) {
+ if (!(objects.poll() instanceof PceId pceId)) {
throw new PCEPDeserializerException("metric-pce-list must start with PCE-ID object.");
}
- final MetricPceBuilder metricPceBuilder = new MetricPceBuilder().setPceId((PceId) pceId);
+ final MetricPceBuilder metricPceBuilder = new MetricPceBuilder().setPceId(pceId);
State state = State.START;
for (Object obj = objects.peek(); obj != null; obj = objects.peek()) {
state = insertObject(metricPceBuilder, state, obj);
*/
package org.opendaylight.protocol.pcep.p2mp.te.lsp;
+import static com.google.common.base.Preconditions.checkArgument;
+
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
- Preconditions.checkArgument(tlv instanceof P2mpPceCapability, "P2mpPceCapability is mandatory.");
+ checkArgument(tlv instanceof P2mpPceCapability, "P2mpPceCapability is mandatory.");
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
body.writeShort(0);
TlvUtil.formatTlv(TYPE, body, buffer);
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
public class P2MPTeLspTlvsParserTest {
import java.util.List;
import java.util.NoSuchElementException;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.Pcinitiate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.PcinitiateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.initiated.rev200720.pcinitiate.message.PcinitiateMessageBuilder;
throws PCEPDeserializerException {
checkArgument(objects != null, "Passed list can't be null.");
final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder();
- final List<Requests> reqs = new ArrayList<>();
+ final var reqs = new ArrayList<Requests>();
while (!objects.isEmpty()) {
- reqs.add(this.getValidRequest(objects));
+ reqs.add(getValidRequest(objects));
}
builder.setRequests(reqs);
return new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build();
.setSrp(consumeObject(objects, Srp.class))
.setLsp(consumeObject(objects, Lsp.class));
- final List<Metrics> metrics = new ArrayList<>();
+ final var metrics = new ArrayList<Metrics>();
State state = State.INIT;
for (Object obj = objects.peek(); obj != null; obj = objects.peek()) {
state = insertObject(state, obj, builder, metrics);
import io.netty.buffer.Unpooled;
import java.util.Map;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.message.PCEPErrorMessageParser;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcerr.pcerr.message.error.type.StatefulCase;
* Parser for {@link PcerrMessage}.
*/
public final class StatefulErrorMessageParser extends PCEPErrorMessageParser {
-
public StatefulErrorMessageParser(final ObjectRegistry registry) {
super(registry);
}
@Override
protected void serializeCases(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types
.rev181109.pcerr.message.PcerrMessage err, final ByteBuf buffer) {
- if (err.getErrorType() instanceof RequestCase) {
- final List<Rps> rps = ((RequestCase) err.getErrorType()).getRequest().getRps();
- for (final Rps r : rps) {
+ if (err.getErrorType() instanceof RequestCase request) {
+ for (final Rps r : request.getRequest().nonnullRps()) {
serializeObject(r.getRp(), buffer);
}
}
- if (err.getErrorType() instanceof StatefulCase) {
- final List<Srps> srps = ((StatefulCase) err.getErrorType()).getStateful().getSrps();
- for (final Srps s : srps) {
+ if (err.getErrorType() instanceof StatefulCase stateful) {
+ for (final Srps s : stateful.getStateful().nonnullSrps()) {
serializeObject(s.getSrp(), buffer);
}
}
if (first == null) {
throw new PCEPDeserializerException("Error message is empty.");
}
- final List<Rps> requestParameters = new ArrayList<>();
- final List<Srps> srps = new ArrayList<>();
- final List<Errors> errorObjects = new ArrayList<>();
+ final var requestParameters = new ArrayList<Rps>();
+ final var srps = new ArrayList<Srps>();
+ final var errorObjects = new ArrayList<Errors>();
final PcerrMessageBuilder b = new PcerrMessageBuilder();
State state = State.INIT;
if (first instanceof ErrorObject) {
errorObjects.add(new ErrorsBuilder().setErrorObject((ErrorObject) first).build());
state = State.ERROR_IN;
- } else if (first instanceof Rp) {
- final Rp rp = (Rp) first;
+ } else if (first instanceof Rp rp) {
if (rp.getProcessingRule()) {
errors.add(createErrorMsg(PCEPErrors.P_FLAG_NOT_SET, Optional.empty()));
return null;
final List<Rps> requestParameters, final List<Srps> srps, final PcerrMessageBuilder builder) {
switch (state) {
case ERROR_IN:
- if (obj instanceof ErrorObject) {
- final ErrorObject o = (ErrorObject) obj;
+ if (obj instanceof ErrorObject o) {
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR_IN;
}
// fall through
case RP_IN:
- if (obj instanceof Rp) {
- final Rp o = (Rp) obj;
+ if (obj instanceof Rp o) {
requestParameters.add(new RpsBuilder().setRp(o).build());
return State.RP_IN;
}
// fall through
case SRP_IN:
- if (obj instanceof Srp) {
- final Srp o = (Srp) obj;
+ if (obj instanceof Srp o) {
srps.add(new SrpsBuilder().setSrp(o).build());
return State.SRP_IN;
}
}
// fall through
case ERROR:
- if (obj instanceof ErrorObject) {
- final ErrorObject o = (ErrorObject) obj;
+ if (obj instanceof ErrorObject o) {
errorObjects.add(new ErrorsBuilder().setErrorObject(o).build());
return State.ERROR;
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.util.BitArray;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.PSTUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt;
throw new PCEPDeserializerException("Pcrpt message cannot be empty.");
}
- final List<Reports> reports = new ArrayList<>();
-
+ final var reports = new ArrayList<Reports>();
while (!objects.isEmpty()) {
final Reports report = getValidReports(objects, errors);
if (report != null) {
boolean lspViaSR = false;
Object object = objects.remove();
- if (object instanceof Srp) {
- final Srp srp = (Srp) object;
+ if (object instanceof Srp srp) {
final Tlvs tlvs = srp.getTlvs();
if (tlvs != null) {
lspViaSR = PSTUtil.isDefaultPST(tlvs.getPathSetupType());
private static boolean validateLsp(final Object object, final boolean lspViaSR, final List<Message> errors,
final ReportsBuilder builder) {
- if (object instanceof Lsp) {
- final Lsp lsp = (Lsp) object;
+ if (object instanceof Lsp lsp) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp
.object.lsp.Tlvs tlvs = lsp.getTlvs();
if (!lspViaSR && lsp.getPlspId().getValue().toJava() != 0
final ReportsBuilder builder) {
final PathBuilder pBuilder = new PathBuilder();
Object object = objects.remove();
- if (object instanceof Ero) {
- pBuilder.setEro((Ero) object);
+ if (object instanceof Ero ero) {
+ pBuilder.setEro(ero);
} else {
errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.empty()));
return false;
final List<Metrics> pathMetrics) {
switch (state) {
case INIT:
- if (obj instanceof Lspa) {
- builder.setLspa((Lspa) obj);
+ if (obj instanceof Lspa lspa) {
+ builder.setLspa(lspa);
return State.LSPA_IN;
}
// fall through
case LSPA_IN:
// Check presence for <intended-attribute-list> i.e LSPA, Bandwidth, Metrics, IRO ... as per old draft
- if (obj instanceof Bandwidth) {
- builder.setBandwidth((Bandwidth) obj);
+ if (obj instanceof Bandwidth bandwidth) {
+ builder.setBandwidth(bandwidth);
return State.LSPA_IN;
}
- if (obj instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
- .reoptimization.bandwidth.object.ReoptimizationBandwidth) {
- builder.setReoptimizationBandwidth((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .pcep.types.rev181109.reoptimization.bandwidth.object.ReoptimizationBandwidth) obj);
+ if (obj
+ instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
+ .reoptimization.bandwidth.object.ReoptimizationBandwidth reoptBandwidth) {
+ builder.setReoptimizationBandwidth(reoptBandwidth);
return State.LSPA_IN;
}
// fall through
case BANDWIDTH_IN:
- if (obj instanceof Metric) {
- pathMetrics.add(new MetricsBuilder().setMetric((Metric) obj).build());
+ if (obj instanceof Metric metric) {
+ pathMetrics.add(new MetricsBuilder().setMetric(metric).build());
return State.BANDWIDTH_IN;
}
// fall through
case METRIC_IN:
- if (obj instanceof Iro) {
- builder.setIro((Iro) obj);
+ if (obj instanceof Iro iro) {
+ builder.setIro(iro);
return State.IRO_IN;
}
// fall through
case IRO_IN:
- if (obj instanceof Rro) {
- builder.setRro((Rro) obj);
+ if (obj instanceof Rro rro) {
+ builder.setRro(rro);
return State.RRO_IN;
}
// fall through
case RRO_IN:
// Check presence for <intended-attribute-list> i.e LSPA, Bandwidth, Metrics, IRO ... as per RFC8231
- if (obj instanceof Lspa) {
- builder.setLspa((Lspa) obj);
+ if (obj instanceof Lspa lspa) {
+ builder.setLspa(lspa);
return State.LSPA_IN;
}
// fall through
import java.util.List;
import java.util.Optional;
import java.util.Queue;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractMessageParser;
import org.opendaylight.protocol.pcep.spi.MessageUtil;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcupd;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcupdBuilder;
checkArgument(message instanceof Pcupd, "Wrong instance of Message. Passed instance of %s. Need Pcupd.",
message.getClass());
final Pcupd msg = (Pcupd) message;
- final List<Updates> updates = msg.getPcupdMessage().getUpdates();
final ByteBuf buffer = Unpooled.buffer();
- for (final Updates update : updates) {
+ for (final Updates update : msg.getPcupdMessage().nonnullUpdates()) {
serializeUpdate(update, buffer);
}
MessageUtil.formatMessage(TYPE, buffer, out);
throw new PCEPDeserializerException("Pcup message cannot be empty.");
}
- final List<Updates> updateRequests = new ArrayList<>();
-
+ final var updateRequests = new ArrayList<Updates>();
while (!objects.isEmpty()) {
final Updates upd = getValidUpdates(objects, errors);
if (upd != null) {
final UpdatesBuilder builder = new UpdatesBuilder();
Object object = objects.remove();
- if (object instanceof Srp) {
- builder.setSrp((Srp) object);
+ if (object instanceof Srp srp) {
+ builder.setSrp(srp);
object = objects.poll();
} else {
errors.add(createErrorMsg(PCEPErrors.SRP_MISSING, Optional.empty()));
}
private static boolean validateLsp(final Object object, final List<Message> errors, final UpdatesBuilder builder) {
- if (object instanceof Lsp) {
- builder.setLsp((Lsp) object);
+ if (object instanceof Lsp lsp) {
+ builder.setLsp(lsp);
} else {
errors.add(createErrorMsg(PCEPErrors.LSP_MISSING, Optional.empty()));
return false;
final UpdatesBuilder builder) {
final PathBuilder pBuilder = new PathBuilder();
Object object = objects.remove();
- if (object instanceof Ero) {
- pBuilder.setEro((Ero) object);
+ if (object instanceof Ero ero) {
+ pBuilder.setEro(ero);
} else {
errors.add(createErrorMsg(PCEPErrors.ERO_MISSING, Optional.empty()));
return false;
}
private static void parsePath(final Queue<Object> objects, final PathBuilder pathBuilder) {
- final List<Metrics> pathMetrics = new ArrayList<>();
+ final var pathMetrics = new ArrayList<Metrics>();
State state = State.INIT;
for (Object obj = objects.peek(); obj != null; obj = objects.peek()) {
state = insertObject(state, obj, pathBuilder, pathMetrics);
final List<Metrics> pathMetrics) {
switch (state) {
case INIT:
- if (obj instanceof Lspa) {
- pathBuilder.setLspa((Lspa) obj);
+ if (obj instanceof Lspa lspa) {
+ pathBuilder.setLspa(lspa);
return State.LSPA_IN;
}
// fall through
case LSPA_IN:
- if (obj instanceof Bandwidth) {
- pathBuilder.setBandwidth((Bandwidth) obj);
+ if (obj instanceof Bandwidth bandwidth) {
+ pathBuilder.setBandwidth(bandwidth);
return State.LSPA_IN;
}
- if (obj instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
- .reoptimization.bandwidth.object.ReoptimizationBandwidth) {
- pathBuilder.setReoptimizationBandwidth((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.pcep.types.rev181109.reoptimization.bandwidth.object.ReoptimizationBandwidth) obj);
+ if (obj
+ instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
+ .reoptimization.bandwidth.object.ReoptimizationBandwidth reoptBandwidth) {
+ pathBuilder.setReoptimizationBandwidth(reoptBandwidth);
return State.LSPA_IN;
}
// fall through
case BANDWIDTH_IN:
- if (obj instanceof Metric) {
- pathMetrics.add(new MetricsBuilder().setMetric((Metric) obj).build());
+ if (obj instanceof Metric metric) {
+ pathMetrics.add(new MetricsBuilder().setMetric(metric).build());
return State.BANDWIDTH_IN;
}
// fall through
case METRIC_IN:
- if (obj instanceof Iro) {
- pathBuilder.setIro((Iro) obj);
+ if (obj instanceof Iro iro) {
+ pathBuilder.setIro(iro);
return State.IRO_IN;
}
// fall through
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.nio.charset.StandardCharsets;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.AbstractObjectWithTlvsParser;
import org.opendaylight.protocol.pcep.spi.ObjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.SrpIdNumber;
@Override
public void addTlv(final TlvsBuilder builder, final Tlv tlv) {
- if (tlv instanceof SymbolicPathName) {
- builder.setSymbolicPathName((SymbolicPathName) tlv);
+ if (tlv instanceof SymbolicPathName symbolic) {
+ builder.setSymbolicPathName(symbolic);
}
- if (tlv instanceof PathSetupType) {
- builder.setPathSetupType((PathSetupType) tlv);
+ if (tlv instanceof PathSetupType setup) {
+ builder.setPathSetupType(setup);
}
}
*/
package org.opendaylight.protocol.pcep.ietf.stateful;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
@Override
public void serializeTlv(final Tlv tlv, final ByteBuf buffer) {
- Preconditions.checkArgument(tlv instanceof Stateful, "StatefulCapabilityTlv is mandatory.");
+ checkArgument(tlv instanceof Stateful, "StatefulCapabilityTlv is mandatory.");
final Stateful sct = (Stateful) tlv;
TlvUtil.formatTlv(TYPE, Unpooled.wrappedBuffer(serializeFlags(sct).array()), buffer);
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
@Override
public Tlv parseTlv(final ByteBuf buffer) throws PCEPDeserializerException {
- if (buffer == null) {
- return null;
- }
- return new LspDbVersionBuilder().setLspDbVersionValue(readUint64(buffer)).build();
+ return buffer == null ? null : new LspDbVersionBuilder().setLspDbVersionValue(readUint64(buffer)).build();
}
}
import com.google.common.base.Preconditions;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import java.io.IOException;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.ietf.initiated.InitiatedSrpObjectParser;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulActivator;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulLspObjectParser;
import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
@Before
public void setUp() {
- new BaseParserExtensionActivator().start(this.ctx);
+ new BaseParserExtensionActivator().start(ctx);
}
@Test
new SyncOptimizationsActivator().start(ctx);
final SyncOptimizationsOpenObjectParser parser = new SyncOptimizationsOpenObjectParser(
- this.ctx.getTlvHandlerRegistry(), this.ctx.getVendorInformationTlvRegistry());
+ ctx.getTlvHandlerRegistry(), ctx.getVendorInformationTlvRegistry());
final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes(
"src/test/resources/PCEPOpenObject1.bin"));
new SyncOptimizationsActivator().start(ctx);
final SyncOptimizationsLspObjectParser parser = new SyncOptimizationsLspObjectParser(
- this.ctx.getTlvHandlerRegistry(), this.ctx.getVendorInformationTlvRegistry());
+ ctx.getTlvHandlerRegistry(), ctx.getVendorInformationTlvRegistry());
final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes(
"src/test/resources/PCEPLspObject1WithTLV.bin"));
public void testStatefulLspObjectWithTlv() throws IOException, PCEPDeserializerException {
new StatefulActivator().start(ctx);
- final StatefulLspObjectParser parser = new StatefulLspObjectParser(this.tlvRegistry, this.viTlvRegistry);
+ final StatefulLspObjectParser parser = new StatefulLspObjectParser(tlvRegistry, viTlvRegistry);
final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes(
"src/test/resources/PCEPLspObject2WithTLV.bin"));
@Test
public void testSrpObject() throws PCEPDeserializerException {
- final InitiatedSrpObjectParser parser = new InitiatedSrpObjectParser(this.tlvRegistry,
- this.viTlvRegistry);
+ final InitiatedSrpObjectParser parser = new InitiatedSrpObjectParser(tlvRegistry,
+ viTlvRegistry);
final ByteBuf result = Unpooled.wrappedBuffer(new byte[] {
(byte) 0x21, (byte) 0x10, (byte) 0x00, (byte) 0x0c, 0, 0, 0, (byte) 0x01, 0, 0, 0, (byte) 0x01
});
0x0, 0x01,
/* pst-tlv */
0x0, 0x1C, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0 };
- final InitiatedSrpObjectParser parser = new InitiatedSrpObjectParser(this.tlvRegistry,
- this.viTlvRegistry);
+ final InitiatedSrpObjectParser parser = new InitiatedSrpObjectParser(tlvRegistry,
+ viTlvRegistry);
final SrpBuilder builder = new SrpBuilder()
.setProcessingRule(false)
.setIgnore(false)
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.ietf.stateful.PathBindingTlvParser;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulLSPIdentifierIpv4TlvParser;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulLSPIdentifierIpv6TlvParser;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulLspUpdateErrorTlvParser;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulRSVPErrorSpecTlvParser;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulStatefulCapabilityTlvParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsCapabilityTlvParser;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.util.Ipv4Util;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.ietf.initiated.InitiatedActivator;
import org.opendaylight.protocol.pcep.ietf.initiated.InitiatedPCInitiateMessageParser;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulActivator;
import org.opendaylight.protocol.pcep.ietf.stateful.StatefulPCUpdateRequestMessageParser;
import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
import org.opendaylight.protocol.pcep.parser.message.PCEPOpenMessageParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator;
import org.opendaylight.protocol.util.ByteArray;
@Before
public void setUp() {
- this.ctx = new SimplePCEPExtensionProviderContext();
- this.act = new BaseParserExtensionActivator();
- this.act.start(this.ctx);
+ ctx = new SimplePCEPExtensionProviderContext();
+ act = new BaseParserExtensionActivator();
+ act.start(ctx);
- this.lspa = new LspaBuilder()
+ lspa = new LspaBuilder()
.setProcessingRule(false)
.setIgnore(false)
.setLocalProtectionDesired(false)
.lspa.object.lspa.TlvsBuilder().build())
.build();
- this.metrics = new MetricsBuilder()
+ metrics = new MetricsBuilder()
.setMetric(new MetricBuilder()
.setIgnore(false)
.setProcessingRule(false)
.setValue(new Float32(new byte[4])).build())
.build();
- this.eroASSubobject = new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(
+ eroASSubobject = new AsNumberCaseBuilder().setAsNumber(new AsNumberBuilder().setAsNumber(
new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber(
Uint32.valueOf(0xFFFF)))
.build()).build();
- this.rroUnnumberedSub = new UnnumberedCaseBuilder()
+ rroUnnumberedSub = new UnnumberedCaseBuilder()
.setUnnumbered(new UnnumberedBuilder()
.setRouterId(Uint32.valueOf(0x00112233L))
.setInterfaceId(Uint32.valueOf(0x00ff00ffL))
.setIgnore(false)
.setProcessingRule(false);
final List<Subobject> iroSubs = new ArrayList<>();
- iroSubs.add(new SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
+ iroSubs.add(new SubobjectBuilder().setSubobjectType(eroASSubobject).setLoose(false).build());
iroBuilder.setSubobject(iroSubs);
- this.iro = iroBuilder.build();
+ iro = iroBuilder.build();
final EroBuilder eroBuilder = new EroBuilder();
eroBuilder.setIgnore(false);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route
.object.ero.Subobject> eroSubs = new ArrayList<>();
eroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit
- .route.object.ero.SubobjectBuilder().setSubobjectType(this.eroASSubobject).setLoose(false).build());
+ .route.object.ero.SubobjectBuilder().setSubobjectType(eroASSubobject).setLoose(false).build());
eroBuilder.setSubobject(eroSubs);
- this.ero = eroBuilder.build();
+ ero = eroBuilder.build();
final RroBuilder rroBuilder = new RroBuilder();
rroBuilder.setIgnore(false);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route
.object.rro.Subobject> rroSubs = new ArrayList<>();
rroSubs.add(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported
- .route.object.rro.SubobjectBuilder().setSubobjectType(this.rroUnnumberedSub).setProtectionAvailable(false)
+ .route.object.rro.SubobjectBuilder().setSubobjectType(rroUnnumberedSub).setProtectionAvailable(false)
.setProtectionInUse(false).build());
rroBuilder.setSubobject(rroSubs);
- this.rro = rroBuilder.build();
+ rro = rroBuilder.build();
- this.srp = new SrpBuilder()
+ srp = new SrpBuilder()
.setIgnore(false)
.setProcessingRule(false)
.setOperationId(new SrpIdNumber(Uint32.ONE))
.setTlvs(new TlvsBuilder().build())
.addAugmentation(new Lsp1Builder().setCreate(false).build());
- this.lspSrp = lspBuilder.build();
- this.lsp = lspBuilder.setTlvs(new TlvsBuilder()
+ lspSrp = lspBuilder.build();
+ lsp = lspBuilder.setTlvs(new TlvsBuilder()
.setLspIdentifiers(new LspIdentifiersBuilder()
.setAddressFamily(new Ipv4CaseBuilder()
.setIpv4(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful
.setSourceIpv4Address(new Ipv4AddressNoZone("255.255.255.255"))
.setDestinationIpv4Address(new Ipv4AddressNoZone("255.255.255.255"));
- this.bandwidth = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
+ bandwidth = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109
.bandwidth.object.BandwidthBuilder()
.setIgnore(false)
.setProcessingRule(false)
.setBandwidth(new Bandwidth(new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }))
.build();
- this.reoptimizationBandwidth = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types
+ reoptimizationBandwidth = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types
.rev181109.reoptimization.bandwidth.object.ReoptimizationBandwidthBuilder()
.setIgnore(false)
.setProcessingRule(false)
@Test
public void testOpenMsg() throws IOException, PCEPDeserializerException {
- new StatefulActivator().start(this.ctx);
+ new StatefulActivator().start(ctx);
final ByteBuf result = Unpooled.wrappedBuffer(
ByteArray.fileToBytes("src/test/resources/PCEPOpenMessage1.bin"));
- final PCEPOpenMessageParser parser = new PCEPOpenMessageParser(this.ctx.getObjectHandlerRegistry());
+ final PCEPOpenMessageParser parser = new PCEPOpenMessageParser(ctx.getObjectHandlerRegistry());
final OpenMessageBuilder builder = new OpenMessageBuilder()
.setOpen(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.open
.object.OpenBuilder()
.build();
final StatefulPCRequestMessageParser parser = new StatefulPCRequestMessageParser(
- this.ctx.getObjectHandlerRegistry());
+ ctx.getObjectHandlerRegistry());
ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCReq.1.bin"));
assertEquals(pcReq, parser.parseMessage(result.slice(4, result.readableBytes() - 4), Collections.emptyList()));
public void testUpdMsg() throws IOException, PCEPDeserializerException {
new InitiatedActivator().start(ctx);
final StatefulPCUpdateRequestMessageParser parser = new StatefulPCUpdateRequestMessageParser(
- this.ctx.getObjectHandlerRegistry());
+ ctx.getObjectHandlerRegistry());
final PathBuilder pBuilder = new PathBuilder()
- .setEro(this.ero)
- .setLspa(this.lspa);
+ .setEro(ero)
+ .setLspa(lspa);
final PcupdMessageBuilder builder = new PcupdMessageBuilder()
.setUpdates(List.of(
- new UpdatesBuilder().setSrp(this.srp).setLsp(this.lspSrp).setPath(pBuilder.build()).build()));
+ new UpdatesBuilder().setSrp(srp).setLsp(lspSrp).setPath(pBuilder.build()).build()));
ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/PCUpd.2.bin"));
assertEquals(new PcupdBuilder().setPcupdMessage(builder.build()).build(),
assertArrayEquals(result.array(), buf.array());
builder.setUpdates(List.of(
- new UpdatesBuilder().setSrp(this.srp).setLsp(this.lspSrp).setPath(pBuilder.build()).build(),
- new UpdatesBuilder().setSrp(this.srp).setLsp(this.lspSrp).setPath(new PathBuilder()
- .setEro(this.ero)
- .setLspa(this.lspa)
+ new UpdatesBuilder().setSrp(srp).setLsp(lspSrp).setPath(pBuilder.build()).build(),
+ new UpdatesBuilder().setSrp(srp).setLsp(lspSrp).setPath(new PathBuilder()
+ .setEro(ero)
+ .setLspa(lspa)
.build())
.build()));
ByteBuf result = Unpooled.wrappedBuffer(PCRT1);
final StatefulPCReportMessageParser parser = new StatefulPCReportMessageParser(
- this.ctx.getObjectHandlerRegistry());
+ ctx.getObjectHandlerRegistry());
final PcrptMessageBuilder builder = new PcrptMessageBuilder();
final List<Reports> reports = new ArrayList<>();
- reports.add(new ReportsBuilder().setLsp(this.lsp).build());
+ reports.add(new ReportsBuilder().setLsp(lsp).build());
builder.setReports(reports);
final Message parseResult = parser.parseMessage(result.slice(4, result.readableBytes() - 4),
List.of());
result = Unpooled.wrappedBuffer(PCRT2);
builder.setReports(List.of(new ReportsBuilder()
- .setLsp(this.lsp)
+ .setLsp(lsp)
.setPath(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720
.pcrpt.message.pcrpt.message.reports.PathBuilder()
- .setEro(this.ero)
- .setLspa(this.lspa)
+ .setEro(ero)
+ .setLspa(lspa)
.build())
.build()));
final List<Reports> reports2 = new ArrayList<>();
final var pBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful
.rev200720.pcrpt.message.pcrpt.message.reports.PathBuilder();
- pBuilder.setEro(this.ero);
- pBuilder.setLspa(this.lspa);
- pBuilder.setMetrics(Lists.newArrayList(this.metrics, this.metrics));
- pBuilder.setRro(this.rro);
- reports2.add(new ReportsBuilder().setSrp(this.srp).setLsp(this.lspSrp).setPath(pBuilder.build()).build());
+ pBuilder.setEro(ero);
+ pBuilder.setLspa(lspa);
+ pBuilder.setMetrics(Lists.newArrayList(metrics, metrics));
+ pBuilder.setRro(rro);
+ reports2.add(new ReportsBuilder().setSrp(srp).setLsp(lspSrp).setPath(pBuilder.build()).build());
builder.setReports(reports2);
assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(),
final List<Reports> reports3 = new ArrayList<>();
final var pBuilder1 = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful
.rev200720.pcrpt.message.pcrpt.message.reports.PathBuilder();
- pBuilder1.setEro(this.ero);
- pBuilder1.setLspa(this.lspa);
- pBuilder1.setMetrics(Lists.newArrayList(this.metrics, this.metrics));
- pBuilder1.setRro(this.rro);
- reports3.add(new ReportsBuilder().setSrp(this.srp).setLsp(this.lspSrp).setPath(pBuilder.build()).build());
- reports3.add(new ReportsBuilder().setSrp(this.srp).setLsp(this.lspSrp).setPath(pBuilder1.build()).build());
+ pBuilder1.setEro(ero);
+ pBuilder1.setLspa(lspa);
+ pBuilder1.setMetrics(Lists.newArrayList(metrics, metrics));
+ pBuilder1.setRro(rro);
+ reports3.add(new ReportsBuilder().setSrp(srp).setLsp(lspSrp).setPath(pBuilder.build()).build());
+ reports3.add(new ReportsBuilder().setSrp(srp).setLsp(lspSrp).setPath(pBuilder1.build()).build());
builder.setReports(reports3);
assertEquals(new PcrptBuilder().setPcrptMessage(builder.build()).build(),
result = Unpooled.wrappedBuffer(PCRT3);
final List<Reports> reports4 = new ArrayList<>();
- reports4.add(new ReportsBuilder().setLsp(this.lsp).setPath(new org.opendaylight.yang.gen.v1.urn.opendaylight
+ reports4.add(new ReportsBuilder().setLsp(lsp).setPath(new org.opendaylight.yang.gen.v1.urn.opendaylight
.params.xml.ns.yang.pcep.ietf.stateful.rev200720.pcrpt.message.pcrpt.message.reports.PathBuilder()
- .setEro(this.ero).setLspa(this.lspa).setBandwidth(this.bandwidth)
- .setReoptimizationBandwidth(this.reoptimizationBandwidth).build()).build());
+ .setEro(ero).setLspa(lspa).setBandwidth(bandwidth)
+ .setReoptimizationBandwidth(reoptimizationBandwidth).build()).build());
builder.setReports(reports4);
final ByteBuf input2 = result.slice(4, result.readableBytes() - 4);
final ByteBuf result = Unpooled.wrappedBuffer(ByteArray.fileToBytes("src/test/resources/Pcinit.bin"));
final InitiatedPCInitiateMessageParser parser = new InitiatedPCInitiateMessageParser(
- this.ctx.getObjectHandlerRegistry());
+ ctx.getObjectHandlerRegistry());
final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder()
.setRequests(List.of(new RequestsBuilder()
- .setSrp(this.srp)
- .setLsp(this.lspSrp)
- .setEro(this.ero)
- .setLspa(this.lspa)
- .setMetrics(List.of(this.metrics))
- .setIro(this.iro)
+ .setSrp(srp)
+ .setLsp(lspSrp)
+ .setEro(ero)
+ .setLspa(lspa)
+ .setMetrics(List.of(metrics))
+ .setIro(iro)
.build()));
assertEquals(new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build(),
new StatefulActivator().start(ctx);
final StatefulErrorMessageParser parser = new StatefulErrorMessageParser(
- this.ctx.getObjectHandlerRegistry());
+ ctx.getObjectHandlerRegistry());
ErrorObject error1 = new ErrorObjectBuilder().setIgnore(false).setProcessingRule(false)
.setType(Uint8.valueOf(19)).setValue(Uint8.ONE).build();
new StatefulActivator().start(ctx);
final StatefulPCReportMessageParser parser = new StatefulPCReportMessageParser(
- this.ctx.getObjectHandlerRegistry());
+ ctx.getObjectHandlerRegistry());
final ByteBuf buf = Unpooled.wrappedBuffer(statefulMsg);
final List<Message> errors = new ArrayList<>();
new InitiatedActivator().start(ctx);
final StatefulPCUpdateRequestMessageParser parser = new StatefulPCUpdateRequestMessageParser(
- this.ctx.getObjectHandlerRegistry());
+ ctx.getObjectHandlerRegistry());
final ByteBuf buf = Unpooled.wrappedBuffer(badUpdateMsg);
final List<Message> errors = new ArrayList<>();
import io.netty.handler.codec.ByteToMessageDecoder;
import java.util.ArrayList;
import java.util.List;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.MessageRegistry;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPMessageConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
import org.slf4j.Logger;
import org.checkerframework.checker.lock.qual.GuardedBy;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.PCEPDispatcher;
import org.opendaylight.protocol.pcep.PCEPDispatcherDependencies;
import org.opendaylight.protocol.pcep.PCEPSession;
import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelOutboundHandler;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
+import org.opendaylight.protocol.pcep.MessageRegistry;
/**
* PCEP specific factory for protocol inbound/outbound handlers.
import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.subobject.GeneralizedLabelParser;
import org.opendaylight.protocol.pcep.parser.subobject.Type1LabelParser;
import org.opendaylight.protocol.pcep.parser.subobject.WavebandSwitchingLabelParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.GeneralizedLabelCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCaseBuilder;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.PCEPDispatcherDependencies;
import org.opendaylight.protocol.pcep.PCEPSession;
import org.opendaylight.protocol.pcep.PCEPSessionListenerFactory;
import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory;
import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.pojo.DefaultPCEPExtensionConsumerContext;
import org.opendaylight.protocol.util.InetSocketAddressUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionErrorPolicy;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
import org.opendaylight.protocol.pcep.parser.object.PCEPBandwidthObjectParser;
import org.opendaylight.protocol.pcep.parser.object.unreach.PCEPIpv6UnreachDestinationParser;
import org.opendaylight.protocol.pcep.parser.object.unreach.PCEPUnreachDestinationSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.pojo.DefaultPCEPExtensionConsumerContext;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Close;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
import org.opendaylight.protocol.pcep.parser.tlv.NoPathVectorTlvParser;
import org.opendaylight.protocol.pcep.parser.tlv.OFListTlvParser;
import org.opendaylight.protocol.pcep.parser.tlv.OverloadedDurationTlvParser;
import org.opendaylight.protocol.pcep.parser.tlv.PathSetupTypeTlvParser;
import org.opendaylight.protocol.pcep.parser.tlv.ReqMissingTlvParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.NoPathVectorTlv;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.impl.TestVendorInformationTlvParser.TestEnterpriseSpecificInformation;
import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
import org.opendaylight.protocol.pcep.parser.message.PCEPCloseMessageParser;
import org.opendaylight.protocol.pcep.parser.message.PCEPRequestMessageParser;
import org.opendaylight.protocol.pcep.parser.message.PCEPStartTLSMessageParser;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
import org.opendaylight.protocol.pcep.parser.subobject.EROAsNumberSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.EROExplicitExclusionRouteSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.EROPathKey128SubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.EROPathKey32SubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.EROUnnumberedInterfaceSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.util.Ipv6Util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
import org.opendaylight.protocol.pcep.parser.subobject.RROIpv4PrefixSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.RROIpv6PrefixSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.RROPathKey128SubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.RROPathKey32SubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.RROUnnumberedInterfaceSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.util.Ipv6Util;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.subobject.XROAsNumberSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.XROIpv4PrefixSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.XROIpv6PrefixSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.XROPathKey32SubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.XROSrlgSubobjectParser;
import org.opendaylight.protocol.pcep.parser.subobject.XROUnnumberedInterfaceSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.protocol.util.Ipv6Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
import static com.google.common.base.Preconditions.checkArgument;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.object.end.points.PCEPEndPointsIpv4ObjectParser;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.PCEPCapability;
import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory;
import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.MockPcepSessionErrorPolicy;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCDispatcherImpl;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.pojo.DefaultPCEPExtensionConsumerContext;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
import java.util.concurrent.ExecutionException;
import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.PCEPPeerProposal;
import org.opendaylight.protocol.pcep.PCEPSession;
import org.opendaylight.protocol.pcep.PCEPSessionListenerFactory;
import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactoryDependencies;
import org.opendaylight.protocol.pcep.impl.PCEPHandlerFactory;
import org.opendaylight.protocol.pcep.pcc.mock.api.PCCDispatcher;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.PCEPDispatcher;
import org.opendaylight.protocol.pcep.PCEPDispatcherDependencies;
import org.opendaylight.protocol.pcep.PCEPSession;
import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.MockPcepSessionErrorPolicy;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCDispatcherImpl;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.pojo.DefaultPCEPExtensionConsumerContext;
import org.opendaylight.protocol.util.InetSocketAddressUtil;
import org.opendaylight.yangtools.yang.common.Uint8;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import java.util.concurrent.TimeUnit;
import org.junit.Before;
import org.opendaylight.protocol.concepts.KeyMapping;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.PCEPCapability;
import org.opendaylight.protocol.pcep.PCEPDispatcher;
import org.opendaylight.protocol.pcep.PCEPDispatcherDependencies;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.MockPcepSessionErrorPolicy;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCDispatcherImpl;
import org.opendaylight.protocol.pcep.pcc.mock.protocol.PCCSessionListener;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.BitArray;
import org.opendaylight.protocol.util.Ipv4Util;
import org.opendaylight.protocol.util.Ipv6Util;
@Override
public Boolean getMFlag() {
- return this.mflag;
+ return mflag;
}
@Override
public Boolean getCFlag() {
- return this.cflag;
+ return cflag;
}
@Override
public NaiType getNaiType() {
- return this.naiType;
+ return naiType;
}
@Override
public Uint32 getSid() {
- return this.sid;
+ return sid;
}
@Override
public Nai getNai() {
- return this.nai;
+ return nai;
}
}
}
private static Nai parseNai(final NaiType naiType, final ByteBuf buffer) {
- switch (naiType) {
- case Ipv4NodeId:
- return new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(Ipv4Util.addressForByteBuf(buffer)))
- .build();
- case Ipv6NodeId:
- return new IpNodeIdBuilder().setIpAddress(new IpAddressNoZone(Ipv6Util.addressForByteBuf(buffer)))
- .build();
- case Ipv4Adjacency:
- return new IpAdjacencyBuilder()
- .setLocalIpAddress(new IpAddressNoZone(Ipv4Util.addressForByteBuf(buffer)))
- .setRemoteIpAddress(new IpAddressNoZone(Ipv4Util.addressForByteBuf(buffer))).build();
- case Ipv6Adjacency:
- return new IpAdjacencyBuilder()
- .setLocalIpAddress(new IpAddressNoZone(Ipv6Util.addressForByteBuf(buffer)))
- .setRemoteIpAddress(new IpAddressNoZone(Ipv6Util.addressForByteBuf(buffer))).build();
- case Unnumbered:
- return new UnnumberedAdjacencyBuilder()
- .setLocalNodeId(ByteBufUtils.readUint32(buffer))
- .setLocalInterfaceId(ByteBufUtils.readUint32(buffer))
- .setRemoteNodeId(ByteBufUtils.readUint32(buffer))
- .setRemoteInterfaceId(ByteBufUtils.readUint32(buffer)).build();
- case Ipv6Local:
- return new Ipv6LocalBuilder()
- .setLocalIpv6Address(Ipv6Util.addressForByteBuf(buffer))
- .setLocalId(ByteBufUtils.readUint32(buffer))
- .setRemoteIpv6Address(Ipv6Util.addressForByteBuf(buffer))
- .setRemoteId(ByteBufUtils.readUint32(buffer)).build();
- default:
- return null;
- }
+ return switch (naiType) {
+ case Ipv4NodeId -> new IpNodeIdBuilder()
+ .setIpAddress(new IpAddressNoZone(Ipv4Util.addressForByteBuf(buffer)))
+ .build();
+ case Ipv6NodeId -> new IpNodeIdBuilder()
+ .setIpAddress(new IpAddressNoZone(Ipv6Util.addressForByteBuf(buffer)))
+ .build();
+ case Ipv4Adjacency -> new IpAdjacencyBuilder()
+ .setLocalIpAddress(new IpAddressNoZone(Ipv4Util.addressForByteBuf(buffer)))
+ .setRemoteIpAddress(new IpAddressNoZone(Ipv4Util.addressForByteBuf(buffer)))
+ .build();
+ case Ipv6Adjacency -> new IpAdjacencyBuilder()
+ .setLocalIpAddress(new IpAddressNoZone(Ipv6Util.addressForByteBuf(buffer)))
+ .setRemoteIpAddress(new IpAddressNoZone(Ipv6Util.addressForByteBuf(buffer)))
+ .build();
+ case Unnumbered -> new UnnumberedAdjacencyBuilder()
+ .setLocalNodeId(ByteBufUtils.readUint32(buffer))
+ .setLocalInterfaceId(ByteBufUtils.readUint32(buffer))
+ .setRemoteNodeId(ByteBufUtils.readUint32(buffer))
+ .setRemoteInterfaceId(ByteBufUtils.readUint32(buffer))
+ .build();
+ case Ipv6Local -> new Ipv6LocalBuilder()
+ .setLocalIpv6Address(Ipv6Util.addressForByteBuf(buffer))
+ .setLocalId(ByteBufUtils.readUint32(buffer))
+ .setRemoteIpv6Address(Ipv6Util.addressForByteBuf(buffer))
+ .setRemoteId(ByteBufUtils.readUint32(buffer))
+ .build();
+ default -> null;
+ };
}
protected static SrSubobject parseSrSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
*/
package org.opendaylight.protocol.pcep.segment.routing;
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkArgument;
+
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.EROSubobjectUtil;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.SrSubobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.add.lsp.input.arguments.ero.subobject.subobject.type.SrEroTypeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
private final int type;
SrEroSubobjectParser() {
- this.type = IANA_TYPE;
+ type = IANA_TYPE;
}
@Deprecated
SrEroSubobjectParser(final boolean isIanaAssignedType) {
- this.type = isIanaAssignedType ? IANA_TYPE : LEGACY_TYPE;
+ type = isIanaAssignedType ? IANA_TYPE : LEGACY_TYPE;
}
@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
- Preconditions.checkArgument(subobject.getSubobjectType() instanceof SrSubobject,
+ checkArgument(subobject.getSubobjectType() instanceof SrSubobject,
"Unknown subobject instance. Passed %s. Needed SrSubobject.", subobject.getSubobjectType()
.getClass());
final SrSubobject srSubobject = (SrSubobject) subobject.getSubobjectType();
final ByteBuf body = serializeSubobject(srSubobject);
- EROSubobjectUtil.formatSubobject(this.type, subobject.getLoose(), body, buffer);
+ EROSubobjectUtil.formatSubobject(type, subobject.getLoose(), body, buffer);
}
@Override
@Deprecated
public int getCodePoint() {
- return this.type;
+ return type;
}
}
\ No newline at end of file
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.TlvUtil;
import static com.google.common.base.Preconditions.checkArgument;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil;
private final int type;
SrRroSubobjectParser() {
- this.type = IANA_TYPE;
+ type = IANA_TYPE;
}
@Deprecated
SrRroSubobjectParser(final boolean isIanaAssignedType) {
- this.type = isIanaAssignedType ? IANA_TYPE : LEGACY_TYPE;
+ type = isIanaAssignedType ? IANA_TYPE : LEGACY_TYPE;
}
@Override
- public void serializeSubobject(Subobject subobject, ByteBuf buffer) {
+ public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
final SubobjectType subobjType = subobject.getSubobjectType();
checkArgument(subobjType instanceof SrSubobject, "Unknown subobject instance. Passed %s. Needed SrSubobject.",
subobjType.getClass());
final SrSubobject srSubobject = (SrSubobject) subobjType;
final ByteBuf body = serializeSubobject(srSubobject);
- RROSubobjectUtil.formatSubobject(this.type, body, buffer);
+ RROSubobjectUtil.formatSubobject(type, body, buffer);
}
@Override
public Subobject parseSubobject(final ByteBuf buffer) throws PCEPDeserializerException {
- final SrRroTypeBuilder srRroSubobjectBuilder = new SrRroTypeBuilder(parseSrSubobject(buffer));
- final SubobjectBuilder subobjectBuilder = new SubobjectBuilder();
- subobjectBuilder.setSubobjectType(srRroSubobjectBuilder.build());
- return subobjectBuilder.build();
+ return new SubobjectBuilder().setSubobjectType(new SrRroTypeBuilder(parseSrSubobject(buffer)).build()).build();
}
@Deprecated
public int getCodePoint() {
- return this.type;
+ return type;
}
}
import io.netty.buffer.Unpooled;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
@Before
public void setUp() {
- this.ctx = new SimplePCEPExtensionProviderContext();
- this.act = new SegmentRoutingActivator();
- this.act.start(this.ctx);
- this.parser = new SrEroSubobjectParser();
+ ctx = new SimplePCEPExtensionProviderContext();
+ act = new SegmentRoutingActivator();
+ act.start(ctx);
+ parser = new SrEroSubobjectParser();
}
@Test
.build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITH_IPV4_NODEID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITH_IPV4_NODEID, ByteArray.getAllBytes(buffer));
}
new Ipv6AddressNoZone("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITH_IPV6_NODEID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITH_IPV6_NODEID, ByteArray.getAllBytes(buffer));
}
.setRemoteIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("74.125.43.100"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITH_IPV4_ADJ, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITH_IPV4_ADJ, ByteArray.getAllBytes(buffer));
}
.build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITH_IPV6_ADJ, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITH_IPV6_ADJ, ByteArray.getAllBytes(buffer));
}
.build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITH_UNNUMBERED, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITH_UNNUMBERED, ByteArray.getAllBytes(buffer));
}
.setMFlag(false);
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITHOUT_NAI, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITHOUT_NAI, ByteArray.getAllBytes(buffer));
}
new Ipv4AddressNoZone("74.125.43.99"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITHOUT_SID, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITHOUT_SID, ByteArray.getAllBytes(buffer));
}
.build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_ERO_SUBOBJECT_WITH_IPV4_NODEID_MFLAG, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_ERO_SUBOBJECT_WITH_IPV4_NODEID_MFLAG_AFTER, ByteArray.getAllBytes(buffer));
}
}
import java.util.List;
import org.junit.Before;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.parser.object.PCEPExplicitRouteObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
@Before
public void setUp() {
- this.ctx = new SimplePCEPExtensionProviderContext();
- this.act = new SegmentRoutingActivator();
- this.act.start(this.ctx);
- this.tlvRegistry = this.ctx.getTlvHandlerRegistry();
- this.viTlvRegistry = this.ctx.getVendorInformationTlvRegistry();
+ ctx = new SimplePCEPExtensionProviderContext();
+ act = new SegmentRoutingActivator();
+ act.start(ctx);
+ tlvRegistry = ctx.getTlvHandlerRegistry();
+ viTlvRegistry = ctx.getVendorInformationTlvRegistry();
}
@Test
public void testOpenObjectWithSpcTlv() throws PCEPDeserializerException {
- final PcepOpenObjectWithSpcTlvParser parser = new PcepOpenObjectWithSpcTlvParser(this.tlvRegistry,
- this.viTlvRegistry);
+ final PcepOpenObjectWithSpcTlvParser parser = new PcepOpenObjectWithSpcTlvParser(tlvRegistry,
+ viTlvRegistry);
final OpenBuilder builder = new OpenBuilder()
.setProcessingRule(false)
@Test
public void testSrEroObjectWithSubobjects() throws PCEPDeserializerException {
final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(
- this.ctx.getEROSubobjectHandlerRegistry());
+ ctx.getEROSubobjectHandlerRegistry());
final EroBuilder builder = new EroBuilder();
builder.setProcessingRule(false);
@Test
public void testSrEroSerializerWithUpdateLspAugmentation() throws PCEPDeserializerException {
final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser(
- this.ctx.getEROSubobjectHandlerRegistry());
+ ctx.getEROSubobjectHandlerRegistry());
final EroBuilder builder = new EroBuilder();
builder.setProcessingRule(false);
import io.netty.buffer.Unpooled;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone;
@Before
public void setUp() {
- this.ctx = new SimplePCEPExtensionProviderContext();
- this.act = new SegmentRoutingActivator();
- this.act.start(this.ctx);
- this.parser = new SrRroSubobjectParser();
+ ctx = new SimplePCEPExtensionProviderContext();
+ act = new SegmentRoutingActivator();
+ act.start(ctx);
+ parser = new SrRroSubobjectParser();
}
@Test
.build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_RRO_SUBOBJECT_WITH_IPV4_NODEID, 2))));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RRO_SUBOBJECT_WITH_IPV4_NODEID, ByteArray.getAllBytes(buffer));
}
new Ipv6AddressNoZone("fe80:cd00::211e:729c"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_RROR_SUBOBJECT_WITH_IPV6_NODEID, 2))));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RROR_SUBOBJECT_WITH_IPV6_NODEID, ByteArray.getAllBytes(buffer));
}
.setRemoteIpAddress(new IpAddressNoZone(new Ipv4AddressNoZone("74.125.43.100"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_RRO_SUBOBJECT_WITH_IPV4_ADJ, 2))));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RRO_SUBOBJECT_WITH_IPV4_ADJ, ByteArray.getAllBytes(buffer));
}
.setRemoteIpAddress(new IpAddressNoZone(new Ipv6AddressNoZone("fe80:cd00::211e:729d"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_RRO_SUBOBJECT_WITH_IPV6_ADJ, 2))));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RRO_SUBOBJECT_WITH_IPV6_ADJ, ByteArray.getAllBytes(buffer));
}
.build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_RRO_SUBOBJECT_WIT_UNNUMBERED, 2))));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RRO_SUBOBJECT_WIT_UNNUMBERED, ByteArray.getAllBytes(buffer));
}
.setMFlag(true);
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_RRO_SUBOBJECT_WITHOUT_NAI, 2))));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RRO_SUBOBJECT_WITHOUT_NAI, ByteArray.getAllBytes(buffer));
}
.build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
- assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(
+ assertEquals(subobjBuilder.build(), parser.parseSubobject(Unpooled.wrappedBuffer(
ByteArray.cutBytes(SR_RRO_SUBOBJECT_WITHOUT_SID, 2))));
final ByteBuf buffer = Unpooled.buffer();
- this.parser.serializeSubobject(subobjBuilder.build(), buffer);
+ parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(SR_RRO_SUBOBJECT_WITHOUT_SID, ByteArray.getAllBytes(buffer));
}
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.junit.Test;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapability;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev200720.sr.pce.capability.tlv.SrPceCapabilityBuilder;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.SubobjectBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.PathKey;
import java.util.Optional;
import java.util.Queue;
import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.util.BitArray;
import org.opendaylight.protocol.util.ByteArray;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.tlvs.VendorInformationTlv;
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
/**
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
/**
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.EnterpriseSpecificInformation;
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
public interface LabelParser {
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
public interface LabelRegistry {
import io.netty.buffer.ByteBuf;
import java.util.List;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
public interface MessageParser {
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
*/
package org.opendaylight.protocol.pcep.spi;
+import org.opendaylight.protocol.pcep.MessageRegistry;
+
public interface PCEPExtensionConsumerContext {
LabelRegistry getLabelHandlerRegistry();
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.Subobject;
/**
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.reported.route.object.rro.Subobject;
/**
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
public interface TlvParser {
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Tlv;
public interface TlvRegistry {
import io.netty.buffer.ByteBuf;
import java.util.Optional;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import io.netty.buffer.ByteBuf;
import java.util.Optional;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.vendor.information.tlvs.VendorInformationTlv;
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
public interface XROSubobjectParser {
package org.opendaylight.protocol.pcep.spi;
import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject;
public interface XROSubobjectRegistry {
import javax.inject.Singleton;
import org.eclipse.jdt.annotation.NonNull;
import org.kohsuke.MetaInfServices;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.LabelRegistry;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
import org.opendaylight.protocol.pcep.spi.PCEPExtensionConsumerContext;
import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.concepts.HandlerRegistry;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Values;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.explicit.route.object.ero.Subobject;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType;
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.concepts.HandlerRegistry;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.LabelParser;
import org.opendaylight.protocol.pcep.spi.LabelRegistry;
import org.opendaylight.protocol.pcep.spi.LabelSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Values;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
import org.opendaylight.yangtools.concepts.Registration;
import io.netty.buffer.ByteBuf;
import java.util.List;
import org.opendaylight.protocol.concepts.HandlerRegistry;
+import org.opendaylight.protocol.pcep.MessageRegistry;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.MessageParser;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.MessageSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.util.Values;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message;
import org.opendaylight.yangtools.concepts.Registration;
import io.netty.buffer.ByteBuf;
import java.util.Optional;
import org.opendaylight.protocol.concepts.HandlerRegistry;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.pcep.spi.VendorInformationObjectRegistry;
*/
package org.opendaylight.protocol.pcep.spi.pojo;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
import org.opendaylight.protocol.pcep.spi.LabelRegistry;
import org.opendaylight.protocol.pcep.spi.LabelSerializer;
import org.opendaylight.protocol.pcep.spi.MessageParser;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.MessageSerializer;
import org.opendaylight.protocol.pcep.spi.ObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.concepts.HandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.RROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.concepts.HandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvRegistry;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import io.netty.buffer.ByteBuf;
import java.util.Optional;
import org.opendaylight.protocol.concepts.HandlerRegistry;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.ObjectParser;
import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.PCEPErrors;
import org.opendaylight.protocol.pcep.spi.UnknownObject;
import org.opendaylight.protocol.pcep.spi.VendorInformationObjectRegistry;
import io.netty.buffer.ByteBuf;
import java.util.Optional;
import org.opendaylight.protocol.concepts.HandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.TlvParser;
import org.opendaylight.protocol.pcep.spi.TlvSerializer;
import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
import io.netty.buffer.ByteBuf;
import org.opendaylight.protocol.concepts.HandlerRegistry;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
import org.opendaylight.protocol.pcep.spi.XROSubobjectRegistry;
import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.close.object.CCloseBuilder;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcerr;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Pcrep;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Object;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.ObjectHeader;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
+import org.opendaylight.protocol.pcep.PCEPDeserializerException;
import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev181109.Keepalive;
import java.util.List;
import java.util.ServiceLoader;
import java.util.concurrent.ExecutionException;
+import org.opendaylight.protocol.pcep.MessageRegistry;
import org.opendaylight.protocol.pcep.PCEPCapability;
import org.opendaylight.protocol.pcep.PCEPSessionProposalFactory;
import org.opendaylight.protocol.pcep.ietf.stateful.PCEPStatefulCapability;
import org.opendaylight.protocol.pcep.impl.BasePCEPSessionProposalFactory;
import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory;
import org.opendaylight.protocol.pcep.impl.PCEPDispatcherImpl;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
import org.opendaylight.protocol.pcep.spi.PCEPExtensionConsumerContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.config.rev230112.PcepSessionErrorPolicy;
import org.opendaylight.yangtools.yang.common.Uint16;