Enforce findbug & checkstyle for bgp inet 81/66581/3
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 18 Dec 2017 16:38:47 +0000 (17:38 +0100)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Wed, 20 Dec 2017 14:27:53 +0000 (14:27 +0000)
Change-Id: Ie623110fa1d1a5466f2ceb914284b07d24e76f87
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
17 files changed:
bgp/inet/pom.xml
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/AbstractIPRibSupport.java [moved from bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/AbstractIPRIBSupport.java with 86% similarity]
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupport.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupport.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/RIBActivator.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/TableTypeActivator.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv4NlriParser.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/Ipv6NlriParser.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/nexthop/Ipv4NextHopParserSerializer.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/codec/nexthop/Ipv6NextHopParserSerializer.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv4RIBSupportTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/IPv6RIBSupportTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/Ipv6BgpPrefixSidParserTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/TableTypeActivatorTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/BGPParserTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/Ipv4NlriParserTest.java
bgp/inet/src/test/java/org/opendaylight/protocol/bgp/inet/codec/nexthop/NextHopParserSerializerTest.java

index 3b2bb68eff03ee10b2a52222e6bd02102f1b5238..5b2017a375e792978dd28b61d3c78b127dccea21 100644 (file)
         </dependency>
     </dependencies>
 
+    <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>
+        </plugins>
+    </build>
+
     <scm>
         <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
         <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
similarity index 86%
rename from bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/AbstractIPRIBSupport.java
rename to bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/AbstractIPRibSupport.java
index dd072e2a519ec8bcedc38c949fbcb959d5cbb35a..1cd2b9be1de25ad5f790f89ced17b10a81fc92dc 100644 (file)
@@ -35,16 +35,19 @@ import org.slf4j.LoggerFactory;
 /**
  * Common {@link org.opendaylight.protocol.bgp.rib.spi.RIBSupport} class for IPv4 and IPv6 addresses.
  */
-abstract class AbstractIPRIBSupport extends MultiPathAbstractRIBSupport {
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractIPRIBSupport.class);
+abstract class AbstractIPRibSupport extends MultiPathAbstractRIBSupport {
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractIPRibSupport.class);
     private final NodeIdentifier prefixNid;
     private final NodeIdentifier nlriRoutesList;
     private final ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects;
 
-    protected AbstractIPRIBSupport(final Class<? extends DataObject> prefixClass, final Class<? extends AddressFamily> addressFamilyClass,
-        final Class<? extends Routes> cazeClass, final Class<? extends DataObject> containerClass, final Class<? extends Route> listClass,
+    protected AbstractIPRibSupport(final Class<? extends DataObject> prefixClass,
+            final Class<? extends AddressFamily> addressFamilyClass,
+        final Class<? extends Routes> cazeClass,
+            final Class<? extends DataObject> containerClass, final Class<? extends Route> listClass,
         final QName destinationQname, final QName prefixesQname) {
-        super(cazeClass, containerClass, listClass, addressFamilyClass, UnicastSubsequentAddressFamily.class, "prefix", destinationQname);
+        super(cazeClass, containerClass, listClass, addressFamilyClass,
+                UnicastSubsequentAddressFamily.class, "prefix", destinationQname);
         this.prefixNid = new NodeIdentifier(routeKeyQName());
         this.nlriRoutesList = new NodeIdentifier(prefixesQname);
         this.cacheableNlriObjects = ImmutableSet.of(prefixClass);
@@ -75,7 +78,8 @@ abstract class AbstractIPRIBSupport extends MultiPathAbstractRIBSupport {
     protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
         final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
         if (destination != null) {
-            final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = destination.getChild(this.nlriRoutesList);
+            final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes =
+                    destination.getChild(this.nlriRoutesList);
             if (maybeRoutes.isPresent()) {
                 final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
                 if (routes instanceof UnkeyedListNode) {
@@ -94,14 +98,16 @@ abstract class AbstractIPRIBSupport extends MultiPathAbstractRIBSupport {
     }
 
     /**
-     * Prefix and Path Id are the route key
+     * Prefix and Path Id are the route key.
      *
      * @param prefixes UnkeyedListEntryNode containing route
      * @return Nid with Route Key
      */
     private NodeIdentifierWithPredicates createRouteKey(final UnkeyedListEntryNode prefixes) {
-        final Optional<DataContainerChild<? extends PathArgument, ?>> maybePrefixLeaf = prefixes.getChild(routePrefixIdentifier());
-        final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf = prefixes.getChild(routePathIdNid());
+        final Optional<DataContainerChild<? extends PathArgument, ?>> maybePrefixLeaf =
+                prefixes.getChild(routePrefixIdentifier());
+        final Optional<DataContainerChild<? extends PathArgument, ?>> maybePathIdLeaf =
+                prefixes.getChild(routePathIdNid());
         Preconditions.checkState(maybePrefixLeaf.isPresent());
         final Object prefixValue = maybePrefixLeaf.get().getValue();
         return PathIdUtil.createNidKey(routeQName(), routeKeyQName(), pathIdQName(), prefixValue, maybePathIdLeaf);
index 2beb8c5d8e2b1e87940333a76a109e79f0ea0297..90dc0404db381f10df66868dc0ec7d8f42281a99 100644 (file)
@@ -21,6 +21,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.Ipv4Routes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.routes.ipv4.routes.Ipv4Route;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Ipv4PrefixAndPathId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.destination.DestinationType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
@@ -29,12 +30,12 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
 /**
  * Class supporting IPv4 unicast RIBs.
  */
-final class IPv4RIBSupport extends AbstractIPRIBSupport {
+final class IPv4RIBSupport extends AbstractIPRibSupport {
 
     private static final IPv4RIBSupport SINGLETON = new IPv4RIBSupport();
 
     private IPv4RIBSupport() {
-        super(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Ipv4PrefixAndPathId.class, Ipv4AddressFamily.class,
+        super(Ipv4PrefixAndPathId.class, Ipv4AddressFamily.class,
                 Ipv4RoutesCase.class, Ipv4Routes.class, Ipv4Route.class, DestinationIpv4.QNAME, Ipv4Prefixes.QNAME);
     }
 
@@ -56,13 +57,16 @@ final class IPv4RIBSupport extends AbstractIPRIBSupport {
     @Nonnull
     @Override
     protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
-        return new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(extractPrefixes(routes)).build()).build();
+        return new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
+                .setIpv4Prefixes(extractPrefixes(routes)).build()).build();
     }
 
     @Nonnull
     @Override
     protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
-        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-                new DestinationIpv4Builder().setIpv4Prefixes(extractPrefixes(routes)).build()).build();
+        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
+                .setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(extractPrefixes(routes))
+                        .build()).build();
     }
 }
index d305a22f66abe7486734bf7a39766eb06e1c03fc..bc65761368b5f8388ddbd604ee3b77b0127d29d8 100644 (file)
@@ -29,13 +29,14 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
 /**
  * Class supporting IPv6 unicast RIBs.
  */
-final class IPv6RIBSupport extends AbstractIPRIBSupport {
+final class IPv6RIBSupport extends AbstractIPRibSupport {
 
     private static final IPv6RIBSupport SINGLETON = new IPv6RIBSupport();
 
     private IPv6RIBSupport() {
         super(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.Ipv6Prefix.class,
-                Ipv6AddressFamily.class, Ipv6RoutesCase.class, Ipv6Routes.class, Ipv6Route.class, DestinationIpv6.QNAME, Ipv6Prefixes.QNAME);
+                Ipv6AddressFamily.class, Ipv6RoutesCase.class, Ipv6Routes.class, Ipv6Route.class,
+                DestinationIpv6.QNAME, Ipv6Prefixes.QNAME);
     }
 
     static IPv6RIBSupport getInstance() {
@@ -45,22 +46,25 @@ final class IPv6RIBSupport extends AbstractIPRIBSupport {
     @Nonnull
     @Override
     protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
-        return new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build();
+        return new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder()
+                .setIpv6Prefixes(extractPrefixes(routes)).build()).build();
     }
 
     @Nonnull
     @Override
     protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
-        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes
-                .destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
-                        new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build();
+        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder()
+                .setDestinationIpv6(new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes))
+                        .build()).build();
     }
 
     private List<Ipv6Prefixes> extractPrefixes(final Collection<MapEntryNode> routes) {
         final List<Ipv6Prefixes> prefs = new ArrayList<>(routes.size());
         for (final MapEntryNode route : routes) {
             final String prefix = (String) NormalizedNodes.findNode(route, routePrefixIdentifier()).get().getValue();
-            prefs.add(new Ipv6PrefixesBuilder().setPathId(PathIdUtil.buildPathId(route, routePathIdNid())).setPrefix(new Ipv6Prefix(prefix)).build());
+            prefs.add(new Ipv6PrefixesBuilder().setPathId(PathIdUtil.buildPathId(route, routePathIdNid()))
+                    .setPrefix(new Ipv6Prefix(prefix)).build());
         }
         return prefs;
     }
index 6444ff61826fae0c7e6f175763e3a48e02f20301..00b50dd57d9eb38ef256bfbd9395096dafeb24f3 100644 (file)
@@ -20,7 +20,9 @@ public final class RIBActivator extends AbstractRIBExtensionProviderActivator {
     @Override
     protected List<AutoCloseable> startRIBExtensionProviderImpl(final RIBExtensionProviderContext context) {
         return Lists.newArrayList(
-            context.registerRIBSupport(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv4RIBSupport.getInstance()),
-            context.registerRIBSupport(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, IPv6RIBSupport.getInstance()));
+            context.registerRIBSupport(Ipv4AddressFamily.class,
+                    UnicastSubsequentAddressFamily.class, IPv4RIBSupport.getInstance()),
+            context.registerRIBSupport(Ipv6AddressFamily.class,
+                    UnicastSubsequentAddressFamily.class, IPv6RIBSupport.getInstance()));
     }
 }
index 47bb0843d9b85ff84dcc7b10022a219c9c456f79..60bd434ce6fc8786b3ee8000be609fe407485846 100644 (file)
@@ -22,10 +22,13 @@ import org.opendaylight.yangtools.concepts.AbstractRegistration;
 public final class TableTypeActivator extends AbstractBGPTableTypeRegistryProviderActivator {
 
     @Override
-    protected List<AbstractRegistration> startBGPTableTypeRegistryProviderImpl(final BGPTableTypeRegistryProvider provider) {
+    protected List<AbstractRegistration> startBGPTableTypeRegistryProviderImpl(
+            final BGPTableTypeRegistryProvider provider) {
         return Lists.newArrayList(
-                provider.registerBGPTableType(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class, IPV4UNICAST.class),
-                provider.registerBGPTableType(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class, IPV6UNICAST.class));
+                provider.registerBGPTableType(Ipv4AddressFamily.class,
+                        UnicastSubsequentAddressFamily.class, IPV4UNICAST.class),
+                provider.registerBGPTableType(Ipv6AddressFamily.class,
+                        UnicastSubsequentAddressFamily.class, IPV6UNICAST.class));
     }
 
 }
index 4bc7a086b3997bf2c2538857d5aca19c6b79c67c..623b096d3e5c23dc5ca3db9ed01925ed671ee3a2 100644 (file)
@@ -66,27 +66,35 @@ public final class Ipv4NlriParser implements NlriParser, NlriSerializer {
     }
 
     @Override
-    public void parseNlri(final ByteBuf nlri, final MpReachNlriBuilder builder, final PeerSpecificParserConstraint constraint) {
+    public void parseNlri(final ByteBuf nlri, final MpReachNlriBuilder builder,
+            final PeerSpecificParserConstraint constraint) {
         builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
-                new DestinationIpv4CaseBuilder().setDestinationIpv4(prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
+                new DestinationIpv4CaseBuilder().setDestinationIpv4(prefixes(nlri, constraint,
+                        builder.getAfi(), builder.getSafi())).build()).build());
     }
 
     @Override
-    public void parseNlri(final ByteBuf nlri, final MpUnreachNlriBuilder builder, final PeerSpecificParserConstraint constraint) {
-        builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-                prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
+    public void parseNlri(final ByteBuf nlri, final MpUnreachNlriBuilder builder,
+            final PeerSpecificParserConstraint constraint) {
+        builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
+                        .setDestinationIpv4(prefixes(nlri, constraint, builder.getAfi(), builder.getSafi()))
+                        .build()).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 Attributes pathAttributes = (Attributes) attribute;
         final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
         final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
         if (pathAttributes1 != null) {
             final AdvertizedRoutes advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
             if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv4Case) {
-                final DestinationIpv4Case destinationIpv4Case = (DestinationIpv4Case) advertizedRoutes.getDestinationType();
+                final DestinationIpv4Case destinationIpv4Case =
+                        (DestinationIpv4Case) advertizedRoutes.getDestinationType();
                 for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) {
                     PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator);
                     ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator);
@@ -94,9 +102,14 @@ public final class Ipv4NlriParser implements NlriParser, NlriSerializer {
             }
         } else if (pathAttributes2 != null) {
             final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
-            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case) {
-                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case destinationIpv4Case =
-                        (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case) withdrawnRoutes.getDestinationType();
+            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen
+                    .v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri
+                    .withdrawn.routes.destination.type.DestinationIpv4Case) {
+                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                        .DestinationIpv4Case destinationIpv4Case = (org.opendaylight.yang.gen.v1.urn.opendaylight
+                        .params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes
+                        .destination.type.DestinationIpv4Case) withdrawnRoutes.getDestinationType();
                 for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) {
                     PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator);
                     ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator);
index d5e68db16e67741f065feffeb63861627ab4d08b..706b0a7fdb1a8ace90858fa390cacb400edaf43d 100644 (file)
@@ -12,8 +12,6 @@ import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import java.util.ArrayList;
 import java.util.List;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
 import org.opendaylight.protocol.bgp.parser.spi.MultiPathSupportUtil;
@@ -47,7 +45,8 @@ public final class Ipv6NlriParser implements NlriParser, NlriSerializer {
     private static DestinationIpv6 prefixes(final ByteBuf nlri, final PeerSpecificParserConstraint constraint,
             final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
         final List<Ipv6Prefixes> prefixes = new ArrayList<>();
-        final boolean supported = MultiPathSupportUtil.isTableTypeSupported(constraint, new BgpTableTypeImpl(afi, safi));
+        final boolean supported = MultiPathSupportUtil.isTableTypeSupported(constraint,
+                new BgpTableTypeImpl(afi, safi));
         while (nlri.isReadable()) {
             final Ipv6PrefixesBuilder prefixesBuilder = new Ipv6PrefixesBuilder();
             if (supported) {
@@ -70,28 +69,33 @@ public final class Ipv6NlriParser implements NlriParser, NlriSerializer {
     }
 
     @Override
-    public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpReachNlriBuilder builder,
-            @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
-        builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv6CaseBuilder().
-                setDestinationIpv6(prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
+    public void parseNlri(final ByteBuf nlri, final MpReachNlriBuilder builder,
+            final PeerSpecificParserConstraint constraint) {
+        builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv6CaseBuilder()
+                .setDestinationIpv6(prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
     }
 
     @Override
-    public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpUnreachNlriBuilder builder, @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
-        builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
+    public void parseNlri(final ByteBuf nlri, final MpUnreachNlriBuilder builder,
+            final PeerSpecificParserConstraint constraint) {
+        builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn
+                .opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes
+                .destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
                 prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).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 Attributes pathAttributes = (Attributes) attribute;
         final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
         final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
         if (pathAttributes1 != null) {
             final AdvertizedRoutes advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
             if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv6Case) {
-                final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) advertizedRoutes.getDestinationType();
+                final DestinationIpv6Case destinationIpv6Case =
+                        (DestinationIpv6Case) advertizedRoutes.getDestinationType();
                 for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
                     PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
                     ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
@@ -99,9 +103,15 @@ public final class Ipv6NlriParser implements NlriParser, NlriSerializer {
             }
         } else if (pathAttributes2 != null) {
             final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
-            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) {
-                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case destinationIpv6Case =
-                        (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) withdrawnRoutes.getDestinationType();
+            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen
+                    .v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri
+                    .withdrawn.routes.destination.type.DestinationIpv6Case) {
+                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                        .DestinationIpv6Case destinationIpv6Case =
+                        (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                                .DestinationIpv6Case) withdrawnRoutes.getDestinationType();
                 for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
                     PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
                     ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
index 7860faa1dc2ee2a14f428d00e63af5b24a456d6e..a12af5e5a34caa48fc3eaf52ecea4decedba5c05 100644 (file)
@@ -20,13 +20,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 public final class Ipv4NextHopParserSerializer implements NextHopParserSerializer {
     @Override
     public CNextHop parseNextHop(final ByteBuf buffer) throws BGPParsingException {
-        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);
         return NextHopUtil.parseNextHop(buffer);
     }
 
     @Override
-    public void serializeNextHop(final CNextHop cNextHop, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(cNextHop instanceof Ipv4NextHopCase, "cNextHop is not a Ipv4 NextHop object.");
-        NextHopUtil.serializeNextHop( cNextHop, byteAggregator);
+    public void serializeNextHop(final CNextHop nextHop, final ByteBuf byteAggregator) {
+        Preconditions.checkArgument(nextHop instanceof Ipv4NextHopCase,
+                "cNextHop is not a Ipv4 NextHop object.");
+        NextHopUtil.serializeNextHop(nextHop, byteAggregator);
     }
 }
index a69eb44fa12ccb75a0273e92842672e08079691d..5a95d59cd7647ed8927a28122b8caa22d98d211f 100644 (file)
@@ -24,8 +24,9 @@ public final class Ipv6NextHopParserSerializer implements NextHopParserSerialize
     }
 
     @Override
-    public void serializeNextHop(final CNextHop cNextHop, final ByteBuf byteAggregator) {
-        Preconditions.checkArgument(cNextHop instanceof Ipv6NextHopCase, "cNextHop is not a Ipv6 NextHop object.");
-        NextHopUtil.serializeNextHop(cNextHop,byteAggregator);
+    public void serializeNextHop(final CNextHop nextHop, final ByteBuf byteAggregator) {
+        Preconditions.checkArgument(nextHop instanceof Ipv6NextHopCase,
+                "cNextHop is not a Ipv6 NextHop object.");
+        NextHopUtil.serializeNextHop(nextHop, byteAggregator);
     }
 }
index fa6340dc117ba7112d554859a99b0152a6e1fc0a..bca7aaf9e04f09a06f6517694e08d123863d09a2 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bgp.inet;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
@@ -54,18 +55,23 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest {
     private static final Ipv4RouteKey ROUTE_KEY = new Ipv4RouteKey(PATH_ID, PREFIX);
     private static final Ipv4Prefixes IPV4_PREFIXES = new Ipv4PrefixesBuilder().setPathId(PATH_ID)
             .setPrefix(PREFIX).build();
-    private static final DestinationIpv4Case REACH_NLRI = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
-    .setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
+    private static final DestinationIpv4Case REACH_NLRI = new DestinationIpv4CaseBuilder()
+            .setDestinationIpv4(new DestinationIpv4Builder()
+                    .setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
-    .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case UNREACH_NLRI =
-    new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
-    .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-            new DestinationIpv4Builder().setIpv4Prefixes(Lists.newArrayList(IPV4_PREFIXES)).build()).build();
+            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case UNREACH_NLRI =
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                    .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
+                    .setDestinationIpv4(new DestinationIpv4Builder()
+                            .setIpv4Prefixes(Collections.singletonList(IPV4_PREFIXES)).build()).build();
 
-    private static final Ipv4Route ROUTE = new Ipv4RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID).setPrefix(PREFIX).build();
-    private static final Ipv4Routes ROUTES = new Ipv4RoutesBuilder().setIpv4Route(Collections.singletonList(ROUTE)).build();
-    private static final Ipv4Routes EMPTY_ROUTES = new Ipv4RoutesBuilder().setIpv4Route(Collections.emptyList()).build();
+    private static final Ipv4Route ROUTE = new Ipv4RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID)
+            .setPrefix(PREFIX).build();
+    private static final Ipv4Routes ROUTES = new Ipv4RoutesBuilder()
+            .setIpv4Route(Collections.singletonList(ROUTE)).build();
+    private static final Ipv4Routes EMPTY_ROUTES = new Ipv4RoutesBuilder()
+            .setIpv4Route(Collections.emptyList()).build();
 
     @Override
     public void setUp() throws Exception {
@@ -76,7 +82,8 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testDeleteRoutes() {
         RIB_SUPPORT.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<Ipv4Route> instanceIdentifier = (InstanceIdentifier<Ipv4Route>) this.deletedRoutes.get(0);
+        @SuppressWarnings("unchecked") final InstanceIdentifier<Ipv4Route> instanceIdentifier =
+                (InstanceIdentifier<Ipv4Route>) this.deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(Ipv4Route.class));
     }
 
@@ -98,14 +105,16 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Update update = RIB_SUPPORT.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
-        assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
+        assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri()
+                .getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().getAugmentation(Attributes1.class));
     }
 
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Update update = RIB_SUPPORT.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
-        assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes().getDestinationType());
+        assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri()
+                .getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().getAugmentation(Attributes2.class));
     }
 
@@ -116,59 +125,63 @@ public final class IPv4RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testCacheableNlriObjects() {
-        Assert.assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Ipv4PrefixAndPathId.class), RIB_SUPPORT.cacheableNlriObjects());
+        assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+                .message.rev171207.Ipv4PrefixAndPathId.class), RIB_SUPPORT.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        Assert.assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
+        assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
     }
 
     @Test
     public void testRouteIdAddPath() {
         final NodeIdentifierWithPredicates expected = createRouteNIWP(ROUTES);
-        final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(), ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
-        Assert.assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
+        final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(),
+                ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
+        assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
-        Assert.assertEquals(getRoutePath().node(prefixNii), RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
+        assertEquals(getRoutePath().node(prefixNii), RIB_SUPPORT.routePath(getTablePath()
+                .node(Routes.QNAME), prefixNii));
     }
 
 
     @Test
     public void testExtractPathId() {
         final NormalizedNode<?, ?> route = Iterables.getOnlyElement(createRoutes(ROUTES));
-        Assert.assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
+        assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
-        Assert.assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT
-                .routeAttributesIdentifier());
+        assertEquals(new NodeIdentifier(QName.create(Ipv4Routes.QNAME, Attributes.QNAME.getLocalName().intern())),
+                RIB_SUPPORT.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        Assert.assertEquals(Ipv4RoutesCase.class, RIB_SUPPORT.routesCaseClass());
+        assertEquals(Ipv4RoutesCase.class, RIB_SUPPORT.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        Assert.assertEquals(Ipv4Routes.class, RIB_SUPPORT.routesContainerClass());
+        assertEquals(Ipv4Routes.class, RIB_SUPPORT.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        Assert.assertEquals(Ipv4Route.class, RIB_SUPPORT.routesListClass());
+        assertEquals(Ipv4Route.class, RIB_SUPPORT.routesListClass());
     }
 
     @Test
     public void testChangedRoutes() {
         final Routes emptyCase = new Ipv4RoutesCaseBuilder().build();
-        DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
+        DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
+                createRoutes(emptyCase)).getRootNode();
         Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new Ipv4RoutesCaseBuilder().setIpv4Routes(new Ipv4RoutesBuilder().build()).build();
index 4c0f31b85eeeb977d4132a6b389c10cf74ba055f..951600ccf6a8ff2ebd1f369529517d1878f59dc1 100644 (file)
@@ -8,9 +8,9 @@
 
 package org.opendaylight.protocol.bgp.inet;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
@@ -54,19 +54,24 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
     private static final Ipv6Prefix PREFIX = new Ipv6Prefix("2001:db8:1:2::/64");
     private static final Ipv6RouteKey ROUTE_KEY = new Ipv6RouteKey(PATH_ID, PREFIX);
     private static final Ipv6Prefixes IPV6_PREFIXES = new Ipv6PrefixesBuilder().setPathId(PATH_ID)
-        .setPrefix(PREFIX).build();
-    private static final DestinationIpv6Case REACH_NLRI = new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder()
-        .setIpv6Prefixes(Lists.newArrayList(IPV6_PREFIXES)).build()).build();
+            .setPrefix(PREFIX).build();
+    private static final DestinationIpv6Case REACH_NLRI = new DestinationIpv6CaseBuilder()
+            .setDestinationIpv6(new DestinationIpv6Builder()
+                    .setIpv6Prefixes(Lists.newArrayList(IPV6_PREFIXES)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
-        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case UNREACH_NLRI =
-        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
-            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
-            new DestinationIpv6Builder().setIpv6Prefixes(Lists.newArrayList(IPV6_PREFIXES)).build()).build();
-
-    private static final Ipv6Route ROUTE = new Ipv6RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID).setPrefix(PREFIX).build();
-    private static final Ipv6Routes ROUTES = new Ipv6RoutesBuilder().setIpv6Route(Collections.singletonList(ROUTE)).build();
-    private static final Ipv6Routes EMPTY_ROUTES = new Ipv6RoutesBuilder().setIpv6Route(Collections.emptyList()).build();
+            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case UNREACH_NLRI =
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                    .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder()
+                    .setDestinationIpv6(new DestinationIpv6Builder()
+                            .setIpv6Prefixes(Collections.singletonList(IPV6_PREFIXES)).build()).build();
+
+    private static final Ipv6Route ROUTE = new Ipv6RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID)
+            .setPrefix(PREFIX).build();
+    private static final Ipv6Routes ROUTES = new Ipv6RoutesBuilder()
+            .setIpv6Route(Collections.singletonList(ROUTE)).build();
+    private static final Ipv6Routes EMPTY_ROUTES = new Ipv6RoutesBuilder()
+            .setIpv6Route(Collections.emptyList()).build();
 
     @Override
     public void setUp() throws Exception {
@@ -77,7 +82,8 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testDeleteRoutes() {
         RIB_SUPPORT.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<Ipv6Route> instanceIdentifier = (InstanceIdentifier<Ipv6Route>) this.deletedRoutes.get(0);
+        @SuppressWarnings("unchecked") final InstanceIdentifier<Ipv6Route> instanceIdentifier =
+                (InstanceIdentifier<Ipv6Route>) this.deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(Ipv6Route.class));
     }
 
@@ -99,14 +105,16 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Update update = RIB_SUPPORT.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
-        assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
+        assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+                .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().getAugmentation(Attributes1.class));
     }
 
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Update update = RIB_SUPPORT.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
-        assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes().getDestinationType());
+        assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class)
+                .getMpReachNlri().getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().getAugmentation(Attributes2.class));
     }
 
@@ -117,60 +125,63 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testCacheableNlriObjects() {
-        Assert.assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.Ipv6Prefix.class),
-            RIB_SUPPORT.cacheableNlriObjects());
+        assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet
+                .rev171207.Ipv6Prefix.class), RIB_SUPPORT.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        Assert.assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
+        assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
     }
 
     @Test
     public void testRouteIdAddPath() {
         final NodeIdentifierWithPredicates expected = createRouteNIWP(ROUTES);
-        final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(), ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
-        Assert.assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
+        final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(),
+                ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
+        assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
-        Assert.assertEquals(getRoutePath().node(prefixNii), RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
+        assertEquals(getRoutePath().node(prefixNii),
+                RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
     }
 
 
     @Test
     public void testExtractPathId() {
         final NormalizedNode<?, ?> route = Iterables.getOnlyElement(createRoutes(ROUTES));
-        Assert.assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
+        assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
-        Assert.assertEquals(new NodeIdentifier(QName.create(Ipv6Routes.QNAME, Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT
-            .routeAttributesIdentifier());
+        assertEquals(new NodeIdentifier(QName.create(Ipv6Routes.QNAME,
+                Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        Assert.assertEquals(Ipv6RoutesCase.class, RIB_SUPPORT.routesCaseClass());
+        assertEquals(Ipv6RoutesCase.class, RIB_SUPPORT.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        Assert.assertEquals(Ipv6Routes.class, RIB_SUPPORT.routesContainerClass());
+        assertEquals(Ipv6Routes.class, RIB_SUPPORT.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        Assert.assertEquals(Ipv6Route.class, RIB_SUPPORT.routesListClass());
+        assertEquals(Ipv6Route.class, RIB_SUPPORT.routesListClass());
     }
 
     @Test
     public void testChangedRoutes() {
         final Routes emptyCase = new Ipv6RoutesCaseBuilder().build();
-        DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
+        DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
+                createRoutes(emptyCase)).getRootNode();
         Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new Ipv6RoutesCaseBuilder().setIpv6Routes(new Ipv6RoutesBuilder().build()).build();
index 5a0e4464a8dda573b5b2475881d27184f9a27b87..5b62aa09ea0a9da66323b20dd6b0a781cd295de1 100644 (file)
@@ -22,9 +22,9 @@ public final class Ipv6BgpPrefixSidParserTest {
 
     private final Ipv6BgpPrefixSidParser handler = new Ipv6BgpPrefixSidParser();
 
-    private final byte[] expected = new byte[] {0, (byte)0x80, 0};
+    private final byte[] expected = new byte[]{0, (byte) 0x80, 0};
 
-    @Test(expected=IllegalArgumentException.class)
+    @Test(expected = IllegalArgumentException.class)
     public void testWrongTlvType() {
         this.handler.serializeBgpPrefixSidTlv(() -> BgpPrefixSidTlv.class, Unpooled.EMPTY_BUFFER);
     }
index 11b4161432a2906a4d73e407d79ffcab3893cf39..bb54b9c11d5b14db9c3668d22f18ff3a84a2b6ea 100644 (file)
@@ -8,8 +8,9 @@
 
 package org.opendaylight.protocol.bgp.inet;
 
+import static org.junit.Assert.assertEquals;
+
 import java.util.Optional;
-import org.junit.Assert;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.openconfig.spi.SimpleBGPTableTypeRegistryProvider;
 import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
@@ -23,8 +24,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 
 public class TableTypeActivatorTest {
 
-    private static final BgpTableType IPV4 = new BgpTableTypeImpl(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
-    private static final BgpTableType IPV6 = new BgpTableTypeImpl(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
+    private static final BgpTableType IPV4 = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+            UnicastSubsequentAddressFamily.class);
+    private static final BgpTableType IPV6 = new BgpTableTypeImpl(Ipv6AddressFamily.class,
+            UnicastSubsequentAddressFamily.class);
 
     @Test
     public void testActivator() {
@@ -33,14 +36,14 @@ public class TableTypeActivatorTest {
         tableTypeActivator.startBGPTableTypeRegistryProvider(registry);
 
         final Optional<Class<? extends AfiSafiType>> afiSafiType = registry.getAfiSafiType(IPV4);
-        Assert.assertEquals(IPV4UNICAST.class, afiSafiType.get());
+        assertEquals(IPV4UNICAST.class, afiSafiType.get());
         final Optional<Class<? extends AfiSafiType>> afiSafiType2 = registry.getAfiSafiType(IPV6);
-        Assert.assertEquals(IPV6UNICAST.class, afiSafiType2.get());
+        assertEquals(IPV6UNICAST.class, afiSafiType2.get());
 
         final Optional<BgpTableType> tableType = registry.getTableType(IPV4UNICAST.class);
-        Assert.assertEquals(IPV4, tableType.get());
+        assertEquals(IPV4, tableType.get());
         final Optional<BgpTableType> tableType2 = registry.getTableType(IPV6UNICAST.class);
-        Assert.assertEquals(IPV6, tableType2.get());
+        assertEquals(IPV6, tableType2.get());
 
         tableTypeActivator.stopBGPTableTypeRegistryProvider();
         tableTypeActivator.close();
index 876cc3b56222f50645df2b97ffff96f5d78226cb..5377cea8dd42306f385ab3840c6c33052aa6e978 100644 (file)
@@ -70,15 +70,15 @@ public class BGPParserTest {
         messageRegistry = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance().getMessageRegistry();
 
         final String name = "/up2.bin";
-        try (final InputStream is = BGPParserTest.class.getResourceAsStream(name)) {
+        try (InputStream is = BGPParserTest.class.getResourceAsStream(name)) {
             if (is == null) {
                 throw new IOException("Failed to get resource " + name);
             }
             final ByteArrayOutputStream bis = new ByteArrayOutputStream();
             final byte[] data = new byte[MAX_SIZE];
-            int nRead = 0;
-            while ((nRead = is.read(data, 0, data.length)) != -1) {
-                bis.write(data, 0, nRead);
+            int position;
+            while ((position = is.read(data, 0, data.length)) != -1) {
+                bis.write(data, 0, position);
             }
             bis.flush();
 
@@ -163,7 +163,8 @@ public class BGPParserTest {
         asPath.add(new SegmentsBuilder().setAsSequence(asNumbers).build());
 
         final Ipv6NextHopCase nextHop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(
-                new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8::1")).setLinkLocal(new Ipv6Address("fe80::c001:bff:fe7e:0")).build()).build();
+                new Ipv6NextHopBuilder().setGlobal(new Ipv6Address("2001:db8::1"))
+                        .setLinkLocal(new Ipv6Address("fe80::c001:bff:fe7e:0")).build()).build();
 
         final List<ClusterIdentifier> clusters = Lists.newArrayList(new ClusterIdentifier(new Ipv4Address("1.2.3.4")),
                 new ClusterIdentifier(new Ipv4Address("5.6.7.8")));
@@ -194,9 +195,11 @@ public class BGPParserTest {
         mpBuilder.setSafi(UnicastSubsequentAddressFamily.class);
         mpBuilder.setCNextHop(nextHop);
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
-                new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder().setIpv6Prefixes(prefs).build()).build()).build());
+                new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder()
+                        .setIpv6Prefixes(prefs).build()).build()).build());
 
-        paBuilder.addAugmentation(Attributes1.class, new Attributes1Builder().setMpReachNlri(mpBuilder.build()).build());
+        paBuilder.addAugmentation(Attributes1.class, new Attributes1Builder()
+                .setMpReachNlri(mpBuilder.build()).build());
         assertEquals(paBuilder.getAugmentation(Attributes1.class).getMpReachNlri(),
                 attrs.getAugmentation(Attributes1.class).getMpReachNlri());
         paBuilder.setUnrecognizedAttributes(Collections.emptyList());
index 4db59ce9c1f3f3f149701036e1c30f25e69b9545..05191841acb0734778f888725ed82a06759701ea 100644 (file)
@@ -52,27 +52,23 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
 
 public class Ipv4NlriParserTest {
-    private final Ipv4NlriParser parser = new Ipv4NlriParser();
-
-    private final String ipPrefix1 = "1.2.3.4/32";
-    private final String ipPrefix2 = "1.2.3.5/32";
-    private final String additionalIpWD = "1.2.3.6/32";
-
-    private final List<Ipv4Prefixes> prefixes = new ArrayList<>();
-    private final ByteBuf inputBytes = Unpooled.buffer();
-
-    private static final byte[] MP_NLRI_BYTES = new byte[] {
+    private static final byte[] MP_NLRI_BYTES = new byte[]{
         0x0, 0x0, 0x0, 0x1, 0x18, 0x1, 0x1, 0x1,
         0x0, 0x0, 0x0, 0x2, 0x18, 0x1, 0x1, 0x1};
-
     private static final Ipv4Prefix DESTINATION = new Ipv4Prefix("1.1.1.0/24");
-
     private static final ArrayList<Ipv4Prefixes> PREFIXES = Lists.newArrayList(
             createIpv4Prefix(1L, DESTINATION),
             createIpv4Prefix(2L, DESTINATION));
-
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case ip4caseWD;
-    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case ip4caseWDWrong;
+    private final Ipv4NlriParser parser = new Ipv4NlriParser();
+    private final String ipPrefix1 = "1.2.3.4/32";
+    private final String ipPrefix2 = "1.2.3.5/32";
+    private final String additionalIpWD = "1.2.3.6/32";
+    private final List<Ipv4Prefixes> prefixes = new ArrayList<>();
+    private final ByteBuf inputBytes = Unpooled.buffer();
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp
+            .unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case ip4caseWD;
+    private org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp
+            .unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case ip4caseWDWrong;
     private DestinationIpv4Case ip4caseAD;
     private DestinationIpv4Case ip4caseADWrong;
 
@@ -82,6 +78,10 @@ public class Ipv4NlriParserTest {
     @Mock
     private MultiPathSupport muliPathSupport;
 
+    private static Ipv4Prefixes createIpv4Prefix(final long pathId, final Ipv4Prefix prefix) {
+        return new Ipv4PrefixesBuilder().setPathId(new PathId(pathId)).setPrefix(prefix).build();
+    }
+
     @Before
     public void setUp() {
         MockitoAnnotations.initMocks(this);
@@ -91,15 +91,19 @@ public class Ipv4NlriParserTest {
         this.prefixes.add(new Ipv4PrefixesBuilder().setPrefix(prefix1).build());
         this.prefixes.add(new Ipv4PrefixesBuilder().setPrefix(prefix2).build());
 
-        this.ip4caseWD = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-                new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
-        this.ip4caseAD = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
+        this.ip4caseWD = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207
+                .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
+                .setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(this.prefixes).build()).build();
+        this.ip4caseAD = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
+                .setIpv4Prefixes(this.prefixes).build()).build();
 
         final ArrayList<Ipv4Prefixes> fakePrefixes = new ArrayList<>(this.prefixes);
         fakePrefixes.add(new Ipv4PrefixesBuilder().setPrefix(wrongPrefix).build());
-        this.ip4caseWDWrong = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-                new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
-        this.ip4caseADWrong = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
+        this.ip4caseWDWrong = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207
+                .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder()
+                .setDestinationIpv4(new DestinationIpv4Builder().setIpv4Prefixes(fakePrefixes).build()).build();
+        this.ip4caseADWrong = new DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
+                .setIpv4Prefixes(fakePrefixes).build()).build();
 
         final ByteBuf buffer1 = Unpooled.buffer(5);
         ByteBufWriteUtil.writeMinimalPrefix(prefix1, buffer1);
@@ -125,7 +129,8 @@ public class Ipv4NlriParserTest {
         final MpUnreachNlriBuilder b = new MpUnreachNlriBuilder();
         b.setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class);
         this.parser.parseNlri(this.inputBytes, b);
-        assertNotNull("Withdrawn routes, destination type should not be null", b.getWithdrawnRoutes().getDestinationType());
+        assertNotNull("Withdrawn routes, destination type should not be null", b.getWithdrawnRoutes()
+                .getDestinationType());
 
         assertEquals(this.ip4caseWD.hashCode(), b.getWithdrawnRoutes().getDestinationType().hashCode());
         assertFalse(this.ip4caseWDWrong.hashCode() == b.getWithdrawnRoutes().getDestinationType().hashCode());
@@ -139,7 +144,8 @@ public class Ipv4NlriParserTest {
         final MpReachNlriBuilder b = new MpReachNlriBuilder();
         b.setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class);
         this.parser.parseNlri(this.inputBytes, b);
-        assertNotNull("Advertized routes, destination type should not be null", b.getAdvertizedRoutes().getDestinationType());
+        assertNotNull("Advertized routes, destination type should not be null", b.getAdvertizedRoutes()
+                .getDestinationType());
 
         assertEquals(this.ip4caseAD.hashCode(), b.getAdvertizedRoutes().getDestinationType().hashCode());
         assertFalse(this.ip4caseADWrong.hashCode() == b.getAdvertizedRoutes().getDestinationType().hashCode());
@@ -173,9 +179,10 @@ public class Ipv4NlriParserTest {
     public void parseUnreachNlriMultiPathTest() {
         final MpUnreachNlri mpUnreachNlri = new MpUnreachNlriBuilder().setWithdrawnRoutes(
                 new WithdrawnRoutesBuilder().setDestinationType(
-                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4CaseBuilder().setDestinationIpv4(
-                                new DestinationIpv4Builder().setIpv4Prefixes(
-                                        PREFIXES).build()).build()).build()).build();
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                                .DestinationIpv4CaseBuilder().setDestinationIpv4(new DestinationIpv4Builder()
+                                .setIpv4Prefixes(PREFIXES).build()).build()).build()).build();
         final MpUnreachNlriBuilder mpUnreachNlriBuilder = new MpUnreachNlriBuilder();
         mpUnreachNlriBuilder.setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class);
         this.parser.parseNlri(Unpooled.wrappedBuffer(MP_NLRI_BYTES), mpUnreachNlriBuilder, this.constraint);
@@ -189,8 +196,4 @@ public class Ipv4NlriParserTest {
         serializer.serializeAttribute(attributes, output);
         Assert.assertArrayEquals(MP_NLRI_BYTES, output.array());
     }
-
-    private static Ipv4Prefixes createIpv4Prefix(final long pathId, final Ipv4Prefix prefix) {
-        return new Ipv4PrefixesBuilder().setPathId(new PathId(pathId)).setPrefix(prefix).build();
-    }
 }
index 786d45d11a403525856732faf5f0a77b32f90e60..31207f51cf9958e9c2dd302a83ad092a671964f5 100644 (file)
@@ -16,8 +16,6 @@ import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv4NextHopParserSerializer;
-import org.opendaylight.protocol.bgp.inet.codec.nexthop.Ipv6NextHopParserSerializer;
 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
@@ -32,16 +30,16 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 
 public class NextHopParserSerializerTest {
 
-    public static final byte[] ipv6lB = {0x20, 1, 0x0d, (byte) 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    private static final byte[] IPV6LB = {0x20, 1, 0x0d, (byte) 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
         1, (byte) 0xfe, (byte) 0x80, 0, 0, 0, 0, 0, 0, (byte) 0xc0, 1, 0x0b, (byte) 0xff, (byte) 0xfe, 0x7e, 0, 0};
 
-    public static final Ipv6Address ipv6 = new Ipv6Address("2001:db8::1");
-    public static final Ipv6Address ipv6l = new Ipv6Address("fe80::c001:bff:fe7e:0");
+    private static final Ipv6Address IPV6 = new Ipv6Address("2001:db8::1");
+    private static final Ipv6Address IPV6L = new Ipv6Address("fe80::c001:bff:fe7e:0");
 
-    Ipv4NextHopParserSerializer ipv4NextHopParserSerializer;
-    Ipv6NextHopParserSerializer ipv6NextHopParserSerializer;
-    CNextHop hop;
-    ByteBuf buffer;
+    private Ipv4NextHopParserSerializer ipv4NextHopParserSerializer;
+    private Ipv6NextHopParserSerializer ipv6NextHopParserSerializer;
+    private CNextHop hop;
+    private ByteBuf buffer;
 
     @Before
     public final void setUp() {
@@ -66,12 +64,13 @@ public class NextHopParserSerializerTest {
 
     @Test
     public void testSerializeIpv6LinkNextHopCase() throws BGPParsingException {
-        this.hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setGlobal(ipv6).setLinkLocal(ipv6l).build()).build();
+        this.hop = new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder()
+                .setGlobal(IPV6).setLinkLocal(IPV6L).build()).build();
         this.buffer.clear();
         this.ipv6NextHopParserSerializer.serializeNextHop(this.hop, this.buffer);
-        assertArrayEquals(ipv6lB, ByteArray.readAllBytes(this.buffer));
+        assertArrayEquals(IPV6LB, ByteArray.readAllBytes(this.buffer));
 
-        final CNextHop parsedHop = this.ipv6NextHopParserSerializer.parseNextHop(Unpooled.wrappedBuffer(ipv6lB));
+        final CNextHop parsedHop = this.ipv6NextHopParserSerializer.parseNextHop(Unpooled.wrappedBuffer(IPV6LB));
         assertTrue(parsedHop instanceof Ipv6NextHopCase);
         assertEquals(this.hop, parsedHop);
     }