From 573e76691c197a1756e48d54d24f1f9ee76df472 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Sat, 14 Jan 2023 17:16:58 +0100 Subject: [PATCH] Promote MessageRegistry to pcep-api The base ability to parse messages is inherently tied to a PCEPDispatcher. At the end up the day we will need to pass the parsing registry when we create a server. JIRA: BGPCEP-962 Change-Id: Ic80888f063ea7cab2a6b28ec9978f151313d64ce Signed-off-by: Robert Varga --- pcep/api/pom.xml | 4 + .../protocol/pcep}/MessageRegistry.java | 2 +- .../pcep}/PCEPDeserializerException.java | 2 +- .../extension/BandwidthUsageObjectCodec.java | 9 +- .../PCEPBandwidthUsageObjectCodecTest.java | 2 +- .../extension/PcRptMessageCodecTest.java | 16 +-- .../message/PCEPCloseMessageParser.java | 2 +- .../message/PCEPErrorMessageParser.java | 19 ++- .../message/PCEPKeepAliveMessageParser.java | 7 +- .../PCEPMonitoringReplyMessageParser.java | 2 +- .../PCEPMonitoringRequestMessageParser.java | 9 +- .../PCEPNotificationMessageParser.java | 11 +- .../parser/message/PCEPOpenMessageParser.java | 2 +- .../message/PCEPReplyMessageParser.java | 8 +- .../message/PCEPRequestMessageParser.java | 8 +- .../message/PCEPStartTLSMessageParser.java | 7 +- .../AbstractEROWithSubobjectsParser.java | 10 +- .../AbstractRROWithSubobjectsParser.java | 14 +-- ...AbstractVendorInformationObjectParser.java | 2 +- .../AbstractXROWithSubobjectsParser.java | 14 +-- .../object/PCEPBandwidthObjectParser.java | 2 +- .../object/PCEPClassTypeObjectParser.java | 2 +- .../parser/object/PCEPCloseObjectParser.java | 2 +- .../parser/object/PCEPErrorObjectParser.java | 2 +- .../object/PCEPExcludeRouteObjectParser.java | 2 +- .../PCEPExistingBandwidthObjectParser.java | 9 +- .../object/PCEPExplicitRouteObjectParser.java | 2 +- .../PCEPGlobalConstraintsObjectParser.java | 2 +- .../object/PCEPIncludeRouteObjectParser.java | 12 +- .../object/PCEPLoadBalancingObjectParser.java | 2 +- .../parser/object/PCEPLspaObjectParser.java | 2 +- .../parser/object/PCEPMetricObjectParser.java | 2 +- .../object/PCEPMonitoringObjectParser.java | 2 +- .../parser/object/PCEPNoPathObjectParser.java | 2 +- .../object/PCEPNotificationObjectParser.java | 2 +- .../PCEPObjectiveFunctionObjectParser.java | 2 +- .../parser/object/PCEPOpenObjectParser.java | 2 +- .../object/PCEPOverloadObjectParser.java | 2 +- .../object/PCEPPathKeyObjectParser.java | 12 +- .../object/PCEPPccIdReqIPv4ObjectParser.java | 2 +- .../object/PCEPPccIdReqIPv6ObjectParser.java | 2 +- .../object/PCEPPceIdIPv4ObjectParser.java | 2 +- .../object/PCEPPceIdIPv6ObjectParser.java | 2 +- .../object/PCEPProcTimeObjectParser.java | 2 +- .../object/PCEPReportedRouteObjectParser.java | 12 +- .../PCEPRequestParameterObjectParser.java | 2 +- ...PCEPSecondaryExplicitRouteObjecParser.java | 10 +- .../PCEPSecondaryRecordRouteObjectParser.java | 10 +- .../parser/object/PCEPSvecObjectParser.java | 2 +- .../bnc/BranchNodeListObjectParser.java | 12 +- .../bnc/NonBranchNodeListObjectParser.java | 12 +- .../points/PCEPEndPointsIpv4ObjectParser.java | 2 +- .../points/PCEPEndPointsIpv6ObjectParser.java | 2 +- .../PCEPP2MPEndPointsIpv4ObjectParser.java | 2 +- .../PCEPP2MPEndPointsIpv6ObjectParser.java | 2 +- .../PCEPIpv4UnreachDestinationParser.java | 4 +- .../PCEPIpv6UnreachDestinationParser.java | 2 +- .../parser/subobject/AsNumberCaseParser.java | 2 +- .../subobject/EROAsNumberSubobjectParser.java | 7 +- ...ExplicitExclusionRouteSubobjectParser.java | 16 +-- .../EROIpv4PrefixSubobjectParser.java | 2 +- .../EROIpv6PrefixSubobjectParser.java | 2 +- .../subobject/EROLabelSubobjectParser.java | 8 +- .../EROPathKey128SubobjectParser.java | 2 +- .../EROPathKey32SubobjectParser.java | 2 +- ...EROUnnumberedInterfaceSubobjectParser.java | 2 +- .../subobject/GeneralizedLabelParser.java | 9 +- .../RROIpv4PrefixSubobjectParser.java | 2 +- .../RROIpv6PrefixSubobjectParser.java | 2 +- .../subobject/RROLabelSubobjectParser.java | 13 +- .../RROPathKey128SubobjectParser.java | 2 +- .../RROPathKey32SubobjectParser.java | 2 +- ...RROUnnumberedInterfaceSubobjectParser.java | 2 +- .../parser/subobject/Type1LabelParser.java | 2 +- .../WavebandSwitchingLabelParser.java | 2 +- .../subobject/XROAsNumberSubobjectParser.java | 2 +- .../XROIpv4PrefixSubobjectParser.java | 2 +- .../XROIpv6PrefixSubobjectParser.java | 2 +- .../XROPathKey128SubobjectParser.java | 2 +- .../XROPathKey32SubobjectParser.java | 2 +- .../subobject/XROSrlgSubobjectParser.java | 2 +- ...XROUnnumberedInterfaceSubobjectParser.java | 2 +- .../AbstractVendorInformationTlvParser.java | 2 +- .../parser/tlv/NoPathVectorTlvParser.java | 7 +- .../pcep/parser/tlv/OFListTlvParser.java | 2 +- .../pcep/parser/tlv/OrderTlvParser.java | 2 +- .../tlv/OverloadedDurationTlvParser.java | 2 +- .../parser/tlv/PathSetupTypeTlvParser.java | 2 +- .../pcep/parser/tlv/ReqMissingTlvParser.java | 2 +- .../protocol/pcep/parser/util/Util.java | 7 +- .../te/lsp/P2MPTeLspCapabilityParser.java | 7 +- .../p2mp/te/lsp/P2MPTeLspTlvsParserTest.java | 2 +- .../InitiatedPCInitiateMessageParser.java | 8 +- .../ietf/stateful/PathBindingTlvParser.java | 2 +- .../stateful/StatefulErrorMessageParser.java | 34 ++--- .../StatefulLSPIdentifierIpv4TlvParser.java | 2 +- .../StatefulLSPIdentifierIpv6TlvParser.java | 2 +- .../stateful/StatefulLspObjectParser.java | 2 +- .../StatefulLspSymbolicNameTlvParser.java | 2 +- .../StatefulLspUpdateErrorTlvParser.java | 2 +- .../StatefulPCReportMessageParser.java | 47 ++++--- .../StatefulPCUpdateRequestMessageParser.java | 46 ++++--- .../StatefulRSVPErrorSpecTlvParser.java | 2 +- .../stateful/StatefulSrpObjectParser.java | 10 +- .../StatefulStatefulCapabilityTlvParser.java | 7 +- .../optimizations/LspDbVersionTlvParser.java | 7 +- .../SpeakerEntityIdTlvParser.java | 2 +- .../pcep/ietf/PCEPObjectParserTest.java | 18 +-- .../protocol/pcep/ietf/PCEPTlvParserTest.java | 2 +- .../protocol/pcep/ietf/PCEPValidatorTest.java | 118 +++++++++--------- .../pcep/impl/PCEPByteToMessageDecoder.java | 4 +- .../pcep/impl/PCEPDispatcherImpl.java | 2 +- .../pcep/impl/PCEPHandlerFactory.java | 2 +- .../pcep/impl/PCEPMessageToByteEncoder.java | 2 +- .../pcep/impl/LabelSubobjectParserTest.java | 2 +- .../pcep/impl/PCEPDispatcherImplTest.java | 2 +- .../pcep/impl/PCEPObjectParserTest.java | 2 +- .../protocol/pcep/impl/PCEPParserTest.java | 2 +- .../protocol/pcep/impl/PCEPTlvParserTest.java | 2 +- .../protocol/pcep/impl/PCEPValidatorTest.java | 2 +- .../pcep/impl/PcepEROSubobjectParserTest.java | 2 +- .../pcep/impl/PcepRROSubobjectParserTest.java | 2 +- .../pcep/impl/PcepXROSubobjectParserTest.java | 2 +- .../pcc/mock/PCCEndPointIpv4ObjectParser.java | 2 +- .../protocol/pcep/pcc/mock/PCCsBuilder.java | 2 +- .../pcc/mock/protocol/PCCDispatcherImpl.java | 2 +- .../pcep/pcc/mock/PCCDispatcherImplTest.java | 2 +- .../mock/PCCEndPointIpv4ObjectParserTest.java | 2 +- .../protocol/pcep/pcc/mock/PCCMockCommon.java | 2 +- .../routing/AbstractSrSubobjectParser.java | 71 ++++++----- .../segment/routing/SrEroSubobjectParser.java | 15 +-- .../routing/SrPceCapabilityTlvParser.java | 2 +- .../segment/routing/SrRroSubobjectParser.java | 17 ++- .../routing/SrEroSubobjectParserTest.java | 42 +++---- .../segment/routing/SrObjectParserTest.java | 20 +-- .../routing/SrRroSubobjectParserTest.java | 38 +++--- .../pcep/segment/routing/SrTlvParserTest.java | 2 +- .../AbstractEROPathKeySubobjectParser.java | 1 + .../pcep/spi/AbstractMessageParser.java | 1 + .../spi/AbstractObjectWithTlvsParser.java | 1 + .../protocol/pcep/spi/EROSubobjectParser.java | 1 + .../pcep/spi/EROSubobjectRegistry.java | 1 + .../EnterpriseSpecificInformationParser.java | 1 + .../protocol/pcep/spi/LabelParser.java | 1 + .../protocol/pcep/spi/LabelRegistry.java | 1 + .../protocol/pcep/spi/MessageParser.java | 1 + .../protocol/pcep/spi/ObjectParser.java | 1 + .../protocol/pcep/spi/ObjectRegistry.java | 1 + .../spi/PCEPExtensionConsumerContext.java | 2 + .../protocol/pcep/spi/RROSubobjectParser.java | 1 + .../pcep/spi/RROSubobjectRegistry.java | 1 + .../protocol/pcep/spi/TlvParser.java | 1 + .../protocol/pcep/spi/TlvRegistry.java | 1 + .../spi/VendorInformationObjectRegistry.java | 1 + .../spi/VendorInformationTlvRegistry.java | 1 + .../protocol/pcep/spi/XROSubobjectParser.java | 1 + .../pcep/spi/XROSubobjectRegistry.java | 1 + .../DefaultPCEPExtensionConsumerContext.java | 2 +- .../spi/pojo/SimpleEROSubobjectRegistry.java | 2 +- .../pcep/spi/pojo/SimpleLabelRegistry.java | 2 +- .../pcep/spi/pojo/SimpleMessageRegistry.java | 4 +- .../pcep/spi/pojo/SimpleObjectRegistry.java | 2 +- .../SimplePCEPExtensionProviderContext.java | 2 +- .../spi/pojo/SimpleRROSubobjectRegistry.java | 2 +- .../pcep/spi/pojo/SimpleTlvRegistry.java | 2 +- ...SimpleVendorInformationObjectRegistry.java | 2 +- .../SimpleVendorInformationTlvRegistry.java | 2 +- .../spi/pojo/SimpleXROSubobjectRegistry.java | 2 +- .../protocol/pcep/spi/APITest.java | 1 + .../pcep/spi/AbstractMessageParserTest.java | 1 + .../pcep/spi/AbstractObjectWithTlvsTest.java | 1 + .../protocol/pcep/spi/RegistryTest.java | 1 + .../protocol/pcep/testtool/Main.java | 2 +- 173 files changed, 519 insertions(+), 519 deletions(-) rename pcep/{spi/src/main/java/org/opendaylight/protocol/pcep/spi => api/src/main/java/org/opendaylight/protocol/pcep}/MessageRegistry.java (96%) rename pcep/{spi/src/main/java/org/opendaylight/protocol/pcep/spi => api/src/main/java/org/opendaylight/protocol/pcep}/PCEPDeserializerException.java (96%) diff --git a/pcep/api/pom.xml b/pcep/api/pom.xml index 9775eb58db..1fcd04bbfb 100644 --- a/pcep/api/pom.xml +++ b/pcep/api/pom.xml @@ -36,6 +36,10 @@ io.netty netty-transport + + io.netty + netty-buffer + io.netty netty-common diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageRegistry.java b/pcep/api/src/main/java/org/opendaylight/protocol/pcep/MessageRegistry.java similarity index 96% rename from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageRegistry.java rename to pcep/api/src/main/java/org/opendaylight/protocol/pcep/MessageRegistry.java index 2b5ed015bc..b99fc94123 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageRegistry.java +++ b/pcep/api/src/main/java/org/opendaylight/protocol/pcep/MessageRegistry.java @@ -5,7 +5,7 @@ * 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPDeserializerException.java b/pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPDeserializerException.java similarity index 96% rename from pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPDeserializerException.java rename to pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPDeserializerException.java index 92c92b7019..46c7bd189c 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPDeserializerException.java +++ b/pcep/api/src/main/java/org/opendaylight/protocol/pcep/PCEPDeserializerException.java @@ -5,7 +5,7 @@ * 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. diff --git a/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/BandwidthUsageObjectCodec.java b/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/BandwidthUsageObjectCodec.java index 25f56e4e0b..78f3cbe4a3 100644 --- a/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/BandwidthUsageObjectCodec.java +++ b/pcep/auto-bandwidth-extension/src/main/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/BandwidthUsageObjectCodec.java @@ -8,17 +8,17 @@ 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; @@ -38,8 +38,7 @@ public final class BandwidthUsageObjectCodec extends CommonObjectParser implemen @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 + "."); @@ -57,7 +56,7 @@ public final class BandwidthUsageObjectCodec extends CommonObjectParser implemen @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 bwSample = ((BandwidthUsage) object).getBwSample(); final ByteBuf body = Unpooled.buffer(bwSample.size() * BW_LENGTH); diff --git a/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PCEPBandwidthUsageObjectCodecTest.java b/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PCEPBandwidthUsageObjectCodecTest.java index b27e6aa440..98f0ead270 100644 --- a/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PCEPBandwidthUsageObjectCodecTest.java +++ b/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PCEPBandwidthUsageObjectCodecTest.java @@ -14,8 +14,8 @@ import com.google.common.collect.Lists; 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; diff --git a/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PcRptMessageCodecTest.java b/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PcRptMessageCodecTest.java index 14e6f88a4d..178f146531 100644 --- a/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PcRptMessageCodecTest.java +++ b/pcep/auto-bandwidth-extension/src/test/java/org/opendaylight/protocol/pcep/auto/bandwidth/extension/PcRptMessageCodecTest.java @@ -21,9 +21,9 @@ import java.util.Queue; 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; @@ -59,14 +59,14 @@ public class PcRptMessageCodecTest { @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")); @@ -88,7 +88,7 @@ public class PcRptMessageCodecTest { @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")); @@ -103,7 +103,7 @@ public class PcRptMessageCodecTest { @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()) @@ -118,7 +118,7 @@ public class PcRptMessageCodecTest { + "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)); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPCloseMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPCloseMessageParser.java index c0559ec264..d47f07ef19 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPCloseMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPCloseMessageParser.java @@ -13,10 +13,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPErrorMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPErrorMessageParser.java index b282c7effe..6482f99a6f 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPErrorMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPErrorMessageParser.java @@ -9,17 +9,16 @@ 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.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; @@ -54,11 +53,11 @@ public class PCEPErrorMessageParser extends AbstractMessageParser { @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); @@ -98,8 +97,7 @@ public class PCEPErrorMessageParser extends AbstractMessageParser { 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; @@ -146,15 +144,13 @@ public class PCEPErrorMessageParser extends AbstractMessageParser { final List 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; } @@ -167,8 +163,7 @@ public class PCEPErrorMessageParser extends AbstractMessageParser { } // 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; } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPKeepAliveMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPKeepAliveMessageParser.java index da1a648143..a335b2ccb6 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPKeepAliveMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPKeepAliveMessageParser.java @@ -7,15 +7,16 @@ */ 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; @@ -36,7 +37,7 @@ public class PCEPKeepAliveMessageParser extends AbstractMessageParser { @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); } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringReplyMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringReplyMessageParser.java index 9be69652b0..4c5a0d8cb5 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringReplyMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringReplyMessageParser.java @@ -15,11 +15,11 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringRequestMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringRequestMessageParser.java index 9f6cad16d3..e94fe6ce93 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringRequestMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPMonitoringRequestMessageParser.java @@ -5,18 +5,19 @@ * 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; @@ -42,10 +43,10 @@ public class PCEPMonitoringRequestMessageParser extends PCEPRequestMessageParser @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) { diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPNotificationMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPNotificationMessageParser.java index eb0fe026a6..fd0a47c7f1 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPNotificationMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPNotificationMessageParser.java @@ -15,10 +15,10 @@ 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.PcntfBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message; @@ -68,8 +68,7 @@ public class PCEPNotificationMessageParser extends AbstractMessageParser { throw new PCEPDeserializerException("Notification message cannot be empty."); } - final List compositeNotifications = new ArrayList<>(); - + final var compositeNotifications = new ArrayList(); while (!objects.isEmpty()) { final Notifications comObj = getValidNotificationComposite(objects, errors); if (comObj == null) { @@ -121,8 +120,7 @@ public class PCEPNotificationMessageParser extends AbstractMessageParser { .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; @@ -132,8 +130,7 @@ public class PCEPNotificationMessageParser extends AbstractMessageParser { } // 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; } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPOpenMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPOpenMessageParser.java index 58eda092a6..2ea49d6dbb 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPOpenMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPOpenMessageParser.java @@ -13,10 +13,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPReplyMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPReplyMessageParser.java index ca0751d2b5..4d018b5d2a 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPReplyMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPReplyMessageParser.java @@ -15,11 +15,11 @@ 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.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; @@ -153,7 +153,7 @@ public class PCEPReplyMessageParser extends AbstractMessageParser { } final List 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); } @@ -218,7 +218,7 @@ public class PCEPReplyMessageParser extends AbstractMessageParser { private Result handleNoPath(final NoPath noPath, final Queue 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(); } @@ -237,7 +237,7 @@ public class PCEPReplyMessageParser extends AbstractMessageParser { if (!vendorInfoObjects.isEmpty()) { builder.setVendorInformationObject(vendorInfoObjects); } - this.parsePath(pBuilder, objects); + parsePath(pBuilder, objects); paths.add(pBuilder.build()); } builder.setPaths(paths); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPRequestMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPRequestMessageParser.java index 1dbbc65b70..4130b7037d 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPRequestMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPRequestMessageParser.java @@ -9,17 +9,16 @@ 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.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; @@ -218,7 +217,7 @@ public class PCEPRequestMessageParser extends AbstractMessageParser { @Override protected Message validate(final Queue objects, final List 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."); } @@ -431,8 +430,7 @@ public class PCEPRequestMessageParser extends AbstractMessageParser { } // 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 { diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPStartTLSMessageParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPStartTLSMessageParser.java index bca93cf46c..5b7d7504eb 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPStartTLSMessageParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/message/PCEPStartTLSMessageParser.java @@ -7,15 +7,16 @@ */ 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; @@ -33,7 +34,7 @@ public class PCEPStartTLSMessageParser extends AbstractMessageParser { @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); } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractEROWithSubobjectsParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractEROWithSubobjectsParser.java index 93067c9beb..a9fa6e3090 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractEROWithSubobjectsParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractEROWithSubobjectsParser.java @@ -7,17 +7,17 @@ */ 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; @@ -38,7 +38,7 @@ public abstract class AbstractEROWithSubobjectsParser extends CommonObjectParser protected List 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 subs = new ArrayList<>(); while (buffer.isReadable()) { final boolean loose = (buffer.getUnsignedByte(buffer.readerIndex()) & 1 << Values.FIRST_BIT_OFFSET) != 0; @@ -49,7 +49,7 @@ public abstract class AbstractEROWithSubobjectsParser extends CommonObjectParser "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 { @@ -63,7 +63,7 @@ public abstract class AbstractEROWithSubobjectsParser extends CommonObjectParser protected final void serializeSubobject(final List subobjects, final ByteBuf buffer) { if (subobjects != null) { for (final Subobject subobject : subobjects) { - this.subobjReg.serializeSubobject(subobject, buffer); + subobjReg.serializeSubobject(subobject, buffer); } } } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractRROWithSubobjectsParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractRROWithSubobjectsParser.java index e3ea391477..3ebcfc5c7e 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractRROWithSubobjectsParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractRROWithSubobjectsParser.java @@ -7,16 +7,16 @@ */ 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; @@ -37,8 +37,7 @@ public abstract class AbstractRROWithSubobjectsParser extends CommonObjectParser } protected List 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 subs = new ArrayList<>(); while (buffer.isReadable()) { final int type = buffer.readUnsignedByte(); @@ -48,7 +47,7 @@ public abstract class AbstractRROWithSubobjectsParser extends CommonObjectParser "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 { @@ -60,10 +59,9 @@ public abstract class AbstractRROWithSubobjectsParser extends CommonObjectParser } protected final void serializeSubobject(final List 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); } } } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractVendorInformationObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractVendorInformationObjectParser.java index 6933b2b1a3..14ee35c29f 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractVendorInformationObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractVendorInformationObjectParser.java @@ -13,11 +13,11 @@ import static org.opendaylight.protocol.pcep.spi.VendorInformationUtil.VENDOR_IN 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractXROWithSubobjectsParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractXROWithSubobjectsParser.java index 6294070cfd..77279f0b34 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractXROWithSubobjectsParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/AbstractXROWithSubobjectsParser.java @@ -7,17 +7,17 @@ */ 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; @@ -39,8 +39,7 @@ public abstract class AbstractXROWithSubobjectsParser extends CommonObjectParser } protected List 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 subs = new ArrayList<>(); while (buffer.isReadable()) { final boolean mandatory = @@ -53,7 +52,7 @@ public abstract class AbstractXROWithSubobjectsParser extends CommonObjectParser + 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 { @@ -65,10 +64,9 @@ public abstract class AbstractXROWithSubobjectsParser extends CommonObjectParser } protected final void serializeSubobject(final List 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); } } } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPBandwidthObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPBandwidthObjectParser.java index 13ed96c34d..95490d6ca1 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPBandwidthObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPBandwidthObjectParser.java @@ -12,10 +12,10 @@ 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.bandwidth.object.Bandwidth; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPClassTypeObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPClassTypeObjectParser.java index cd9f9d4612..62bdf0ac80 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPClassTypeObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPClassTypeObjectParser.java @@ -11,10 +11,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPCloseObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPCloseObjectParser.java index ef19b084c1..11928a2dce 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPCloseObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPCloseObjectParser.java @@ -12,9 +12,9 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPErrorObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPErrorObjectParser.java index 72baf064e1..7a4a2c5a5c 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPErrorObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPErrorObjectParser.java @@ -12,9 +12,9 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExcludeRouteObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExcludeRouteObjectParser.java index 2e1a2e52d5..d3fff5e5aa 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExcludeRouteObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExcludeRouteObjectParser.java @@ -11,8 +11,8 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExistingBandwidthObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExistingBandwidthObjectParser.java index 3ba6b39fc9..abff1a3994 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExistingBandwidthObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExistingBandwidthObjectParser.java @@ -7,15 +7,15 @@ */ 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; @@ -37,8 +37,7 @@ public class PCEPExistingBandwidthObjectParser extends CommonObjectParser implem @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 + "."); @@ -56,7 +55,7 @@ public class PCEPExistingBandwidthObjectParser extends CommonObjectParser implem 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(); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExplicitRouteObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExplicitRouteObjectParser.java index 89e8be945a..f424fa230e 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExplicitRouteObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPExplicitRouteObjectParser.java @@ -10,9 +10,9 @@ package org.opendaylight.protocol.pcep.parser.object; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPGlobalConstraintsObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPGlobalConstraintsObjectParser.java index ebe0428caa..455176c3b8 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPGlobalConstraintsObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPGlobalConstraintsObjectParser.java @@ -12,9 +12,9 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPIncludeRouteObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPIncludeRouteObjectParser.java index 896d89d20d..611c80a03d 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPIncludeRouteObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPIncludeRouteObjectParser.java @@ -7,14 +7,15 @@ */ 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; @@ -36,8 +37,7 @@ public final class PCEPIncludeRouteObjectParser extends AbstractEROWithSubobject @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 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)) { @@ -55,8 +55,8 @@ public final class PCEPIncludeRouteObjectParser extends AbstractEROWithSubobject @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 pk = new ArrayList<>(); final List subs = parseSubobjects(bytes); for (final Subobject sub : subs) { @@ -57,8 +57,8 @@ public final class PCEPPathKeyObjectParser extends AbstractEROWithSubobjectsPars @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 subs = new ArrayList<>(); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv4ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv4ObjectParser.java index 873180d0cc..8025a56a11 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv4ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv4ObjectParser.java @@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.parser.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv6ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv6ObjectParser.java index 9d787c0596..2f354f8d12 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv6ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPccIdReqIPv6ObjectParser.java @@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.parser.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv4ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv4ObjectParser.java index 3fd2fcafa3..9deac483f1 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv4ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv4ObjectParser.java @@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.parser.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv6ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv6ObjectParser.java index a36a72f58f..f30dfaaa10 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv6ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPPceIdIPv6ObjectParser.java @@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.parser.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPProcTimeObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPProcTimeObjectParser.java index e8da9c76e0..963ffc24a0 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPProcTimeObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPProcTimeObjectParser.java @@ -11,10 +11,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPReportedRouteObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPReportedRouteObjectParser.java index 01aee5a255..e699b84ecf 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPReportedRouteObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPReportedRouteObjectParser.java @@ -7,11 +7,12 @@ */ 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; @@ -31,8 +32,7 @@ public final class PCEPReportedRouteObjectParser extends AbstractRROWithSubobjec @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()) @@ -42,8 +42,8 @@ public final class PCEPReportedRouteObjectParser extends AbstractRROWithSubobjec @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); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPRequestParameterObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPRequestParameterObjectParser.java index 7eefa33e6c..f451b8b996 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPRequestParameterObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPRequestParameterObjectParser.java @@ -12,9 +12,9 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryExplicitRouteObjecParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryExplicitRouteObjecParser.java index 7b2a0c3e55..abd791ca57 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryExplicitRouteObjecParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryExplicitRouteObjecParser.java @@ -5,17 +5,17 @@ * 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; @@ -34,7 +34,7 @@ public final class PCEPSecondaryExplicitRouteObjecParser extends AbstractEROWith @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()); @@ -50,7 +50,7 @@ public final class PCEPSecondaryExplicitRouteObjecParser extends AbstractEROWith @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(); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryRecordRouteObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryRecordRouteObjectParser.java index e7d521a046..9628bb4ba1 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryRecordRouteObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSecondaryRecordRouteObjectParser.java @@ -5,16 +5,16 @@ * 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; @@ -34,7 +34,7 @@ public final class PCEPSecondaryRecordRouteObjectParser extends AbstractRROWithS @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()); @@ -54,7 +54,7 @@ public final class PCEPSecondaryRecordRouteObjectParser extends AbstractRROWithS @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(); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSvecObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSvecObjectParser.java index 6194ebfb69..6216cd41af 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSvecObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/PCEPSvecObjectParser.java @@ -13,10 +13,10 @@ import com.google.common.collect.ImmutableSet; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/BranchNodeListObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/BranchNodeListObjectParser.java index 0bc2280446..19b72c8a2e 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/BranchNodeListObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/BranchNodeListObjectParser.java @@ -7,13 +7,14 @@ */ 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; @@ -30,9 +31,8 @@ public final class BranchNodeListObjectParser extends AbstractEROWithSubobjectsP @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()) @@ -42,7 +42,7 @@ public final class BranchNodeListObjectParser extends AbstractEROWithSubobjectsP @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(); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/NonBranchNodeListObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/NonBranchNodeListObjectParser.java index fd3609c35c..e3c3731879 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/NonBranchNodeListObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/bnc/NonBranchNodeListObjectParser.java @@ -7,13 +7,14 @@ */ 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; @@ -29,9 +30,8 @@ public final class NonBranchNodeListObjectParser extends AbstractEROWithSubobjec @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()) @@ -41,7 +41,7 @@ public final class NonBranchNodeListObjectParser extends AbstractEROWithSubobjec @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(); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv4ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv4ObjectParser.java index b54b9059ad..4b5057607e 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv4ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv4ObjectParser.java @@ -11,9 +11,9 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv6ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv6ObjectParser.java index 7c90773866..747a8b0d72 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv6ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPEndPointsIpv6ObjectParser.java @@ -11,9 +11,9 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java index baf337fe2e..6a57ef8c6c 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv4ObjectParser.java @@ -13,9 +13,9 @@ import com.google.common.collect.ImmutableSet; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java index 8ccf1a36ad..f54a85edd9 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/end/points/PCEPP2MPEndPointsIpv6ObjectParser.java @@ -13,9 +13,9 @@ import com.google.common.collect.ImmutableSet; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv4UnreachDestinationParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv4UnreachDestinationParser.java index dd2d757450..a8dc9c1d2d 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv4UnreachDestinationParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv4UnreachDestinationParser.java @@ -13,9 +13,9 @@ import com.google.common.collect.ImmutableSet; 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; @@ -46,7 +46,7 @@ public final class PCEPIpv4UnreachDestinationParser extends CommonObjectParser { @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."); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv6UnreachDestinationParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv6UnreachDestinationParser.java index c7bfaac238..80b028349b 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv6UnreachDestinationParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/object/unreach/PCEPIpv6UnreachDestinationParser.java @@ -13,9 +13,9 @@ import com.google.common.collect.ImmutableSet; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/AsNumberCaseParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/AsNumberCaseParser.java index 336ae5e0d0..293bf27c7b 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/AsNumberCaseParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/AsNumberCaseParser.java @@ -11,7 +11,7 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROAsNumberSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROAsNumberSubobjectParser.java index bcdc5d38f9..2b2dcff1b1 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROAsNumberSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROAsNumberSubobjectParser.java @@ -7,12 +7,13 @@ */ 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; @@ -32,7 +33,7 @@ public class EROAsNumberSubobjectParser implements EROSubobjectParser, EROSubobj @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); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROExplicitExclusionRouteSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROExplicitExclusionRouteSubobjectParser.java index 87b9fc26dd..325e92f74f 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROExplicitExclusionRouteSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROExplicitExclusionRouteSubobjectParser.java @@ -7,15 +7,16 @@ */ 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; @@ -39,8 +40,7 @@ public class EROExplicitExclusionRouteSubobjectParser implements EROSubobjectPar @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 xros = parseSubobject(buffer); final List 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 xros = new ArrayList<>(); @@ -78,14 +78,14 @@ public class EROExplicitExclusionRouteSubobjectParser implements EROSubobjectPar 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 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); } } } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv4PrefixSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv4PrefixSubobjectParser.java index 279e666284..24e0988b81 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv4PrefixSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv4PrefixSubobjectParser.java @@ -11,10 +11,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv6PrefixSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv6PrefixSubobjectParser.java index 9e775c905e..e47247339d 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv6PrefixSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROIpv6PrefixSubobjectParser.java @@ -11,10 +11,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROLabelSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROLabelSubobjectParser.java index c75fa14855..865ce54c61 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROLabelSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROLabelSubobjectParser.java @@ -12,11 +12,11 @@ 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.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; @@ -46,7 +46,7 @@ public class EROLabelSubobjectParser implements EROSubobjectParser, EROSubobject private final LabelRegistry registry; public EROLabelSubobjectParser(final LabelRegistry labelReg) { - this.registry = requireNonNull(labelReg); + registry = requireNonNull(labelReg); } @Override @@ -60,7 +60,7 @@ public class EROLabelSubobjectParser implements EROSubobjectParser, EROSubobject 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; @@ -81,7 +81,7 @@ public class EROLabelSubobjectParser implements EROSubobjectParser, EROSubobject "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); } } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey128SubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey128SubobjectParser.java index db11074f7d..ee4adf4cf6 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey128SubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey128SubobjectParser.java @@ -8,8 +8,8 @@ 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 { diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey32SubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey32SubobjectParser.java index fda2a5736a..5c20860308 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey32SubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROPathKey32SubobjectParser.java @@ -8,8 +8,8 @@ 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 { diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROUnnumberedInterfaceSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROUnnumberedInterfaceSubobjectParser.java index bc9a0e022c..8d60c66268 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROUnnumberedInterfaceSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/EROUnnumberedInterfaceSubobjectParser.java @@ -11,10 +11,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/GeneralizedLabelParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/GeneralizedLabelParser.java index 715e1ca2cf..55fc017fdd 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/GeneralizedLabelParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/GeneralizedLabelParser.java @@ -7,13 +7,15 @@ */ 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; @@ -30,8 +32,7 @@ public class GeneralizedLabelParser implements LabelParser, LabelSerializer { @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()) @@ -41,7 +42,7 @@ public class GeneralizedLabelParser implements LabelParser, LabelSerializer { @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."); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv4PrefixSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv4PrefixSubobjectParser.java index 0b8e04c249..ec52978b34 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv4PrefixSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv4PrefixSubobjectParser.java @@ -11,7 +11,7 @@ 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.RROSubobjectParser; import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv6PrefixSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv6PrefixSubobjectParser.java index e96075f2cf..e377046b21 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv6PrefixSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROIpv6PrefixSubobjectParser.java @@ -11,7 +11,7 @@ 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.RROSubobjectParser; import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java index cd30750d9a..00150ed2fa 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROLabelSubobjectParser.java @@ -7,13 +7,13 @@ */ 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; @@ -47,13 +47,12 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject 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 + "."); @@ -62,7 +61,7 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject 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; @@ -82,7 +81,7 @@ public class RROLabelSubobjectParser implements RROSubobjectParser, RROSubobject 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); } } diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey128SubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey128SubobjectParser.java index 7ad5315f16..e03cf46926 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey128SubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey128SubobjectParser.java @@ -11,7 +11,7 @@ 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.RROSubobjectParser; import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil; import org.opendaylight.protocol.util.ByteArray; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey32SubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey32SubobjectParser.java index 4e9e5a4af6..75d3a68fd2 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey32SubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROPathKey32SubobjectParser.java @@ -11,7 +11,7 @@ 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.RROSubobjectParser; import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROUnnumberedInterfaceSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROUnnumberedInterfaceSubobjectParser.java index a819439f9c..bb082d3635 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROUnnumberedInterfaceSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/RROUnnumberedInterfaceSubobjectParser.java @@ -11,7 +11,7 @@ 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.RROSubobjectParser; import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.RROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/Type1LabelParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/Type1LabelParser.java index 30e77e4938..fa76dc78ed 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/Type1LabelParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/Type1LabelParser.java @@ -11,10 +11,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/WavebandSwitchingLabelParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/WavebandSwitchingLabelParser.java index 7a1f2acd80..f4e9b56726 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/WavebandSwitchingLabelParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/WavebandSwitchingLabelParser.java @@ -11,10 +11,10 @@ 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.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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROAsNumberSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROAsNumberSubobjectParser.java index b6e333fa5f..a1bc99ff0e 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROAsNumberSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROAsNumberSubobjectParser.java @@ -9,7 +9,7 @@ package org.opendaylight.protocol.pcep.parser.subobject; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv4PrefixSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv4PrefixSubobjectParser.java index 911c0810dc..35ea6e52be 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv4PrefixSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv4PrefixSubobjectParser.java @@ -11,7 +11,7 @@ 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.XROSubobjectParser; import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv6PrefixSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv6PrefixSubobjectParser.java index 856f72f8f3..0ba1a7584e 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv6PrefixSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROIpv6PrefixSubobjectParser.java @@ -11,7 +11,7 @@ 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.XROSubobjectParser; import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey128SubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey128SubobjectParser.java index 5d4a792860..bdad36831b 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey128SubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey128SubobjectParser.java @@ -11,7 +11,7 @@ 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.XROSubobjectParser; import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil; import org.opendaylight.protocol.util.ByteArray; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey32SubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey32SubobjectParser.java index d751a9ffda..52cef8a7b4 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey32SubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROPathKey32SubobjectParser.java @@ -11,7 +11,7 @@ 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.XROSubobjectParser; import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java index 52eba0323d..0663339932 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java @@ -11,7 +11,7 @@ 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.XROSubobjectParser; import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROUnnumberedInterfaceSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROUnnumberedInterfaceSubobjectParser.java index 4757202db4..95482de808 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROUnnumberedInterfaceSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROUnnumberedInterfaceSubobjectParser.java @@ -11,7 +11,7 @@ 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.XROSubobjectParser; import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer; import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/AbstractVendorInformationTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/AbstractVendorInformationTlvParser.java index 7580afc72a..815dd679fd 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/AbstractVendorInformationTlvParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/AbstractVendorInformationTlvParser.java @@ -12,8 +12,8 @@ import static org.opendaylight.protocol.pcep.spi.VendorInformationUtil.VENDOR_IN 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/NoPathVectorTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/NoPathVectorTlvParser.java index 909a61641b..c59b9ded51 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/NoPathVectorTlvParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/NoPathVectorTlvParser.java @@ -7,10 +7,11 @@ */ 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; @@ -56,7 +57,7 @@ public class NoPathVectorTlvParser implements TlvParser, TlvSerializer { @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); diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OFListTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OFListTlvParser.java index 25ec06d864..b99d986eee 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OFListTlvParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OFListTlvParser.java @@ -12,7 +12,7 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OrderTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OrderTlvParser.java index 7c7c5ef6bf..011753702d 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OrderTlvParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OrderTlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OverloadedDurationTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OverloadedDurationTlvParser.java index 73847c5436..7f16586039 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OverloadedDurationTlvParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/OverloadedDurationTlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/PathSetupTypeTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/PathSetupTypeTlvParser.java index 0a00e9d0a8..c3572d93cc 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/PathSetupTypeTlvParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/PathSetupTypeTlvParser.java @@ -13,7 +13,7 @@ import io.netty.buffer.ByteBuf; 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/ReqMissingTlvParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/ReqMissingTlvParser.java index 7701c57720..4e0bb7f92e 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/ReqMissingTlvParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/tlv/ReqMissingTlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/util/Util.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/util/Util.java index 700a6e3725..46d89e3365 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/util/Util.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/util/Util.java @@ -8,7 +8,7 @@ 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; @@ -47,12 +47,11 @@ public final class Util { } public static MetricPce validateMonitoringMetrics(final Queue 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); diff --git a/pcep/ietf-p2mp-te-lsp/src/main/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspCapabilityParser.java b/pcep/ietf-p2mp-te-lsp/src/main/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspCapabilityParser.java index 6298034ff5..72340bd38e 100644 --- a/pcep/ietf-p2mp-te-lsp/src/main/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspCapabilityParser.java +++ b/pcep/ietf-p2mp-te-lsp/src/main/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspCapabilityParser.java @@ -7,11 +7,12 @@ */ 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; @@ -27,7 +28,7 @@ public final class P2MPTeLspCapabilityParser implements TlvParser, TlvSerializer @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); diff --git a/pcep/ietf-p2mp-te-lsp/src/test/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspTlvsParserTest.java b/pcep/ietf-p2mp-te-lsp/src/test/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspTlvsParserTest.java index 960ce27047..26da98d96d 100644 --- a/pcep/ietf-p2mp-te-lsp/src/test/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspTlvsParserTest.java +++ b/pcep/ietf-p2mp-te-lsp/src/test/java/org/opendaylight/protocol/pcep/p2mp/te/lsp/P2MPTeLspTlvsParserTest.java @@ -14,7 +14,7 @@ import static org.opendaylight.protocol.pcep.p2mp.te.lsp.P2MPTeLspCapabilityPars 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 { diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated/InitiatedPCInitiateMessageParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated/InitiatedPCInitiateMessageParser.java index 4853e174fe..5ca3ae0e1d 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated/InitiatedPCInitiateMessageParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/initiated/InitiatedPCInitiateMessageParser.java @@ -15,10 +15,10 @@ import java.util.ArrayList; 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; @@ -79,9 +79,9 @@ public class InitiatedPCInitiateMessageParser extends AbstractMessageParser { throws PCEPDeserializerException { checkArgument(objects != null, "Passed list can't be null."); final PcinitiateMessageBuilder builder = new PcinitiateMessageBuilder(); - final List reqs = new ArrayList<>(); + final var reqs = new ArrayList(); while (!objects.isEmpty()) { - reqs.add(this.getValidRequest(objects)); + reqs.add(getValidRequest(objects)); } builder.setRequests(reqs); return new PcinitiateBuilder().setPcinitiateMessage(builder.build()).build(); @@ -92,7 +92,7 @@ public class InitiatedPCInitiateMessageParser extends AbstractMessageParser { .setSrp(consumeObject(objects, Srp.class)) .setLsp(consumeObject(objects, Lsp.class)); - final List metrics = new ArrayList<>(); + final var metrics = new ArrayList(); State state = State.INIT; for (Object obj = objects.peek(); obj != null; obj = objects.peek()) { state = insertObject(state, obj, builder, metrics); diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/PathBindingTlvParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/PathBindingTlvParser.java index e9b9978ad9..472aa04d7d 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/PathBindingTlvParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/PathBindingTlvParser.java @@ -16,7 +16,7 @@ import io.netty.buffer.ByteBuf; 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; diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulErrorMessageParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulErrorMessageParser.java index 13408b798f..e21db88143 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulErrorMessageParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulErrorMessageParser.java @@ -14,9 +14,9 @@ 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.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; @@ -47,7 +47,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.typ * Parser for {@link PcerrMessage}. */ public final class StatefulErrorMessageParser extends PCEPErrorMessageParser { - public StatefulErrorMessageParser(final ObjectRegistry registry) { super(registry); } @@ -55,15 +54,13 @@ public final class StatefulErrorMessageParser extends PCEPErrorMessageParser { @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 = ((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 = ((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); } } @@ -78,16 +75,15 @@ public final class StatefulErrorMessageParser extends PCEPErrorMessageParser { if (first == null) { throw new PCEPDeserializerException("Error message is empty."); } - final List requestParameters = new ArrayList<>(); - final List srps = new ArrayList<>(); - final List errorObjects = new ArrayList<>(); + final var requestParameters = new ArrayList(); + final var srps = new ArrayList(); + final var errorObjects = new ArrayList(); 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; @@ -135,22 +131,19 @@ public final class StatefulErrorMessageParser extends PCEPErrorMessageParser { final List requestParameters, final List 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; } @@ -163,8 +156,7 @@ public final class StatefulErrorMessageParser extends PCEPErrorMessageParser { } // 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; } diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv4TlvParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv4TlvParser.java index fcd78de171..dac1937699 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv4TlvParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv4TlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv6TlvParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv6TlvParser.java index 9a0809f6e1..efd9db27fb 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv6TlvParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLSPIdentifierIpv6TlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspObjectParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspObjectParser.java index 04cf4fd4cc..b2ebba52c4 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspObjectParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspObjectParser.java @@ -13,9 +13,9 @@ import com.google.common.primitives.UnsignedBytes; 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; diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspSymbolicNameTlvParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspSymbolicNameTlvParser.java index 1342c7dd4c..54d441dded 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspSymbolicNameTlvParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspSymbolicNameTlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspUpdateErrorTlvParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspUpdateErrorTlvParser.java index 6206a4fb88..8bd078880b 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspUpdateErrorTlvParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulLspUpdateErrorTlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCReportMessageParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCReportMessageParser.java index 37832b7e33..2bca0b4efd 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCReportMessageParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCReportMessageParser.java @@ -15,10 +15,10 @@ 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.PSTUtil; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.Pcrpt; @@ -92,8 +92,7 @@ public class StatefulPCReportMessageParser extends AbstractMessageParser { throw new PCEPDeserializerException("Pcrpt message cannot be empty."); } - final List reports = new ArrayList<>(); - + final var reports = new ArrayList(); while (!objects.isEmpty()) { final Reports report = getValidReports(objects, errors); if (report != null) { @@ -108,8 +107,7 @@ public class StatefulPCReportMessageParser extends AbstractMessageParser { 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()); @@ -132,8 +130,7 @@ public class StatefulPCReportMessageParser extends AbstractMessageParser { private static boolean validateLsp(final Object object, final boolean lspViaSR, final List 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 @@ -155,8 +152,8 @@ public class StatefulPCReportMessageParser extends AbstractMessageParser { 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; @@ -207,46 +204,46 @@ public class StatefulPCReportMessageParser extends AbstractMessageParser { final List 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 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 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 diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCUpdateRequestMessageParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCUpdateRequestMessageParser.java index bdca0f9161..fd630d26ac 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCUpdateRequestMessageParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulPCUpdateRequestMessageParser.java @@ -15,10 +15,10 @@ 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.ietf.stateful.rev200720.Pcupd; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.PcupdBuilder; @@ -55,9 +55,8 @@ public class StatefulPCUpdateRequestMessageParser extends AbstractMessageParser checkArgument(message instanceof Pcupd, "Wrong instance of Message. Passed instance of %s. Need Pcupd.", message.getClass()); final Pcupd msg = (Pcupd) message; - final List 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); @@ -87,8 +86,7 @@ public class StatefulPCUpdateRequestMessageParser extends AbstractMessageParser throw new PCEPDeserializerException("Pcup message cannot be empty."); } - final List updateRequests = new ArrayList<>(); - + final var updateRequests = new ArrayList(); while (!objects.isEmpty()) { final Updates upd = getValidUpdates(objects, errors); if (upd != null) { @@ -105,8 +103,8 @@ public class StatefulPCUpdateRequestMessageParser extends AbstractMessageParser 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())); @@ -125,8 +123,8 @@ public class StatefulPCUpdateRequestMessageParser extends AbstractMessageParser } private static boolean validateLsp(final Object object, final List 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; @@ -138,8 +136,8 @@ public class StatefulPCUpdateRequestMessageParser extends AbstractMessageParser 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; @@ -150,7 +148,7 @@ public class StatefulPCUpdateRequestMessageParser extends AbstractMessageParser } private static void parsePath(final Queue objects, final PathBuilder pathBuilder) { - final List pathMetrics = new ArrayList<>(); + final var pathMetrics = new ArrayList(); State state = State.INIT; for (Object obj = objects.peek(); obj != null; obj = objects.peek()) { state = insertObject(state, obj, pathBuilder, pathMetrics); @@ -170,32 +168,32 @@ public class StatefulPCUpdateRequestMessageParser extends AbstractMessageParser final List 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 diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulRSVPErrorSpecTlvParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulRSVPErrorSpecTlvParser.java index 2fa942cd3f..315f741162 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulRSVPErrorSpecTlvParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulRSVPErrorSpecTlvParser.java @@ -12,7 +12,7 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulSrpObjectParser.java b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulSrpObjectParser.java index cade4dbad6..32e08a78dd 100644 --- a/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulSrpObjectParser.java +++ b/pcep/ietf-stateful/src/main/java/org/opendaylight/protocol/pcep/ietf/stateful/StatefulSrpObjectParser.java @@ -12,9 +12,9 @@ import static com.google.common.base.Preconditions.checkArgument; 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; @@ -68,11 +68,11 @@ public class StatefulSrpObjectParser extends AbstractObjectWithTlvsParser 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); @@ -248,9 +248,9 @@ public class PCEPValidatorTest { final List 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); @@ -258,12 +258,12 @@ public class PCEPValidatorTest { final List 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)) @@ -284,8 +284,8 @@ public class PCEPValidatorTest { .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 @@ -305,14 +305,14 @@ public class PCEPValidatorTest { .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) @@ -322,11 +322,11 @@ public class PCEPValidatorTest { @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() @@ -427,7 +427,7 @@ public class PCEPValidatorTest { .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())); @@ -440,14 +440,14 @@ public class PCEPValidatorTest { 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(), @@ -457,10 +457,10 @@ public class PCEPValidatorTest { 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())); @@ -479,12 +479,12 @@ public class PCEPValidatorTest { ByteBuf result = Unpooled.wrappedBuffer(PCRT1); final StatefulPCReportMessageParser parser = new StatefulPCReportMessageParser( - this.ctx.getObjectHandlerRegistry()); + ctx.getObjectHandlerRegistry()); final PcrptMessageBuilder builder = new PcrptMessageBuilder(); final List 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()); @@ -496,11 +496,11 @@ public class PCEPValidatorTest { 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())); @@ -516,11 +516,11 @@ public class PCEPValidatorTest { final List 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(), @@ -539,12 +539,12 @@ public class PCEPValidatorTest { final List 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(), @@ -556,10 +556,10 @@ public class PCEPValidatorTest { result = Unpooled.wrappedBuffer(PCRT3); final List 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); @@ -577,16 +577,16 @@ public class PCEPValidatorTest { 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(), @@ -601,7 +601,7 @@ public class PCEPValidatorTest { 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(); @@ -722,7 +722,7 @@ public class PCEPValidatorTest { new StatefulActivator().start(ctx); final StatefulPCReportMessageParser parser = new StatefulPCReportMessageParser( - this.ctx.getObjectHandlerRegistry()); + ctx.getObjectHandlerRegistry()); final ByteBuf buf = Unpooled.wrappedBuffer(statefulMsg); final List errors = new ArrayList<>(); @@ -770,7 +770,7 @@ public class PCEPValidatorTest { new InitiatedActivator().start(ctx); final StatefulPCUpdateRequestMessageParser parser = new StatefulPCUpdateRequestMessageParser( - this.ctx.getObjectHandlerRegistry()); + ctx.getObjectHandlerRegistry()); final ByteBuf buf = Unpooled.wrappedBuffer(badUpdateMsg); final List errors = new ArrayList<>(); diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPByteToMessageDecoder.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPByteToMessageDecoder.java index 1077dee337..c88c05f567 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPByteToMessageDecoder.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPByteToMessageDecoder.java @@ -16,8 +16,8 @@ import io.netty.channel.ChannelHandlerContext; 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; diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImpl.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImpl.java index cf9d165cac..df874bb25c 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImpl.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImpl.java @@ -33,11 +33,11 @@ import java.util.concurrent.TimeUnit; 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; diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPHandlerFactory.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPHandlerFactory.java index 3fe350d62f..f98fc00bd4 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPHandlerFactory.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPHandlerFactory.java @@ -11,7 +11,7 @@ import static java.util.Objects.requireNonNull; 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. diff --git a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPMessageToByteEncoder.java b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPMessageToByteEncoder.java index bbb7649dd2..0b542105dd 100644 --- a/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPMessageToByteEncoder.java +++ b/pcep/impl/src/main/java/org/opendaylight/protocol/pcep/impl/PCEPMessageToByteEncoder.java @@ -14,7 +14,7 @@ import io.netty.buffer.ByteBufUtil; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/LabelSubobjectParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/LabelSubobjectParserTest.java index 13ffd25cfa..a85daada0f 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/LabelSubobjectParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/LabelSubobjectParserTest.java @@ -14,10 +14,10 @@ import static org.junit.Assert.fail; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImplTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImplTest.java index cc94f6bd98..4dd0067518 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImplTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPDispatcherImplTest.java @@ -46,12 +46,12 @@ import org.junit.runner.RunWith; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java index fe73321578..f292ceec46 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPObjectParserTest.java @@ -24,6 +24,7 @@ import java.util.List; 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; @@ -65,7 +66,6 @@ import org.opendaylight.protocol.pcep.parser.object.unreach.PCEPIpv4UnreachDesti 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPParserTest.java index d8574917be..d66088d67d 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPParserTest.java @@ -16,7 +16,7 @@ import io.netty.buffer.Unpooled; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPTlvParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPTlvParserTest.java index f97b90b529..04664e1d29 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPTlvParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPTlvParserTest.java @@ -15,6 +15,7 @@ import com.google.common.collect.ImmutableSet; 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; @@ -22,7 +23,6 @@ import org.opendaylight.protocol.pcep.parser.tlv.OrderTlvParser; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java index 602b45ae64..9788cb5403 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PCEPValidatorTest.java @@ -20,6 +20,7 @@ import java.util.List; 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; @@ -33,7 +34,6 @@ import org.opendaylight.protocol.pcep.parser.message.PCEPReplyMessageParser; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepEROSubobjectParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepEROSubobjectParserTest.java index b93ae3effb..d069376132 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepEROSubobjectParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepEROSubobjectParserTest.java @@ -17,6 +17,7 @@ import java.util.ArrayList; 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; @@ -26,7 +27,6 @@ import org.opendaylight.protocol.pcep.parser.subobject.EROLabelSubobjectParser; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepRROSubobjectParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepRROSubobjectParserTest.java index 2289d6a2b4..fa85152e0d 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepRROSubobjectParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepRROSubobjectParserTest.java @@ -14,6 +14,7 @@ import static org.junit.Assert.fail; 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; @@ -21,7 +22,6 @@ import org.opendaylight.protocol.pcep.parser.subobject.RROLabelSubobjectParser; 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; diff --git a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepXROSubobjectParserTest.java b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepXROSubobjectParserTest.java index 782ae5fad4..6cea8cf8f7 100644 --- a/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepXROSubobjectParserTest.java +++ b/pcep/impl/src/test/java/org/opendaylight/protocol/pcep/impl/PcepXROSubobjectParserTest.java @@ -14,6 +14,7 @@ import static org.junit.Assert.fail; 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; @@ -21,7 +22,6 @@ import org.opendaylight.protocol.pcep.parser.subobject.XROPathKey128SubobjectPar 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; diff --git a/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParser.java b/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParser.java index f31442ad68..018984545a 100644 --- a/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParser.java +++ b/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParser.java @@ -10,8 +10,8 @@ package org.opendaylight.protocol.pcep.pcc.mock; 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; diff --git a/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCsBuilder.java b/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCsBuilder.java index 1441b2d126..184028155f 100644 --- a/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCsBuilder.java +++ b/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/PCCsBuilder.java @@ -19,6 +19,7 @@ import java.util.Optional; 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; @@ -27,7 +28,6 @@ import org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager; 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; diff --git a/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCDispatcherImpl.java b/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCDispatcherImpl.java index ec81fefc5a..ebd93e3352 100755 --- a/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCDispatcherImpl.java +++ b/pcep/pcc-mock/src/main/java/org/opendaylight/protocol/pcep/pcc/mock/protocol/PCCDispatcherImpl.java @@ -27,6 +27,7 @@ import java.net.InetSocketAddress; 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; @@ -34,7 +35,6 @@ import org.opendaylight.protocol.pcep.PCEPSessionNegotiatorFactory; 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; diff --git a/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCDispatcherImplTest.java b/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCDispatcherImplTest.java index 5ae9d216f0..675d799063 100644 --- a/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCDispatcherImplTest.java +++ b/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCDispatcherImplTest.java @@ -27,6 +27,7 @@ import org.junit.runner.RunWith; 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; @@ -36,7 +37,6 @@ import org.opendaylight.protocol.pcep.impl.DefaultPCEPSessionNegotiatorFactory; 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; diff --git a/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParserTest.java b/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParserTest.java index aa710b27aa..8cbcd60dfd 100644 --- a/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParserTest.java +++ b/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCEndPointIpv4ObjectParserTest.java @@ -13,8 +13,8 @@ import static org.junit.Assert.assertFalse; 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; diff --git a/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCMockCommon.java b/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCMockCommon.java index 1c768eff3c..fdddbd57d4 100644 --- a/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCMockCommon.java +++ b/pcep/pcc-mock/src/test/java/org/opendaylight/protocol/pcep/pcc/mock/PCCMockCommon.java @@ -31,6 +31,7 @@ import java.util.ServiceLoader; 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; @@ -46,7 +47,6 @@ import org.opendaylight.protocol.pcep.pcc.mock.api.PCCTunnelManager; 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; diff --git a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/AbstractSrSubobjectParser.java b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/AbstractSrSubobjectParser.java index b3f552b811..8ca52005bf 100644 --- a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/AbstractSrSubobjectParser.java +++ b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/AbstractSrSubobjectParser.java @@ -11,7 +11,7 @@ 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.util.BitArray; import org.opendaylight.protocol.util.Ipv4Util; import org.opendaylight.protocol.util.Ipv6Util; @@ -64,27 +64,27 @@ public abstract class AbstractSrSubobjectParser { @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; } } @@ -172,36 +172,35 @@ public abstract class AbstractSrSubobjectParser { } 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 { diff --git a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParser.java b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParser.java index 040be8a2f4..dc59423e88 100644 --- a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParser.java +++ b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParser.java @@ -7,12 +7,13 @@ */ 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; @@ -29,23 +30,23 @@ public class SrEroSubobjectParser extends AbstractSrSubobjectParser implements E 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 @@ -59,6 +60,6 @@ public class SrEroSubobjectParser extends AbstractSrSubobjectParser implements E @Deprecated public int getCodePoint() { - return this.type; + return type; } } \ No newline at end of file diff --git a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrPceCapabilityTlvParser.java b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrPceCapabilityTlvParser.java index 29445f7e31..b810dc7b19 100644 --- a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrPceCapabilityTlvParser.java +++ b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrPceCapabilityTlvParser.java @@ -11,7 +11,7 @@ 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; diff --git a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParser.java b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParser.java index 26b715b679..ae6ca8177f 100644 --- a/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParser.java +++ b/pcep/segment-routing/src/main/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParser.java @@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.segment.routing; 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; @@ -31,34 +31,31 @@ public class SrRroSubobjectParser extends AbstractSrSubobjectParser implements R 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; } } diff --git a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParserTest.java b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParserTest.java index 68bae5c178..15e007c6c9 100644 --- a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParserTest.java +++ b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrEroSubobjectParserTest.java @@ -14,7 +14,7 @@ import io.netty.buffer.ByteBuf; 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; @@ -101,10 +101,10 @@ public class SrEroSubobjectParserTest { @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 @@ -118,10 +118,10 @@ public class SrEroSubobjectParserTest { .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)); } @@ -136,10 +136,10 @@ public class SrEroSubobjectParserTest { 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)); } @@ -155,10 +155,10 @@ public class SrEroSubobjectParserTest { .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)); } @@ -175,10 +175,10 @@ public class SrEroSubobjectParserTest { .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)); } @@ -195,10 +195,10 @@ public class SrEroSubobjectParserTest { .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)); } @@ -211,10 +211,10 @@ public class SrEroSubobjectParserTest { .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)); } @@ -228,10 +228,10 @@ public class SrEroSubobjectParserTest { 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)); } @@ -246,10 +246,10 @@ public class SrEroSubobjectParserTest { .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)); } } diff --git a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrObjectParserTest.java b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrObjectParserTest.java index 0605520055..e2d443a943 100644 --- a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrObjectParserTest.java +++ b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrObjectParserTest.java @@ -17,9 +17,9 @@ import java.util.ArrayList; 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; @@ -66,17 +66,17 @@ public class SrObjectParserTest { @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) @@ -108,7 +108,7 @@ public class SrObjectParserTest { @Test public void testSrEroObjectWithSubobjects() throws PCEPDeserializerException { final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser( - this.ctx.getEROSubobjectHandlerRegistry()); + ctx.getEROSubobjectHandlerRegistry()); final EroBuilder builder = new EroBuilder(); builder.setProcessingRule(false); @@ -139,7 +139,7 @@ public class SrObjectParserTest { @Test public void testSrEroSerializerWithUpdateLspAugmentation() throws PCEPDeserializerException { final PCEPExplicitRouteObjectParser parser = new PCEPExplicitRouteObjectParser( - this.ctx.getEROSubobjectHandlerRegistry()); + ctx.getEROSubobjectHandlerRegistry()); final EroBuilder builder = new EroBuilder(); builder.setProcessingRule(false); diff --git a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParserTest.java b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParserTest.java index e2b8b9457f..df83687a76 100644 --- a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParserTest.java +++ b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrRroSubobjectParserTest.java @@ -14,7 +14,7 @@ import io.netty.buffer.ByteBuf; 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; @@ -90,10 +90,10 @@ public class SrRroSubobjectParserTest { @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 @@ -107,10 +107,10 @@ public class SrRroSubobjectParserTest { .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)); } @@ -125,10 +125,10 @@ public class SrRroSubobjectParserTest { 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)); } @@ -144,10 +144,10 @@ public class SrRroSubobjectParserTest { .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)); } @@ -163,10 +163,10 @@ public class SrRroSubobjectParserTest { .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)); } @@ -183,10 +183,10 @@ public class SrRroSubobjectParserTest { .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)); } @@ -199,10 +199,10 @@ public class SrRroSubobjectParserTest { .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)); } @@ -216,10 +216,10 @@ public class SrRroSubobjectParserTest { .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)); } } diff --git a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrTlvParserTest.java b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrTlvParserTest.java index 361094a69b..b283ba98a5 100644 --- a/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrTlvParserTest.java +++ b/pcep/segment-routing/src/test/java/org/opendaylight/protocol/pcep/segment/routing/SrTlvParserTest.java @@ -13,7 +13,7 @@ import static org.junit.Assert.assertEquals; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractEROPathKeySubobjectParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractEROPathKeySubobjectParser.java index c49a203a65..13e4187746 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractEROPathKeySubobjectParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractEROPathKeySubobjectParser.java @@ -11,6 +11,7 @@ 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.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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParser.java index c07d5462c2..c04659cac1 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParser.java @@ -17,6 +17,7 @@ import java.util.List; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsParser.java index 0c688f9bae..e0f24c2640 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsParser.java @@ -15,6 +15,7 @@ import io.netty.buffer.ByteBufUtil; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectParser.java index 3f653f9bef..d175f2f6a6 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectParser.java @@ -8,6 +8,7 @@ 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; /** diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectRegistry.java index 6dd6c2b52b..adc7f7e596 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EROSubobjectRegistry.java @@ -8,6 +8,7 @@ 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; /** diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EnterpriseSpecificInformationParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EnterpriseSpecificInformationParser.java index 1bcaa1c77d..c7ea156f6a 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EnterpriseSpecificInformationParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/EnterpriseSpecificInformationParser.java @@ -8,6 +8,7 @@ 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelParser.java index 381bc9a73f..de1c20228b 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelParser.java @@ -8,6 +8,7 @@ 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 { diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java index 06dd76116f..9308d86c33 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/LabelRegistry.java @@ -8,6 +8,7 @@ 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 { diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageParser.java index d2e4e7b01a..c70be962a9 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/MessageParser.java @@ -9,6 +9,7 @@ package org.opendaylight.protocol.pcep.spi; 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 { diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectParser.java index 50f8fa2b51..d9dc914ed2 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectParser.java @@ -8,6 +8,7 @@ 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java index 00d49cbe62..fd908de8b0 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/ObjectRegistry.java @@ -8,6 +8,7 @@ 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionConsumerContext.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionConsumerContext.java index cd1255dffb..6ddf22019d 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionConsumerContext.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/PCEPExtensionConsumerContext.java @@ -7,6 +7,8 @@ */ package org.opendaylight.protocol.pcep.spi; +import org.opendaylight.protocol.pcep.MessageRegistry; + public interface PCEPExtensionConsumerContext { LabelRegistry getLabelHandlerRegistry(); diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectParser.java index 5a8a4e8a5d..8b6964eba5 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectParser.java @@ -8,6 +8,7 @@ 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; /** diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectRegistry.java index 09c8f47884..4bb0c15cbf 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/RROSubobjectRegistry.java @@ -8,6 +8,7 @@ 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; /** diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvParser.java index 0485b3ee5e..d1ba094a44 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvParser.java @@ -8,6 +8,7 @@ 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 { diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvRegistry.java index 47e341735a..f42beeaedb 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/TlvRegistry.java @@ -8,6 +8,7 @@ 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 { diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationObjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationObjectRegistry.java index 672a314cd8..5fbcf3103a 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationObjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationObjectRegistry.java @@ -9,6 +9,7 @@ package org.opendaylight.protocol.pcep.spi; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationTlvRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationTlvRegistry.java index 259e0b6c36..9269b25bb4 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationTlvRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/VendorInformationTlvRegistry.java @@ -9,6 +9,7 @@ package org.opendaylight.protocol.pcep.spi; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectParser.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectParser.java index acd3ac016b..6a3a60f757 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectParser.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectParser.java @@ -8,6 +8,7 @@ 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 { diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectRegistry.java index 98b7cfa342..252aa47341 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/XROSubobjectRegistry.java @@ -8,6 +8,7 @@ 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 { diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/DefaultPCEPExtensionConsumerContext.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/DefaultPCEPExtensionConsumerContext.java index f682f12abb..96fa1f67f6 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/DefaultPCEPExtensionConsumerContext.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/DefaultPCEPExtensionConsumerContext.java @@ -15,9 +15,9 @@ import javax.inject.Inject; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleEROSubobjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleEROSubobjectRegistry.java index bcd50e5742..c3203d10f8 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleEROSubobjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleEROSubobjectRegistry.java @@ -11,10 +11,10 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelRegistry.java index a047a4cef4..2b669ce103 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleLabelRegistry.java @@ -11,10 +11,10 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleMessageRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleMessageRegistry.java index 400908732b..0d0d7c28bd 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleMessageRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleMessageRegistry.java @@ -12,10 +12,10 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectRegistry.java index 127fe36836..5ceb65c01e 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleObjectRegistry.java @@ -13,10 +13,10 @@ import com.google.common.base.Preconditions; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java index 08a5952e6a..76ff6d8231 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimplePCEPExtensionProviderContext.java @@ -7,6 +7,7 @@ */ 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; @@ -14,7 +15,6 @@ 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.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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectRegistry.java index c02d942a3b..b8497ef7c7 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleRROSubobjectRegistry.java @@ -11,7 +11,7 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java index c848ddd2cc..51a8afc05f 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleTlvRegistry.java @@ -11,7 +11,7 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationObjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationObjectRegistry.java index 9597d0f757..f66fb585e3 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationObjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationObjectRegistry.java @@ -10,9 +10,9 @@ package org.opendaylight.protocol.pcep.spi.pojo; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationTlvRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationTlvRegistry.java index b5da4d2282..ed7935f044 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationTlvRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleVendorInformationTlvRegistry.java @@ -10,7 +10,7 @@ package org.opendaylight.protocol.pcep.spi.pojo; 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; diff --git a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectRegistry.java b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectRegistry.java index f435aa4cfc..9a19d836c3 100644 --- a/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectRegistry.java +++ b/pcep/spi/src/main/java/org/opendaylight/protocol/pcep/spi/pojo/SimpleXROSubobjectRegistry.java @@ -11,7 +11,7 @@ import static com.google.common.base.Preconditions.checkArgument; 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; diff --git a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/APITest.java b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/APITest.java index 320e08657c..2003cab97b 100644 --- a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/APITest.java +++ b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/APITest.java @@ -13,6 +13,7 @@ import static org.junit.Assert.assertNull; 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; diff --git a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParserTest.java b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParserTest.java index ec424a4839..a039744c79 100644 --- a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParserTest.java +++ b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractMessageParserTest.java @@ -27,6 +27,7 @@ import org.junit.Test; 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; diff --git a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsTest.java b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsTest.java index b1bf06f64a..c7f4e1f51c 100644 --- a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsTest.java +++ b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/AbstractObjectWithTlvsTest.java @@ -25,6 +25,7 @@ import org.junit.Test; 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; diff --git a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/RegistryTest.java b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/RegistryTest.java index adf1b4e35a..c691324ef8 100644 --- a/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/RegistryTest.java +++ b/pcep/spi/src/test/java/org/opendaylight/protocol/pcep/spi/RegistryTest.java @@ -22,6 +22,7 @@ import org.junit.Test; 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; diff --git a/pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.java b/pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.java index a532e1c4f1..7a532859ee 100644 --- a/pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.java +++ b/pcep/testtool/src/main/java/org/opendaylight/protocol/pcep/testtool/Main.java @@ -15,13 +15,13 @@ import java.util.ArrayList; 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; -- 2.36.6