Enforce findbug and checkstyle under BMP Parser 32/66732/1
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 22 Dec 2017 11:39:26 +0000 (12:39 +0100)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 22 Dec 2017 12:26:21 +0000 (13:26 +0100)
Change-Id: I9f2b96af276dbbe4edd528373473c42a1d459daf
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
27 files changed:
bmp/bmp-parser-impl/pom.xml
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/BmpActivator.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/message/InitiationHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/message/PeerDownHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/message/PeerUpHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/message/RouteMirroringMessageHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/message/RouteMonitoringMessageHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/message/StatisticsReportHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/message/TerminationHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/MirrorInformationTlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType001TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType003TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType005TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType006TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType007TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType008TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType009TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType010TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType011TlvHandler.java
bmp/bmp-parser-impl/src/main/java/org/opendaylight/protocol/bmp/parser/tlv/StatType012TlvHandler.java
bmp/bmp-parser-impl/src/test/java/org/opendaylight/protocol/bmp/parser/message/InitiationHandlerTest.java
bmp/bmp-parser-impl/src/test/java/org/opendaylight/protocol/bmp/parser/message/PeerDownHandlerTest.java
bmp/bmp-parser-impl/src/test/java/org/opendaylight/protocol/bmp/parser/message/PeerUpHandlerTest.java
bmp/bmp-parser-impl/src/test/java/org/opendaylight/protocol/bmp/parser/message/RouteMonitoringMessageHandlerTest.java
bmp/bmp-parser-impl/src/test/java/org/opendaylight/protocol/bmp/parser/message/StatisticsReportHandlerTest.java
bmp/bmp-parser-impl/src/test/java/org/opendaylight/protocol/bmp/parser/message/TerminationHandlerTest.java
bmp/bmp-parser-impl/src/test/java/org/opendaylight/protocol/bmp/parser/message/TestUtil.java

index 91d398b927e6648f380e71f375672c6b2df06dcd..669a7f373402ecf25444104a1e34da70fa0266a8 100644 (file)
 
     <build>
         <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>findbugs-maven-plugin</artifactId>
+                <configuration>
+                    <failOnError>true</failOnError>
+                </configuration>
+            </plugin>
             <!-- test jar -->
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
index 4b1f6d611c6cc28ba117ecbc79cdd76c977183bb..135e8ffc814af84bedbb0e6dd21a4c8485e164d0 100644 (file)
@@ -114,20 +114,26 @@ public final class BmpActivator extends AbstractBmpExtensionProviderActivator {
 
         final StatisticsReportHandler statisticsReportHandler = new StatisticsReportHandler(this.messageRegistry,
                 context.getBmpStatisticsTlvRegistry());
-        regs.add(context.registerBmpMessageParser(statisticsReportHandler.getBmpMessageType(), statisticsReportHandler));
+        regs.add(context.registerBmpMessageParser(statisticsReportHandler.getBmpMessageType(),
+                statisticsReportHandler));
         regs.add(context.registerBmpMessageSerializer(StatsReportsMessage.class, statisticsReportHandler));
 
-        final RouteMonitoringMessageHandler routeMonitoringMessageHandler = new RouteMonitoringMessageHandler(this.messageRegistry);
-        regs.add(context.registerBmpMessageParser(routeMonitoringMessageHandler.getBmpMessageType(), routeMonitoringMessageHandler));
+        final RouteMonitoringMessageHandler routeMonitoringMessageHandler =
+                new RouteMonitoringMessageHandler(this.messageRegistry);
+        regs.add(context.registerBmpMessageParser(routeMonitoringMessageHandler.getBmpMessageType(),
+                routeMonitoringMessageHandler));
         regs.add(context.registerBmpMessageSerializer(RouteMonitoringMessage.class, routeMonitoringMessageHandler));
 
-        final RouteMirroringMessageHandler routeMirroringMessageHandler = new RouteMirroringMessageHandler(this.messageRegistry, context.getBmpRouteMirroringTlvRegistry());
-        regs.add(context.registerBmpMessageParser(routeMirroringMessageHandler.getBmpMessageType(), routeMirroringMessageHandler));
+        final RouteMirroringMessageHandler routeMirroringMessageHandler =
+                new RouteMirroringMessageHandler(this.messageRegistry, context.getBmpRouteMirroringTlvRegistry());
+        regs.add(context.registerBmpMessageParser(routeMirroringMessageHandler.getBmpMessageType(),
+                routeMirroringMessageHandler));
         regs.add(context.registerBmpMessageSerializer(RouteMirroringMessage.class, routeMirroringMessageHandler));
 
     }
 
-    private static void registerBmpTlvHandlers(final List<AutoCloseable> regs, final BmpExtensionProviderContext context) {
+    private static void registerBmpTlvHandlers(final List<AutoCloseable> regs,
+            final BmpExtensionProviderContext context) {
         final DescriptionTlvHandler descriptionTlvHandler = new DescriptionTlvHandler();
         regs.add(context.registerBmpInitiationTlvParser(DescriptionTlvHandler.TYPE, descriptionTlvHandler));
         regs.add(context.registerBmpInitiationTlvSerializer(DescriptionTlv.class, descriptionTlvHandler));
@@ -153,14 +159,16 @@ public final class BmpActivator extends AbstractBmpExtensionProviderActivator {
         regs.add(context.registerBmpRouteMirroringTlvSerializer(MirrorInformationTlv.class, informationTlvHandler));
     }
 
-    private void registerBmpStatTlvHandlers(final List<AutoCloseable> regs, final BmpExtensionProviderContext context) {
+    private void registerBmpStatTlvHandlers(final List<AutoCloseable> regs,
+            final BmpExtensionProviderContext context) {
         final StatType000TlvHandler statType000TlvHandler = new StatType000TlvHandler();
         regs.add(context.registerBmpStatisticsTlvParser(StatType000TlvHandler.TYPE, statType000TlvHandler));
         regs.add(context.registerBmpStatisticsTlvSerializer(RejectedPrefixesTlv.class, statType000TlvHandler));
 
         final StatType001TlvHandler statType001TlvHandler = new StatType001TlvHandler();
         regs.add(context.registerBmpStatisticsTlvParser(StatType001TlvHandler.TYPE, statType001TlvHandler));
-        regs.add(context.registerBmpStatisticsTlvSerializer(DuplicatePrefixAdvertisementsTlv.class, statType001TlvHandler));
+        regs.add(context.registerBmpStatisticsTlvSerializer(DuplicatePrefixAdvertisementsTlv.class,
+                statType001TlvHandler));
 
         final StatType002TlvHandler statType002TlvHandler = new StatType002TlvHandler();
         regs.add(context.registerBmpStatisticsTlvParser(StatType002TlvHandler.TYPE, statType002TlvHandler));
@@ -168,7 +176,8 @@ public final class BmpActivator extends AbstractBmpExtensionProviderActivator {
 
         final StatType003TlvHandler statType003TlvHandler = new StatType003TlvHandler();
         regs.add(context.registerBmpStatisticsTlvParser(StatType003TlvHandler.TYPE, statType003TlvHandler));
-        regs.add(context.registerBmpStatisticsTlvSerializer(InvalidatedClusterListLoopTlv.class, statType003TlvHandler));
+        regs.add(context.registerBmpStatisticsTlvSerializer(InvalidatedClusterListLoopTlv.class,
+                statType003TlvHandler));
 
         final StatType004TlvHandler statType004TlvHandler = new StatType004TlvHandler();
         regs.add(context.registerBmpStatisticsTlvParser(StatType004TlvHandler.TYPE, statType004TlvHandler));
@@ -190,11 +199,13 @@ public final class BmpActivator extends AbstractBmpExtensionProviderActivator {
         regs.add(context.registerBmpStatisticsTlvParser(StatType008TlvHandler.TYPE, statType008TlvHandler));
         regs.add(context.registerBmpStatisticsTlvSerializer(LocRibRoutesTlv.class, statType008TlvHandler));
 
-        final StatType009TlvHandler statType009TlvHandler = new StatType009TlvHandler(this.afiRegistry, this.safiRegistry);
+        final StatType009TlvHandler statType009TlvHandler =
+                new StatType009TlvHandler(this.afiRegistry, this.safiRegistry);
         regs.add(context.registerBmpStatisticsTlvParser(StatType009TlvHandler.TYPE, statType009TlvHandler));
         regs.add(context.registerBmpStatisticsTlvSerializer(PerAfiSafiAdjRibInTlv.class, statType009TlvHandler));
 
-        final StatType010TlvHandler statType010TlvHandler = new StatType010TlvHandler(this.afiRegistry, this.safiRegistry);
+        final StatType010TlvHandler statType010TlvHandler =
+                new StatType010TlvHandler(this.afiRegistry, this.safiRegistry);
         regs.add(context.registerBmpStatisticsTlvParser(StatType010TlvHandler.TYPE, statType010TlvHandler));
         regs.add(context.registerBmpStatisticsTlvSerializer(PerAfiSafiLocRibTlv.class, statType010TlvHandler));
 
index 5122eb7c8937e92abf69eed47ef18d76d21cf843..a6cddfda3647908f20853ef545e7d99817e03ffc 100644 (file)
@@ -37,7 +37,8 @@ public class InitiationHandler extends AbstractBmpMessageWithTlvParser<TlvsBuild
 
     @Override
     public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
-        Preconditions.checkArgument(message instanceof InitiationMessage, "Incorrect instance of BGP message. The Initiation Message is expected.");
+        Preconditions.checkArgument(message instanceof InitiationMessage,
+                "Incorrect instance of BGP message. The Initiation Message is expected.");
         final InitiationMessage initiation = (InitiationMessage) message;
         serializeTlvs(initiation.getTlvs(), buffer);
     }
@@ -85,7 +86,8 @@ public class InitiationHandler extends AbstractBmpMessageWithTlvParser<TlvsBuild
         } else if (tlv instanceof StringTlv) {
             builder.setStringInformation(ImmutableList.<StringInformation>builder()
                     .addAll(builder.getStringInformation())
-                    .add(new StringInformationBuilder().setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
+                    .add(new StringInformationBuilder()
+                            .setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
         }
     }
 }
index 351c6055efff19b0679e313e9df08bc95cb1353d..adbf7b2852d419bedeba428a70c4cf10ff8a039f 100644 (file)
@@ -13,6 +13,7 @@ import static org.opendaylight.protocol.bmp.parser.message.PeerDownHandler.Reaso
 import static org.opendaylight.protocol.bmp.parser.message.PeerDownHandler.Reason.REASON_ONE;
 import static org.opendaylight.protocol.bmp.parser.message.PeerDownHandler.Reason.REASON_THREE;
 import static org.opendaylight.protocol.bmp.parser.message.PeerDownHandler.Reason.REASON_TWO;
+
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 import io.netty.buffer.ByteBuf;
@@ -45,20 +46,23 @@ public class PeerDownHandler extends AbstractBmpPerPeerMessageParser<PeerDownNot
     @Override
     public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
         super.serializeMessageBody(message, buffer);
-        Preconditions.checkArgument(message instanceof PeerDownNotification, "An instance of PeerDownNotification is required");
+        Preconditions.checkArgument(message instanceof PeerDownNotification,
+                "An instance of PeerDownNotification is required");
         final PeerDownNotification peerDown = (PeerDownNotification) message;
         if (peerDown.isLocalSystemClosed()) {
             if (peerDown.getData() instanceof FsmEventCode) {
                 ByteBufWriteUtil.writeUnsignedByte(REASON_TWO.getValue(), buffer);
                 ByteBufWriteUtil.writeUnsignedShort(((FsmEventCode) peerDown.getData()).getFsmEventCode(), buffer);
-            } else if (peerDown.getData() instanceof
-                org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) {
+            } else if (peerDown.getData()
+                    instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207
+                    .peer.down.data.Notification) {
                 ByteBufWriteUtil.writeUnsignedByte(REASON_ONE.getValue(), buffer);
                 serializePDU(peerDown.getData(), buffer);
             }
         } else {
-            if (peerDown.getData() instanceof
-                org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) {
+            if (peerDown.getData()
+                    instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207
+                    .peer.down.data.Notification) {
                 ByteBufWriteUtil.writeUnsignedByte(REASON_THREE.getValue(), buffer);
                 serializePDU(peerDown.getData(), buffer);
             } else {
@@ -68,51 +72,58 @@ public class PeerDownHandler extends AbstractBmpPerPeerMessageParser<PeerDownNot
     }
 
     private void serializePDU(final Data data, final ByteBuf buffer) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification notification
-            = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification) data;
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+                .Notification notification = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp
+                .message.rev171207.peer.down.data.Notification) data;
         this.msgRegistry.serializeMessage(new NotifyBuilder(notification.getNotification()).build(), buffer);
     }
 
     @Override
     public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
-        final PeerDownNotificationBuilder peerDown = new PeerDownNotificationBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+        final PeerDownNotificationBuilder peerDown = new PeerDownNotificationBuilder()
+                .setPeerHeader(parsePerPeerHeader(bytes));
         final Reason reason = Reason.forValue(bytes.readUnsignedByte());
         if (reason != null) {
             switch (reason) {
-            case REASON_ONE:
-                peerDown.setLocalSystemClosed(true);
-                peerDown.setData(parseBgpNotificationMessage(bytes));
-                break;
-            case REASON_TWO:
-                peerDown.setLocalSystemClosed(true);
-                peerDown.setData(new FsmEventCodeBuilder().setFsmEventCode(bytes.readUnsignedShort()).build());
-                break;
-            case REASON_THREE:
-            case REASON_FOUR:
-                peerDown.setLocalSystemClosed(false);
-                peerDown.setData(parseBgpNotificationMessage(bytes));
-                break;
-            case REASON_FIVE:
-                peerDown.setLocalSystemClosed(false);
-                break;
-            default:
-                break;
+                case REASON_ONE:
+                    peerDown.setLocalSystemClosed(true);
+                    peerDown.setData(parseBgpNotificationMessage(bytes));
+                    break;
+                case REASON_TWO:
+                    peerDown.setLocalSystemClosed(true);
+                    peerDown.setData(new FsmEventCodeBuilder().setFsmEventCode(bytes.readUnsignedShort()).build());
+                    break;
+                case REASON_THREE:
+                case REASON_FOUR:
+                    peerDown.setLocalSystemClosed(false);
+                    peerDown.setData(parseBgpNotificationMessage(bytes));
+                    break;
+                case REASON_FIVE:
+                    peerDown.setLocalSystemClosed(false);
+                    break;
+                default:
+                    break;
             }
         }
 
         return peerDown.build();
     }
 
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.Notification parseBgpNotificationMessage(final ByteBuf bytes) throws BmpDeserializationException {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.NotificationBuilder notificationCBuilder
-            = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.NotificationBuilder();
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+            .Notification parseBgpNotificationMessage(final ByteBuf bytes) throws BmpDeserializationException {
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+                .NotificationBuilder notificationCBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params
+                .xml.ns.yang.bmp.message.rev171207.peer.down.data.NotificationBuilder();
 
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification.NotificationBuilder notificationBuilder
-            = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification.NotificationBuilder();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data
+                .notification.NotificationBuilder notificationBuilder = new org.opendaylight.yang.gen.v1.urn
+                .opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification
+                .NotificationBuilder();
         try {
             final Notification not = this.msgRegistry.parseMessage(bytes, null);
             requireNonNull(not, "Notify message may not be null.");
-            Preconditions.checkArgument(not instanceof NotifyMessage, "An instance of NotifyMessage is required");
+            Preconditions.checkArgument(not instanceof NotifyMessage,
+                    "An instance of NotifyMessage is required");
             notificationBuilder.fieldsFrom((NotifyMessage) not);
             notificationCBuilder.setNotification(notificationBuilder.build());
         } catch (final BGPDocumentedException | BGPParsingException e) {
@@ -128,8 +139,11 @@ public class PeerDownHandler extends AbstractBmpPerPeerMessageParser<PeerDownNot
     }
 
     public enum Reason {
-
-        REASON_ONE((short) 1), REASON_TWO((short) 2), REASON_THREE((short) 3), REASON_FOUR((short) 4), REASON_FIVE((short) 5);
+        REASON_ONE((short) 1),
+        REASON_TWO((short) 2),
+        REASON_THREE((short) 3),
+        REASON_FOUR((short) 4),
+        REASON_FIVE((short) 5);
 
         private static final Map<Short, Reason> VALUE_MAP;
 
index d749dfe1796d04314fe91da0c0796ad485f50723..6e52246160d6a3d63fc4ecd7cf9c3c39584fcb37 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.protocol.bmp.parser.message;
 
-
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.base.Preconditions;
@@ -85,7 +84,7 @@ public class PeerUpHandler extends AbstractBmpPerPeerMessageParser<InformationBu
     @Override
     public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
         final PeerUpNotificationBuilder peerUpNot = new PeerUpNotificationBuilder()
-            .setPeerHeader(parsePerPeerHeader(bytes));
+                .setPeerHeader(parsePerPeerHeader(bytes));
 
         if (peerUpNot.getPeerHeader().isIpv4()) {
             bytes.skipBytes(Ipv6Util.IPV6_LENGTH - Ipv4Util.IP4_LENGTH);
@@ -97,26 +96,26 @@ public class PeerUpHandler extends AbstractBmpPerPeerMessageParser<InformationBu
         peerUpNot.setRemotePort(new PortNumber(bytes.readUnsignedShort()));
         try {
             final Notification opSent = this.msgRegistry
-                .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
+                    .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
             requireNonNull(opSent,
-                "Error on parse Sent OPEN Message, Sent OPEN Message is null");
+                    "Error on parse Sent OPEN Message, Sent OPEN Message is null");
             Preconditions.checkArgument(opSent instanceof OpenMessage,
-                "An instance of OpenMessage notification is required");
+                    "An instance of OpenMessage notification is required");
             final OpenMessage sent = (OpenMessage) opSent;
 
             final Notification opRec = this.msgRegistry
-                .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
+                    .parseMessage(bytes.readSlice(getBgpMessageLength(bytes)), null);
             requireNonNull(opRec,
-                "Error on parse Received  OPEN Message, Received  OPEN Message is null");
+                    "Error on parse Received  OPEN Message, Received  OPEN Message is null");
             Preconditions.checkArgument(opRec instanceof OpenMessage,
-                "An instance of OpenMessage notification is required");
+                    "An instance of OpenMessage notification is required");
             final OpenMessage received = (OpenMessage) opRec;
 
             peerUpNot.setSentOpen(new SentOpenBuilder(sent).build());
             peerUpNot.setReceivedOpen(new ReceivedOpenBuilder(received).build());
 
             final InformationBuilder infos = new InformationBuilder();
-            if ( bytes.isReadable() ) {
+            if (bytes.isReadable()) {
                 parseTlvs(infos, bytes);
                 peerUpNot.setInformation(infos.build());
             }
@@ -132,11 +131,11 @@ public class PeerUpHandler extends AbstractBmpPerPeerMessageParser<InformationBu
     protected void addTlv(final InformationBuilder builder, final Tlv tlv) {
         if (tlv instanceof StringTlv) {
             final ImmutableList.Builder<StringInformation> stringInfoListBuilder = ImmutableList.builder();
-            if ( builder.getStringInformation() != null ) {
+            if (builder.getStringInformation() != null) {
                 stringInfoListBuilder.addAll(builder.getStringInformation());
             }
             builder.setStringInformation(stringInfoListBuilder.add(new StringInformationBuilder().setStringTlv(
-                new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
+                    new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
         }
     }
 
index e3f62d02c59984e2e391b5cca8741ba6b6b82e69..06f33c4626bf30ba09141cc29dcbb7bcf71c61e6 100644 (file)
@@ -38,14 +38,16 @@ public class RouteMirroringMessageHandler extends AbstractBmpPerPeerMessageParse
     @Override
     public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
         super.serializeMessageBody(message, buffer);
-        Preconditions.checkArgument(message instanceof RouteMirroringMessage, "An instance of RouteMirroringMessage is required");
+        Preconditions.checkArgument(message instanceof RouteMirroringMessage,
+                "An instance of RouteMirroringMessage is required");
         final RouteMirroringMessage routeMirror = (RouteMirroringMessage) message;
         serializeTlvs(routeMirror.getTlvs(), buffer);
     }
 
     @Override
     public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
-        final RouteMirroringMessageBuilder routeMirror = new RouteMirroringMessageBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+        final RouteMirroringMessageBuilder routeMirror = new RouteMirroringMessageBuilder()
+                .setPeerHeader(parsePerPeerHeader(bytes));
         final TlvsBuilder tlvsBuilder = new TlvsBuilder();
         parseTlvs(tlvsBuilder, bytes);
         return routeMirror.setTlvs(tlvsBuilder.build()).build();
index d6f6bee1d069823b8d13155d7857f333fcb2f82d..3a2451de73edf1ffecce29485784ad8cc7b2ccf5 100644 (file)
@@ -36,22 +36,25 @@ public class RouteMonitoringMessageHandler extends AbstractBmpPerPeerMessagePars
     @Override
     public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
         super.serializeMessageBody(message, buffer);
-        Preconditions.checkArgument(message instanceof RouteMonitoringMessage, "An instance of RouteMonitoringMessage is required");
+        Preconditions.checkArgument(message instanceof RouteMonitoringMessage,
+                "An instance of RouteMonitoringMessage is required");
         final RouteMonitoringMessage routeMonitor = (RouteMonitoringMessage) message;
         this.msgRegistry.serializeMessage(new UpdateBuilder(routeMonitor.getUpdate()).build(), buffer);
     }
 
     @Override
     public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
-        final RouteMonitoringMessageBuilder routeMonitor = new RouteMonitoringMessageBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+        final RouteMonitoringMessageBuilder routeMonitor = new RouteMonitoringMessageBuilder()
+                .setPeerHeader(parsePerPeerHeader(bytes));
         try {
             final Notification message = this.msgRegistry.parseMessage(bytes, null);
             requireNonNull(message, "UpdateMessage may not be null");
-            Preconditions.checkArgument(message instanceof UpdateMessage, "An instance of UpdateMessage is required");
+            Preconditions.checkArgument(message instanceof UpdateMessage,
+                    "An instance of UpdateMessage is required");
             final UpdateMessage updateMessage = (UpdateMessage) message;
-            final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route.monitoring
-                .message.Update update = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message
-                .rev171207.route.monitoring.message.UpdateBuilder(updateMessage).build();
+            final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.route
+                    .monitoring.message.Update update = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
+                    .ns.yang.bmp.message.rev171207.route.monitoring.message.UpdateBuilder(updateMessage).build();
             routeMonitor.setUpdate(update);
         } catch (final BGPDocumentedException | BGPParsingException e) {
             throw new BmpDeserializationException("Error while parsing Update Message.", e);
index e15de8ee48b20c984db2fcde3069570ef12a615d..5368da6be4a3f4bdbfd3d980033c1635126af180 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bmp.parser.message;
 
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.INT_BYTES_LENGTH;
 import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedInt;
+
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -39,9 +40,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.tlvs.UpdatesTreatedAsWithdrawTlv;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-/**
- * Created by cgasparini on 13.5.2015.
- */
 public class StatisticsReportHandler extends AbstractBmpPerPeerMessageParser<TlvsBuilder> {
 
     private static final int MESSAGE_TYPE = 1;
@@ -53,14 +51,16 @@ public class StatisticsReportHandler extends AbstractBmpPerPeerMessageParser<Tlv
     @Override
     public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
         super.serializeMessageBody(message, buffer);
-        Preconditions.checkArgument(message instanceof StatsReportsMessage, "An instance of Statistics Reports message is required");
+        Preconditions.checkArgument(message instanceof StatsReportsMessage,
+                "An instance of Statistics Reports message is required");
         final StatsReportsMessage statsReport = (StatsReportsMessage) message;
         serializeTlvs(statsReport.getTlvs(), buffer);
     }
 
     @Override
     public Notification parseMessageBody(final ByteBuf bytes) throws BmpDeserializationException {
-        final StatsReportsMessageBuilder statReport = new StatsReportsMessageBuilder().setPeerHeader(parsePerPeerHeader(bytes));
+        final StatsReportsMessageBuilder statReport = new StatsReportsMessageBuilder()
+                .setPeerHeader(parsePerPeerHeader(bytes));
         final TlvsBuilder tlvsBuilder = new TlvsBuilder();
         bytes.skipBytes(INT_BYTES_LENGTH);
         parseTlvs(tlvsBuilder, bytes);
@@ -73,7 +73,7 @@ public class StatisticsReportHandler extends AbstractBmpPerPeerMessageParser<Tlv
         return MESSAGE_TYPE;
     }
 
-    protected void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
+    private void serializeTlvs(final Tlvs tlvs, final ByteBuf output) {
         final AtomicInteger counter = new AtomicInteger(0);
         final ByteBuf tlvsBuffer = Unpooled.buffer();
         serializeStatTlv(tlvs.getRejectedPrefixesTlv(), tlvsBuffer, counter);
index 22d1e9df7fd7485eebed7eeba2688694b1cba619..c869e48d4b59786dff1d59a02d78ce67b24d3dfe 100644 (file)
@@ -26,9 +26,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
-/**
- * Created by cgasparini on 13.5.2015.
- */
 public class TerminationHandler extends AbstractBmpMessageWithTlvParser<TlvsBuilder> {
 
     public TerminationHandler(final BmpTlvRegistry tlvRegistry) {
@@ -52,7 +49,8 @@ public class TerminationHandler extends AbstractBmpMessageWithTlvParser<TlvsBuil
 
     @Override
     public void serializeMessageBody(final Notification message, final ByteBuf buffer) {
-        Preconditions.checkArgument(message instanceof TerminationMessage, "An instance of Termination message is required");
+        Preconditions.checkArgument(message instanceof TerminationMessage,
+                "An instance of Termination message is required");
         final TerminationMessage terminationMsg = (TerminationMessage) message;
         serializeTlvs(terminationMsg.getTlvs(), buffer);
     }
@@ -80,7 +78,8 @@ public class TerminationHandler extends AbstractBmpMessageWithTlvParser<TlvsBuil
         } else if (tlv instanceof StringTlv) {
             builder.setStringInformation(ImmutableList.<StringInformation>builder()
                     .addAll(builder.getStringInformation())
-                    .add(new StringInformationBuilder().setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
+                    .add(new StringInformationBuilder()
+                            .setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
         }
     }
 }
index 10f2aec76f81270300641f4751cf44fa4e38d613..f7d9694fc9e2ce09ad80c61ef0dd3d36bbeb542d 100644 (file)
@@ -25,7 +25,8 @@ public class MirrorInformationTlvHandler implements BmpTlvParser, BmpTlvSerializ
 
     @Override
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
-        Preconditions.checkArgument(tlv instanceof MirrorInformationTlv, "MirrorInformationTlv is mandatory.");
+        Preconditions.checkArgument(tlv instanceof MirrorInformationTlv,
+                "MirrorInformationTlv is mandatory.");
         TlvUtil.formatTlvShort16(TYPE, ((MirrorInformationTlv) tlv).getCode().getIntValue(), output);
     }
 
@@ -34,6 +35,7 @@ public class MirrorInformationTlvHandler implements BmpTlvParser, BmpTlvSerializ
         if (buffer == null) {
             return null;
         }
-        return new MirrorInformationTlvBuilder().setCode(MirrorInformationCode.forValue(buffer.readUnsignedShort())).build();
+        return new MirrorInformationTlvBuilder()
+                .setCode(MirrorInformationCode.forValue(buffer.readUnsignedShort())).build();
     }
 }
index 21b8f028933fa132df905d812e27c7d4b18431fd..4e5226a9a277574786505f02b563645fe9c08691 100644 (file)
@@ -25,7 +25,8 @@ public class StatType001TlvHandler implements BmpTlvParser, BmpTlvSerializer {
 
     @Override
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
-        Preconditions.checkArgument(tlv instanceof DuplicatePrefixAdvertisementsTlv, "DuplicatePrefixAdvertisementsTlv is mandatory.");
+        Preconditions.checkArgument(tlv instanceof DuplicatePrefixAdvertisementsTlv,
+                "DuplicatePrefixAdvertisementsTlv is mandatory.");
         TlvUtil.formatTlvCounter32(TYPE, ((DuplicatePrefixAdvertisementsTlv) tlv).getCount(), output);
     }
 
index 30d5ef1b6a98e80109e3f5197fb3a41469652ab5..00d66f85cfe65b2700c094542559495983c55969 100644 (file)
@@ -25,7 +25,8 @@ public class StatType003TlvHandler implements BmpTlvParser, BmpTlvSerializer {
 
     @Override
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
-        Preconditions.checkArgument(tlv instanceof InvalidatedClusterListLoopTlv, "InvalidatedClusterListLoopTlv is mandatory.");
+        Preconditions.checkArgument(tlv instanceof InvalidatedClusterListLoopTlv,
+                "InvalidatedClusterListLoopTlv is mandatory.");
         TlvUtil.formatTlvCounter32(TYPE, ((InvalidatedClusterListLoopTlv) tlv).getCount(), output);
     }
 
index e605742905784449df03a2e15f8b398086f24c08..75cb5a9956c55ba3ff42450ce743bd979b5a1a98 100644 (file)
@@ -25,7 +25,8 @@ public class StatType005TlvHandler implements BmpTlvParser, BmpTlvSerializer {
 
     @Override
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
-        Preconditions.checkArgument(tlv instanceof InvalidatedOriginatorIdTlv, "InvalidatedOriginatorIdTlv is mandatory.");
+        Preconditions.checkArgument(tlv instanceof InvalidatedOriginatorIdTlv,
+                "InvalidatedOriginatorIdTlv is mandatory.");
         TlvUtil.formatTlvCounter32(TYPE, ((InvalidatedOriginatorIdTlv) tlv).getCount(), output);
     }
 
index 7066d01b4e32510f6a91f3ab0f0b03bd5bcb64f7..47ee954da35494be61c3028366fdc1e89d11d95e 100644 (file)
@@ -25,7 +25,8 @@ public class StatType006TlvHandler implements BmpTlvParser, BmpTlvSerializer {
 
     @Override
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
-        Preconditions.checkArgument(tlv instanceof InvalidatedAsConfedLoopTlv, "InvalidatedAsConfedLoopTlv is mandatory.");
+        Preconditions.checkArgument(tlv instanceof InvalidatedAsConfedLoopTlv,
+                "InvalidatedAsConfedLoopTlv is mandatory.");
         TlvUtil.formatTlvCounter32(TYPE, ((InvalidatedAsConfedLoopTlv) tlv).getCount(), output);
     }
 
index 4b99d407ae599f381a154f24b9663881c269199b..0af5a8bed67f4aec5e277a3be018798625626b57 100644 (file)
@@ -36,7 +36,8 @@ public class StatType007TlvHandler implements BmpTlvParser, BmpTlvSerializer {
         if (buffer == null) {
             return null;
         }
-        return new AdjRibsInRoutesTlvBuilder().setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+        return new AdjRibsInRoutesTlvBuilder()
+                .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
     }
 
 }
index 91b4daccb80749e73f0a35c05959bbe2293856c2..3abade45b1e2e64cb133d4898bfb9ec82dc10dd1 100644 (file)
@@ -36,6 +36,7 @@ public class StatType008TlvHandler implements BmpTlvParser, BmpTlvSerializer {
         if (buffer == null) {
             return null;
         }
-        return new LocRibRoutesTlvBuilder().setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+        return new LocRibRoutesTlvBuilder()
+                .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
     }
 }
index 9555a62cbbc314698f3fb6dbd83e0b502a16e039..536d63a75dac7e06a5edda1ed7b1bf0aea11d0f5 100644 (file)
@@ -42,8 +42,10 @@ public class StatType009TlvHandler implements BmpTlvParser, BmpTlvSerializer {
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
         Preconditions.checkArgument(tlv instanceof PerAfiSafiAdjRibInTlv, "PerAfiSafiAdjRibInTlv is mandatory.");
         final ByteBuf buffer = Unpooled.buffer();
-        ByteBufWriteUtil.writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv).getAfi()), buffer);
-        ByteBufWriteUtil.writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv).getSafi()).shortValue(), buffer);
+        ByteBufWriteUtil.writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv)
+                .getAfi()), buffer);
+        ByteBufWriteUtil.writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiAdjRibInTlv) tlv)
+                .getSafi()).shortValue(), buffer);
         ByteBufWriteUtil.writeUnsignedLong(((PerAfiSafiAdjRibInTlv) tlv).getCount().getValue(), buffer);
         TlvUtil.formatTlv(TYPE, buffer, output);
     }
@@ -54,8 +56,8 @@ public class StatType009TlvHandler implements BmpTlvParser, BmpTlvSerializer {
             return null;
         }
         return new PerAfiSafiAdjRibInTlvBuilder()
-                       .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
-                       .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
-                       .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+                .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
+                .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
+                .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
     }
 }
index 58ecc621313df0c0611df5b1b71b0f67f7e2d5ca..3da1ee9e48b89d4752d5f3edd4c506cf439f92d2 100644 (file)
@@ -9,6 +9,9 @@
 package org.opendaylight.protocol.bmp.parser.tlv;
 
 import static java.util.Objects.requireNonNull;
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedByte;
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedLong;
+import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedShort;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
@@ -21,7 +24,6 @@ import org.opendaylight.protocol.bmp.spi.parser.BmpTlvParser;
 import org.opendaylight.protocol.bmp.spi.parser.BmpTlvSerializer;
 import org.opendaylight.protocol.bmp.spi.parser.TlvUtil;
 import org.opendaylight.protocol.util.ByteArray;
-import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Gauge64;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Tlv;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.tlvs.PerAfiSafiLocRibTlv;
@@ -42,9 +44,9 @@ public class StatType010TlvHandler implements BmpTlvParser, BmpTlvSerializer {
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
         Preconditions.checkArgument(tlv instanceof PerAfiSafiLocRibTlv, "PerAfiSafiLocRibInTlv is mandatory.");
         final ByteBuf buffer = Unpooled.buffer();
-        ByteBufWriteUtil.writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getAfi()), buffer);
-        ByteBufWriteUtil.writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getSafi()).shortValue(), buffer);
-        ByteBufWriteUtil.writeUnsignedLong(((PerAfiSafiLocRibTlv) tlv).getCount().getValue(), buffer);
+        writeUnsignedShort(this.afiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getAfi()), buffer);
+        writeUnsignedByte(this.safiRegistry.numberForClass(((PerAfiSafiLocRibTlv) tlv).getSafi()).shortValue(), buffer);
+        writeUnsignedLong(((PerAfiSafiLocRibTlv) tlv).getCount().getValue(), buffer);
         TlvUtil.formatTlv(TYPE, buffer, output);
     }
 
@@ -54,8 +56,8 @@ public class StatType010TlvHandler implements BmpTlvParser, BmpTlvSerializer {
             return null;
         }
         return new PerAfiSafiLocRibTlvBuilder()
-                       .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
-                       .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
-                       .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
+                .setAfi(this.afiRegistry.classForFamily(buffer.readUnsignedShort()))
+                .setSafi(this.safiRegistry.classForFamily(buffer.readUnsignedByte()))
+                .setCount(new Gauge64(new BigInteger(ByteArray.readAllBytes(buffer)))).build();
     }
 }
index 8a52b14c6c3e054988d9f02d7ff34547d606307a..367847ef5cf4a726c4ab4226eb11bb402cecfe9e 100644 (file)
@@ -25,7 +25,8 @@ public class StatType011TlvHandler implements BmpTlvParser, BmpTlvSerializer {
 
     @Override
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
-        Preconditions.checkArgument(tlv instanceof UpdatesTreatedAsWithdrawTlv, "UpdatesTreatedAsWithdrawTlv is mandatory.");
+        Preconditions.checkArgument(tlv instanceof UpdatesTreatedAsWithdrawTlv,
+                "UpdatesTreatedAsWithdrawTlv is mandatory.");
         TlvUtil.formatTlvCounter32(TYPE, ((UpdatesTreatedAsWithdrawTlv) tlv).getCount(), output);
     }
 
index 8ab440f0d820597f29af70160a9ec4409c7326e8..6dc3826bdd7ac1b012c32243862555ee1bf4988b 100644 (file)
@@ -25,7 +25,8 @@ public class StatType012TlvHandler implements BmpTlvParser, BmpTlvSerializer {
 
     @Override
     public void serializeTlv(final Tlv tlv, final ByteBuf output) {
-        Preconditions.checkArgument(tlv instanceof PrefixesTreatedAsWithdrawTlv, "PrefixesTreatedAsWithdrawTlv is mandatory.");
+        Preconditions.checkArgument(tlv instanceof PrefixesTreatedAsWithdrawTlv,
+                "PrefixesTreatedAsWithdrawTlv is mandatory.");
         TlvUtil.formatTlvCounter32(TYPE, ((PrefixesTreatedAsWithdrawTlv) tlv).getCount(), output);
     }
 
index c9959c7bac457b963d75c8238f77bd6d2c0207b1..b39a2a5cdba6ef26863e61db4a7369a8b7354f23 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.protocol.bmp.parser.message;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createInitMsg;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
@@ -39,13 +40,20 @@ public class InitiationHandlerTest extends AbstractBmpMessageTest {
          * 00 1C <- the length of STRING
          * 54 68 65 20 69 6E 66 6F 72 6D 61 74 69 6F 6E 20 66 69 65 6C 64 20 74 79 70 65 20 30 <- value of STRING
          */
-        (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x4B, (byte) 0x04, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x0E,
-        (byte) 0x53, (byte) 0x79, (byte) 0x73, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x20, (byte) 0x74, (byte) 0x79,
-        (byte) 0x70, (byte) 0x65, (byte) 0x20, (byte) 0x32, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x0F, (byte) 0x53, (byte) 0x79,
-        (byte) 0x73, (byte) 0x44, (byte) 0x65, (byte) 0x73, (byte) 0x63, (byte) 0x72, (byte) 0x20, (byte) 0x74, (byte) 0x79, (byte) 0x70,
-        (byte) 0x65, (byte) 0x20, (byte) 0x31, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1C, (byte) 0x54, (byte) 0x68, (byte) 0x65,
-        (byte) 0x20, (byte) 0x69, (byte) 0x6E, (byte) 0x66, (byte) 0x6F, (byte) 0x72, (byte) 0x6D, (byte) 0x61, (byte) 0x74, (byte) 0x69,
-        (byte) 0x6F, (byte) 0x6E, (byte) 0x20, (byte) 0x66, (byte) 0x69, (byte) 0x65, (byte) 0x6C, (byte) 0x64, (byte) 0x20, (byte) 0x74,
+        (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x4B, (byte) 0x04, (byte) 0x00, (byte) 0x02,
+        (byte) 0x00, (byte) 0x0E,
+        (byte) 0x53, (byte) 0x79, (byte) 0x73, (byte) 0x4E, (byte) 0x61, (byte) 0x6D, (byte) 0x65, (byte) 0x20,
+        (byte) 0x74, (byte) 0x79,
+        (byte) 0x70, (byte) 0x65, (byte) 0x20, (byte) 0x32, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x0F,
+        (byte) 0x53, (byte) 0x79,
+        (byte) 0x73, (byte) 0x44, (byte) 0x65, (byte) 0x73, (byte) 0x63, (byte) 0x72, (byte) 0x20, (byte) 0x74,
+        (byte) 0x79, (byte) 0x70,
+        (byte) 0x65, (byte) 0x20, (byte) 0x31, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x1C, (byte) 0x54,
+        (byte) 0x68, (byte) 0x65,
+        (byte) 0x20, (byte) 0x69, (byte) 0x6E, (byte) 0x66, (byte) 0x6F, (byte) 0x72, (byte) 0x6D, (byte) 0x61,
+        (byte) 0x74, (byte) 0x69,
+        (byte) 0x6F, (byte) 0x6E, (byte) 0x20, (byte) 0x66, (byte) 0x69, (byte) 0x65, (byte) 0x6C, (byte) 0x64,
+        (byte) 0x20, (byte) 0x74,
         (byte) 0x79, (byte) 0x70, (byte) 0x65, (byte) 0x20, (byte) 0x30
     };
 
@@ -58,7 +66,8 @@ public class InitiationHandlerTest extends AbstractBmpMessageTest {
 
     @Test
     public void testParseInitiationMessage() throws BmpDeserializationException {
-        final InitiationMessage parsedInitMsg = (InitiationMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(INIT_MSG));
+        final InitiationMessage parsedInitMsg = (InitiationMessage) getBmpMessageRegistry()
+                .parseMessage(Unpooled.copiedBuffer(INIT_MSG));
         assertEquals(createInitMsg(SYS_DESCR, SYS_NAME, STR_INFO), parsedInitMsg);
     }
 }
index 88d9a8ee9e50625d7202f0b8cf95c5a4dd526dfe..8f92d77fc5fcd7ed974f2838af58ad8a36eb246c 100644 (file)
@@ -11,6 +11,7 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createPeerDownFSM;
 import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createPeerDownNotification;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
@@ -38,7 +39,8 @@ public class PeerDownHandlerTest extends AbstractBmpMessageTest {
          * 00 00 00 0A - time stamp micro - 4 bytes
          *
          * 02 <- Reason why the session was terminated (2 - the local system closed the session)
-         * 00 18 <- the code of FSM event (24 - NotifMsgVerErr - An event is generated when a Notification message with "version error" is received.)
+         * 00 18 <- the code of FSM event (24 - NotifMsgVerErr - An event is generated when a
+          * Notification message with "version error" is received.)
          */
         (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x33, (byte) 0x02,
 
@@ -46,7 +48,8 @@ public class PeerDownHandlerTest extends AbstractBmpMessageTest {
         (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
@@ -93,7 +96,8 @@ public class PeerDownHandlerTest extends AbstractBmpMessageTest {
         (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
@@ -102,7 +106,8 @@ public class PeerDownHandlerTest extends AbstractBmpMessageTest {
 
         (byte) 0x01,
 
-        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
         (byte) 0x00, (byte) 0x15,
         (byte) 0x03,
         (byte) 0x01,
index 56a1d2732e3f0a86602f3c8d5ed199e667597099..3d2bd143d3df1373d7f794694582b4125869ec07 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bmp.parser.message;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createPeerUpNotification;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
@@ -62,19 +63,22 @@ public class PeerUpHandlerTest extends AbstractBmpMessageTest {
         (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x05,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A,
 
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0xDC,
         (byte) 0x13, (byte) 0x88,
 
-        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
         (byte) 0x00, (byte) 0x2B,
         (byte) 0x01,
         (byte) 0x04,
@@ -82,9 +86,11 @@ public class PeerUpHandlerTest extends AbstractBmpMessageTest {
         (byte) 0x03, (byte) 0xE8,
         (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14,
         (byte) 0x0E,
-        (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
+        (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46,
+        (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
 
-        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
         (byte) 0x00, (byte) 0x2B,
         (byte) 0x01,
         (byte) 0x04,
@@ -92,7 +98,8 @@ public class PeerUpHandlerTest extends AbstractBmpMessageTest {
         (byte) 0x03, (byte) 0xE8,
         (byte) 0x14, (byte) 0x14, (byte) 0x14, (byte) 0x14,
         (byte) 0x0E,
-        (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
+        (byte) 0x02, (byte) 0x0C, (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46,
+        (byte) 0x41, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x50,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04,
         (byte) 0x61, (byte) 0x61, (byte) 0x61, (byte) 0x61
     };
index b29c1b95c9225578a9a8fa01e87f89cd0e57b3a1..2fee2b53386676e1ab8f72b74ab03b33ee786927 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.protocol.bmp.parser.message;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createRouteMonitMsg;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
@@ -50,17 +51,20 @@ public class RouteMonitoringMessageHandlerTest extends AbstractBmpMessageTest {
         (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x05,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A,
 
-        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
+        (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF,
         (byte) 0x00, (byte) 0x84,
         (byte) 0x02,
-        (byte) 0x00, (byte) 0x0C, (byte) 0x18, (byte) 0x0A, (byte) 0x0A, (byte) 0x14, (byte) 0x18, (byte) 0x14, (byte) 0x14,
+        (byte) 0x00, (byte) 0x0C, (byte) 0x18, (byte) 0x0A, (byte) 0x0A, (byte) 0x14, (byte) 0x18, (byte) 0x14,
+        (byte) 0x14,
         (byte) 0x0A, (byte) 0x18, (byte) 0x1E, (byte) 0x0A, (byte) 0x0A, (byte) 0x00, (byte) 0x55, (byte) 0x40,
         (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x80, (byte) 0x1A, (byte) 0x0B, (byte) 0x01, (byte) 0x00,
         (byte) 0x0B, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
@@ -85,7 +89,8 @@ public class RouteMonitoringMessageHandlerTest extends AbstractBmpMessageTest {
 
     @Test
     public void testParseRouteMonitMessage() throws BmpDeserializationException {
-        final RouteMonitoringMessage parsedInitMsg = (RouteMonitoringMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(ROUTE_MONIT_MSG));
+        final RouteMonitoringMessage parsedInitMsg = (RouteMonitoringMessage) getBmpMessageRegistry()
+                .parseMessage(Unpooled.copiedBuffer(ROUTE_MONIT_MSG));
         assertEquals(createRouteMonitMsg(true), parsedInitMsg);
     }
 }
index e177eac86481c94164719972ba9d7a0b9f3fd9ec..a2e952c7b68c62c7aef52e356b47144e425d706c 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bmp.parser.message;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createStatsReportMsg;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
@@ -93,7 +94,8 @@ public class StatisticsReportHandlerTest extends AbstractBmpMessageTest {
         (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,    // < - element 28
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,    // < - element 28
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x48,
         (byte) 0x0A, (byte) 0x0A, (byte) 0x0A, (byte) 0x0A,
@@ -102,24 +104,33 @@ public class StatisticsReportHandlerTest extends AbstractBmpMessageTest {
 
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0E,  // <- tlv counts
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x04, (byte) 0x00,
-        (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x10,
-        (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B, (byte) 0x00, (byte) 0x03, (byte) 0x00,
-        (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x35, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00,
-        (byte) 0x00, (byte) 0x42, (byte) 0x00, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x46, (byte) 0x00,
-        (byte) 0x06, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x37, (byte) 0x00, (byte) 0x07, (byte) 0x00, (byte) 0x08,
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A, (byte) 0x00, (byte) 0x08, (byte) 0x00,
-        (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x64,
+        (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x04, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x10,
+        (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B,
+        (byte) 0x00, (byte) 0x03, (byte) 0x00,
+        (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x35, (byte) 0x00, (byte) 0x04, (byte) 0x00,
+        (byte) 0x04, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x42, (byte) 0x00, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x46, (byte) 0x00,
+        (byte) 0x06, (byte) 0x00, (byte) 0x04, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x37, (byte) 0x00,
+        (byte) 0x07, (byte) 0x00, (byte) 0x08,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A,
+        (byte) 0x00, (byte) 0x08, (byte) 0x00,
+        (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x64,
 
         (byte) 0x00, (byte) 0x09, //  <- per afi safi adj rib routes type
         (byte) 0x00, (byte) 0x0B, //  <- length
         (byte) 0x00, (byte) 0x01, //  <- afi
         (byte) 0x01,              //  <- safi
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x09, //  <- value
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x09, //  <- value
         (byte) 0x00, (byte) 0x0A, //  <- per afi safi local rib routes type
         (byte) 0x00, (byte) 0x0B, //  <- length
         (byte) 0x00, (byte) 0x01, //  <- afi
         (byte) 0x01,              //  <- safi
-        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0A, //  <- value
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x0A, //  <- value
         (byte) 0x00, (byte) 0x0B, //  <- updates treated as withdraw
         (byte) 0x00, (byte) 0x04, // <- length
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0B, //  <- value
@@ -140,7 +151,8 @@ public class StatisticsReportHandlerTest extends AbstractBmpMessageTest {
 
     @Test
     public void testParseStatsReportMessage() throws BmpDeserializationException {
-        final StatsReportsMessage parsedStatsReportsMsg = (StatsReportsMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(STATS_REPORT));
+        final StatsReportsMessage parsedStatsReportsMsg = (StatsReportsMessage) getBmpMessageRegistry()
+                .parseMessage(Unpooled.copiedBuffer(STATS_REPORT));
         assertEquals(createStatsReportMsg(), parsedStatsReportsMsg);
     }
 }
index 8c4bf8619597093e537127157c780f2cdc42cb1b..ed7a7826d87a4e48e1fa94c44e1a2e95ac898df4 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bmp.parser.message;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.opendaylight.protocol.bmp.parser.message.TestUtil.createTerminationMsg;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
@@ -58,7 +59,8 @@ public class TerminationHandlerTest extends AbstractBmpMessageTest {
 
     @Test
     public void testParseTerminationMessage() throws BmpDeserializationException {
-        final TerminationMessage parsedInitMsg = (TerminationMessage) getBmpMessageRegistry().parseMessage(Unpooled.copiedBuffer(TERMINATION_MESSAGE));
+        final TerminationMessage parsedInitMsg = (TerminationMessage) getBmpMessageRegistry()
+                .parseMessage(Unpooled.copiedBuffer(TERMINATION_MESSAGE));
         assertEquals(createTerminationMsg(), parsedInitMsg);
     }
 }
index 3bc86eed6d3c3c20f0aebed1654c57056a173895..aa5a3303d8e5074f001c401a8f8d8a0b737b4f7b 100644 (file)
@@ -116,11 +116,11 @@ public final class TestUtil {
     }
 
     public static final Ipv4Address IPV4_ADDRESS_10 = new Ipv4Address("10.10.10.10");
-    public static final Ipv4Address IPV4_ADDRESS_20 = new Ipv4Address("20.20.20.20");
-    public static final Ipv4Address IPV4_ADDRESS_30 = new Ipv4Address("30.30.30.30");
-    public static final Ipv4Address IPV4_ADDRESS_40 = new Ipv4Address("40.40.40.40");
-    public static final Ipv4Address IPV4_ADDRESS_12 = new Ipv4Address("12.12.12.12");
-    public static final Ipv4Address IPV4_ADDRESS_100 = new Ipv4Address("100.100.100.100");
+    private static final Ipv4Address IPV4_ADDRESS_20 = new Ipv4Address("20.20.20.20");
+    private static final Ipv4Address IPV4_ADDRESS_30 = new Ipv4Address("30.30.30.30");
+    private static final Ipv4Address IPV4_ADDRESS_40 = new Ipv4Address("40.40.40.40");
+    private static final Ipv4Address IPV4_ADDRESS_12 = new Ipv4Address("12.12.12.12");
+    private static final Ipv4Address IPV4_ADDRESS_100 = new Ipv4Address("100.100.100.100");
     public static final AsNumber PEER_AS = new AsNumber(72L);
     public static final PortNumber PEER_LOCAL_PORT = new PortNumber(220);
     public static final PortNumber PEER_REMOTE_PORT = new PortNumber(5000);
@@ -134,20 +134,22 @@ public final class TestUtil {
         return initMsgBuilder.setTlvs(tlvsBuilder.build()).build();
     }
 
-    public static StringInformation createStringInfo(final String string) {
-        return new StringInformationBuilder().setStringTlv(new StringTlvBuilder().setStringInfo(string).build()).build();
+    private static StringInformation createStringInfo(final String string) {
+        return new StringInformationBuilder()
+                .setStringTlv(new StringTlvBuilder().setStringInfo(string).build()).build();
     }
 
     public static TerminationMessage createTerminationMsg() {
         final TerminationMessageBuilder terminatMsgBuilder = new TerminationMessageBuilder();
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder tlvsBuilder =
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination.TlvsBuilder();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.termination
+                .TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+                .bmp.message.rev171207.termination.TlvsBuilder();
         tlvsBuilder.setReasonTlv(new ReasonTlvBuilder().setReason(Reason.AdministrativelyClosed).build());
         tlvsBuilder.setStringInformation(Lists.newArrayList(createStringInfo("error1"), createStringInfo("error1")));
         return terminatMsgBuilder.setTlvs(tlvsBuilder.build()).build();
     }
 
-    public static PeerHeader createPeerHeader(final Ipv4Address bgpId, final AdjRibInType ribType) {
+    private static PeerHeader createPeerHeader(final Ipv4Address bgpId, final AdjRibInType ribType) {
         final PeerHeaderBuilder peerHeaderBuilder = new PeerHeaderBuilder()
             .setAddress(new IpAddress(IPV4_ADDRESS_10))
             .setAs(PEER_AS)
@@ -160,11 +162,11 @@ public final class TestUtil {
         return peerHeaderBuilder.build();
     }
 
-    public static PeerHeader createPeerHeader(final Ipv4Address bgpId) {
+    private static PeerHeader createPeerHeader(final Ipv4Address bgpId) {
         return createPeerHeader(bgpId, AdjRibInType.PrePolicy);
     }
 
-    public static PeerHeader createPeerHeader() {
+    private static PeerHeader createPeerHeader() {
         return createPeerHeader(IPV4_ADDRESS_10);
     }
 
@@ -185,7 +187,7 @@ public final class TestUtil {
         return peerUpNotifBuilder.build();
     }
 
-    public static PeerUpNotification createPeerUpNotification() {
+    static PeerUpNotification createPeerUpNotification() {
         return createPeerUpNotification(IPV4_ADDRESS_10, false);
     }
 
@@ -199,7 +201,8 @@ public final class TestUtil {
 
     public static PeerDownNotification createPeerDownNotification(final Ipv4Address bgpId) {
         final NotificationBuilder notifBuilder = new NotificationBuilder()
-            .setNotification(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.down.data.notification.NotificationBuilder()
+            .setNotification(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message
+                    .rev171207.peer.down.data.notification.NotificationBuilder()
             .setErrorCode((short) 1)
             .setErrorSubcode((short) 1).build());
         final PeerDownNotificationBuilder peerDownNotifBuilder = new PeerDownNotificationBuilder()
@@ -209,7 +212,7 @@ public final class TestUtil {
         return peerDownNotifBuilder.build();
     }
 
-    public static PeerDownNotification createPeerDownNotification() {
+    static PeerDownNotification createPeerDownNotification() {
         return createPeerDownNotification(IPV4_ADDRESS_10);
     }
 
@@ -224,7 +227,8 @@ public final class TestUtil {
 
     private static List<OptionalCapabilities> createOptionalCapabilities(final boolean multiprotocol) {
         final OptionalCapabilitiesBuilder optCapabilitiesBuilder = new OptionalCapabilitiesBuilder()
-            .setCParameters(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(70L)).build()).build());
+            .setCParameters(new CParametersBuilder().setAs4BytesCapability(new As4BytesCapabilityBuilder()
+                    .setAsNumber(new AsNumber(70L)).build()).build());
         final CParametersBuilder paramsBuilder = new CParametersBuilder();
         if (multiprotocol) {
             final CParameters1Builder params1Builder = new CParameters1Builder();
@@ -235,7 +239,8 @@ public final class TestUtil {
         }
         final OptionalCapabilitiesBuilder optCapabilitiesBuilder2 = new OptionalCapabilitiesBuilder()
             .setCParameters(paramsBuilder
-                    .setAs4BytesCapability(new As4BytesCapabilityBuilder().setAsNumber(new AsNumber(80L)).build()).build());
+                    .setAs4BytesCapability(new As4BytesCapabilityBuilder()
+                            .setAsNumber(new AsNumber(80L)).build()).build());
         final List<OptionalCapabilities> optCapabilities = Lists.newArrayList();
         optCapabilities.add(optCapabilitiesBuilder.build());
         optCapabilities.add(optCapabilitiesBuilder2.build());
@@ -257,7 +262,8 @@ public final class TestUtil {
         return createRouteMonitMsg(withNormalizedIpv4Prefixes, IPV4_ADDRESS_10, AdjRibInType.PrePolicy);
     }
 
-    public static RouteMonitoringMessage createRouteMonitMsg(final boolean withNormalizedIpv4Prefixes, final Ipv4Address bgpId, final AdjRibInType ribType) {
+    public static RouteMonitoringMessage createRouteMonitMsg(final boolean withNormalizedIpv4Prefixes,
+            final Ipv4Address bgpId, final AdjRibInType ribType) {
         final RouteMonitoringMessageBuilder routeMonitMsgBuilder = new RouteMonitoringMessageBuilder()
             .setPeerHeader(createPeerHeader(bgpId, ribType))
             .setUpdate(createUpdate(withNormalizedIpv4Prefixes));
@@ -267,8 +273,11 @@ public final class TestUtil {
     public static RouteMirroringMessage createRouteMirrorMsg(final Ipv4Address bgpId) {
         final RouteMirroringMessageBuilder routeMirrorMsgBuilder = new RouteMirroringMessageBuilder()
             .setPeerHeader(createPeerHeader(bgpId));
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.mirror.TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.mirror.TlvsBuilder();
-        tlvsBuilder.setMirrorInformationTlv(new MirrorInformationTlvBuilder().setCode(MirrorInformationCode.forValue(1)).build());
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.mirror
+                .TlvsBuilder tlvsBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+                .bmp.message.rev171207.mirror.TlvsBuilder();
+        tlvsBuilder.setMirrorInformationTlv(new MirrorInformationTlvBuilder()
+                .setCode(MirrorInformationCode.forValue(1)).build());
         routeMirrorMsgBuilder.setTlvs(tlvsBuilder.build());
         return routeMirrorMsgBuilder.build();
     }
@@ -287,14 +296,17 @@ public final class TestUtil {
     }
 
     private static Attributes createAttributes() {
-        final List<AsNumber> asSequences = Lists.newArrayList(new AsNumber(72L), new AsNumber(82L), new AsNumber(92L));
+        final List<AsNumber> asSequences = Lists.newArrayList(new AsNumber(72L), new AsNumber(82L),
+                new AsNumber(92L));
         final List<Segments> segments = Lists.newArrayList();
         final SegmentsBuilder segmentsBuild = new SegmentsBuilder();
         segmentsBuild.setAsSequence(asSequences).build();
 
         final AttributesBuilder attribBuilder = new AttributesBuilder()
-            .setAggregator(new AggregatorBuilder().setAsNumber(new AsNumber(72L)).setNetworkAddress(new Ipv4Address(IPV4_ADDRESS_20)).build())
-            .setAigp(new AigpBuilder().setAigpTlv(new AigpTlvBuilder().setMetric(new AccumulatedIgpMetric(BigInteger.ONE)).build()).build())
+            .setAggregator(new AggregatorBuilder().setAsNumber(new AsNumber(72L))
+                    .setNetworkAddress(new Ipv4Address(IPV4_ADDRESS_20)).build())
+            .setAigp(new AigpBuilder().setAigpTlv(new AigpTlvBuilder()
+                    .setMetric(new AccumulatedIgpMetric(BigInteger.ONE)).build()).build())
             .setAsPath(new AsPathBuilder().setSegments(segments).build())
             .setAtomicAggregate(new AtomicAggregateBuilder().build())
             .setClusterId(new ClusterIdBuilder().setCluster(Lists.newArrayList(new ClusterIdentifier(IPV4_ADDRESS_30),
@@ -338,41 +350,64 @@ public final class TestUtil {
     }
 
     private static List<WithdrawnRoutes> createWithdrawnRoutes() {
-        final WithdrawnRoutes w1 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("10.10.20.0/24")).build();
-        final WithdrawnRoutes w2 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("20.20.10.0/24")).build();
-        final WithdrawnRoutes w3 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("30.10.10.0/24")).build();
+        final WithdrawnRoutes w1 = new WithdrawnRoutesBuilder()
+                .setPrefix(new Ipv4Prefix("10.10.20.0/24")).build();
+        final WithdrawnRoutes w2 = new WithdrawnRoutesBuilder()
+                .setPrefix(new Ipv4Prefix("20.20.10.0/24")).build();
+        final WithdrawnRoutes w3 = new WithdrawnRoutesBuilder()
+                .setPrefix(new Ipv4Prefix("30.10.10.0/24")).build();
         return Lists.newArrayList(w1, w2, w3);
     }
 
     public static StatsReportsMessage createStatsReportMsg(final Ipv4Address bgpId) {
         final StatsReportsMessageBuilder statsReportMsgBuilder = new StatsReportsMessageBuilder();
         statsReportMsgBuilder.setPeerHeader(TestUtil.createPeerHeader(bgpId));
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.TlvsBuilder tlvsBuilder =
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.TlvsBuilder();
-        tlvsBuilder.setAdjRibsInRoutesTlv(new AdjRibsInRoutesTlvBuilder().setCount(new Gauge64(BigInteger.valueOf(10L))).build());
-        tlvsBuilder.setDuplicatePrefixAdvertisementsTlv(new DuplicatePrefixAdvertisementsTlvBuilder().setCount(new Counter32(16L)).build());
-        tlvsBuilder.setDuplicateWithdrawsTlv(new DuplicateWithdrawsTlvBuilder().setCount(new Counter32(11L)).build());
-        tlvsBuilder.setInvalidatedAsConfedLoopTlv(new InvalidatedAsConfedLoopTlvBuilder().setCount(new Counter32(55L)).build());
-        tlvsBuilder.setInvalidatedAsPathLoopTlv(new InvalidatedAsPathLoopTlvBuilder().setCount(new Counter32(66L)).build());
-        tlvsBuilder.setInvalidatedClusterListLoopTlv(new InvalidatedClusterListLoopTlvBuilder().setCount(new Counter32(53L)).build());
-        tlvsBuilder.setInvalidatedOriginatorIdTlv(new InvalidatedOriginatorIdTlvBuilder().setCount(new Counter32(70L)).build());
-        tlvsBuilder.setLocRibRoutesTlv(new LocRibRoutesTlvBuilder().setCount(new Gauge64(BigInteger.valueOf(100L))).build());
-        tlvsBuilder.setRejectedPrefixesTlv(new RejectedPrefixesTlvBuilder().setCount(new Counter32(8L)).build());
-        tlvsBuilder.setPerAfiSafiAdjRibInTlv(new PerAfiSafiAdjRibInTlvBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setCount(new Gauge64(BigInteger.valueOf(9L))).build());
-        tlvsBuilder.setPerAfiSafiLocRibTlv(new PerAfiSafiLocRibTlvBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).setCount(new Gauge64(BigInteger.valueOf(10L))).build());
-        tlvsBuilder.setUpdatesTreatedAsWithdrawTlv(new UpdatesTreatedAsWithdrawTlvBuilder().setCount(new Counter32(11L)).build());
-        tlvsBuilder.setPrefixesTreatedAsWithdrawTlv(new PrefixesTreatedAsWithdrawTlvBuilder().setCount(new Counter32(12L)).build());
-        tlvsBuilder.setDuplicateUpdatesTlv(new DuplicateUpdatesTlvBuilder().setCount(new Counter32(13L)).build());
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat
+                .TlvsBuilder tlvsBuilder =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat
+                        .TlvsBuilder();
+        tlvsBuilder.setAdjRibsInRoutesTlv(new AdjRibsInRoutesTlvBuilder()
+                .setCount(new Gauge64(BigInteger.valueOf(10L))).build());
+        tlvsBuilder.setDuplicatePrefixAdvertisementsTlv(new DuplicatePrefixAdvertisementsTlvBuilder()
+                .setCount(new Counter32(16L)).build());
+        tlvsBuilder.setDuplicateWithdrawsTlv(new DuplicateWithdrawsTlvBuilder()
+                .setCount(new Counter32(11L)).build());
+        tlvsBuilder.setInvalidatedAsConfedLoopTlv(new InvalidatedAsConfedLoopTlvBuilder()
+                .setCount(new Counter32(55L)).build());
+        tlvsBuilder.setInvalidatedAsPathLoopTlv(new InvalidatedAsPathLoopTlvBuilder()
+                .setCount(new Counter32(66L)).build());
+        tlvsBuilder.setInvalidatedClusterListLoopTlv(new InvalidatedClusterListLoopTlvBuilder()
+                .setCount(new Counter32(53L)).build());
+        tlvsBuilder.setInvalidatedOriginatorIdTlv(new InvalidatedOriginatorIdTlvBuilder()
+                .setCount(new Counter32(70L)).build());
+        tlvsBuilder.setLocRibRoutesTlv(new LocRibRoutesTlvBuilder()
+                .setCount(new Gauge64(BigInteger.valueOf(100L))).build());
+        tlvsBuilder.setRejectedPrefixesTlv(new RejectedPrefixesTlvBuilder()
+                .setCount(new Counter32(8L)).build());
+        tlvsBuilder.setPerAfiSafiAdjRibInTlv(new PerAfiSafiAdjRibInTlvBuilder()
+                .setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
+                .setCount(new Gauge64(BigInteger.valueOf(9L))).build());
+        tlvsBuilder.setPerAfiSafiLocRibTlv(new PerAfiSafiLocRibTlvBuilder()
+                .setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class)
+                .setCount(new Gauge64(BigInteger.valueOf(10L))).build());
+        tlvsBuilder.setUpdatesTreatedAsWithdrawTlv(new UpdatesTreatedAsWithdrawTlvBuilder()
+                .setCount(new Counter32(11L)).build());
+        tlvsBuilder.setPrefixesTreatedAsWithdrawTlv(new PrefixesTreatedAsWithdrawTlvBuilder()
+                .setCount(new Counter32(12L)).build());
+        tlvsBuilder.setDuplicateUpdatesTlv(new DuplicateUpdatesTlvBuilder()
+                .setCount(new Counter32(13L)).build());
         return statsReportMsgBuilder.setTlvs(tlvsBuilder.build()).build();
     }
 
-    public static StatsReportsMessage createStatsReportMsg() {
+    static StatsReportsMessage createStatsReportMsg() {
         return createStatsReportMsg(IPV4_ADDRESS_10);
     }
 
 
-    public static RouteMonitoringMessage createRouteMonMsgWithEndOfRibMarker(final Ipv4Address bgpId, final AdjRibInType ribType) {
-        return new RouteMonitoringMessageBuilder().setPeerHeader(createPeerHeader(bgpId, ribType)).setUpdate(createEndOfRibMarker()).build();
+    public static RouteMonitoringMessage createRouteMonMsgWithEndOfRibMarker(final Ipv4Address bgpId,
+            final AdjRibInType ribType) {
+        return new RouteMonitoringMessageBuilder().setPeerHeader(createPeerHeader(bgpId, ribType))
+                .setUpdate(createEndOfRibMarker()).build();
     }
 
     private static Update createEndOfRibMarker() {