Fix multiple checkstyle complains 01/73001/1
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Thu, 14 Jun 2018 11:45:06 +0000 (13:45 +0200)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Thu, 14 Jun 2018 11:45:06 +0000 (13:45 +0200)
Change-Id: Ie499dd6a81262bd5e09823099ce8b6c91ddc9065
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
29 files changed:
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/BGPActivator.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPKeepAliveMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPNotificationMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPOpenMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/BGPRouteRefreshMessageParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AggregatorAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AsPathAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/AtomicAggregateAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/BgpPrefixSidAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/ClusterIdAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/CommunitiesAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/CommunityUtil.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/ExtendedCommunitiesAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/LocalPreferenceAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/MultiExitDiscriminatorAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/NextHopAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/OriginAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/OriginatorIdAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/ReachAttributeParser.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/UnrecognizedAttributesSerializer.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/AsTwoOctetSpecificEcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/EncapsulationEC.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/LinkBandwidthEC.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/OpaqueEcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/RouteOriginAsTwoOctetEcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/RouteOriginIpv4EcHandler.java
bgp/parser-impl/src/main/java/org/opendaylight/protocol/bgp/parser/impl/message/update/extended/communities/four/octect/as/specific/Generic4OctASEcHandler.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/BgpExtendedMessageCapabilityHandlerTest.java
bgp/parser-impl/src/test/java/org/opendaylight/protocol/bgp/parser/impl/RouteRefreshCapabilityHandlerTest.java

index ea3ff2e3c28a11fff218058620a8bfe003c28c9d..d8215627c27330fe668c7a14e0e4c6216f3cdddb 100755 (executable)
@@ -132,7 +132,8 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         return regs;
     }
 
-    private static void registerCapabilityParsers(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
+    private static void registerCapabilityParsers(final List<AutoCloseable> regs,
+            final BGPExtensionProviderContext context) {
         final AddressFamilyRegistry afiReg = context.getAddressFamilyRegistry();
         final SubsequentAddressFamilyRegistry safiReg = context.getSubsequentAddressFamilyRegistry();
 
@@ -165,8 +166,10 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerCapabilitySerializer(BgpExtendedMessageCapability.class, bgpextmessage));
     }
 
-    private static void registerAttributeParsers(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
-        final BgpPrefixSidAttributeParser prefixSidAttributeParser = new BgpPrefixSidAttributeParser(context.getBgpPrefixSidTlvRegistry());
+    private static void registerAttributeParsers(final List<AutoCloseable> regs,
+            final BGPExtensionProviderContext context) {
+        final BgpPrefixSidAttributeParser prefixSidAttributeParser
+                = new BgpPrefixSidAttributeParser(context.getBgpPrefixSidTlvRegistry());
         regs.add(context.registerAttributeSerializer(BgpPrefixSid.class, prefixSidAttributeParser));
         regs.add(context.registerAttributeParser(BgpPrefixSidAttributeParser.TYPE, prefixSidAttributeParser));
 
@@ -186,9 +189,11 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerAttributeSerializer(NextHop.class, nextHopAttributeParser));
         regs.add(context.registerAttributeParser(NextHopAttributeParser.TYPE, nextHopAttributeParser));
 
-        final MultiExitDiscriminatorAttributeParser multiExitDiscriminatorAttributeParser = new MultiExitDiscriminatorAttributeParser();
+        final MultiExitDiscriminatorAttributeParser multiExitDiscriminatorAttributeParser
+                = new MultiExitDiscriminatorAttributeParser();
         regs.add(context.registerAttributeSerializer(MultiExitDisc.class, multiExitDiscriminatorAttributeParser));
-        regs.add(context.registerAttributeParser(MultiExitDiscriminatorAttributeParser.TYPE, multiExitDiscriminatorAttributeParser));
+        regs.add(context.registerAttributeParser(MultiExitDiscriminatorAttributeParser.TYPE,
+                multiExitDiscriminatorAttributeParser));
 
         final LocalPreferenceAttributeParser localPreferenceAttributeParser = new LocalPreferenceAttributeParser();
         regs.add(context.registerAttributeSerializer(LocalPref.class, localPreferenceAttributeParser));
@@ -198,11 +203,13 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerAttributeSerializer(AtomicAggregate.class, atomicAggregateAttributeParser));
         regs.add(context.registerAttributeParser(AtomicAggregateAttributeParser.TYPE, atomicAggregateAttributeParser));
 
-        final AggregatorAttributeParser as4AggregatorAttributeParser = new AggregatorAttributeParser(context.getReferenceCache());
+        final AggregatorAttributeParser as4AggregatorAttributeParser
+                = new AggregatorAttributeParser(context.getReferenceCache());
         regs.add(context.registerAttributeSerializer(Aggregator.class, as4AggregatorAttributeParser));
         regs.add(context.registerAttributeParser(AggregatorAttributeParser.TYPE, as4AggregatorAttributeParser));
 
-        final CommunitiesAttributeParser communitiesAttributeParser = new CommunitiesAttributeParser(context.getReferenceCache());
+        final CommunitiesAttributeParser communitiesAttributeParser
+                = new CommunitiesAttributeParser(context.getReferenceCache());
         regs.add(context.registerAttributeSerializer(Communities.class, communitiesAttributeParser));
         regs.add(context.registerAttributeParser(CommunitiesAttributeParser.TYPE, communitiesAttributeParser));
 
@@ -224,17 +231,22 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerAttributeSerializer(MpUnreachNlri.class, mpUnreachAttributeParser));
         regs.add(context.registerAttributeParser(MPUnreachAttributeParser.TYPE, mpUnreachAttributeParser));
 
-        final ExtendedCommunitiesAttributeParser extendedCommunitiesAttributeParser = new ExtendedCommunitiesAttributeParser(context.getExtendedCommunityRegistry());
+        final ExtendedCommunitiesAttributeParser extendedCommunitiesAttributeParser
+                = new ExtendedCommunitiesAttributeParser(context.getExtendedCommunityRegistry());
         regs.add(context.registerAttributeSerializer(ExtendedCommunities.class, extendedCommunitiesAttributeParser));
-        regs.add(context.registerAttributeParser(ExtendedCommunitiesAttributeParser.TYPE, extendedCommunitiesAttributeParser));
+        regs.add(context.registerAttributeParser(ExtendedCommunitiesAttributeParser.TYPE,
+                extendedCommunitiesAttributeParser));
 
-        regs.add(context.registerAttributeParser(AS4AggregatorAttributeParser.TYPE, new AS4AggregatorAttributeParser()));
+        regs.add(context.registerAttributeParser(AS4AggregatorAttributeParser.TYPE,
+                new AS4AggregatorAttributeParser()));
         regs.add(context.registerAttributeParser(AS4PathAttributeParser.TYPE, new AS4PathAttributeParser()));
 
-        regs.add(context.registerAttributeSerializer(UnrecognizedAttributes.class, new UnrecognizedAttributesSerializer()));
+        regs.add(context.registerAttributeSerializer(UnrecognizedAttributes.class,
+                new UnrecognizedAttributesSerializer()));
     }
 
-    private static void registerMessageParsers(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
+    private static void registerMessageParsers(final List<AutoCloseable> regs,
+            final BGPExtensionProviderContext context) {
         final BGPOpenMessageParser omp = new BGPOpenMessageParser(context.getParameterRegistry());
         regs.add(context.registerMessageParser(BGPOpenMessageParser.TYPE, omp));
         regs.add(context.registerMessageSerializer(Open.class, omp));
@@ -258,77 +270,86 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerMessageSerializer(RouteRefresh.class, rrmp));
     }
 
-    private static void registerExtendedCommunities(final List<AutoCloseable> regs, final BGPExtensionProviderContext context) {
+    private static void registerExtendedCommunities(final List<AutoCloseable> regs,
+            final BGPExtensionProviderContext context) {
         final AsTwoOctetSpecificEcHandler twoOctetSpecificEcHandler = new AsTwoOctetSpecificEcHandler();
-        regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(true), twoOctetSpecificEcHandler.getSubType(),
-                twoOctetSpecificEcHandler));
-        regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(false), twoOctetSpecificEcHandler.getSubType(),
-                twoOctetSpecificEcHandler));
+        regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(true),
+                twoOctetSpecificEcHandler.getSubType(), twoOctetSpecificEcHandler));
+        regs.add(context.registerExtendedCommunityParser(twoOctetSpecificEcHandler.getType(false),
+                twoOctetSpecificEcHandler.getSubType(), twoOctetSpecificEcHandler));
         regs.add(context.registerExtendedCommunitySerializer(AsSpecificExtendedCommunityCase.class, twoOctetSpecificEcHandler));
 
         final Ipv4SpecificEcHandler ipv4SpecificEcHandler = new Ipv4SpecificEcHandler();
-        regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(true), ipv4SpecificEcHandler.getSubType(),
+        regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(true),
+                ipv4SpecificEcHandler.getSubType(), ipv4SpecificEcHandler));
+        regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(false),
+                ipv4SpecificEcHandler.getSubType(), ipv4SpecificEcHandler));
+        regs.add(context.registerExtendedCommunitySerializer(Inet4SpecificExtendedCommunityCase.class,
                 ipv4SpecificEcHandler));
-        regs.add(context.registerExtendedCommunityParser(ipv4SpecificEcHandler.getType(false), ipv4SpecificEcHandler.getSubType(),
-                ipv4SpecificEcHandler));
-        regs.add(context.registerExtendedCommunitySerializer(Inet4SpecificExtendedCommunityCase.class, ipv4SpecificEcHandler));
 
         final OpaqueEcHandler opaqueEcHandler = new OpaqueEcHandler();
-        regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(true), opaqueEcHandler.getSubType(),
-                opaqueEcHandler));
-        regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(false), opaqueEcHandler.getSubType(),
-                opaqueEcHandler));
+        regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(true),
+                opaqueEcHandler.getSubType(), opaqueEcHandler));
+        regs.add(context.registerExtendedCommunityParser(opaqueEcHandler.getType(false),
+                opaqueEcHandler.getSubType(), opaqueEcHandler));
         regs.add(context.registerExtendedCommunitySerializer(OpaqueExtendedCommunityCase.class, opaqueEcHandler));
 
         final RouteOriginAsTwoOctetEcHandler routeOriginAS2bEcHandler = new RouteOriginAsTwoOctetEcHandler();
-        regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(true), routeOriginAS2bEcHandler.getSubType(),
-                routeOriginAS2bEcHandler));
-        regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(false), routeOriginAS2bEcHandler.getSubType(),
+        regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(true),
+                routeOriginAS2bEcHandler.getSubType(), routeOriginAS2bEcHandler));
+        regs.add(context.registerExtendedCommunityParser(routeOriginAS2bEcHandler.getType(false),
+                routeOriginAS2bEcHandler.getSubType(), routeOriginAS2bEcHandler));
+        regs.add(context.registerExtendedCommunitySerializer(RouteOriginExtendedCommunityCase.class,
                 routeOriginAS2bEcHandler));
-        regs.add(context.registerExtendedCommunitySerializer(RouteOriginExtendedCommunityCase.class, routeOriginAS2bEcHandler));
 
         final RouteTargetAsTwoOctetEcHandler routeTargetAS2bEcHandler = new RouteTargetAsTwoOctetEcHandler();
-        regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(true), routeTargetAS2bEcHandler.getSubType(),
-                routeTargetAS2bEcHandler));
-        regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(false), routeTargetAS2bEcHandler.getSubType(),
+        regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(true),
+                routeTargetAS2bEcHandler.getSubType(), routeTargetAS2bEcHandler));
+        regs.add(context.registerExtendedCommunityParser(routeTargetAS2bEcHandler.getType(false),
+                routeTargetAS2bEcHandler.getSubType(), routeTargetAS2bEcHandler));
+        regs.add(context.registerExtendedCommunitySerializer(RouteTargetExtendedCommunityCase.class,
                 routeTargetAS2bEcHandler));
-        regs.add(context.registerExtendedCommunitySerializer(RouteTargetExtendedCommunityCase.class, routeTargetAS2bEcHandler));
 
         final RouteOriginIpv4EcHandler routeOriginIpv4EcHandler = new RouteOriginIpv4EcHandler();
-        regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(true), routeOriginIpv4EcHandler.getSubType(),
-                routeOriginIpv4EcHandler));
-        regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(false), routeOriginIpv4EcHandler.getSubType(),
-                routeOriginIpv4EcHandler));
+        regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(true),
+                routeOriginIpv4EcHandler.getSubType(), routeOriginIpv4EcHandler));
+        regs.add(context.registerExtendedCommunityParser(routeOriginIpv4EcHandler.getType(false),
+                routeOriginIpv4EcHandler.getSubType(), routeOriginIpv4EcHandler));
         regs.add(context.registerExtendedCommunitySerializer(RouteOriginIpv4Case.class, routeOriginIpv4EcHandler));
 
         final RouteTargetIpv4EcHandler routeTargetIpv4EcHandler = new RouteTargetIpv4EcHandler();
-        regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(true), routeTargetIpv4EcHandler.getSubType(),
-                routeTargetIpv4EcHandler));
-        regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(false), routeTargetIpv4EcHandler.getSubType(),
-                routeTargetIpv4EcHandler));
+        regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(true),
+                routeTargetIpv4EcHandler.getSubType(), routeTargetIpv4EcHandler));
+        regs.add(context.registerExtendedCommunityParser(routeTargetIpv4EcHandler.getType(false),
+                routeTargetIpv4EcHandler.getSubType(), routeTargetIpv4EcHandler));
         regs.add(context.registerExtendedCommunitySerializer(RouteTargetIpv4Case.class, routeTargetIpv4EcHandler));
 
         final LinkBandwidthEC linkBandwidthECHandler = new LinkBandwidthEC();
-        regs.add(context.registerExtendedCommunityParser(linkBandwidthECHandler.getType(false), linkBandwidthECHandler.getSubType(),
-                linkBandwidthECHandler));
+        regs.add(context.registerExtendedCommunityParser(linkBandwidthECHandler.getType(false),
+                linkBandwidthECHandler.getSubType(), linkBandwidthECHandler));
         regs.add(context.registerExtendedCommunitySerializer(LinkBandwidthCase.class, linkBandwidthECHandler));
 
         final Generic4OctASEcHandler gen4OctASEcHandler = new Generic4OctASEcHandler();
-        regs.add(context.registerExtendedCommunityParser(gen4OctASEcHandler.getType(true), gen4OctASEcHandler.getSubType(), gen4OctASEcHandler));
-        regs.add(context.registerExtendedCommunityParser(gen4OctASEcHandler.getType(false), gen4OctASEcHandler.getSubType(), gen4OctASEcHandler));
-        regs.add(context.registerExtendedCommunitySerializer(As4GenericSpecExtendedCommunityCase.class, gen4OctASEcHandler));
+        regs.add(context.registerExtendedCommunityParser(gen4OctASEcHandler.getType(true),
+                gen4OctASEcHandler.getSubType(), gen4OctASEcHandler));
+        regs.add(context.registerExtendedCommunityParser(gen4OctASEcHandler.getType(false),
+                gen4OctASEcHandler.getSubType(), gen4OctASEcHandler));
+        regs.add(context.registerExtendedCommunitySerializer(As4GenericSpecExtendedCommunityCase.class,
+                gen4OctASEcHandler));
 
         final RouteTarget4OctectASEcHandler rt4ASHandler = new RouteTarget4OctectASEcHandler();
-        regs.add(context.registerExtendedCommunityParser(rt4ASHandler.getType(true), rt4ASHandler.getSubType(), rt4ASHandler));
+        regs.add(context.registerExtendedCommunityParser(rt4ASHandler.getType(true),
+                rt4ASHandler.getSubType(), rt4ASHandler));
         regs.add(context.registerExtendedCommunitySerializer(As4RouteTargetExtendedCommunityCase.class, rt4ASHandler));
 
         final RouteOrigin4OctectASEcHandler rOrig4Oct = new RouteOrigin4OctectASEcHandler();
-        regs.add(context.registerExtendedCommunityParser(rOrig4Oct.getType(true), rOrig4Oct.getSubType(), rOrig4Oct));
+        regs.add(context.registerExtendedCommunityParser(rOrig4Oct.getType(true)
+                , rOrig4Oct.getSubType(), rOrig4Oct));
         regs.add(context.registerExtendedCommunitySerializer(As4RouteOriginExtendedCommunityCase.class, rOrig4Oct));
 
         final EncapsulationEC encapsulationECHandler = new EncapsulationEC();
-        regs.add(context.registerExtendedCommunityParser(encapsulationECHandler.getType(true), encapsulationECHandler.getSubType(),
-                encapsulationECHandler));
+        regs.add(context.registerExtendedCommunityParser(encapsulationECHandler.getType(true),
+                encapsulationECHandler.getSubType(), encapsulationECHandler));
         regs.add(context.registerExtendedCommunitySerializer(EncapsulationCase.class, encapsulationECHandler));
 
         final VrfRouteImportHandler vrfRouteImportHandler = new VrfRouteImportHandler();
index aefb34441db0c4e262fd978bb3404c4bca86d1de..6e3994d0a2cb329b026ce44dc1e4eb9d10aa9509 100644 (file)
@@ -30,7 +30,8 @@ public final class BGPKeepAliveMessageParser implements MessageParser, MessageSe
     @Override
     public Keepalive parseMessageBody(final ByteBuf body, final int messageLength) throws BGPDocumentedException {
         if (body.isReadable()) {
-            throw BGPDocumentedException.badMessageLength("Message length field not within valid range.", messageLength);
+            throw BGPDocumentedException.badMessageLength("Message length field not within valid range.",
+                    messageLength);
         }
         return KEEPALIVE_MSG;
     }
index 61ede298e48493b2e01b11209f550bc599216690..132509ab779b1c3225281e9319f04591936729f0 100644 (file)
@@ -73,12 +73,13 @@ public final class BGPNotificationMessageParser implements MessageParser, Messag
         }
         final int errorCode = body.readUnsignedByte();
         final int errorSubcode = body.readUnsignedByte();
-        final NotifyBuilder builder = new NotifyBuilder().setErrorCode((short) errorCode).setErrorSubcode((short) errorSubcode);
+        final NotifyBuilder builder = new NotifyBuilder()
+                .setErrorCode((short) errorCode).setErrorSubcode((short) errorSubcode);
         if (body.isReadable()) {
             builder.setData(ByteArray.readAllBytes(body));
         }
-        LOG.debug("BGP Notification message was parsed: err = {}, data = {}.", BGPError.forValue(errorCode, errorSubcode),
-            Arrays.toString(builder.getData()));
+        LOG.debug("BGP Notification message was parsed: err = {}, data = {}.",
+                BGPError.forValue(errorCode, errorSubcode), Arrays.toString(builder.getData()));
         return builder.build();
     }
 }
index feb98969f8711aeebb1628016fc97bf984493225..4b5308b375b7cca0038ca4615f64b288b649e9d0 100644 (file)
@@ -48,7 +48,8 @@ public final class BGPOpenMessageParser implements MessageParser, MessageSeriali
     private static final int BGP_ID_SIZE = 4;
     private static final int OPT_PARAM_LENGTH_SIZE = 1;
 
-    private static final int MIN_MSG_LENGTH = VERSION_SIZE + AS_SIZE + HOLD_TIME_SIZE + BGP_ID_SIZE + OPT_PARAM_LENGTH_SIZE;
+    private static final int MIN_MSG_LENGTH = VERSION_SIZE + AS_SIZE
+            + HOLD_TIME_SIZE + BGP_ID_SIZE + OPT_PARAM_LENGTH_SIZE;
 
     private static final int BGP_VERSION = 4;
 
@@ -112,14 +113,15 @@ public final class BGPOpenMessageParser implements MessageParser, MessageSeriali
         }
         final int version = body.readUnsignedByte();
         if (version != BGP_VERSION) {
-            throw new BGPDocumentedException("BGP Protocol version " + version + " not supported.", BGPError.VERSION_NOT_SUPPORTED);
+            throw new BGPDocumentedException("BGP Protocol version " + version + " not supported.",
+                    BGPError.VERSION_NOT_SUPPORTED);
         }
         final AsNumber as = new AsNumber((long) body.readUnsignedShort());
         final int holdTime = body.readUnsignedShort();
         if (holdTime == 1 || holdTime == 2) {
             throw new BGPDocumentedException("Hold time value not acceptable.", BGPError.HOLD_TIME_NOT_ACC);
         }
-        Ipv4Address bgpId = null;
+        Ipv4Address bgpId;
         try {
             bgpId = Ipv4Util.addressForByteBuf(body);
         } catch (final IllegalArgumentException e) {
@@ -131,19 +133,22 @@ public final class BGPOpenMessageParser implements MessageParser, MessageSeriali
         if (optLength > 0) {
             fillParams(body.slice(), optParams);
         }
-        LOG.debug("BGP Open message was parsed: AS = {}, holdTimer = {}, bgpId = {}, optParams = {}", as, holdTime, bgpId, optParams);
-        return new OpenBuilder().setMyAsNumber(as.getValue().intValue()).setHoldTimer(holdTime).setBgpIdentifier(bgpId).setBgpParameters(
-            optParams).build();
+        LOG.debug("BGP Open message was parsed: AS = {}, holdTimer = {}, bgpId = {}, optParams = {}", as,
+                holdTime, bgpId, optParams);
+        return new OpenBuilder().setMyAsNumber(as.getValue().intValue()).setHoldTimer(holdTime)
+                .setBgpIdentifier(bgpId).setBgpParameters(optParams).build();
     }
 
     private void fillParams(final ByteBuf buffer, final List<BgpParameters> params) throws BGPDocumentedException {
-        Preconditions.checkArgument(buffer != null && buffer.isReadable(), "BUffer cannot be null or empty.");
+        Preconditions.checkArgument(buffer != null && buffer.isReadable(),
+                "Buffer cannot be null or empty.");
         if (LOG.isTraceEnabled()) {
             LOG.trace("Started parsing of BGP parameter: {}", ByteBufUtil.hexDump(buffer));
         }
         while (buffer.isReadable()) {
             if (buffer.readableBytes() <= 2) {
-                throw new BGPDocumentedException("Malformed parameter encountered (" + buffer.readableBytes() + " bytes left)", BGPError.OPT_PARAM_NOT_SUPPORTED);
+                throw new BGPDocumentedException("Malformed parameter encountered (" + buffer.readableBytes()
+                        + " bytes left)", BGPError.OPT_PARAM_NOT_SUPPORTED);
             }
             final int paramType = buffer.readUnsignedByte();
             final int paramLength = buffer.readUnsignedByte();
index af27ac2972e6ccb84032c3478a944beff13a5dcd..e2c2cd652e0b9c1a6eddea271d14a0ba1002ed7d 100644 (file)
@@ -36,11 +36,13 @@ public final class BGPRouteRefreshMessageParser implements MessageParser, Messag
 
     public static final int TYPE = 5;
     private static final int TRIPLET_BYTE_SIZE = 4;
+    private static final String ARGUMENT_ERROR = "Message is not of type RouteRefresh.";
 
     private final AddressFamilyRegistry afiReg;
     private final SubsequentAddressFamilyRegistry safiReg;
 
-    public BGPRouteRefreshMessageParser(final AddressFamilyRegistry afiReg, final SubsequentAddressFamilyRegistry safiReg) {
+    public BGPRouteRefreshMessageParser(final AddressFamilyRegistry afiReg,
+            final SubsequentAddressFamilyRegistry safiReg) {
         this.afiReg = requireNonNull(afiReg);
         this.safiReg = requireNonNull(safiReg);
     }
@@ -53,11 +55,12 @@ public final class BGPRouteRefreshMessageParser implements MessageParser, Messag
      */
     @Override
     public void serializeMessage(final Notification message, final ByteBuf bytes) {
-        Preconditions.checkArgument(message instanceof RouteRefresh, "Message is not of type RouteRefresh.");
+        Preconditions.checkArgument(message instanceof RouteRefresh, ARGUMENT_ERROR);
         final RouteRefresh msg = (RouteRefresh) message;
 
         final ByteBuf msgBuf = Unpooled.buffer(TRIPLET_BYTE_SIZE);
-        MultiprotocolCapabilitiesUtil.serializeMPAfiSafi(this.afiReg, this.safiReg, msg.getAfi(), msg.getSafi(), msgBuf);
+        MultiprotocolCapabilitiesUtil.serializeMPAfiSafi(this.afiReg, this.safiReg,
+                msg.getAfi(), msg.getSafi(), msgBuf);
 
         LOG.trace("RouteRefresh message serialized to: {}", ByteBufUtil.hexDump(msgBuf));
         MessageUtil.formatMessage(TYPE, msgBuf, bytes);
@@ -77,9 +80,11 @@ public final class BGPRouteRefreshMessageParser implements MessageParser, Messag
         if (body.readableBytes() < TRIPLET_BYTE_SIZE) {
             throw BGPDocumentedException.badMessageLength("RouteRefresh message is too small.", messageLength);
         }
-        final Optional<BgpTableType> parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(body, this.afiReg, this.safiReg);
+        final Optional<BgpTableType> parsedAfiSafi = MultiprotocolCapabilitiesUtil.parseMPAfiSafi(body, this.afiReg,
+                this.safiReg);
         if (!parsedAfiSafi.isPresent()) {
-            throw new BGPDocumentedException("Unsupported afi/safi in Route Refresh message.", BGPError.WELL_KNOWN_ATTR_NOT_RECOGNIZED);
+            throw new BGPDocumentedException("Unsupported afi/safi in Route Refresh message.",
+                    BGPError.WELL_KNOWN_ATTR_NOT_RECOGNIZED);
         }
         return new RouteRefreshBuilder(parsedAfiSafi.get()).build();
     }
index 733fe6aa3c0d60c30814afee87ea20a3624d9a54..c44e09b12831e591d077ca8d95da72276512c9b1 100644 (file)
@@ -51,17 +51,20 @@ public final class AggregatorAttributeParser implements AttributeParser, Attribu
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final Attributes pathAttributes = (Attributes) attribute;
         final Aggregator aggregator = pathAttributes.getAggregator();
         if (aggregator == null) {
             return;
         }
-        Preconditions.checkArgument(aggregator.getAsNumber() != null, "Missing AS number that formed the aggregate route (encoded as 2 octets).");
+        Preconditions.checkArgument(aggregator.getAsNumber() != null,
+                "Missing AS number that formed the aggregate route (encoded as 2 octets).");
         final ShortAsNumber shortAsNumber = new ShortAsNumber(aggregator.getAsNumber());
         final ByteBuf buffer = Unpooled.buffer();
         buffer.writeInt(shortAsNumber.getValue().intValue());
         buffer.writeBytes(Ipv4Util.bytesForAddress(aggregator.getNetworkAddress()));
-        AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, TYPE, buffer, byteAggregator);
+        AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE,
+                TYPE, buffer, byteAggregator);
     }
 }
index d5775b3972100d055692b7694e3a196a159feac6..e3a8161bff6a5942dae02094350a9a0cba9c12f6 100644 (file)
@@ -54,9 +54,9 @@ public final class AsPathAttributeParser implements AttributeParser, AttributeSe
      * @param buffer bytes to be parsed
      * @return new ASPath object
      * @throws BGPDocumentedException if there is no AS_SEQUENCE present (mandatory)
-     * @throws BGPParsingException
      */
-    private static AsPath parseAsPath(final ReferenceCache refCache, final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    private static AsPath parseAsPath(final ReferenceCache refCache, final ByteBuf buffer)
+            throws BGPDocumentedException, BGPParsingException {
         if (!buffer.isReadable()) {
             return EMPTY;
         }
@@ -70,7 +70,8 @@ public final class AsPathAttributeParser implements AttributeParser, AttributeSe
             }
             final int count = buffer.readUnsignedByte();
 
-            final List<AsNumber> asList = AsPathSegmentParser.parseAsSegment(refCache, count, buffer.readSlice(count * AsPathSegmentParser.AS_NUMBER_LENGTH));
+            final List<AsNumber> asList = AsPathSegmentParser.parseAsSegment(refCache, count,
+                    buffer.readSlice(count * AsPathSegmentParser.AS_NUMBER_LENGTH));
             if (segmentType == SegmentType.AS_SEQUENCE) {
                 ases.add(new SegmentsBuilder().setAsSequence(asList).build());
                 isSequence = true;
@@ -79,7 +80,8 @@ public final class AsPathAttributeParser implements AttributeParser, AttributeSe
             }
         }
         if (!isSequence) {
-            throw new BGPDocumentedException("AS_SEQUENCE must be present in AS_PATH attribute.", BGPError.AS_PATH_MALFORMED);
+            throw new BGPDocumentedException("AS_SEQUENCE must be present in AS_PATH attribute.",
+                    BGPError.AS_PATH_MALFORMED);
         }
 
         ases.trimToSize();
@@ -87,13 +89,15 @@ public final class AsPathAttributeParser implements AttributeParser, AttributeSe
     }
 
     @Override
-    public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) throws BGPDocumentedException, BGPParsingException {
+    public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder)
+            throws BGPDocumentedException, BGPParsingException {
         builder.setAsPath(parseAsPath(this.refCache, buffer));
     }
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final Attributes pathAttributes = (Attributes) attribute;
         final AsPath asPath = pathAttributes.getAsPath();
         if (asPath == null) {
index c19a351bd809b47a1f352ce43ee0cf7fccf2de4f..97f402c13941d2246f85dd40cbeb8ee612a1000a 100644 (file)
@@ -29,7 +29,8 @@ public final class AtomicAggregateAttributeParser implements AttributeParser,Att
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final Attributes pathAttributes = (Attributes) attribute;
         if (pathAttributes.getAtomicAggregate() == null) {
             return;
index 793ca9ca049d4bfdf6c9038e17bc904719df0ef0..b8e5c9924a690cfc163aa05ab8992c15c1468456 100644 (file)
@@ -39,7 +39,8 @@ public final class BgpPrefixSidAttributeParser implements AttributeParser, Attri
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final Attributes pathAttributes = (Attributes) attribute;
         final BgpPrefixSid prefixSid = pathAttributes.getBgpPrefixSid();
         if (prefixSid == null) {
@@ -51,7 +52,8 @@ public final class BgpPrefixSidAttributeParser implements AttributeParser, Attri
     }
 
     @Override
-    public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) throws BGPDocumentedException, BGPParsingException {
+    public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder)
+            throws BGPDocumentedException, BGPParsingException {
         final BgpPrefixSidBuilder sid = new BgpPrefixSidBuilder();
         final List<BgpPrefixSidTlvs> tlvList = new ArrayList<>();
         while (buffer.isReadable()) {
index 5cce26dcf9359d6d3a786453173c7c7caf7bf01e..e6ee76c953c4d382b45d322f5639d33b4944287b 100644 (file)
@@ -38,7 +38,8 @@ public final class ClusterIdAttributeParser implements AttributeParser, Attribut
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final ClusterId cid = ((Attributes) attribute).getClusterId();
         if (cid == null) {
             return;
index 76a58b5aeac82e6114480eecde27d026eb6347f6..929dae63cbe720a930d224c993d93d55bbbc7487 100644 (file)
@@ -65,9 +65,11 @@ public final class CommunitiesAttributeParser implements AttributeParser, Attrib
     * @throws BGPDocumentedException
     */
     @VisibleForTesting
-    public static Community parseCommunity(final ReferenceCache refCache, final ByteBuf buffer) throws BGPDocumentedException {
+    public static Community parseCommunity(final ReferenceCache refCache, final ByteBuf buffer)
+            throws BGPDocumentedException {
         if (buffer.readableBytes() != COMMUNITY_LENGTH) {
-            throw new BGPDocumentedException("Community with wrong length: " + buffer.readableBytes(), BGPError.OPT_ATTR_ERROR);
+            throw new BGPDocumentedException("Community with wrong length: "
+                    + buffer.readableBytes(), BGPError.OPT_ATTR_ERROR);
         }
         final byte[] body = ByteArray.getBytes(buffer, COMMUNITY_LENGTH);
         if (Arrays.equals(body, NO_EXPORT)) {
@@ -92,6 +94,7 @@ public final class CommunitiesAttributeParser implements AttributeParser, Attrib
             communitiesBuffer.writeShort(community.getAsNumber().getValue().shortValue());
             communitiesBuffer.writeShort(community.getSemantics().shortValue());
         }
-        AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, TYPE, communitiesBuffer, byteAggregator);
+        AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE,
+                TYPE, communitiesBuffer, byteAggregator);
     }
 }
index 2749bf7792bc55e2cc43d1e06af3d5de15d395e9..1e198e0677ec5a2a738d5e8bd60ec5d78621ac83 100644 (file)
@@ -25,18 +25,21 @@ public final class CommunityUtil {
      * advertised outside a BGP confederation boundary (a stand-alone autonomous system that is not part of a
      * confederation should be considered a confederation itself).
      */
-    public static final Community NO_EXPORT = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF01);
+    public static final Community NO_EXPORT
+            = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF01);
     /**
      * NO_ADVERTISE community. All routes received carrying a communities attribute containing this value MUST NOT be
      * advertised to other BGP peers.
      */
-    public static final Community NO_ADVERTISE = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF02);
+    public static final Community NO_ADVERTISE
+            = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF02);
     /**
      * NO_EXPORT_SUBCONFED community. All routes received carrying a communities attribute containing this value MUST
      * NOT be advertised to external BGP peers (this includes peers in other members autonomous systems inside a BGP
      * confederation).
      */
-    public static final Community NO_EXPORT_SUBCONFED = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF03);
+    public static final Community NO_EXPORT_SUBCONFED
+            = CommunityUtil.create(NoopReferenceCache.getInstance(), 0xFFFF, 0xFF03);
 
     private final ReferenceCache refCache;
 
index 38152da53c6b5ddd3c7511d6e71bb1e08eca2295..765e573fb7348af0b858fd6bd4f1351087fc24d7 100644 (file)
@@ -37,7 +37,8 @@ public final class ExtendedCommunitiesAttributeParser implements AttributeParser
     }
 
     @Override
-    public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) throws BGPDocumentedException, BGPParsingException {
+    public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder)
+            throws BGPDocumentedException, BGPParsingException {
         final List<ExtendedCommunities> set = new ArrayList<>();
         while (buffer.isReadable()) {
             final ExtendedCommunities exComm = this.ecReg.parseExtendedCommunity(buffer);
@@ -50,7 +51,8 @@ public final class ExtendedCommunitiesAttributeParser implements AttributeParser
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final List<ExtendedCommunities> communitiesList = ((Attributes) attribute).getExtendedCommunities();
         if (communitiesList == null || communitiesList.isEmpty()) {
             return;
@@ -60,7 +62,8 @@ public final class ExtendedCommunitiesAttributeParser implements AttributeParser
             this.ecReg.serializeExtendedCommunity(extendedCommunities, extendedCommunitiesBuffer);
         }
         if (extendedCommunitiesBuffer.readableBytes() > 0) {
-            AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, TYPE, extendedCommunitiesBuffer, byteAggregator);
+            AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL | AttributeUtil.TRANSITIVE, TYPE,
+                    extendedCommunitiesBuffer, byteAggregator);
         }
     }
 }
index 14577154b566e95993f57a90611bc54e8bd65b5d..f55931d053e55922d7b2e10ff51e3f23e8e1e10a 100644 (file)
@@ -30,11 +30,13 @@ public final class LocalPreferenceAttributeParser implements AttributeParser,Att
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final LocalPref lp = ((Attributes) attribute).getLocalPref();
         if (lp == null) {
             return;
         }
-        AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE, Unpooled.copyInt(lp.getPref().intValue()), byteAggregator);
+        AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE,
+                Unpooled.copyInt(lp.getPref().intValue()), byteAggregator);
     }
 }
index 93ab2ed7aa7330f5f1d4fb7b85f211046af7e1c3..3f76d7e03589e53f20246726d25ae148b0cd3735 100644 (file)
@@ -30,11 +30,13 @@ public final class MultiExitDiscriminatorAttributeParser implements AttributePar
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final MultiExitDisc multiExitDisc = ((Attributes) attribute).getMultiExitDisc();
         if (multiExitDisc == null) {
             return;
         }
-        AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, Unpooled.copyInt(multiExitDisc.getMed().intValue()), byteAggregator);
+        AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE,
+                Unpooled.copyInt(multiExitDisc.getMed().intValue()), byteAggregator);
     }
 }
index 14a5cf292d9b3855c69590dea7b5cbf74411ff5a..c4b1998caa63c14152965307ac980ff295195c0c 100644 (file)
@@ -26,13 +26,16 @@ public final class NextHopAttributeParser implements AttributeParser, AttributeS
 
     @Override
     public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) {
-        Preconditions.checkArgument(buffer.readableBytes() == Ipv4Util.IP4_LENGTH, "Length of byte array for NEXT_HOP should be %s, but is %s", buffer.readableBytes(), Ipv4Util.IP4_LENGTH);
+        Preconditions.checkArgument(buffer.readableBytes() == Ipv4Util.IP4_LENGTH,
+                "Length of byte array for NEXT_HOP should be %s, but is %s",
+                buffer.readableBytes(), Ipv4Util.IP4_LENGTH);
         builder.setCNextHop(NextHopUtil.parseNextHop(buffer));
     }
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final CNextHop cNextHop = ((Attributes) attribute).getCNextHop();
         if (cNextHop == null) {
             return;
index d10c873091cc4535a1bad89890161697d85117f0..0f541a1c9210f3f2f34dfec2266d44d843ff915d 100644 (file)
@@ -36,7 +36,8 @@ public final class OriginAttributeParser implements AttributeParser, AttributeSe
         final byte rawOrigin = buffer.readByte();
         final BgpOrigin borigin = BgpOrigin.forValue(UnsignedBytes.toInt(rawOrigin));
         if (borigin == null) {
-            throw new BGPDocumentedException("Unknown Origin type.", BGPError.ORIGIN_ATTR_NOT_VALID, new byte[] { (byte) 0x01, (byte) 0x01, rawOrigin} );
+            throw new BGPDocumentedException("Unknown Origin type.", BGPError.ORIGIN_ATTR_NOT_VALID,
+                    new byte[] { (byte) 0x01, (byte) 0x01, rawOrigin} );
         }
         switch (borigin) {
         case Egp:
@@ -55,11 +56,14 @@ public final class OriginAttributeParser implements AttributeParser, AttributeSe
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final Origin origin = ((Attributes) attribute).getOrigin();
         if (origin == null) {
             return;
         }
-        AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE, Unpooled.wrappedBuffer(new byte[] {UnsignedBytes.checkedCast(origin.getValue().getIntValue())}), byteAggregator);
+        AttributeUtil.formatAttribute(AttributeUtil.TRANSITIVE, TYPE,
+                Unpooled.wrappedBuffer(new byte[] {UnsignedBytes.checkedCast(origin.getValue().getIntValue())}),
+                byteAggregator);
     }
 }
index 2fd8132ac37596942ae079f856ff86d7913176fa..90c6cba4fd1ba9bd01eb6b74128fccca053fc8af 100644 (file)
@@ -26,13 +26,16 @@ public final class OriginatorIdAttributeParser implements AttributeParser,Attrib
 
     @Override
     public void parseAttribute(final ByteBuf buffer, final AttributesBuilder builder) {
-        Preconditions.checkArgument(buffer.readableBytes() == Ipv4Util.IP4_LENGTH, "Length of byte array for ORIGINATOR_ID should be %s, but is %s", Ipv4Util.IP4_LENGTH, buffer.readableBytes());
+        Preconditions.checkArgument(buffer.readableBytes() == Ipv4Util.IP4_LENGTH,
+                "Length of byte array for ORIGINATOR_ID should be %s, but is %s",
+                Ipv4Util.IP4_LENGTH, buffer.readableBytes());
         builder.setOriginatorId(new OriginatorIdBuilder().setOriginator(Ipv4Util.addressForByteBuf(buffer)).build());
     }
 
     @Override
     public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attribute instanceof Attributes,
+                "Attribute parameter is not a PathAttribute object.");
         final OriginatorId originator = ((Attributes) attribute).getOriginatorId();
         if (originator == null) {
             return;
index f62373432855a8d8882c52e0047ee8e96edeb321..3e3b98663b21e9f59def4393005492d54bd2b89f 100644 (file)
@@ -14,9 +14,6 @@ import org.opendaylight.protocol.bgp.parser.spi.AttributeParser;
 import org.opendaylight.protocol.bgp.parser.spi.AttributeSerializer;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.AttributesBuilder;
 
-/**
- * @author Claudio D. Gasparini
- */
 public abstract class ReachAttributeParser implements AttributeParser, AttributeSerializer {
 
     @Override
index e753ad7c3f2ea639106673fc66a523c792a05b2b..8de008d827b4d1210ce8d8bc5ff71fa499184349 100755 (executable)
@@ -25,7 +25,8 @@ public class UnrecognizedAttributesSerializer implements AttributeSerializer {
 
     @Override
     public void serializeAttribute(final DataObject attributes, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(attributes instanceof Attributes, "Attributes parameter is not a PathAttribute object.");
+        Preconditions.checkArgument(attributes instanceof Attributes,
+                "Attributes parameter is not a PathAttribute object.");
         final List<UnrecognizedAttributes> unrecognizedAttrs = ((Attributes) attributes).getUnrecognizedAttributes();
         if (unrecognizedAttrs == null) {
             return;
@@ -39,7 +40,8 @@ public class UnrecognizedAttributesSerializer implements AttributeSerializer {
             if (unrecognizedAttr.isTransitive()) {
                 flags |= AttributeUtil.TRANSITIVE;
             }
-            AttributeUtil.formatAttribute(flags, unrecognizedAttr.getType(), Unpooled.wrappedBuffer(unrecognizedAttr.getValue()), byteAggregator);
+            AttributeUtil.formatAttribute(flags, unrecognizedAttr.getType(),
+                    Unpooled.wrappedBuffer(unrecognizedAttr.getValue()), byteAggregator);
         }
     }
 
index 0dba596da502b8bda657619d5b866f550588a85d..432346df6524d61083f4e4134ee3945e4a5b08fc 100644 (file)
@@ -28,7 +28,8 @@ public class AsTwoOctetSpecificEcHandler extends AbstractTwoOctetAsExtendedCommu
     private static final int SUBTYPE = 0;
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
+            throws BGPDocumentedException, BGPParsingException {
         final AsSpecificExtendedCommunity asSpecific = new AsSpecificExtendedCommunityBuilder()
             .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort()))
             .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH))
@@ -39,9 +40,12 @@ public class AsTwoOctetSpecificEcHandler extends AbstractTwoOctetAsExtendedCommu
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
         Preconditions.checkArgument(extendedCommunity instanceof AsSpecificExtendedCommunityCase,
-                "The extended community %s is not AsSpecificExtendedCommunity type.", extendedCommunity);
-        final AsSpecificExtendedCommunity asSpecific = ((AsSpecificExtendedCommunityCase) extendedCommunity).getAsSpecificExtendedCommunity();
-        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(asSpecific.getGlobalAdministrator().getValue()), byteAggregator);
+                "The extended community %s is not AsSpecificExtendedCommunity type.",
+                extendedCommunity);
+        final AsSpecificExtendedCommunity asSpecific = ((AsSpecificExtendedCommunityCase) extendedCommunity)
+                .getAsSpecificExtendedCommunity();
+        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(asSpecific.getGlobalAdministrator().getValue()),
+                byteAggregator);
         byteAggregator.writeBytes(asSpecific.getLocalAdministrator());
     }
 
index b57a3fea538f134aa1a3524af91471f0e4c94e8e..ed0f8c2dd025db4a2ea9ec4fa57842e5873424a7 100755 (executable)
@@ -34,9 +34,12 @@ public class EncapsulationEC extends AbstractOpaqueExtendedCommunity {
     private static final int CONTENT_SIZE = 6;
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
-        Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
-        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_SIZE, "Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ".");
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
+            throws BGPDocumentedException, BGPParsingException {
+        Preconditions.checkArgument(buffer != null && buffer.isReadable(),
+                "Array of bytes is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_SIZE,
+                "Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ".");
         buffer.skipBytes(RESERVED_SIZE);
         final EncapsulationExtendedCommunity encap = new EncapsulationExtendedCommunityBuilder()
             .setTunnelType(EncapsulationTunnelType.forValue(buffer.readUnsignedShort()))
@@ -48,7 +51,8 @@ public class EncapsulationEC extends AbstractOpaqueExtendedCommunity {
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf body) {
         Preconditions.checkArgument(extendedCommunity instanceof EncapsulationCase,
             "The extended community %s is not EncapsulationCase type.", extendedCommunity);
-        final EncapsulationExtendedCommunity encap = ((EncapsulationCase) extendedCommunity).getEncapsulationExtendedCommunity();
+        final EncapsulationExtendedCommunity encap
+                = ((EncapsulationCase) extendedCommunity).getEncapsulationExtendedCommunity();
         body.writeZero(RESERVED_SIZE);
         body.writeShort(encap.getTunnelType().getIntValue());
     }
index f866ce07bd6c7e9a2b649f52456b3f748ed04b0d..10fb52fbbf6e1bb18eaa50d9154a8c2226e429fe 100644 (file)
@@ -32,7 +32,8 @@ public class LinkBandwidthEC implements ExtendedCommunityParser, ExtendedCommuni
     private static final int AS_TRANS_LENGTH = 2;
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
+            throws BGPDocumentedException, BGPParsingException {
         buffer.skipBytes(AS_TRANS_LENGTH);
         final LinkBandwidthExtendedCommunity lb = new LinkBandwidthExtendedCommunityBuilder()
             .setBandwidth(new Bandwidth(ByteArray.readBytes(buffer, BANDWIDTH_SIZE)))
@@ -44,7 +45,8 @@ public class LinkBandwidthEC implements ExtendedCommunityParser, ExtendedCommuni
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf body) {
         Preconditions.checkArgument(extendedCommunity instanceof LinkBandwidthCase,
             "The extended community %s is not LinkBandwidthCase type.", extendedCommunity);
-        final LinkBandwidthExtendedCommunity lb = ((LinkBandwidthCase) extendedCommunity).getLinkBandwidthExtendedCommunity();
+        final LinkBandwidthExtendedCommunity lb
+                = ((LinkBandwidthCase) extendedCommunity).getLinkBandwidthExtendedCommunity();
         body.writeShort(AS_TRANS);
         ByteBufWriteUtil.writeFloat32(lb.getBandwidth(), body);
     }
index 557fca1798be006cb6a2ebcc573da04a3486c00e..82dde5ef5b09da27075a318e95818c1acd601526 100644 (file)
@@ -25,7 +25,8 @@ public final class OpaqueEcHandler extends AbstractOpaqueExtendedCommunity {
     private static final int SUBTYPE = 0;
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
+            throws BGPDocumentedException, BGPParsingException {
         return new OpaqueExtendedCommunityCaseBuilder().setOpaqueExtendedCommunity(
                 new OpaqueExtendedCommunityBuilder()
                     .setValue(ByteArray.readAllBytes(buffer))
@@ -35,8 +36,10 @@ public final class OpaqueEcHandler extends AbstractOpaqueExtendedCommunity {
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
         Preconditions.checkArgument(extendedCommunity instanceof OpaqueExtendedCommunityCase,
-                "The extended community %s is not OpaqueExtendedCommunityCase type.", extendedCommunity);
-        final OpaqueExtendedCommunity opaqueExtendedCommunity = ((OpaqueExtendedCommunityCase) extendedCommunity).getOpaqueExtendedCommunity();
+                "The extended community %s is not OpaqueExtendedCommunityCase type.",
+                extendedCommunity);
+        final OpaqueExtendedCommunity opaqueExtendedCommunity
+                = ((OpaqueExtendedCommunityCase) extendedCommunity).getOpaqueExtendedCommunity();
         byteAggregator.writeBytes(opaqueExtendedCommunity.getValue());
     }
 
index cf17a1ad949e3017d0fd347f42cae4c3ace2bc2f..2318d6d61d911335877a4fe93e7a40b7acf99aa4 100644 (file)
@@ -28,7 +28,8 @@ public final class RouteOriginAsTwoOctetEcHandler extends AbstractTwoOctetAsExte
     private static final int SUBTYPE = 3;
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
+            throws BGPDocumentedException, BGPParsingException {
         final RouteOriginExtendedCommunity targetOrigin = new RouteOriginExtendedCommunityBuilder()
             .setGlobalAdministrator(new ShortAsNumber((long) buffer.readUnsignedShort()))
             .setLocalAdministrator(ByteArray.readBytes(buffer, AS_LOCAL_ADMIN_LENGTH))
@@ -39,9 +40,12 @@ public final class RouteOriginAsTwoOctetEcHandler extends AbstractTwoOctetAsExte
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
         Preconditions.checkArgument(extendedCommunity instanceof RouteOriginExtendedCommunityCase,
-                "The extended community %s is not RouteOriginExtendedCommunity type.", extendedCommunity);
-        final RouteOriginExtendedCommunity routeOrigin = ((RouteOriginExtendedCommunityCase) extendedCommunity).getRouteOriginExtendedCommunity();
-        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(routeOrigin.getGlobalAdministrator().getValue()), byteAggregator);
+                "The extended community %s is not RouteOriginExtendedCommunity type.",
+                extendedCommunity);
+        final RouteOriginExtendedCommunity routeOrigin
+                = ((RouteOriginExtendedCommunityCase) extendedCommunity).getRouteOriginExtendedCommunity();
+        ByteBufWriteUtil.writeUnsignedShort(Ints.checkedCast(routeOrigin.getGlobalAdministrator().getValue()),
+                byteAggregator);
         byteAggregator.writeBytes(routeOrigin.getLocalAdministrator());
     }
 
index 0140c21c219add0f6ee120ac543f96529264dbae..a6cda3af3a2aafec350423a514963d4ddc34f960 100644 (file)
@@ -35,7 +35,8 @@ public final class RouteOriginIpv4EcHandler extends AbstractIpv4ExtendedCommunit
     }
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer)
+            throws BGPDocumentedException, BGPParsingException {
         final RouteOriginIpv4 routeTarget = new RouteOriginIpv4Builder()
             .setGlobalAdministrator(Ipv4Util.addressForByteBuf(buffer))
             .setLocalAdministrator(buffer.readUnsignedShort())
index 7c873c7a8f0187f4337027eb584505a41515a91f..2229bcd73cea25f24d5eef2d2a501eabc9d91222 100644 (file)
@@ -23,17 +23,21 @@ public final class Generic4OctASEcHandler extends Abstract4OctetAsExtendedCommun
     private static final int SUBTYPE = 4;
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) throws BGPDocumentedException, BGPParsingException {
-        return new As4GenericSpecExtendedCommunityCaseBuilder().setAs4GenericSpecExtendedCommunity(new As4GenericSpecExtendedCommunityBuilder()
-            .setAs4SpecificCommon(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf body)
+            throws BGPDocumentedException, BGPParsingException {
+        return new As4GenericSpecExtendedCommunityCaseBuilder()
+                .setAs4GenericSpecExtendedCommunity(new As4GenericSpecExtendedCommunityBuilder()
+                        .setAs4SpecificCommon(FourOctAsCommonECUtil.parseCommon(body)).build()).build();
     }
 
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf body) {
         Preconditions.checkArgument(extendedCommunity instanceof As4GenericSpecExtendedCommunityCase,
-            "The extended community %s is not As4GenericSpecExtendedCommunityCase type.", extendedCommunity);
-        FourOctAsCommonECUtil.serializeCommon(((As4GenericSpecExtendedCommunityCase) extendedCommunity).getAs4GenericSpecExtendedCommunity()
-            .getAs4SpecificCommon(), body);
+                "The extended community %s is not As4GenericSpecExtendedCommunityCase type.",
+                extendedCommunity);
+        FourOctAsCommonECUtil.serializeCommon(((As4GenericSpecExtendedCommunityCase) extendedCommunity)
+                .getAs4GenericSpecExtendedCommunity()
+                .getAs4SpecificCommon(), body);
     }
 
     @Override
index 47a84b68a6f99cf4a8ce4b8b20d94d746128a36c..a2813e1bcc7ef78b418bc0e35089aba4558dbb16 100644 (file)
@@ -28,7 +28,8 @@ public class BgpExtendedMessageCapabilityHandlerTest {
         final ByteBuf buffer = Unpooled.buffer(bgpExeBytes.length);
         handler.serializeCapability(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY, buffer);
         Assert.assertArrayEquals(bgpExeBytes, buffer.array());
-        Assert.assertEquals(handler.parseCapability(Unpooled.wrappedBuffer(bgpExeBytes)), BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY);
+        Assert.assertEquals(handler.parseCapability(Unpooled.wrappedBuffer(bgpExeBytes)),
+                BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY);
 
         final byte[] bgpExeBytes2 = {(byte) 0x40, (byte) 0x06};
         buffer.clear();
index 5338f4f8526b7cc6fa478e74d1ab400fc2ec0c0a..856d85cdddb468d99b55444df3adb7b9f9d22b61 100644 (file)
@@ -31,7 +31,8 @@ public class RouteRefreshCapabilityHandlerTest {
 
     @Test
     public void testRRCapHandler() throws BGPDocumentedException, BGPParsingException {
-        final CParameters expectedParams = new CParametersBuilder().addAugmentation(CParameters1.class,new CParameters1Builder().setRouteRefreshCapability(
+        final CParameters expectedParams = new CParametersBuilder().addAugmentation(CParameters1.class,
+                new CParameters1Builder().setRouteRefreshCapability(
             new RouteRefreshCapabilityBuilder().build()).build()).build();
         assertEquals(expectedParams, HANDLER.parseCapability(Unpooled.copiedBuffer(OK_BYTES)));
         assertEquals(expectedParams, HANDLER.parseCapability(Unpooled.copiedBuffer(WRONG_BYTES)));
@@ -40,7 +41,8 @@ public class RouteRefreshCapabilityHandlerTest {
         HANDLER.serializeCapability(expectedParams, byteAggregator);
         assertEquals(Unpooled.copiedBuffer(CAP_BYTES), byteAggregator);
 
-        final CParameters missingCap = new CParametersBuilder().addAugmentation(CParameters1.class,new CParameters1Builder().setRouteRefreshCapability(
+        final CParameters missingCap = new CParametersBuilder().addAugmentation(CParameters1.class,
+                new CParameters1Builder().setRouteRefreshCapability(
             null).build()).build();
         final ByteBuf byteAggregator2 = Unpooled.buffer(0);
         HANDLER.serializeCapability(missingCap, byteAggregator2);