Enforce checkstyle in labeled-unicast 45/78745/4
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 13 Dec 2018 10:00:56 +0000 (11:00 +0100)
committerRobert Varga <nite@hq.sk>
Thu, 13 Dec 2018 14:48:47 +0000 (14:48 +0000)
This fixes checkstyle violations and flips enforcement on.

Change-Id: I92e080e8a4950727019ce7351afe8311aaac36bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/extensions/labeled-unicast/pom.xml
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/AbstractLabeledUnicastRIBSupport.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/BGPActivator.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/LUNlriParser.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/OriginatorSrgbTlvParser.java
bgp/extensions/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/TableTypeActivator.java
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/ActivatorTest.java
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LUNlriParserTest.java
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv4RIBSupportTest.java
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/LabeledUnicastIpv6RIBSupportTest.java
bgp/extensions/labeled-unicast/src/test/java/org/opendaylight/protocol/bgp/labeled/unicast/TableTypeActivatorTest.java

index a0390146543df74309150cc203b3d386ed3740a1..f7e67b5bbf73ff245861766fd78269808e1756bb 100644 (file)
         </dependency>
     </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <violationSeverity>warn</violationSeverity>
-                </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>
index bd0ae3372b21d7e58d656278364c8b79441ac048..457bdc42ae37d7bb468e547c9b8a4c9949ff8d88 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import io.netty.buffer.ByteBuf;
@@ -135,7 +134,7 @@ abstract class AbstractLabeledUnicastRIBSupport<
     }
 
     /**
-     * Conversion from DataContainer to LabeledUnicastDestination Object
+     * Conversion from DataContainer to LabeledUnicastDestination Object.
      *
      * @param route DataContainer
      * @return LabeledUnicastDestination Object
@@ -149,8 +148,8 @@ abstract class AbstractLabeledUnicastRIBSupport<
         return builder.build();
     }
 
-    protected abstract IpPrefix extractPrefix(final DataContainerNode<? extends PathArgument> route,
-            final NodeIdentifier prefixTypeNid);
+    protected abstract IpPrefix extractPrefix(DataContainerNode<? extends PathArgument> route,
+            NodeIdentifier prefixTypeNid);
 
     public static List<LabelStack> extractLabel(final DataContainerNode<? extends PathArgument> route,
             final NodeIdentifier labelStackNid, final NodeIdentifier labelValueNid) {
index e973b7b87fa88394a8c6991d7dbbf6f8097abdb2..cfff906bd5f0455ce4cc988db9c90892eeb0a9ef 100644 (file)
@@ -31,7 +31,8 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         final List<AutoCloseable> regs = new ArrayList<>(8);
         final LUNlriParser luNlriParser = new LUNlriParser();
 
-        regs.add(context.registerSubsequentAddressFamily(LabeledUnicastSubsequentAddressFamily.class, LABELED_UNICAST_SAFI));
+        regs.add(context.registerSubsequentAddressFamily(LabeledUnicastSubsequentAddressFamily.class,
+            LABELED_UNICAST_SAFI));
 
         final Ipv4NextHopParserSerializer ipv4NextHopParser = new Ipv4NextHopParserSerializer();
         final Ipv6NextHopParserSerializer ipv6NextHopParser = new Ipv6NextHopParserSerializer();
index 58f1eb10d6707ab7c602eefa7d33bf1be0e24f13..ac2a45ecce3a38e4782c19badac7caa899c3d8e6 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import io.netty.buffer.ByteBuf;
@@ -47,6 +46,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlriBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.AddressFamily;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.Ipv4AddressFamily;
@@ -67,28 +67,44 @@ public class LUNlriParser implements NlriParser, NlriSerializer {
             final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
             if (routes != null) {
                 final DestinationType destinationType = routes.getDestinationType();
-                if ( destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
-                    .labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase){
-                    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase labeledUnicastCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase) routes.getDestinationType();
-                    serializeNlri(labeledUnicastCase.getDestinationLabeledUnicast().getCLabeledUnicastDestination(), false, byteAggregator);
-                } else if (destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
-                    .labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase) {
-                    final  org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase labeledUnicastCase = ( org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase) routes.getDestinationType();
-                    serializeNlri(labeledUnicastCase.getDestinationIpv6LabeledUnicast().getCLabeledUnicastDestination(), false, byteAggregator);
+                if (destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+                    .labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination.type
+                    .DestinationLabeledUnicastCase) {
+                    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
+                        .update.attributes.mp.reach.nlri.advertized.routes.destination.type
+                        .DestinationLabeledUnicastCase labeledUnicastCase = (org.opendaylight.yang.gen.v1.urn
+                                .opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp
+                                .reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase)
+                                destinationType;
+                    serializeNlri(labeledUnicastCase.getDestinationLabeledUnicast().getCLabeledUnicastDestination(),
+                        false, byteAggregator);
+                } else if (destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+                        .bgp.labeled.unicast.rev180329.update.attributes.mp.reach.nlri.advertized.routes.destination
+                        .type.DestinationIpv6LabeledUnicastCase) {
+                    final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
+                        .update.attributes.mp.reach.nlri.advertized.routes.destination.type
+                        .DestinationIpv6LabeledUnicastCase labeledUnicastCase = (org.opendaylight.yang.gen.v1.urn
+                                .opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp
+                                .reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase)
+                                destinationType;
+                    serializeNlri(labeledUnicastCase.getDestinationIpv6LabeledUnicast().getCLabeledUnicastDestination(),
+                        false, byteAggregator);
                 }
             }
         } else if (pathAttributes2 != null) {
             final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri();
-            if (mpUnreachNlri.getWithdrawnRoutes() != null) {
-                final DestinationType destinationType = mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
+            final WithdrawnRoutes withDrawnRoutes = mpUnreachNlri.getWithdrawnRoutes();
+
+            if (withDrawnRoutes != null) {
+                final DestinationType destinationType = withDrawnRoutes.getDestinationType();
                 if (destinationType instanceof DestinationLabeledUnicastCase) {
                     final DestinationLabeledUnicastCase labeledUnicastCase = (DestinationLabeledUnicastCase)
-                        mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
+                            destinationType;
                     serializeNlri(labeledUnicastCase.getDestinationLabeledUnicast().getCLabeledUnicastDestination(),
                         true, byteAggregator);
-                } else if(destinationType instanceof DestinationIpv6LabeledUnicastCase) {
+                } else if (destinationType instanceof DestinationIpv6LabeledUnicastCase) {
                     final DestinationIpv6LabeledUnicastCase labeledUnicastCase = (DestinationIpv6LabeledUnicastCase)
-                        mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
+                            destinationType;
                     serializeNlri(labeledUnicastCase.getDestinationIpv6LabeledUnicast().getCLabeledUnicastDestination(),
                         true, byteAggregator);
                 }
@@ -106,7 +122,8 @@ public class LUNlriParser implements NlriParser, NlriSerializer {
             final IpPrefix prefix = dest.getPrefix();
             // Serialize the length field
             // Length field contains one Byte which represents the length of label stack and prefix in bits
-            nlriByteBuf.writeByte((LABEL_LENGTH * (!isUnreachNlri ? labelStack.size() : 1) + getPrefixLength(prefix)) * Byte.SIZE);
+            nlriByteBuf.writeByte((LABEL_LENGTH * (!isUnreachNlri ? labelStack.size() : 1)
+                    + getPrefixLength(prefix)) * Byte.SIZE);
 
             serializeLabelStackEntries(labelStack, isUnreachNlri, nlriByteBuf);
             serializePrefixField(prefix, nlriByteBuf);
@@ -117,9 +134,9 @@ public class LUNlriParser implements NlriParser, NlriSerializer {
     public static void serializeLabelStackEntries(final List<LabelStack> stack, final boolean isUnreachNlri,
             final ByteBuf buffer) {
         if (!isUnreachNlri) {
-            int i = 1;
+            int entry = 1;
             for (final LabelStack labelStackEntry : stack) {
-                if (i++ == stack.size()) {
+                if (entry++ == stack.size()) {
                     // mark last label stack entry with bottom-bit
                     buffer.writeBytes(MplsLabelUtil.byteBufForMplsLabelWithBottomBit(labelStackEntry.getLabelValue()));
                 } else {
@@ -154,29 +171,8 @@ public class LUNlriParser implements NlriParser, NlriSerializer {
         return ByteArray.readAllBytes(buffer);
     }
 
-    private static List<CLabeledUnicastDestination> parseNlri(final ByteBuf nlri, final Class<? extends AddressFamily> afi, final boolean mPathSupported) {
-        if (!nlri.isReadable()) {
-            return null;
-        }
-        final List<CLabeledUnicastDestination> dests = new ArrayList<>();
-
-        while (nlri.isReadable()) {
-            final CLabeledUnicastDestinationBuilder builder = new CLabeledUnicastDestinationBuilder();
-            if (mPathSupported) {
-                builder.setPathId(PathIdUtil.readPathId(nlri));
-            }
-            final short length = nlri.readUnsignedByte();
-            final List<LabelStack> labels = parseLabel(nlri);
-            builder.setLabelStack(labels);
-            final int labelNum = labels != null ? labels.size() : 1;
-            final int prefixLen = length - LABEL_LENGTH * Byte.SIZE * labelNum;
-            builder.setPrefix(parseIpPrefix(nlri, prefixLen, afi));
-            dests.add(builder.build());
-        }
-        return dests;
-    }
-
-    public static IpPrefix parseIpPrefix(final ByteBuf nlri, final int prefixLen, final Class<? extends AddressFamily> afi) {
+    public static IpPrefix parseIpPrefix(final ByteBuf nlri, final int prefixLen,
+            final Class<? extends AddressFamily> afi) {
         final int prefixLenInByte = prefixLen / Byte.SIZE + (prefixLen % Byte.SIZE == 0 ? 0 : 1);
         if (afi.equals(Ipv4AddressFamily.class)) {
             return new IpPrefix(Ipv4Util.prefixForBytes(ByteArray.readBytes(nlri, prefixLenInByte), prefixLen));
@@ -204,6 +200,29 @@ public class LUNlriParser implements NlriParser, NlriSerializer {
         return labels;
     }
 
+    private static List<CLabeledUnicastDestination> parseNlri(final ByteBuf nlri,
+            final Class<? extends AddressFamily> afi, final boolean multiPathSupported) {
+        if (!nlri.isReadable()) {
+            return null;
+        }
+        final List<CLabeledUnicastDestination> dests = new ArrayList<>();
+
+        while (nlri.isReadable()) {
+            final CLabeledUnicastDestinationBuilder builder = new CLabeledUnicastDestinationBuilder();
+            if (multiPathSupported) {
+                builder.setPathId(PathIdUtil.readPathId(nlri));
+            }
+            final short length = nlri.readUnsignedByte();
+            final List<LabelStack> labels = parseLabel(nlri);
+            builder.setLabelStack(labels);
+            final int labelNum = labels != null ? labels.size() : 1;
+            final int prefixLen = length - LABEL_LENGTH * Byte.SIZE * labelNum;
+            builder.setPrefix(parseIpPrefix(nlri, prefixLen, afi));
+            dests.add(builder.build());
+        }
+        return dests;
+    }
+
     @Override
     public void parseNlri(final ByteBuf nlri, final MpReachNlriBuilder builder,
         final PeerSpecificParserConstraint constraint) throws BGPParsingException {
@@ -211,15 +230,15 @@ public class LUNlriParser implements NlriParser, NlriSerializer {
             return;
         }
         final Class<? extends AddressFamily> afi = builder.getAfi();
-        final boolean mPathSupported = MultiPathSupportUtil.isTableTypeSupported(constraint,
+        final boolean multiPathSupported = MultiPathSupportUtil.isTableTypeSupported(constraint,
             new BgpTableTypeImpl(builder.getAfi(), builder.getSafi()));
-        final List<CLabeledUnicastDestination> dst = parseNlri(nlri, afi, mPathSupported);
+        final List<CLabeledUnicastDestination> dst = parseNlri(nlri, afi, multiPathSupported);
 
         DestinationType destination = null;
-        if(afi == Ipv4AddressFamily.class){
+        if (afi == Ipv4AddressFamily.class) {
             destination = new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
                 new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(dst).build()).build();
-        } else if(afi == Ipv6AddressFamily.class) {
+        } else if (afi == Ipv6AddressFamily.class) {
             destination = new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
                 new DestinationIpv6LabeledUnicastBuilder()
                 .setCLabeledUnicastDestination(dst).build()).build();
@@ -228,26 +247,34 @@ public class LUNlriParser implements NlriParser, NlriSerializer {
     }
 
     @Override
-    public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpUnreachNlriBuilder builder, @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
+    public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpUnreachNlriBuilder builder,
+            @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
         if (!nlri.isReadable()) {
             return;
         }
         final Class<? extends AddressFamily> afi = builder.getAfi();
 
-        final boolean mPathSupported = MultiPathSupportUtil.isTableTypeSupported(constraint, new BgpTableTypeImpl(builder.getAfi(), builder.getSafi()));
+        final boolean mPathSupported = MultiPathSupportUtil.isTableTypeSupported(constraint,
+            new BgpTableTypeImpl(builder.getAfi(), builder.getSafi()));
         final List<CLabeledUnicastDestination> dst = parseNlri(nlri, afi, mPathSupported);
 
         DestinationType destination = null;
         if (afi == Ipv4AddressFamily.class) {
-            destination = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp
-                .unreach.nlri.withdrawn.routes.destination.type.DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(dst).build()).build();
+            destination = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast
+                    .rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                    .DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast
+                        .rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination
+                        .labeled.unicast._case.DestinationLabeledUnicastBuilder()
+                        .setCLabeledUnicastDestination(dst).build()).build();
         } else if (afi == Ipv6AddressFamily.class) {
-            destination = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp
-                .unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
-                    .setCLabeledUnicastDestination(dst).build()).build();
+            destination = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast
+                    .rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                    .DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
+                        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast
+                        .rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.ipv6
+                        .labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
+                        .setCLabeledUnicastDestination(dst).build()).build();
         }
         builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(destination).build());
     }
index dbada4aaa637ebef07ec43960e5a21ccac93dc9b..35470da588a35c62222877bc010d7e67dc1ad8ff 100644 (file)
@@ -34,10 +34,12 @@ final class OriginatorSrgbTlvParser implements BgpPrefixSidTlvParser, BgpPrefixS
     }
 
     private static List<SrgbValue> parseSrgbs(final ByteBuf buffer) {
-        Preconditions.checkState(buffer.readableBytes() % SRGB_LENGTH == 0, "Number of SRGBs doesn't fit available bytes.");
+        Preconditions.checkState(buffer.readableBytes() % SRGB_LENGTH == 0,
+                "Number of SRGBs does not fit available bytes.");
         final List<SrgbValue> ret = new ArrayList<>();
         while (buffer.isReadable()) {
-            ret.add(new SrgbValueBuilder().setBase(new Srgb((long) buffer.readUnsignedMedium())).setRange(new Srgb((long) buffer.readUnsignedMedium())).build());
+            ret.add(new SrgbValueBuilder().setBase(new Srgb((long) buffer.readUnsignedMedium()))
+                .setRange(new Srgb((long) buffer.readUnsignedMedium())).build());
         }
         return ret;
     }
index 9a40b2d84379b43203d3a75be8c73e965f652a0b..1cba14f1e231ad901fa8383be5f3065ab1e240eb 100644 (file)
@@ -5,10 +5,9 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
-import com.google.common.collect.Lists;
+import com.google.common.collect.ImmutableList;
 import java.util.List;
 import org.opendaylight.protocol.bgp.openconfig.spi.AbstractBGPTableTypeRegistryProviderActivator;
 import org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryProvider;
@@ -22,10 +21,13 @@ import org.opendaylight.yangtools.concepts.AbstractRegistration;
 public final class TableTypeActivator extends AbstractBGPTableTypeRegistryProviderActivator {
 
     @Override
-    protected List<AbstractRegistration> startBGPTableTypeRegistryProviderImpl(final BGPTableTypeRegistryProvider provider) {
-        return Lists.newArrayList(
-                provider.registerBGPTableType(Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class, IPV4LABELLEDUNICAST.class),
-                provider.registerBGPTableType(Ipv6AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class, IPV6LABELLEDUNICAST.class));
+    protected List<AbstractRegistration> startBGPTableTypeRegistryProviderImpl(
+            final BGPTableTypeRegistryProvider provider) {
+        return ImmutableList.of(
+                provider.registerBGPTableType(Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class,
+                    IPV4LABELLEDUNICAST.class),
+                provider.registerBGPTableType(Ipv6AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class,
+                    IPV6LABELLEDUNICAST.class));
     }
 
 }
index c8bbf9b53dc3d466d0cac5e3dba4f7cb57f18db8..3f9978115b24629b8d4b77de212e1bcb5ea7e84a 100644 (file)
@@ -23,7 +23,8 @@ public class ActivatorTest {
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
         assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(4));
         act.start(context);
-        assertEquals(LabeledUnicastSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry().classForFamily(4));
+        assertEquals(LabeledUnicastSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry()
+            .classForFamily(4));
         act.close();
     }
 }
index 66f593bfe8af86d617508e0600b2735b4f8dedcd..c8d9c287daa08ec20c50bc0521e1729393361e87 100755 (executable)
@@ -54,7 +54,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.
 
 public class LUNlriParserTest {
 
-    /*label stacks with multiple labels.
+    /*
+     * label stacks with multiple labels.
      *
      * label stack:
      * 60       <- length 96
@@ -66,7 +67,7 @@ public class LUNlriParserTest {
      * 1        <- bottomBit 1
      * 22 01 16 <- prefixType IPV4=34.1.22.0/24
      */
-    private static final byte[] LU_REACH_NLRI_IPv4 = new byte[]{
+    private static final byte[] LU_REACH_NLRI_IPV4 = new byte[]{
         (byte) 0x60,
         (byte) 0x00, (byte) 0x16, (byte) 0x30,
         (byte) 0x00, (byte) 0x16, (byte) 0x40,
@@ -74,33 +75,35 @@ public class LUNlriParserTest {
         (byte) 0x22, (byte) 0x01, (byte) 0x16,
     };
 
-    /*label value for withdraw message.
-    *
-    * label stack:
-    * 30       <- length 48
-    * 80 00 00 <- labelValue for withdraw
-    * 22 01 16 <- prefixType IPV4=34.1.22.0/24
-    */
-   private static final byte[] LU_UNREACH_NLRI_IPv4 = new byte[] {
-       (byte) 0x30,
-       (byte) 0x80, (byte) 0x00, (byte) 0x00,
-       (byte) 0x22, (byte) 0x01, (byte) 0x16,
-   };
-
-    /*label stacks with multiple labels.
-    *
-    * label stack:
-    * 1        <- Path Id
-    * 60       <- length 96
-    * 00 16 3  <- labelValue 355
-    * 0        <- etc&bottomBit 0
-    * 00 16 4  <- labelValue 356
-    * 0        <- etc&bottomBit 0
-    * 00 16 6  <- labelValue 357
-    * 1        <- bottomBit 1
-    * 22 01 16 <- prefixType IPV4=34.1.22.0/24
-    */
-    private static final byte[] LU_REACH_NLRI_IPv4_ADD_PATH = new byte[]{
+    /*
+     * label value for withdraw message.
+     *
+     * label stack:
+     * 30       <- length 48
+     * 80 00 00 <- labelValue for withdraw
+     * 22 01 16 <- prefixType IPV4=34.1.22.0/24
+     */
+    private static final byte[] LU_UNREACH_NLRI_IPV4 = new byte[] {
+        (byte) 0x30,
+        (byte) 0x80, (byte) 0x00, (byte) 0x00,
+        (byte) 0x22, (byte) 0x01, (byte) 0x16,
+    };
+
+    /*
+     * label stacks with multiple labels.
+     *
+     * label stack:
+     * 1        <- Path Id
+     * 60       <- length 96
+     * 00 16 3  <- labelValue 355
+     * 0        <- etc&bottomBit 0
+     * 00 16 4  <- labelValue 356
+     * 0        <- etc&bottomBit 0
+     * 00 16 6  <- labelValue 357
+     * 1        <- bottomBit 1
+     * 22 01 16 <- prefixType IPV4=34.1.22.0/24
+     */
+    private static final byte[] LU_REACH_NLRI_IPV4_ADD_PATH = new byte[]{
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
         (byte) 0x60,
         (byte) 0x00, (byte) 0x16, (byte) 0x30,
@@ -109,22 +112,24 @@ public class LUNlriParserTest {
         (byte) 0x22, (byte) 0x01, (byte) 0x16,
     };
 
-    /*label value for withdraw message.
-    *
-    * label stack:
-    * 1        <- Path Id
-    * 30       <- length 48
-    * 80 00 00 <- labelValue for withdraw
-    * 22 01 16 <- prefixType IPV4=34.1.22.0/24
-    */
-    private static final byte[] LU_UNREACH_NLRI_IPv4_ADD_PATH = new byte[] {
+    /*
+     * label value for withdraw message.
+     *
+     * label stack:
+     * 1        <- Path Id
+     * 30       <- length 48
+     * 80 00 00 <- labelValue for withdraw
+     * 22 01 16 <- prefixType IPV4=34.1.22.0/24
+     */
+    private static final byte[] LU_UNREACH_NLRI_IPV4_ADD_PATH = new byte[] {
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
         (byte) 0x30,
         (byte) 0x80, (byte) 0x00, (byte) 0x00,
         (byte) 0x22, (byte) 0x01, (byte) 0x16,
     };
 
-    /*label stacks with multiple labels.
+    /*
+     * label stacks with multiple labels.
      *
      * label stack:
      * C8       <- length 200
@@ -136,7 +141,7 @@ public class LUNlriParserTest {
      * 1        <- bottomBit 1
      * 20 01 D B8 0 1 0 2 0 0 0 0 0 0 0 0 80  <- prefixType IPV6=2001:db8:1:2::/128
      */
-    private static final byte[] LU_REACH_NLRI_IPv6 = new byte[]{
+    private static final byte[] LU_REACH_NLRI_IPV6 = new byte[]{
         (byte) 0xC8,
         (byte) 0x00, (byte) 0x16, (byte) 0x30,
         (byte) 0x00, (byte) 0x16, (byte) 0x40,
@@ -147,23 +152,25 @@ public class LUNlriParserTest {
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
     };
 
-    /*label value for withdraw message.
-    *
-    * label stack:
-    * 98       <- length 152
-    * 80 00 00 <- labelValue for withdraw
-    * 20 01 D B8 0 1 0 2 0 0 0 0 0 0 0 0 80  <- prefixType IPV6=2001:db8:1:2::/128
-    */
-   private static final byte[] LU_UNREACH_NLRI_IPv6 = new byte[] {
-       (byte) 0x98,
-       (byte) 0x80, (byte) 0x00, (byte) 0x00,
-       (byte) 0x20, (byte) 0x01, (byte) 0x0d, (byte) 0xb8,
-       (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x02,
-       (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-       (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-   };
-
-    /*label stacks with multiple labels.
+    /*
+     * label value for withdraw message.
+     *
+     * label stack:
+     * 98       <- length 152
+     * 80 00 00 <- labelValue for withdraw
+     * 20 01 D B8 0 1 0 2 0 0 0 0 0 0 0 0 80  <- prefixType IPV6=2001:db8:1:2::/128
+     */
+    private static final byte[] LU_UNREACH_NLRI_IPV6 = new byte[] {
+        (byte) 0x98,
+        (byte) 0x80, (byte) 0x00, (byte) 0x00,
+        (byte) 0x20, (byte) 0x01, (byte) 0x0d, (byte) 0xb8,
+        (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x02,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+    };
+
+    /*
+     * label stacks with multiple labels.
      *
      * label stack:
      * C8       <- length 200
@@ -175,7 +182,7 @@ public class LUNlriParserTest {
      * 1        <- bottomBit 1
      * 20 01 D B8 0 1 0 2 0 0 0 0 0 0 0 0 80  <- prefixType IPV6=2001:db8:1:2::/128
      */
-    private static final byte[] LU_REACH_NLRI_IPv6_ADD_PATH = new byte[]{
+    private static final byte[] LU_REACH_NLRI_IPV6_ADD_PATH = new byte[]{
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
         (byte) 0xC8,
         (byte) 0x00, (byte) 0x16, (byte) 0x30,
@@ -187,30 +194,31 @@ public class LUNlriParserTest {
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
     };
 
-    /*label value for withdraw message.
-    *
-    * label stack:
-    * 98       <- length 152
-    * 80 00 00 <- labelValue for withdraw
-    * 20 01 D B8 0 1 0 2 0 0 0 0 0 0 0 0 80  <- prefixType IPV6=2001:db8:1:2::/128
-    */
-   private static final byte[] LU_UNREACH_NLRI_IPv6_ADD_PATH = new byte[] {
-       (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
-       (byte) 0x98,
-       (byte) 0x80, (byte) 0x00, (byte) 0x00,
-       (byte) 0x20, (byte) 0x01, (byte) 0x0d, (byte) 0xb8,
-       (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x02,
-       (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-       (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
-   };
+    /*
+     * label value for withdraw message.
+     *
+     * label stack:
+     * 98       <- length 152
+     * 80 00 00 <- labelValue for withdraw
+     * 20 01 D B8 0 1 0 2 0 0 0 0 0 0 0 0 80  <- prefixType IPV6=2001:db8:1:2::/128
+     */
+    private static final byte[] LU_UNREACH_NLRI_IPV6_ADD_PATH = new byte[] {
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
+        (byte) 0x98,
+        (byte) 0x80, (byte) 0x00, (byte) 0x00,
+        (byte) 0x20, (byte) 0x01, (byte) 0x0d, (byte) 0xb8,
+        (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x02,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+        (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
+    };
 
     private static final List<LabelStack> LABEL_STACK = Lists.newArrayList(
         new LabelStackBuilder().setLabelValue(new MplsLabel(355L)).build(),
         new LabelStackBuilder().setLabelValue(new MplsLabel(356L)).build(),
         new LabelStackBuilder().setLabelValue(new MplsLabel(357L)).build());
 
-    private static final IpPrefix IPv4_PREFIX = new IpPrefix(new Ipv4Prefix("34.1.22.0/24"));
-    private static final IpPrefix IPv6_PREFIX = new IpPrefix(new Ipv6Prefix("2001:db8:1:2::/128"));
+    private static final IpPrefix IPV4_PREFIX = new IpPrefix(new Ipv4Prefix("34.1.22.0/24"));
+    private static final IpPrefix IPV6_PREFIX = new IpPrefix(new Ipv6Prefix("2001:db8:1:2::/128"));
     private static final PathId PATH_ID = new PathId(1L);
 
     @Mock
@@ -232,7 +240,7 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder mpBuilder = new MpReachNlriBuilder();
         mpBuilder.setAfi(Ipv4AddressFamily.class);
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        final CLabeledUnicastDestination lu = new CLabeledUnicastDestinationBuilder().setPrefix(IPv4_PREFIX)
+        final CLabeledUnicastDestination lu = new CLabeledUnicastDestinationBuilder().setPrefix(IPV4_PREFIX)
             .setLabelStack(LABEL_STACK).build();
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
@@ -244,14 +252,14 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
         testBuilder.setAfi(Ipv4AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPv4), testBuilder, null);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV4), testBuilder, null);
         assertEquals(mpReachExpected, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
             new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output);
-        assertArrayEquals(LU_REACH_NLRI_IPv4, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_REACH_NLRI_IPV4, ByteArray.readAllBytes(output));
     }
 
     @Test
@@ -261,8 +269,7 @@ public class LUNlriParserTest {
         mpBuilder.setAfi(Ipv4AddressFamily.class);
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
         final CLabeledUnicastDestination lu = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
-            .setPrefix(IPv4_PREFIX).setLabelStack
-            (LABEL_STACK).build();
+            .setPrefix(IPV4_PREFIX).setLabelStack(LABEL_STACK).build();
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
                 new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(Lists.newArrayList(lu))
@@ -273,14 +280,14 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
         testBuilder.setAfi(Ipv4AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPv4_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV4_ADD_PATH), testBuilder, this.constraint);
         assertEquals(mpReachExpected, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
             new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output);
-        assertArrayEquals(LU_REACH_NLRI_IPv4_ADD_PATH, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_REACH_NLRI_IPV4_ADD_PATH, ByteArray.readAllBytes(output));
     }
 
     @Test
@@ -290,7 +297,7 @@ public class LUNlriParserTest {
         mpBuilder.setAfi(Ipv4AddressFamily.class);
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
 
-        final CLabeledUnicastDestination lu1 = new CLabeledUnicastDestinationBuilder().setPrefix(IPv4_PREFIX).build();
+        final CLabeledUnicastDestination lu1 = new CLabeledUnicastDestinationBuilder().setPrefix(IPV4_PREFIX).build();
         mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update
                 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLabeledUnicastCaseBuilder()
@@ -301,14 +308,14 @@ public class LUNlriParserTest {
                 .build()).build());
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
-        final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPrefix(IPv4_PREFIX)
+        final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPrefix(IPV4_PREFIX)
             .setLabelStack(LABEL_STACK).build();
         mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update
                 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLabeledUnicastCaseBuilder()
                 .setDestinationLabeledUnicast(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
-                    .labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.
-                    destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
+                    .labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                    .destination.labeled.unicast._case.DestinationLabeledUnicastBuilder()
                     .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build())
                 .build()).build());
         final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
@@ -317,19 +324,19 @@ public class LUNlriParserTest {
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
         testBuilder.setAfi(Ipv4AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPv4), testBuilder, null);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV4), testBuilder, null);
         assertEquals(mpUnreachExpected1, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv4, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV4, ByteArray.readAllBytes(output));
 
         final ByteBuf output1 = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv4, ByteArray.readAllBytes(output1));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV4, ByteArray.readAllBytes(output1));
     }
 
     @Test
@@ -340,7 +347,7 @@ public class LUNlriParserTest {
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
 
         final CLabeledUnicastDestination lu1 = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
-            .setPrefix(IPv4_PREFIX).build();
+            .setPrefix(IPV4_PREFIX).build();
         mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update
                 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLabeledUnicastCaseBuilder()
@@ -352,7 +359,7 @@ public class LUNlriParserTest {
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
         final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
-            .setPrefix(IPv4_PREFIX).setLabelStack(LABEL_STACK).build();
+            .setPrefix(IPV4_PREFIX).setLabelStack(LABEL_STACK).build();
         mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update
                 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLabeledUnicastCaseBuilder()
@@ -367,19 +374,19 @@ public class LUNlriParserTest {
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
         testBuilder.setAfi(Ipv4AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPv4_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV4_ADD_PATH), testBuilder, this.constraint);
         assertEquals(mpUnreachExpected1, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv4_ADD_PATH, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV4_ADD_PATH, ByteArray.readAllBytes(output));
 
         final ByteBuf output1 = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv4_ADD_PATH, ByteArray.readAllBytes(output1));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV4_ADD_PATH, ByteArray.readAllBytes(output1));
     }
 
     @Test
@@ -388,7 +395,7 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder mpBuilder = new MpReachNlriBuilder();
         mpBuilder.setAfi(Ipv6AddressFamily.class);
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        final CLabeledUnicastDestination lu = new CLabeledUnicastDestinationBuilder().setPrefix(IPv6_PREFIX)
+        final CLabeledUnicastDestination lu = new CLabeledUnicastDestinationBuilder().setPrefix(IPV6_PREFIX)
             .setLabelStack(LABEL_STACK).build();
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationIpv6LabeledUnicastCaseBuilder()
@@ -401,14 +408,14 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
         testBuilder.setAfi(Ipv6AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPv6), testBuilder, null);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV6), testBuilder, null);
         assertEquals(mpReachExpected, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
             new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output);
-        assertArrayEquals(LU_REACH_NLRI_IPv6, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_REACH_NLRI_IPV6, ByteArray.readAllBytes(output));
     }
 
     @Test
@@ -418,7 +425,7 @@ public class LUNlriParserTest {
         mpBuilder.setAfi(Ipv6AddressFamily.class);
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
         final CLabeledUnicastDestination lu = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
-            .setPrefix(IPv6_PREFIX).setLabelStack(LABEL_STACK).build();
+            .setPrefix(IPV6_PREFIX).setLabelStack(LABEL_STACK).build();
         mpBuilder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
             new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
                 new DestinationIpv6LabeledUnicastBuilder()
@@ -430,14 +437,14 @@ public class LUNlriParserTest {
         final MpReachNlriBuilder testBuilder = new MpReachNlriBuilder();
         testBuilder.setAfi(Ipv6AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPv6_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_REACH_NLRI_IPV6_ADD_PATH), testBuilder, this.constraint);
         assertEquals(mpReachExpected, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes1.class,
             new Attributes1Builder().setMpReachNlri(mpReachExpected).build()).build(), output);
-        assertArrayEquals(LU_REACH_NLRI_IPv6_ADD_PATH, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_REACH_NLRI_IPV6_ADD_PATH, ByteArray.readAllBytes(output));
     }
 
     @Test
@@ -447,7 +454,7 @@ public class LUNlriParserTest {
         mpBuilder.setAfi(Ipv6AddressFamily.class);
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
 
-        final CLabeledUnicastDestination lu1 = new CLabeledUnicastDestinationBuilder().setPrefix(IPv6_PREFIX).build();
+        final CLabeledUnicastDestination lu1 = new CLabeledUnicastDestinationBuilder().setPrefix(IPV6_PREFIX).build();
         mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update
                 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6LabeledUnicastCaseBuilder()
@@ -457,7 +464,7 @@ public class LUNlriParserTest {
                     .setCLabeledUnicastDestination(Lists.newArrayList(lu1)).build()).build()).build());
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
-        final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPrefix(IPv6_PREFIX)
+        final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPrefix(IPV6_PREFIX)
             .setLabelStack(LABEL_STACK).build();
         mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1
             .urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.unreach
@@ -472,19 +479,19 @@ public class LUNlriParserTest {
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
         testBuilder.setAfi(Ipv6AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPv6), testBuilder, null);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV6), testBuilder, null);
         assertEquals(mpUnreachExpected1, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv6, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV6, ByteArray.readAllBytes(output));
 
         final ByteBuf output1 = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv6, ByteArray.readAllBytes(output1));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV6, ByteArray.readAllBytes(output1));
     }
 
     @Test
@@ -495,7 +502,7 @@ public class LUNlriParserTest {
         mpBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
 
         final CLabeledUnicastDestination lu1 = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
-            .setPrefix(IPv6_PREFIX).build();
+            .setPrefix(IPV6_PREFIX).build();
         mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
             new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update
                 .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6LabeledUnicastCaseBuilder()
@@ -506,33 +513,33 @@ public class LUNlriParserTest {
         final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
 
         final CLabeledUnicastDestination lu2 = new CLabeledUnicastDestinationBuilder().setPathId(PATH_ID)
-            .setPrefix(IPv6_PREFIX).setLabelStack(LABEL_STACK).build();
-            mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
+            .setPrefix(IPV6_PREFIX).setLabelStack(LABEL_STACK).build();
+        mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
+            .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+            .DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
-                    .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
-                    .DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
-                    new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329
-                        .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled
-                        .unicast._case.DestinationIpv6LabeledUnicastBuilder()
-                        .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build()).build()).build());
-            final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
+                .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled
+                .unicast._case.DestinationIpv6LabeledUnicastBuilder()
+                .setCLabeledUnicastDestination(Lists.newArrayList(lu2)).build()).build()).build());
+        final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
 
         //test parser
         final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
         testBuilder.setAfi(Ipv6AddressFamily.class);
         testBuilder.setSafi(LabeledUnicastSubsequentAddressFamily.class);
-        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPv6_ADD_PATH), testBuilder, this.constraint);
+        parser.parseNlri(Unpooled.copiedBuffer(LU_UNREACH_NLRI_IPV6_ADD_PATH), testBuilder, this.constraint);
         assertEquals(mpUnreachExpected1, testBuilder.build());
 
         //test serializer
         final ByteBuf output = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv6_ADD_PATH, ByteArray.readAllBytes(output));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV6_ADD_PATH, ByteArray.readAllBytes(output));
 
         final ByteBuf output1 = Unpooled.buffer();
         parser.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected1).build()).build(), output1);
-        assertArrayEquals(LU_UNREACH_NLRI_IPv6_ADD_PATH, ByteArray.readAllBytes(output1));
+        assertArrayEquals(LU_UNREACH_NLRI_IPV6_ADD_PATH, ByteArray.readAllBytes(output1));
     }
 }
index 6234f8268498231eb9cd73ebc13c249a4de762ed..41349fa3f6523c7c62a94fe99de214ac8b6442c1 100644 (file)
@@ -57,7 +57,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
 public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastRoutesCase,
         LabeledUnicastRoutes, LabeledUnicastRoute, LabeledUnicastRouteKey> {
 
-    private static final IpPrefix IPv4_PREFIX = new IpPrefix(new Ipv4Prefix("34.1.22.0/24"));
+    private static final IpPrefix IPV4_PREFIX = new IpPrefix(new Ipv4Prefix("34.1.22.0/24"));
     private static final LabeledUnicastRoute ROUTE;
     private static final LabeledUnicastRoutes ROUTES;
     private static final LabeledUnicastRouteKey ROUTE_KEY;
@@ -67,7 +67,7 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
             .setLabelValue(new MplsLabel(355L)).build());
     private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST
             = Collections.singletonList(new CLabeledUnicastDestinationBuilder()
-            .setPathId(PATH_ID).setLabelStack(LABEL_STACK).setPrefix(IPv4_PREFIX).build());
+            .setPathId(PATH_ID).setLabelStack(LABEL_STACK).setPrefix(IPV4_PREFIX).build());
     private static final DestinationLabeledUnicastCase REACH_NLRI = new DestinationLabeledUnicastCaseBuilder()
             .setDestinationLabeledUnicast(new DestinationLabeledUnicastBuilder()
                     .setCLabeledUnicastDestination(LABELED_DESTINATION_LIST).build()).build();
@@ -90,7 +90,7 @@ public class LabeledUnicastIpv4RIBSupportTest extends AbstractRIBSupportTest<Lab
         ROUTE_KEY = new LabeledUnicastRouteKey(PATH_ID, LABEL_KEY);
         ROUTE = new LabeledUnicastRouteBuilder()
                 .withKey(ROUTE_KEY)
-                .setPrefix(IPv4_PREFIX)
+                .setPrefix(IPV4_PREFIX)
                 .setPathId(PATH_ID)
                 .setLabelStack(LABEL_STACK)
                 .setAttributes(new AttributesBuilder().build()).build();
index 1c614a7b3dc9925ae05ddbe0f06cfae0217c28ba..57b5a70da3a615b561e3a559978689b5fe3fbb0e 100644 (file)
@@ -57,7 +57,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidates;
 public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<LabeledUnicastIpv6RoutesCase,
         LabeledUnicastIpv6Routes, LabeledUnicastRoute, LabeledUnicastRouteKey> {
 
-    private static final IpPrefix IPv6_PREFIX = new IpPrefix(new Ipv6Prefix("102:304:500::/40"));
+    private static final IpPrefix IPV6_PREFIX = new IpPrefix(new Ipv6Prefix("102:304:500::/40"));
     private static final LabeledUnicastRoute ROUTE;
     private static final LabeledUnicastIpv6Routes ROUTES;
     private static final LabeledUnicastRouteKey ROUTE_KEY;
@@ -67,7 +67,7 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
             .setLabelValue(new MplsLabel(355L)).build());
     private static final List<CLabeledUnicastDestination> LABELED_DESTINATION_LIST
             = Collections.singletonList(new CLabeledUnicastDestinationBuilder()
-            .setPathId(PATH_ID).setLabelStack(LABEL_STACK).setPrefix(IPv6_PREFIX).build());
+            .setPathId(PATH_ID).setLabelStack(LABEL_STACK).setPrefix(IPV6_PREFIX).build());
     private static final DestinationIpv6LabeledUnicastCase REACH_NLRI
             = new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
             new DestinationIpv6LabeledUnicastBuilder().setCLabeledUnicastDestination(LABELED_DESTINATION_LIST)
@@ -78,8 +78,8 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
             .xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination
             .type.DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(new org.opendaylight
             .yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev180329.update.attributes.mp
-            .unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled.unicast._case.
-            DestinationIpv6LabeledUnicastBuilder().setCLabeledUnicastDestination(LABELED_DESTINATION_LIST).build())
+            .unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled.unicast._case
+            .DestinationIpv6LabeledUnicastBuilder().setCLabeledUnicastDestination(LABELED_DESTINATION_LIST).build())
             .build();
     private LabeledUnicastIpv6RIBSupport ribSupport;
 
@@ -92,7 +92,7 @@ public class LabeledUnicastIpv6RIBSupportTest extends AbstractRIBSupportTest<Lab
         LABEL_KEY = ByteArray.encodeBase64(buffer);
         ROUTE_KEY = new LabeledUnicastRouteKey(PATH_ID, LABEL_KEY);
         ROUTE = new LabeledUnicastRouteBuilder().withKey(ROUTE_KEY)
-                .setPrefix(IPv6_PREFIX).setPathId(PATH_ID).setLabelStack(LABEL_STACK)
+                .setPrefix(IPV6_PREFIX).setPathId(PATH_ID).setLabelStack(LABEL_STACK)
             .setAttributes(new AttributesBuilder().build()).build();
         ROUTES = new LabeledUnicastIpv6RoutesBuilder().setLabeledUnicastRoute(Collections.singletonList(ROUTE)).build();
     }
index f926c915b4ddd2f9f43422a6f26ab3010dc47755..331f27f96991c9c1844a328f1b5df85a209d7c36 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
 import java.util.Optional;
@@ -23,8 +22,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, LabeledUnicastSubsequentAddressFamily.class);
-    private static final BgpTableType IPV6 = new BgpTableTypeImpl(Ipv6AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class);
+    private static final BgpTableType IPV4 = new BgpTableTypeImpl(Ipv4AddressFamily.class,
+        LabeledUnicastSubsequentAddressFamily.class);
+    private static final BgpTableType IPV6 = new BgpTableTypeImpl(Ipv6AddressFamily.class,
+        LabeledUnicastSubsequentAddressFamily.class);
 
     @Test
     public void testActivator() {