Enforce findbug & checkstyle under evon module 77/66577/3
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 18 Dec 2017 13:03:51 +0000 (14:03 +0100)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Wed, 20 Dec 2017 14:27:36 +0000 (14:27 +0000)
Change-Id: Ib09de798d809002e03379805d299e8e577331be4
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
66 files changed:
bgp/evpn/pom.xml
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/BGPActivator.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnRibSupport.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/PMSITunnelAttributeHandler.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/BidirPimTreeParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/IngressReplicationParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/MldpMp2mpLspParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/MldpP2mpLspParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/OpaqueUtil.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/PimSmTreeParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/PimSsmTreeParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/RsvpTeP2MpLspParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/TunnelIdentifierHandler.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/TunnelIdentifierParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/TunnelIdentifierSerializer.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/ASGenParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/AbstractEsiType.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/ArbitraryParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/EsiModelUtil.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/LacpParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/LanParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/MacParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/RouterIdParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/extended/communities/ESImpRouteTargetExtCom.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/extended/communities/Layer2AttributesExtCom.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/AbstractEvpnNlri.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/EthADRParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/EthSegRParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/EvpnNlriParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/IncMultEthTagRParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/MACIpAdvRParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/NlriModelUtil.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/spi/EsiParser.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/spi/EsiRegistry.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/spi/EsiSerializer.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/spi/EvpnRegistry.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/spi/EvpnSerializer.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/spi/pojo/SimpleEsiTypeRegistry.java
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/spi/pojo/SimpleEvpnNlriRegistry.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/BGPActivatorTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnRibSupportTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnTestUtil.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/TableTypeActivatorTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/OpaqueUtilTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/PAddressPMulticastGroupUtilTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/PMSITunnelAttributeHandlerTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/attributes/tunnel/identifier/PMSITunnelAttributeHandlerTestUtil.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/ASGenParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/ArbitraryParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/LacpParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/LanParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/MacParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/esi/types/RouterIdParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/extended/communities/DefaultGatewayExtComTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/extended/communities/ESILabelExtComTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/extended/communities/ESImpRouteTargetExtComTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/extended/communities/Layer2AttributesExtComTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/extended/communities/MACMobExtComTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/EthADRParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/EthSegRParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/EvpnNlriAttributesParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/EvpnNlriParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/IncMultEthTagRParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/impl/nlri/MACIpAdvRParserTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/spi/pojo/SimpleEsiTypeRegistryTest.java
bgp/evpn/src/test/java/org/opendaylight/protocol/bgp/evpn/spi/pojo/SimpleEvpnNlriRegistryTest.java

index 09faedaea5fc8540b8c86a7050dbf143ef47d909..125637b7e781981e08820674019be9ccc76fbd1e 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>
index 6b6f4726e4259de0ab1fe9b3f019a64b66603ce9..006973950af9938efb46ca1de1ccb836967dae94 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.protocol.bgp.evpn.impl;
 
+import com.google.common.annotations.VisibleForTesting;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.bgp.evpn.impl.attributes.PMSITunnelAttributeHandler;
@@ -34,8 +35,10 @@ 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.next.hop.c.next.hop.Ipv6NextHopCase;
 
 public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
-    private static final int L2VPN_AFI = 25;
-    private static final int EVPN_SAFI = 70;
+    @VisibleForTesting
+    static final int L2VPN_AFI = 25;
+    @VisibleForTesting
+    static final int EVPN_SAFI = 70;
 
     @Override
     protected List<AutoCloseable> startImpl(final BGPExtensionProviderContext context) {
@@ -53,8 +56,10 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         return regs;
     }
 
-    private static void registerAttributesHandler(final BGPExtensionProviderContext context, final List<AutoCloseable> regs) {
-        final PMSITunnelAttributeHandler pmsiParser = new PMSITunnelAttributeHandler(context.getAddressFamilyRegistry());
+    private static void registerAttributesHandler(final BGPExtensionProviderContext context,
+            final List<AutoCloseable> regs) {
+        final PMSITunnelAttributeHandler pmsiParser =
+                new PMSITunnelAttributeHandler(context.getAddressFamilyRegistry());
         regs.add(context.registerAttributeParser(pmsiParser.getType(), pmsiParser));
         regs.add(context.registerAttributeSerializer(pmsiParser.getClazz(), pmsiParser));
     }
@@ -67,7 +72,8 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerNlriSerializer(EvpnRoutes.class, nlriHandler));
     }
 
-    private static void registerExtendedCommunities(final BGPExtensionProviderContext context, final List<AutoCloseable> regs) {
+    private static void registerExtendedCommunities(final BGPExtensionProviderContext context,
+            final List<AutoCloseable> regs) {
         final DefaultGatewayExtCom defGEC = new DefaultGatewayExtCom();
         regs.add(context.registerExtendedCommunityParser(defGEC.getType(true), defGEC.getSubType(), defGEC));
         regs.add(context.registerExtendedCommunitySerializer(DefaultGatewayExtendedCommunityCase.class, defGEC));
@@ -77,7 +83,8 @@ public final class BGPActivator extends AbstractBGPExtensionProviderActivator {
         regs.add(context.registerExtendedCommunitySerializer(EsiLabelExtendedCommunityCase.class, esiLEC));
 
         final ESImpRouteTargetExtCom esImpEC = new ESImpRouteTargetExtCom();
-        regs.add(context.registerExtendedCommunityParser(esImpEC.getType(true), esImpEC.getSubType(), esImpEC));
+        regs.add(context.registerExtendedCommunityParser(esImpEC.getType(true),
+                esImpEC.getSubType(), esImpEC));
         regs.add(context.registerExtendedCommunitySerializer(EsImportRouteExtendedCommunityCase.class, esImpEC));
 
         final MACMobExtCom macEC = new MACMobExtCom();
index 610594e70b972fa123c80c77eda938c05238d9f3..0099ac6842ada1c1a6bce4081ee041ba794adaf5 100644 (file)
@@ -52,7 +52,8 @@ final class EvpnRibSupport extends AbstractRIBSupport {
     private static final NodeIdentifier NLRI_ROUTES_LIST = NodeIdentifier.create(EvpnDestination.QNAME);
 
     private EvpnRibSupport() {
-        super(EvpnRoutesCase.class, EvpnRoutes.class, EvpnRoute.class, L2vpnAddressFamily.class, EvpnSubsequentAddressFamily.class, DestinationEvpn.QNAME);
+        super(EvpnRoutesCase.class, EvpnRoutes.class, EvpnRoute.class,
+                L2vpnAddressFamily.class, EvpnSubsequentAddressFamily.class, DestinationEvpn.QNAME);
     }
 
     static EvpnRibSupport getInstance() {
@@ -79,16 +80,18 @@ final class EvpnRibSupport extends AbstractRIBSupport {
     @Nonnull
     @Override
     protected DestinationType buildDestination(@Nonnull final Collection<MapEntryNode> routes) {
-        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.reach.nlri.advertized
-            .routes.destination.type.DestinationEvpnCaseBuilder().setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.
-            ns.yang.bgp.evpn.rev171213.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.evpn._case.
-            DestinationEvpnBuilder().setEvpnDestination(extractRoutes(routes)).build()).build();
+        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update
+                .attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationEvpnCaseBuilder()
+                .setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
+                        .rev171213.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination
+                        .evpn._case.DestinationEvpnBuilder().setEvpnDestination(extractRoutes(routes)).build()).build();
     }
 
     @Nonnull
     @Override
     protected DestinationType buildWithdrawnDestination(@Nonnull final Collection<MapEntryNode> routes) {
-        return new DestinationEvpnCaseBuilder().setDestinationEvpn(new DestinationEvpnBuilder().setEvpnDestination(extractRoutes(routes)).build()).build();
+        return new DestinationEvpnCaseBuilder().setDestinationEvpn(new DestinationEvpnBuilder()
+                .setEvpnDestination(extractRoutes(routes)).build()).build();
     }
 
     private static List<EvpnDestination> extractRoutes(final Collection<MapEntryNode> routes) {
@@ -99,7 +102,8 @@ final class EvpnRibSupport extends AbstractRIBSupport {
     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(NLRI_ROUTES_LIST);
+            final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = destination
+                    .getChild(NLRI_ROUTES_LIST);
             if (maybeRoutes.isPresent()) {
                 final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
                 if (routes instanceof UnkeyedListNode) {
index 160e345cc40c3c5f591e25276472c00a96b6c16b..05a2f7f4934e8ae84c12cc415d87279ede37f648 100644 (file)
@@ -56,7 +56,7 @@ public final class PMSITunnelAttributeHandler implements AttributeParser, Attrib
 
     private static void parseMpls(final PmsiTunnelBuilder pmsiTunnelBuilder, final ByteBuf buffer) {
         final MplsLabel mpls = MplsLabelUtil.mplsLabelForByteBuf(buffer);
-        if(mpls.getValue() != 0) {
+        if (mpls.getValue() != 0) {
             pmsiTunnelBuilder.setMplsLabel(mpls);
         }
     }
@@ -88,7 +88,7 @@ public final class PMSITunnelAttributeHandler implements AttributeParser, Attrib
     }
 
     private static void serializeMpls(final MplsLabel mplsLabel, final ByteBuf body) {
-        if(mplsLabel == null) {
+        if (mplsLabel == null) {
             body.writeZero(MPLS_LENGTH);
         }
         body.writeBytes(MplsLabelUtil.byteBufForMplsLabel(mplsLabel));
index b0053791b88929b96ebc8e63c133bb95889dbb21..a12544c0392e88f26fbf6d32b2b6f1f63ac56ac0 100644 (file)
@@ -17,16 +17,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tun
 final class BidirPimTreeParser implements TunnelIdentifierSerializer, TunnelIdentifierParser {
     @Override
     public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
-        Preconditions.checkArgument(tunnelIdentifier instanceof BidirPimTree, "The tunnelIdentifier %s is not BidirPimTree type.", tunnelIdentifier);
-        PAddressPMulticastGroupUtil.serializeSenderPMulticastGroup(((BidirPimTree) tunnelIdentifier).getBidirPimTree(), buffer);
+        Preconditions.checkArgument(tunnelIdentifier instanceof BidirPimTree,
+                "The tunnelIdentifier %s is not BidirPimTree type.", tunnelIdentifier);
+        PAddressPMulticastGroupUtil
+                .serializeSenderPMulticastGroup(((BidirPimTree) tunnelIdentifier).getBidirPimTree(), buffer);
         return TunnelType.BIDIR_PIM_TREE.getIntValue();
     }
 
     @Override
     public TunnelIdentifier parse(final ByteBuf buffer) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.bidir.pim.tree.
-            BidirPimTreeBuilder bidirPimTree = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.bidir.pim.tree.
-            BidirPimTreeBuilder(PAddressPMulticastGroupUtil.parseSenderPMulticastGroup(buffer));
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.bidir.pim.tree.BidirPimTreeBuilder bidirPimTree =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
+                        .pmsi.tunnel.tunnel.identifier.bidir.pim.tree.BidirPimTreeBuilder(PAddressPMulticastGroupUtil
+                        .parseSenderPMulticastGroup(buffer));
         return new BidirPimTreeBuilder().setBidirPimTree(bidirPimTree.build()).build();
     }
 }
index 20bfd30f22df91849218936541dd9801a9a8caa2..619664d6fae0a181b227ebbc61a0b8edee650771 100644 (file)
@@ -20,19 +20,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tun
 final class IngressReplicationParser implements TunnelIdentifierSerializer, TunnelIdentifierParser {
     @Override
     public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
-        Preconditions.checkArgument(tunnelIdentifier instanceof IngressReplication, "The tunnelIdentifier %s is not IngressReplication type.", tunnelIdentifier);
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.ingress.replication.
-            IngressReplication ingressReplication = ((IngressReplication) tunnelIdentifier).getIngressReplication();
+        Preconditions.checkArgument(tunnelIdentifier instanceof IngressReplication,
+                "The tunnelIdentifier %s is not IngressReplication type.", tunnelIdentifier);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.ingress.replication.IngressReplication ingressReplication =
+                ((IngressReplication) tunnelIdentifier).getIngressReplication();
         serializeIpAddress(ingressReplication.getReceivingEndpointAddress(), buffer);
         return TunnelType.INGRESS_REPLICATION.getIntValue();
     }
 
     @Override
     public TunnelIdentifier parse(final ByteBuf buffer) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier
-            .ingress.replication.IngressReplication builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi
-            .tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
-            .setReceivingEndpointAddress(parseIpAddress(buffer.readableBytes(), buffer)).build();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.ingress.replication.IngressReplication builder =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
+                        .pmsi.tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
+                        .setReceivingEndpointAddress(parseIpAddress(buffer.readableBytes(), buffer)).build();
         return new IngressReplicationBuilder().setIngressReplication(builder).build();
     }
 }
index bd4d31d9607ae1b2caafa5c3aea51ab166b657e9..311a683e7f950a114700f2349b5a0ce073c707a2 100644 (file)
@@ -20,9 +20,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tun
 final class MldpMp2mpLspParser implements TunnelIdentifierSerializer, TunnelIdentifierParser {
     @Override
     public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
-        Preconditions.checkArgument(tunnelIdentifier instanceof MldpMp2mpLsp, "The tunnelIdentifier %s is not MldpMp2mpLsp type.", tunnelIdentifier);
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.mp2mp.lsp.
-            MldpMp2mpLsp mldpMp2mpLsp = ((MldpMp2mpLsp) tunnelIdentifier).getMldpMp2mpLsp();
+        Preconditions.checkArgument(tunnelIdentifier instanceof MldpMp2mpLsp,
+                "The tunnelIdentifier %s is not MldpMp2mpLsp type.", tunnelIdentifier);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.mldp.mp2mp.lsp.MldpMp2mpLsp mldpMp2mpLsp =
+                ((MldpMp2mpLsp) tunnelIdentifier).getMldpMp2mpLsp();
         if (!OpaqueUtil.serializeOpaque(mldpMp2mpLsp, buffer)) {
             return NO_TUNNEL_INFORMATION_PRESENT;
         }
@@ -35,9 +37,10 @@ final class MldpMp2mpLspParser implements TunnelIdentifierSerializer, TunnelIden
         if (opaque == null) {
             return null;
         }
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.mp2mp.lsp.
-            MldpMp2mpLsp mldpMp2mpLsp = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.mp2mp.lsp.
-            MldpMp2mpLspBuilder(opaque).build();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.mldp.mp2mp.lsp.MldpMp2mpLsp mldpMp2mpLsp =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
+                        .pmsi.tunnel.tunnel.identifier.mldp.mp2mp.lsp.MldpMp2mpLspBuilder(opaque).build();
         return new MldpMp2mpLspBuilder().setMldpMp2mpLsp(mldpMp2mpLsp).build();
     }
 }
index cc30e4e759efad413a5ff2b248802f81991d457d..e0d57a433acc0fcd0b7ae0f7c787197d2a5841c0 100644 (file)
@@ -41,9 +41,11 @@ final class MldpP2mpLspParser implements TunnelIdentifierSerializer, TunnelIdent
 
     @Override
     public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
-        Preconditions.checkArgument(tunnelIdentifier instanceof MldpP2mpLsp, "The tunnelIdentifier %s is not RsvpTeP2mpLps type.", tunnelIdentifier);
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp
-            .p2mp.lsp.MldpP2mpLsp mldpP2mpLsp = ((MldpP2mpLsp) tunnelIdentifier).getMldpP2mpLsp();
+        Preconditions.checkArgument(tunnelIdentifier instanceof MldpP2mpLsp,
+                "The tunnelIdentifier %s is not RsvpTeP2mpLps type.", tunnelIdentifier);
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLsp mldpP2mpLsp =
+                ((MldpP2mpLsp) tunnelIdentifier).getMldpP2mpLsp();
 
         final ByteBuf opaqueValues = Unpooled.buffer();
         final int addressFamily = getAddressFamilyValue(mldpP2mpLsp.getAddressFamily());
@@ -79,13 +81,16 @@ final class MldpP2mpLspParser implements TunnelIdentifierSerializer, TunnelIdent
 
     @Override
     public TunnelIdentifier parse(final ByteBuf buffer) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp
-            .p2mp.lsp.MldpP2mpLspBuilder mldpP2mpLsp = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp
-            .p2mp.lsp.MldpP2mpLspBuilder();
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLspBuilder mldpP2mpLsp =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
+                        .pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLspBuilder();
         buffer.skipBytes(RESERVED);
-        final Class<? extends AddressFamily> addressFamily = this.addressFamilyRegistry.classForFamily(buffer.readUnsignedShort());
+        final Class<? extends AddressFamily> addressFamily = this.addressFamilyRegistry
+                .classForFamily(buffer.readUnsignedShort());
         if (addressFamily == null) {
-            LOG.debug("Skipping serialization of TunnelIdentifier {}, address family type  supported", ByteBufUtil.hexDump(buffer));
+            LOG.debug("Skipping serialization of TunnelIdentifier {}, address family type  supported",
+                    ByteBufUtil.hexDump(buffer));
             return null;
         }
         mldpP2mpLsp.setAddressFamily(addressFamily);
index d5909b605c53af81cdd1f8be836b7429eaddef04..ab975b0d6d8ba26ae78768c83fc380445af241f0 100644 (file)
@@ -38,17 +38,17 @@ final class OpaqueUtil {
     static boolean serializeOpaque(final Opaque opaque, final ByteBuf byteBuf) {
         final Short type = opaque.getOpaqueType();
         switch (type) {
-        case GENERIC_LSP_IDENTIFIER:
-            ByteBufWriteUtil.writeUnsignedByte(type, byteBuf);
-            writeGeneric(opaque.getOpaque(), byteBuf);
-            break;
-        case EXTENDED_TYPE:
-            ByteBufWriteUtil.writeUnsignedByte(type, byteBuf);
-            writeExtended(opaque.getOpaque(), opaque.getOpaqueExtendedType(), byteBuf);
-            break;
-        default:
-            LOG.debug("Skipping serialization of Opaque Value {}", opaque);
-            return false;
+            case GENERIC_LSP_IDENTIFIER:
+                ByteBufWriteUtil.writeUnsignedByte(type, byteBuf);
+                writeGeneric(opaque.getOpaque(), byteBuf);
+                break;
+            case EXTENDED_TYPE:
+                ByteBufWriteUtil.writeUnsignedByte(type, byteBuf);
+                writeExtended(opaque.getOpaque(), opaque.getOpaqueExtendedType(), byteBuf);
+                break;
+            default:
+                LOG.debug("Skipping serialization of Opaque Value {}", opaque);
+                return false;
         }
         return true;
     }
@@ -75,17 +75,17 @@ final class OpaqueUtil {
         final short type = buffer.readUnsignedByte();
         final OpaqueValueBuilder builder = new OpaqueValueBuilder();
         switch (type) {
-        case GENERIC_LSP_IDENTIFIER:
-            builder.setOpaque(buildOpaqueValue(buffer));
-            break;
-        case EXTENDED_TYPE:
-            buildExtended(builder, buffer);
-            break;
-        default:
-            final int length = buffer.readUnsignedShort();
-            buffer.skipBytes(length);
-            LOG.debug("Skipping parsing of Opaque Value {}", buffer);
-            return null;
+            case GENERIC_LSP_IDENTIFIER:
+                builder.setOpaque(buildOpaqueValue(buffer));
+                break;
+            case EXTENDED_TYPE:
+                buildExtended(builder, buffer);
+                break;
+            default:
+                final int length = buffer.readUnsignedShort();
+                buffer.skipBytes(length);
+                LOG.debug("Skipping parsing of Opaque Value {}", buffer);
+                return null;
         }
         builder.setOpaqueType(type);
         return builder.build();
index c237afe8fd0d7991c0cf642badfb4094ebffd19e..649aad18500699641bafa9cce5a7631fd00d26be 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier;
 
-
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier;
@@ -18,16 +17,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tun
 final class PimSmTreeParser implements TunnelIdentifierSerializer, TunnelIdentifierParser {
     @Override
     public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
-        Preconditions.checkArgument(tunnelIdentifier instanceof PimSmTree, "The tunnelIdentifier %s is not PimSmTree type.", tunnelIdentifier);
-        PAddressPMulticastGroupUtil.serializeSenderPMulticastGroup(((PimSmTree) tunnelIdentifier).getPimSmTree(), buffer);
+        Preconditions.checkArgument(tunnelIdentifier instanceof PimSmTree,
+                "The tunnelIdentifier %s is not PimSmTree type.", tunnelIdentifier);
+        PAddressPMulticastGroupUtil.serializeSenderPMulticastGroup(((PimSmTree) tunnelIdentifier)
+                .getPimSmTree(), buffer);
         return TunnelType.PIM_SM_TREE.getIntValue();
     }
 
     @Override
     public TunnelIdentifier parse(final ByteBuf buffer) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.pim.sm.tree.
-            PimSmTreeBuilder pimSmTree = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.pim.sm.tree.
-            PimSmTreeBuilder(PAddressPMulticastGroupUtil.parseSenderPMulticastGroup(buffer));
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.pim.sm.tree.PimSmTreeBuilder pimSmTree =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
+                        .pmsi.tunnel.tunnel.identifier.pim.sm.tree.PimSmTreeBuilder(PAddressPMulticastGroupUtil
+                        .parseSenderPMulticastGroup(buffer));
         return new PimSmTreeBuilder().setPimSmTree(pimSmTree.build()).build();
     }
 }
index 43d9a54473e5da2c734e4355bb3a9bbe5fe341dc..298248c0d27b35fb2055d578decab753aeaedfc6 100644 (file)
@@ -17,16 +17,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tun
 final class PimSsmTreeParser implements TunnelIdentifierSerializer, TunnelIdentifierParser {
     @Override
     public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
-        Preconditions.checkArgument(tunnelIdentifier instanceof PimSsmTree, "The tunnelIdentifier %s is not PimSsmTree type.", tunnelIdentifier);
-        PAddressPMulticastGroupUtil.serializeSenderPMulticastGroup(((PimSsmTree) tunnelIdentifier).getPimSsmTree(), buffer);
+        Preconditions.checkArgument(tunnelIdentifier instanceof PimSsmTree,
+                "The tunnelIdentifier %s is not PimSsmTree type.", tunnelIdentifier);
+        PAddressPMulticastGroupUtil
+                .serializeSenderPMulticastGroup(((PimSsmTree) tunnelIdentifier).getPimSsmTree(), buffer);
         return TunnelType.PIM_SSM_TREE.getIntValue();
     }
 
     @Override
     public TunnelIdentifier parse(final ByteBuf buffer) {
-        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.pim.ssm.tree.
-            PimSsmTreeBuilder pimSsmTree = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.pim.ssm.tree.
-            PimSsmTreeBuilder(PAddressPMulticastGroupUtil.parseSenderPMulticastGroup(buffer));
+        final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.pim.ssm.tree.PimSsmTreeBuilder pimSsmTree =
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
+                        .pmsi.tunnel.tunnel.identifier.pim.ssm.tree.PimSsmTreeBuilder(PAddressPMulticastGroupUtil
+                        .parseSenderPMulticastGroup(buffer));
         return new PimSsmTreeBuilder().setPimSsmTree(pimSsmTree.build()).build();
     }
 }
index c39fce5c5bc18045ed4bf269923db062a0d05cda..16e7b67a86f8c2e2e028631cca95d341f90c1f95 100644 (file)
@@ -26,7 +26,8 @@ final class RsvpTeP2MpLspParser implements TunnelIdentifierSerializer, TunnelIde
 
     @Override
     public int serialize(final TunnelIdentifier tunnelIdentifier, final ByteBuf buffer) {
-        Preconditions.checkArgument(tunnelIdentifier instanceof RsvpTeP2mpLsp, "The tunnelIdentifier %s is not RsvpTeP2mpLps type.", tunnelIdentifier);
+        Preconditions.checkArgument(tunnelIdentifier instanceof RsvpTeP2mpLsp,
+                "The tunnelIdentifier %s is not RsvpTeP2mpLps type.", tunnelIdentifier);
         final RsvpTeP2mpLps rsvpTeP2mpLsp = ((RsvpTeP2mpLsp) tunnelIdentifier).getRsvpTeP2mpLps();
         ByteBufWriteUtil.writeUnsignedInt(rsvpTeP2mpLsp.getP2mpId(), buffer);
         buffer.writeZero(RESERVED);
index d6c34c87b698caf874dd0ca79f66e74b4e6f69a2..987ad0a3eb71fa6a8cba7c96847d8030cddc9185 100644 (file)
@@ -21,7 +21,8 @@ public final class TunnelIdentifierHandler {
     private static final Logger LOG = LoggerFactory.getLogger(TunnelIdentifierHandler.class);
     private static final String SKIP_SERIALIZATION = "Skipping serialization of PMSI Tunnel Attribute {}";
     private static final String SKIP_PARSE = "Skipping parsing of PMSI Tunnel Attribute type {}";
-    private final HandlerRegistry<DataContainer, TunnelIdentifierParser, TunnelIdentifierSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, TunnelIdentifierParser, TunnelIdentifierSerializer> handlers =
+            new HandlerRegistry<>();
 
     public TunnelIdentifierHandler(final AddressFamilyRegistry addressFamilyRegistry) {
         final RsvpTeP2MpLspParser rsvpTeP2MpLspParser = new RsvpTeP2MpLspParser();
index dc67b565a20afebab72a7ab9934a13576535453e..6707b1da1bbcf6186cc42390bd04c565e45b8efe 100644 (file)
@@ -9,13 +9,17 @@
 package org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier;
 
 import io.netty.buffer.ByteBuf;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier;
 
 interface TunnelIdentifierParser {
     /**
      * Parse Tunnel Identifier from buffer.
+     *
      * @param buffer Encoded Tunnel Identifier in ByteBuf.
      * @return Parsed Tunnel Identifier body
      */
-    TunnelIdentifier parse(ByteBuf buffer);
+    @Nullable
+    TunnelIdentifier parse(@Nonnull ByteBuf buffer);
 }
index 8a83505b6c6ac7d01fa4c1e71915f0dfddc51b25..cc1ad603efaa1f638c4b66f3fc3a0b399d09f67c 100644 (file)
@@ -9,14 +9,16 @@
 package org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier;
 
 import io.netty.buffer.ByteBuf;
+import javax.annotation.Nonnull;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.TunnelIdentifier;
 
 interface TunnelIdentifierSerializer {
     /**
-     * Serialize tunnel identifier
+     * Serialize tunnel identifier.
+     *
      * @param tunnelIdentifier Tunnel Identifier body
-     * @param buffer Encoded Tunnel Identifier in ByteBuf
+     * @param buffer           Encoded Tunnel Identifier in ByteBuf
      * @return Tunnel identifier Type
      */
-    int serialize(TunnelIdentifier tunnelIdentifier, ByteBuf buffer);
+    int serialize(@Nonnull TunnelIdentifier tunnelIdentifier, @Nonnull ByteBuf buffer);
 }
index 620ec0d94aa1349088be656f075520d8cd21b08f..55a303170c0dedad46a6f57930e974fbbe6696b4 100644 (file)
@@ -27,7 +27,8 @@ final class ASGenParser extends AbstractEsiType {
 
     @Override
     public void serializeBody(final Esi esi, final ByteBuf body) {
-        Preconditions.checkArgument(esi instanceof AsGeneratedCase, "Unknown esi instance. Passed %s. Needed AsGeneratedCase.", esi.getClass());
+        Preconditions.checkArgument(esi instanceof AsGeneratedCase,
+                "Unknown esi instance. Passed %s. Needed AsGeneratedCase.", esi.getClass());
         final AsGenerated asGen = ((AsGeneratedCase) esi).getAsGenerated();
         writeUnsignedInt(asGen.getAs().getValue(), body);
         writeUnsignedInt(asGen.getLocalDiscriminator(), body);
index e9bd5fd43c56aefdaf22aa243893deecc467807e..8b8ab4a911a4815f499a92662acc5bc1ef1e0a4f 100644 (file)
@@ -28,7 +28,7 @@ abstract class AbstractEsiType implements EsiParser, EsiSerializer {
         buffer.writeBytes(body);
     }
 
-    protected abstract void serializeBody(final Esi esi, final ByteBuf buffer);
+    protected abstract void serializeBody(Esi esi, ByteBuf buffer);
 
     protected abstract EsiType getType();
 }
index 61fb881b005dc235e620e7cce3df09dbe8592c38..dee87772f121917fe62f1a02421cfb7e0b2ef307 100644 (file)
@@ -25,7 +25,8 @@ final class ArbitraryParser extends AbstractEsiType {
 
     @Override
     public void serializeBody(final Esi esiCase, final ByteBuf body) {
-        Preconditions.checkArgument(esiCase instanceof ArbitraryCase, "Unknown esi instance. Passed %s. Needed ArbitraryCase.", esiCase.getClass());
+        Preconditions.checkArgument(esiCase instanceof ArbitraryCase,
+                "Unknown esi instance. Passed %s. Needed ArbitraryCase.", esiCase.getClass());
         body.writeBytes(((ArbitraryCase) esiCase).getArbitrary().getArbitrary());
     }
 
@@ -42,6 +43,7 @@ final class ArbitraryParser extends AbstractEsiType {
 
     @Override
     public Esi parseEsi(final ByteBuf body) {
-        return new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder().setArbitrary(ByteArray.readBytes(body, ARBITRARY_LENGTH)).build()).build();
+        return new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder()
+                .setArbitrary(ByteArray.readBytes(body, ARBITRARY_LENGTH)).build()).build();
     }
 }
index 2fd47e84278bbe8f4acdfb9c50e6fe0c95c4748c..89ee156b50710779f9748be92b49c197aba67ce6 100644 (file)
@@ -20,15 +20,24 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 final class EsiModelUtil {
-    static final NodeIdentifier LD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "local-discriminator").intern());
-    static final NodeIdentifier ARB_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "arbitrary").intern());
-    static final NodeIdentifier AS_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "as").intern());
-    static final NodeIdentifier LACP_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "ce-lacp-mac-address").intern());
-    static final NodeIdentifier PK_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "ce-lacp-port-key").intern());
-    static final NodeIdentifier BRIDGE_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "root-bridge-mac-address").intern());
-    static final NodeIdentifier RBP_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "root-bridge-priority").intern());
-    static final NodeIdentifier SYSTEM_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "system-mac-address").intern());
-    static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "router-id").intern());
+    static final NodeIdentifier LD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "local-discriminator").intern());
+    static final NodeIdentifier ARB_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "arbitrary").intern());
+    static final NodeIdentifier AS_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "as").intern());
+    static final NodeIdentifier LACP_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "ce-lacp-mac-address").intern());
+    static final NodeIdentifier PK_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "ce-lacp-port-key").intern());
+    static final NodeIdentifier BRIDGE_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "root-bridge-mac-address").intern());
+    static final NodeIdentifier RBP_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "root-bridge-priority").intern());
+    static final NodeIdentifier SYSTEM_MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "system-mac-address").intern());
+    static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "router-id").intern());
 
     private EsiModelUtil() {
         throw new UnsupportedOperationException();
@@ -40,8 +49,9 @@ final class EsiModelUtil {
 
     static Arbitrary extractArbitrary(final ContainerNode esi) {
         final byte[] arbitrary = (byte[]) esi.getChild(ARB_NID).get().getValue();
-        Preconditions.checkArgument(arbitrary.length == ArbitraryParser.ARBITRARY_LENGTH, "Wrong length of array of bytes. Expected: %s Passed: %s " +
-            ";", ArbitraryParser.ARBITRARY_LENGTH, arbitrary.length);
+        Preconditions.checkArgument(arbitrary.length == ArbitraryParser.ARBITRARY_LENGTH,
+                "Wrong length of array of bytes. Expected: %s Passed: %s "
+                        + ";", ArbitraryParser.ARBITRARY_LENGTH, arbitrary.length);
         return new ArbitraryBuilder().setArbitrary(arbitrary).build();
     }
 
index a09af8cf4ee018e351359ca582f92aa7ef98a4d4..c134b332deeb64602f0839cd6a07e59b7108107b 100644 (file)
@@ -28,7 +28,8 @@ final class LacpParser extends AbstractEsiType {
 
     @Override
     public void serializeBody(final Esi esi, final ByteBuf body) {
-        Preconditions.checkArgument(esi instanceof LacpAutoGeneratedCase, "Unknown esi instance. Passed %s. Needed LacpAutoGeneratedCase.", esi.getClass());
+        Preconditions.checkArgument(esi instanceof LacpAutoGeneratedCase,
+                "Unknown esi instance. Passed %s. Needed LacpAutoGeneratedCase.", esi.getClass());
         final LacpAutoGenerated lacp = ((LacpAutoGeneratedCase) esi).getLacpAutoGenerated();
         body.writeBytes(IetfYangUtil.INSTANCE.bytesFor(lacp.getCeLacpMacAddress()));
         ByteBufWriteUtil.writeUnsignedShort(lacp.getCeLacpPortKey(), body);
index 587ca28bf019f5bdb1e346bdc29525395239723e..7523c0c8c0487a6b4703b65ce1be5b76b4e5989b 100644 (file)
@@ -28,7 +28,8 @@ final class LanParser extends AbstractEsiType {
 
     @Override
     public void serializeBody(final Esi esi, final ByteBuf body) {
-        Preconditions.checkArgument(esi instanceof LanAutoGeneratedCase, "Unknown esi instance. Passed %s. Needed LanAutoGeneratedCase.", esi.getClass());
+        Preconditions.checkArgument(esi instanceof LanAutoGeneratedCase,
+                "Unknown esi instance. Passed %s. Needed LanAutoGeneratedCase.", esi.getClass());
         final LanAutoGenerated lan = ((LanAutoGeneratedCase) esi).getLanAutoGenerated();
         body.writeBytes(IetfYangUtil.INSTANCE.bytesFor(lan.getRootBridgeMacAddress()));
         ByteBufWriteUtil.writeUnsignedShort(lan.getRootBridgePriority(), body);
@@ -51,7 +52,8 @@ final class LanParser extends AbstractEsiType {
     @Override
     public Esi parseEsi(final ByteBuf buffer) {
         final LanAutoGenerated t2 = new LanAutoGeneratedBuilder()
-            .setRootBridgeMacAddress(IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH)))
+            .setRootBridgeMacAddress(IetfYangUtil.INSTANCE
+                    .macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH)))
             .setRootBridgePriority(buffer.readUnsignedShort()).build();
         return new LanAutoGeneratedCaseBuilder().setLanAutoGenerated(t2).build();
     }
index 93f2ca91b9f4ad5756e555f6cdd0dd78e4d8603f..07a6941404a24b6cf43b7d07c5862c8975a92066 100644 (file)
@@ -29,7 +29,8 @@ final class MacParser extends AbstractEsiType {
 
     @Override
     public void serializeBody(final Esi esi, final ByteBuf body) {
-        Preconditions.checkArgument(esi instanceof MacAutoGeneratedCase, "Unknown esi instance. Passed %s. Needed MacAutoGeneratedCase.", esi.getClass());
+        Preconditions.checkArgument(esi instanceof MacAutoGeneratedCase,
+                "Unknown esi instance. Passed %s. Needed MacAutoGeneratedCase.", esi.getClass());
         final MacAutoGenerated macAuto = ((MacAutoGeneratedCase) esi).getMacAutoGenerated();
         body.writeBytes(IetfYangUtil.INSTANCE.bytesFor(macAuto.getSystemMacAddress()));
         ByteBufWriteUtil.writeMedium(macAuto.getLocalDiscriminator().getValue().intValue(), body);
index f282f9723157f66f6a111e38e97a5e394bee93fe..7a17154f25a2c89bb7e35373facb152b0e87df77 100644 (file)
@@ -27,7 +27,8 @@ final class RouterIdParser extends AbstractEsiType {
 
     @Override
     public void serializeBody(final Esi esi, final ByteBuf body) {
-        Preconditions.checkArgument(esi instanceof RouterIdGeneratedCase, "Unknown esi instance. Passed %s. Needed RouterIdGeneratedCase.", esi.getClass());
+        Preconditions.checkArgument(esi instanceof RouterIdGeneratedCase,
+                "Unknown esi instance. Passed %s. Needed RouterIdGeneratedCase.", esi.getClass());
         final RouterIdGenerated routerID = ((RouterIdGeneratedCase) esi).getRouterIdGenerated();
         ByteBufWriteUtil.writeIpv4Address(routerID.getRouterId(), body);
         ByteBufWriteUtil.writeUnsignedInt(routerID.getLocalDiscriminator(), body);
@@ -49,7 +50,8 @@ final class RouterIdParser extends AbstractEsiType {
 
     @Override
     public Esi parseEsi(final ByteBuf buffer) {
-        final RouterIdGenerated routerID = new RouterIdGeneratedBuilder().setRouterId(Ipv4Util.addressForByteBuf(buffer))
+        final RouterIdGenerated routerID = new RouterIdGeneratedBuilder()
+                .setRouterId(Ipv4Util.addressForByteBuf(buffer))
             .setLocalDiscriminator(buffer.readUnsignedInt()).build();
         return new RouterIdGeneratedCaseBuilder().setRouterIdGenerated(routerID).build();
     }
index 02c69bd6e6773bf3fea2da53ff29979469a23c6d..9f3e7efd8f01a464d9fcbf75e343d3792639b16f 100644 (file)
@@ -9,8 +9,6 @@ package org.opendaylight.protocol.bgp.evpn.impl.extended.communities;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-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.yang.types.rev130715.IetfYangUtil;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
@@ -25,18 +23,20 @@ public final class ESImpRouteTargetExtCom extends AbstractExtendedCommunities {
     private static final int MAC_ADDRESS_LENGTH = 6;
 
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf buffer) {
         final MacAddress mac = IetfYangUtil.INSTANCE.macAddressFor(ByteArray.readBytes(buffer, MAC_ADDRESS_LENGTH));
 
         return new EsImportRouteExtendedCommunityCaseBuilder().setEsImportRouteExtendedCommunity(
-            new EsImportRouteExtendedCommunityBuilder().setEsImport(mac).build()).build();
+                new EsImportRouteExtendedCommunityBuilder().setEsImport(mac).build()).build();
     }
 
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf byteAggregator) {
         Preconditions.checkArgument(extendedCommunity instanceof EsImportRouteExtendedCommunityCase,
-            "The extended community %s is not EsImportRouteExtendedCommunityCaseCase type.", extendedCommunity);
-        final EsImportRouteExtendedCommunity extCom = ((EsImportRouteExtendedCommunityCase) extendedCommunity).getEsImportRouteExtendedCommunity();
+                "The extended community %s is not EsImportRouteExtendedCommunityCaseCase type.",
+                extendedCommunity);
+        final EsImportRouteExtendedCommunity extCom = ((EsImportRouteExtendedCommunityCase) extendedCommunity)
+                .getEsImportRouteExtendedCommunity();
         byteAggregator.writeBytes(IetfYangUtil.INSTANCE.bytesFor(extCom.getEsImport()));
     }
 
index bbc54120eab5a300681a71c5809dd9ee9a9b7430..f3b97e40c12eddeb3b68700bdf71a9511730ca30 100644 (file)
@@ -11,8 +11,6 @@ package org.opendaylight.protocol.bgp.evpn.impl.extended.communities;
 import com.google.common.base.Preconditions;
 import com.google.common.primitives.UnsignedBytes;
 import io.netty.buffer.ByteBuf;
-import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
-import org.opendaylight.protocol.bgp.parser.BGPParsingException;
 import org.opendaylight.protocol.util.BitArray;
 import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.NormalizationType;
@@ -36,8 +34,15 @@ public class Layer2AttributesExtCom extends AbstractExtendedCommunities {
     private static final int THREE_BITS_SHIFT = 3;
     private static final int FIVE_BITS_SHIFT = 5;
 
+    private static short getFlagShort(final BitArray flags, final int index) {
+        short opMode = 0;
+        opMode |= flags.get(index + 1) ? 1 : 0;
+        opMode |= (flags.get(index) ? 1 : 0) << 1;
+        return opMode;
+    }
+
     @Override
-    public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) throws BGPDocumentedException, BGPParsingException {
+    public ExtendedCommunity parseExtendedCommunity(final ByteBuf body) {
         final Layer2AttributesExtendedCommunityBuilder builder = new Layer2AttributesExtendedCommunityBuilder();
         final BitArray flags = BitArray.valueOf(body, FLAGS_SIZE);
         builder.setBackupPe(flags.get(BACKUP_PE_OFFSET));
@@ -50,21 +55,16 @@ public class Layer2AttributesExtCom extends AbstractExtendedCommunities {
         builder.setL2Mtu(body.readUnsignedShort());
         body.skipBytes(RESERVED);
         return new Layer2AttributesExtendedCommunityCaseBuilder()
-            .setLayer2AttributesExtendedCommunity(builder.build()).build();
-    }
-
-    private static short getFlagShort(final BitArray flags, final int index) {
-        short opMode= 0;
-        opMode |= flags.get(index + 1) ? 1 : 0;
-        opMode |= (flags.get(index) ? 1 : 0) << 1;
-        return opMode;
+                .setLayer2AttributesExtendedCommunity(builder.build()).build();
     }
 
     @Override
     public void serializeExtendedCommunity(final ExtendedCommunity extendedCommunity, final ByteBuf body) {
         Preconditions.checkArgument(extendedCommunity instanceof Layer2AttributesExtendedCommunityCase,
-            "The extended community %s is not EsImportRouteExtendedCommunityCaseCase type.", extendedCommunity);
-        final Layer2AttributesExtendedCommunity extCom = ((Layer2AttributesExtendedCommunityCase) extendedCommunity).getLayer2AttributesExtendedCommunity();
+                "The extended community %s is not EsImportRouteExtendedCommunityCaseCase type.",
+                extendedCommunity);
+        final Layer2AttributesExtendedCommunity extCom = ((Layer2AttributesExtendedCommunityCase) extendedCommunity)
+                .getLayer2AttributesExtendedCommunity();
         final BitArray flags = new BitArray(FLAGS_SIZE);
         flags.set(PRIMARY_PE_OFFSET, extCom.isPrimaryPe());
         flags.set(BACKUP_PE_OFFSET, extCom.isBackupPe());
@@ -73,17 +73,17 @@ public class Layer2AttributesExtCom extends AbstractExtendedCommunities {
         final byte[] res = flags.array();
         byte aux = 0;
         final OperationalMode modeOfOperation = extCom.getModeOfOperation();
-        if ( modeOfOperation != null) {
+        if (modeOfOperation != null) {
             aux = UnsignedBytes.checkedCast(modeOfOperation.getIntValue());
             aux = (byte) (aux << THREE_BITS_SHIFT);
-            res[res.length -1] = (byte) (res[res.length -1] | aux);
+            res[res.length - 1] = (byte) (res[res.length - 1] | aux);
         }
 
         final NormalizationType normalizationType = extCom.getOperatingPer();
-        if ( normalizationType != null) {
+        if (normalizationType != null) {
             aux = UnsignedBytes.checkedCast(normalizationType.getIntValue());
             aux = (byte) (aux << FIVE_BITS_SHIFT);
-            res[res.length -1] = (byte) (res[res.length -1] | aux);
+            res[res.length - 1] = (byte) (res[res.length - 1] | aux);
         }
         ByteBufWriteUtil.writeUnsignedShort((int) res[res.length - 1], body);
         ByteBufWriteUtil.writeUnsignedShort(extCom.getL2Mtu(), body);
index 79513ca9dd31224409e5188e1bb838b76d794653..43b5ebfcf77847e3cb791b5fb1ac7d2b3462638d 100644 (file)
@@ -39,7 +39,7 @@ abstract class AbstractEvpnNlri implements EvpnParser, EvpnSerializer {
 
     protected abstract NlriType getType();
 
-    protected abstract ByteBuf serializeBody(final EvpnChoice evpn);
+    protected abstract ByteBuf serializeBody(EvpnChoice evpn);
 
     protected static Esi serializeEsi(final ContainerNode evpn) {
         return SimpleEsiTypeRegistry.getInstance().parseEsiModel((ChoiceNode) evpn.getChild(ESI_NID).get());
index 57820c0a761ce1e095f4958ef021e1da890c905b..10c54c096d94c415095de9fd4ba6b334a0e567a1 100644 (file)
@@ -32,16 +32,18 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 final class EthADRParser extends AbstractEvpnNlri {
-    protected static final NodeIdentifier ETH_AD_ROUTE_NID = new NodeIdentifier(EthernetADRoute.QNAME);
+    static final NodeIdentifier ETH_AD_ROUTE_NID = new NodeIdentifier(EthernetADRoute.QNAME);
     private static final int CONTENT_LENGTH = 17;
 
     @Override
     public EvpnChoice parseEvpn(final ByteBuf buffer) {
-        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH, "Wrong length of array of bytes. Passed: %s ;", buffer);
+        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH,
+                "Wrong length of array of bytes. Passed: %s ;", buffer);
         final Esi esi = SimpleEsiTypeRegistry.getInstance().parseEsi(buffer.readSlice(ESI_SIZE));
         final EthernetTagId eti = new EthernetTagIdBuilder().setVlanId(buffer.readUnsignedInt()).build();
         final MplsLabel label = mplsLabelForByteBuf(buffer);
-        final EthernetADRouteBuilder builder = new EthernetADRouteBuilder().setEsi(esi).setEthernetTagId(eti).setMplsLabel(label);
+        final EthernetADRouteBuilder builder = new EthernetADRouteBuilder()
+                .setEsi(esi).setEthernetTagId(eti).setMplsLabel(label);
         return new EthernetADRouteCaseBuilder().setEthernetADRoute(builder.build()).build();
     }
 
@@ -51,9 +53,20 @@ final class EthADRParser extends AbstractEvpnNlri {
     }
 
     @Override
-    public ByteBuf serializeBody(final EvpnChoice evpn) {
-        Preconditions.checkArgument(evpn instanceof EthernetADRouteCase, "Unknown evpn instance. Passed %s. Needed EthernetADRouteCase.", evpn.getClass());
-        return serializeBody(((EthernetADRouteCase) evpn).getEthernetADRoute());
+    public ByteBuf serializeBody(final EvpnChoice evpnChoice) {
+        Preconditions.checkArgument(evpnChoice instanceof EthernetADRouteCase,
+                "Unknown evpn instance. Passed %s. Needed EthernetADRouteCase.", evpnChoice.getClass());
+
+        final EthernetADRoute evpn = ((EthernetADRouteCase) evpnChoice).getEthernetADRoute();
+        final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
+        SimpleEsiTypeRegistry.getInstance().serializeEsi(evpn.getEsi(), body);
+        ByteBufWriteUtil.writeUnsignedInt(evpn.getEthernetTagId().getVlanId(), body);
+
+        final MplsLabel mpls = evpn.getMplsLabel();
+        if (mpls != null) {
+            body.writeBytes(byteBufForMplsLabel(evpn.getMplsLabel()));
+        }
+        return body;
     }
 
     @Override
@@ -74,16 +87,4 @@ final class EthADRParser extends AbstractEvpnNlri {
         builder.setEthernetTagId(extractETI(evpn));
         return builder;
     }
-
-    private static ByteBuf serializeBody(final EthernetADRoute evpn) {
-        final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
-        SimpleEsiTypeRegistry.getInstance().serializeEsi(evpn.getEsi(), body);
-        ByteBufWriteUtil.writeUnsignedInt(evpn.getEthernetTagId().getVlanId(), body);
-
-        final MplsLabel mpls = evpn.getMplsLabel();
-        if (mpls != null) {
-            body.writeBytes(byteBufForMplsLabel(evpn.getMplsLabel()));
-        }
-        return body;
-    }
 }
\ No newline at end of file
index e09a2f6027f547a715d4ccb912d2648f6505f263..c83512aaea59b55c43203a7bc45cab5e14a5b421 100644 (file)
@@ -29,13 +29,14 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 final class EthSegRParser extends AbstractEvpnNlri {
-    protected static final NodeIdentifier ES_ROUTE_NID = new NodeIdentifier(EsRoute.QNAME);
+    static final NodeIdentifier ES_ROUTE_NID = new NodeIdentifier(EsRoute.QNAME);
     private static final int CONTENT_LENGTH = 15;
     private static final int CONTENT_LENGTH2 = 27;
 
     @Override
     public EvpnChoice parseEvpn(final ByteBuf buffer) {
-        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH || buffer.readableBytes() == CONTENT_LENGTH2,
+        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH
+                        || buffer.readableBytes() == CONTENT_LENGTH2,
             "Wrong length of array of bytes. Passed: %s ;", buffer);
 
         final Esi esi = SimpleEsiTypeRegistry.getInstance().parseEsi(buffer.readSlice(ESI_SIZE));
@@ -52,9 +53,15 @@ final class EthSegRParser extends AbstractEvpnNlri {
 
     @Override
     public ByteBuf serializeBody(final EvpnChoice evpnInput) {
-        Preconditions.checkArgument(evpnInput instanceof EsRouteCase, "Unknown evpn instance. Passed %s. Needed EsRouteCase.",
-            evpnInput.getClass());
-        return serializeBody(((EsRouteCase) evpnInput).getEsRoute());
+        Preconditions.checkArgument(evpnInput instanceof EsRouteCase,
+                "Unknown evpn instance. Passed %s. Needed EsRouteCase.", evpnInput.getClass());
+        final EsRoute evpn = ((EsRouteCase) evpnInput).getEsRoute();
+        final ByteBuf body = Unpooled.buffer();
+        SimpleEsiTypeRegistry.getInstance().serializeEsi(evpn.getEsi(), body);
+        final ByteBuf orig = serializeOrigRouteIp(evpn.getOrigRouteIp());
+        Preconditions.checkArgument(orig.readableBytes() > 0);
+        body.writeBytes(orig);
+        return body;
     }
 
     @Override
@@ -70,16 +77,7 @@ final class EthSegRParser extends AbstractEvpnNlri {
         return new EsRouteCaseBuilder().setEsRoute(builder.build()).build();
     }
 
-    private static ByteBuf serializeBody(final EsRoute evpn) {
-        final ByteBuf body = Unpooled.buffer();
-        SimpleEsiTypeRegistry.getInstance().serializeEsi(evpn.getEsi(), body);
-        final ByteBuf orig = serializeOrigRouteIp(evpn.getOrigRouteIp());
-        Preconditions.checkArgument(orig.readableBytes() > 0);
-        body.writeBytes(orig);
-        return body;
-    }
-
-    public static IpAddress parseOrigRouteIp(final ByteBuf buffer) {
+    static IpAddress parseOrigRouteIp(final ByteBuf buffer) {
         final int ipLength = buffer.readUnsignedByte();
         if (ipLength == Ipv6Util.IPV6_BITS_LENGTH) {
             return new IpAddress(Ipv6Util.addressForByteBuf(buffer));
index 87575ae1bab778808f2780dfa252f2582509a533..84dda24bde6f96a8b8685c7b6e918dd1f406b2f7 100644 (file)
@@ -60,7 +60,8 @@ public final class EvpnNlriParser implements NlriParser, NlriSerializer {
         return extractDestination(evpnChoice, EvpnRegistry::serializeEvpnModel);
     }
 
-    private static EvpnDestination extractDestination(final DataContainerNode<? extends PathArgument> evpnChoice, final ExtractionInterface extract) {
+    private static EvpnDestination extractDestination(final DataContainerNode<? extends PathArgument> evpnChoice,
+            final ExtractionInterface extract) {
         final EvpnRegistry reg = SimpleEvpnNlriRegistry.getInstance();
         final ChoiceNode cont = (ChoiceNode) evpnChoice.getChild(EVPN_CHOICE_NID).get();
         final EvpnChoice evpnValue = extract.check(reg, cont);
@@ -68,10 +69,12 @@ public final class EvpnNlriParser implements NlriParser, NlriSerializer {
             LOG.warn("Unrecognized Nlri {}", cont);
             return null;
         }
-        return new EvpnDestinationBuilder().setRouteDistinguisher(extractRouteDistinguisher(evpnChoice)).setEvpnChoice(evpnValue).build();
+        return new EvpnDestinationBuilder().setRouteDistinguisher(extractRouteDistinguisher(evpnChoice))
+                .setEvpnChoice(evpnValue).build();
     }
 
-    public static EvpnDestination extractRouteKeyDestination(final DataContainerNode<? extends PathArgument> evpnChoice) {
+    public static EvpnDestination extractRouteKeyDestination(
+            final DataContainerNode<? extends PathArgument> evpnChoice) {
         return extractDestination(evpnChoice, EvpnRegistry::serializeEvpnRouteKey);
     }
 
@@ -83,10 +86,11 @@ public final class EvpnNlriParser implements NlriParser, NlriSerializer {
         final List<EvpnDestination> dst = parseNlri(nlri);
 
         builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
-            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.
-                routes.destination.type.DestinationEvpnCaseBuilder().setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.
-                yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.evpn._case.DestinationEvpnBuilder()
-                .setEvpnDestination(dst).build()).build()).build());
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes
+                    .mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder()
+                    .setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
+                            .rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination
+                            .evpn._case.DestinationEvpnBuilder().setEvpnDestination(dst).build()).build()).build());
     }
 
     @Override
@@ -97,7 +101,8 @@ public final class EvpnNlriParser implements NlriParser, NlriSerializer {
         final List<EvpnDestination> dst = parseNlri(nlri);
 
         builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
-            new DestinationEvpnCaseBuilder().setDestinationEvpn(new DestinationEvpnBuilder().setEvpnDestination(dst).build()).build()).build());
+            new DestinationEvpnCaseBuilder().setDestinationEvpn(new DestinationEvpnBuilder()
+                    .setEvpnDestination(dst).build()).build()).build());
     }
 
     @Nullable
@@ -134,19 +139,22 @@ public final class EvpnNlriParser implements NlriParser, NlriSerializer {
         } else if (pathAttributes2 != null) {
             final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri();
             final WithdrawnRoutes withdrawnRoutes = mpUnreachNlri.getWithdrawnRoutes();
-            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
-                .ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) {
-                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.
-                    routes.destination.type.DestinationEvpnCase evpnCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
-                    .ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
+            if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType()
+                    instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213
+                    .update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) {
+                final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update
+                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase evpnCase =
+                        (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update
+                                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                                .DestinationEvpnCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
                 serializeNlri(evpnCase.getDestinationEvpn().getEvpnDestination(), byteAggregator);
             }
         }
     }
 
-    public static void serializeNlri(final List<EvpnDestination> cEvpn, final ByteBuf output) {
+    public static void serializeNlri(final List<EvpnDestination> destinationList, final ByteBuf output) {
         ByteBuf nlriOutput = null;
-        for (final EvpnDestination dest : cEvpn) {
+        for (final EvpnDestination dest : destinationList) {
             final ByteBuf nlriCommon = Unpooled.buffer();
             serializeRouteDistinquisher(dest.getRouteDistinguisher(), nlriCommon);
             nlriOutput = SimpleEvpnNlriRegistry.getInstance().serializeEvpn(dest.getEvpnChoice(), nlriCommon);
index e3bad4109aa34ecb3da99fc60fa2320870a73683..21c647a6e751d5b3a0d66948541ed5502bca049d 100644 (file)
@@ -29,18 +29,27 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 final class IncMultEthTagRParser extends AbstractEvpnNlri {
-    protected static final NodeIdentifier INC_MULT_ROUTE_NID = new NodeIdentifier(IncMultiEthernetTagRes.QNAME);
+    static final NodeIdentifier INC_MULT_ROUTE_NID = new NodeIdentifier(IncMultiEthernetTagRes.QNAME);
     private static final int CONTENT_LENGTH = 9;
     private static final int CONTENT_LENGTH2 = 21;
 
+    private static EvpnChoice serializeModel(final ContainerNode evpn) {
+        final IncMultiEthernetTagResBuilder builder = new IncMultiEthernetTagResBuilder();
+        builder.setEthernetTagId(extractETI(evpn));
+        builder.setOrigRouteIp(extractOrigRouteIp(evpn));
+        return new IncMultiEthernetTagResCaseBuilder().setIncMultiEthernetTagRes(builder.build()).build();
+    }
+
     @Override
     public EvpnChoice parseEvpn(final ByteBuf buffer) {
-        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH || buffer.readableBytes() == CONTENT_LENGTH2,
-            "Wrong length of array of bytes. Passed: %s ;", buffer);
+        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH
+                        || buffer.readableBytes() == CONTENT_LENGTH2,
+                "Wrong length of array of bytes. Passed: %s ;", buffer);
 
         final EthernetTagId eti = new EthernetTagIdBuilder().setVlanId(buffer.readUnsignedInt()).build();
         IpAddress ip = requireNonNull(EthSegRParser.parseOrigRouteIp(buffer));
-        final IncMultiEthernetTagResBuilder builder = new IncMultiEthernetTagResBuilder().setEthernetTagId(eti).setOrigRouteIp(ip);
+        final IncMultiEthernetTagResBuilder builder = new IncMultiEthernetTagResBuilder()
+                .setEthernetTagId(eti).setOrigRouteIp(ip);
         return new IncMultiEthernetTagResCaseBuilder().setIncMultiEthernetTagRes(builder.build()).build();
     }
 
@@ -50,31 +59,27 @@ final class IncMultEthTagRParser extends AbstractEvpnNlri {
     }
 
     @Override
-    public ByteBuf serializeBody(final EvpnChoice evpn) {
-        Preconditions.checkArgument(evpn instanceof IncMultiEthernetTagResCase, "Unknown evpn instance. Passed %s. Needed IncMultiEthernetTagResCase.",
-            evpn.getClass());
-        return serializeBody(((IncMultiEthernetTagResCase) evpn).getIncMultiEthernetTagRes());
+    public ByteBuf serializeBody(final EvpnChoice evpnChoice) {
+        Preconditions.checkArgument(evpnChoice instanceof IncMultiEthernetTagResCase,
+                "Unknown evpn instance. Passed %s. Needed IncMultiEthernetTagResCase.",
+                evpnChoice.getClass());
+
+        final IncMultiEthernetTagRes evpn = ((IncMultiEthernetTagResCase) evpnChoice).getIncMultiEthernetTagRes();
+        final ByteBuf body = Unpooled.buffer();
+        ByteBufWriteUtil.writeUnsignedInt(evpn.getEthernetTagId().getVlanId(), body);
+        final ByteBuf orig = EthSegRParser.serializeOrigRouteIp(evpn.getOrigRouteIp());
+        Preconditions.checkArgument(orig.readableBytes() > 0);
+        body.writeBytes(orig);
+        return body;
     }
 
     @Override
     public EvpnChoice serializeEvpnModel(final ContainerNode evpn) {
-        return createRouteKey(evpn);
+        return serializeModel(evpn);
     }
 
     @Override
     public EvpnChoice createRouteKey(final ContainerNode evpn) {
-        final IncMultiEthernetTagResBuilder builder = new IncMultiEthernetTagResBuilder();
-        builder.setEthernetTagId(extractETI(evpn));
-        builder.setOrigRouteIp(extractOrigRouteIp(evpn));
-        return new IncMultiEthernetTagResCaseBuilder().setIncMultiEthernetTagRes(builder.build()).build();
-    }
-
-    private static ByteBuf serializeBody(final IncMultiEthernetTagRes evpn) {
-        final ByteBuf body = Unpooled.buffer();
-        ByteBufWriteUtil.writeUnsignedInt(evpn.getEthernetTagId().getVlanId(), body);
-        final ByteBuf orig = EthSegRParser.serializeOrigRouteIp(evpn.getOrigRouteIp());
-        Preconditions.checkArgument(orig.readableBytes() > 0);
-        body.writeBytes(orig);
-        return body;
+        return serializeModel(evpn);
     }
 }
index 6dc7e731cb073190a7c83cd1c96ce9a88b8ca676..0cf4e36f4d04498c4e46df5779b84e49c2db8e56 100644 (file)
@@ -59,7 +59,8 @@ final class MACIpAdvRParser extends AbstractEvpnNlri {
         } else {
             label2 = null;
         }
-        final MacIpAdvRouteBuilder builder = new MacIpAdvRouteBuilder().setEsi(esi).setEthernetTagId(eti).setMacAddress(mac).setIpAddress(ip)
+        final MacIpAdvRouteBuilder builder = new MacIpAdvRouteBuilder().setEsi(esi).setEthernetTagId(eti)
+                .setMacAddress(mac).setIpAddress(ip)
             .setMplsLabel1(label1).setMplsLabel2(label2);
         return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(builder.build()).build();
     }
@@ -70,36 +71,12 @@ final class MACIpAdvRParser extends AbstractEvpnNlri {
     }
 
     @Override
-    public ByteBuf serializeBody(final EvpnChoice evpn) {
-        Preconditions.checkArgument(evpn instanceof MacIpAdvRouteCase, "Unknown evpn instance. Passed %s. Needed MacIpAdvRouteCase.", evpn.getClass());
-        return serializeBody((MacIpAdvRouteCase) evpn);
-    }
-
-    @Override
-    public EvpnChoice serializeEvpnModel(final ContainerNode evpn) {
-        final MacIpAdvRouteBuilder builder = serializeKeyModel(evpn);
-        builder.setEsi(serializeEsi(evpn));
-        builder.setMplsLabel1(extractMplsLabel(evpn, MPLS1_NID));
-        builder.setMplsLabel2(extractMplsLabel(evpn, MPLS2_NID));
-        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(builder.build()).build();
-    }
-
-    @Override
-    public EvpnChoice createRouteKey(final ContainerNode evpn) {
-        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(serializeKeyModel(evpn).build()).build();
-    }
-
-    private static MacIpAdvRouteBuilder serializeKeyModel(final ContainerNode evpn) {
-        final MacIpAdvRouteBuilder builder = new MacIpAdvRouteBuilder();
-        builder.setEthernetTagId(extractETI(evpn));
-        builder.setMacAddress(extractMAC(evpn));
-        builder.setIpAddress(extractIp(evpn));
-        return builder;
-    }
+    public ByteBuf serializeBody(final EvpnChoice evpnChoice) {
+        Preconditions.checkArgument(evpnChoice instanceof MacIpAdvRouteCase,
+                "Unknown evpn instance. Passed %s. Needed MacIpAdvRouteCase.", evpnChoice.getClass());
 
-    private static ByteBuf serializeBody(final MacIpAdvRouteCase evpnCase) {
         final ByteBuf body = Unpooled.buffer();
-        final MacIpAdvRoute evpn = evpnCase.getMacIpAdvRoute();
+        final MacIpAdvRoute evpn = ((MacIpAdvRouteCase) evpnChoice).getMacIpAdvRoute();
         final Esi esi = evpn.getEsi();
         if (esi != null) {
             SimpleEsiTypeRegistry.getInstance().serializeEsi(evpn.getEsi(), body);
@@ -123,6 +100,28 @@ final class MACIpAdvRParser extends AbstractEvpnNlri {
         return body;
     }
 
+    @Override
+    public EvpnChoice serializeEvpnModel(final ContainerNode evpn) {
+        final MacIpAdvRouteBuilder builder = serializeKeyModel(evpn);
+        builder.setEsi(serializeEsi(evpn));
+        builder.setMplsLabel1(extractMplsLabel(evpn, MPLS1_NID));
+        builder.setMplsLabel2(extractMplsLabel(evpn, MPLS2_NID));
+        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(builder.build()).build();
+    }
+
+    @Override
+    public EvpnChoice createRouteKey(final ContainerNode evpn) {
+        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(serializeKeyModel(evpn).build()).build();
+    }
+
+    private static MacIpAdvRouteBuilder serializeKeyModel(final ContainerNode evpn) {
+        final MacIpAdvRouteBuilder builder = new MacIpAdvRouteBuilder();
+        builder.setEthernetTagId(extractETI(evpn));
+        builder.setMacAddress(extractMAC(evpn));
+        builder.setIpAddress(extractIp(evpn));
+        return builder;
+    }
+
     private static ByteBuf serializeIp(final IpAddress ipAddress) {
         final ByteBuf body = Unpooled.buffer();
         if (ipAddress != null) {
index dbec267b7bb63bf8b99bc6e3c9451e04f6930f1f..c0b082b7f7b1451f3d2547dda66971b8c6359826 100644 (file)
@@ -23,15 +23,24 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
 
 final class NlriModelUtil {
-    static final NodeIdentifier ETI_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "ethernet-tag-id").intern());
-    static final NodeIdentifier VLAN_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "vlan-id").intern());
-    static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "route-distinguisher").intern());
-    static final NodeIdentifier ORI_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "orig-route-ip").intern());
-    static final NodeIdentifier MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "mac-address").intern());
-    static final NodeIdentifier IP_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "ip-address").intern());
-    static final NodeIdentifier MPLS_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "mpls-label").intern());
-    static final NodeIdentifier MPLS1_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "mpls-label1").intern());
-    static final NodeIdentifier MPLS2_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME, "mpls-label2").intern());
+    static final NodeIdentifier ETI_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "ethernet-tag-id").intern());
+    static final NodeIdentifier VLAN_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "vlan-id").intern());
+    static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "route-distinguisher").intern());
+    static final NodeIdentifier ORI_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "orig-route-ip").intern());
+    static final NodeIdentifier MAC_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "mac-address").intern());
+    static final NodeIdentifier IP_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "ip-address").intern());
+    static final NodeIdentifier MPLS_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "mpls-label").intern());
+    static final NodeIdentifier MPLS1_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "mpls-label1").intern());
+    static final NodeIdentifier MPLS2_NID = NodeIdentifier.create(QName.create(EvpnChoice.QNAME,
+            "mpls-label2").intern());
 
     private NlriModelUtil() {
         throw new UnsupportedOperationException();
@@ -63,7 +72,8 @@ final class NlriModelUtil {
         return null;
     }
 
-    static MplsLabel extractMplsLabel(final DataContainerNode<? extends PathArgument> evpn, final NodeIdentifier mplsNid) {
+    static MplsLabel extractMplsLabel(final DataContainerNode<? extends PathArgument> evpn,
+            final NodeIdentifier mplsNid) {
         if (evpn.getChild(mplsNid).isPresent()) {
             return new MplsLabel((Long) evpn.getChild(mplsNid).get().getValue());
         }
index 9b952b8774d05765b9ffac43174ce06b6e01c170..c23992471653a79c99522f8794e1235148f896e2 100644 (file)
@@ -14,7 +14,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 
 public interface EsiParser {
     /**
-     * Parse Ethernet Segment Identifier
+     * Parse Ethernet Segment Identifier.
      *
      * @param buffer encoded ESI body in Bytebuf
      * @return Ethernet Segment Identifier
index 2fc8b8b5d75fbdf061cbdc13e53dc9b7694c3e31..7ad3a11ac8e122368953551be25890e9e53e2118 100644 (file)
@@ -10,30 +10,31 @@ package org.opendaylight.protocol.bgp.evpn.spi;
 
 import io.netty.buffer.ByteBuf;
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.esi.Esi;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 
 public interface EsiRegistry {
     /**
-     * Parse Esi
+     * Parse Esi.
      *
      * @param buffer encoded ESI body in Bytebuf
      * @return Ethernet Segment Identifier
      */
-    @Nonnull
+    @Nullable
     Esi parseEsi(@Nonnull ByteBuf buffer);
 
     /**
-     * Parse Esi Model
+     * Parse Esi Model.
      *
      * @param esi ChoiceNode containing ESI
      * @return Ethernet Segment Identifier
      */
-    @Nonnull
+    @Nullable
     Esi parseEsiModel(@Nonnull ChoiceNode esi);
 
     /**
-     * Serialize Esi
+     * Serialize Esi.
      *
      * @param esi    Ethernet Segment Identifier
      * @param buffer write in Bytebuf encoded ESI body
index 653a8e1bcbb83e97bc878dce2214632cc9d456c2..4e514e49a3e8da791cca8b1e9c137439cbf727a3 100644 (file)
@@ -15,7 +15,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 public interface EsiSerializer {
     /**
-     * Serialize Ethernet Segment Identifier
+     * Serialize Ethernet Segment Identifier.
      *
      * @param esi    Ethernet Segment Identifier
      * @param buffer write in Bytebuf encoded ESI body
@@ -23,7 +23,7 @@ public interface EsiSerializer {
     void serializeEsi(@Nonnull Esi esi, @Nonnull ByteBuf buffer);
 
     /**
-     * Serialize Ethernet Segment Identifier Model
+     * Serialize Ethernet Segment Identifier Model.
      *
      * @param esi Ethernet Segment Identifier Model
      * @return Ethernet Segment Identifier
index dba457f2d637e39093aacabf9ad8a2258028e15a..335c409389cafe74169ed77f7c324381561a3790 100644 (file)
@@ -26,7 +26,7 @@ public interface EvpnRegistry {
     @Nullable EvpnChoice parseEvpn(@Nonnull NlriType type, @Nonnull ByteBuf buffer);
 
     /**
-     * Encode input BGP Evpn to output buffer
+     * Encode input BGP Evpn to output buffer.
      *
      * @param evpn EvpnChoice
      * @param common encoded common Evpn
@@ -40,13 +40,13 @@ public interface EvpnRegistry {
      * @param evpnChoice ChoiceNode containing Evpn
      * @return EvpnChoice
      */
-    @Nonnull EvpnChoice serializeEvpnModel(@Nonnull ChoiceNode evpnChoice);
+    @Nullable EvpnChoice serializeEvpnModel(@Nonnull ChoiceNode evpnChoice);
 
     /**
-     * Create Route key from Evpn model
+     * Create Route key from Evpn model.
      *
      * @param evpnChoice ChoiceNode containing Evpn
      * @return EvpnChoice
      */
-    @Nonnull EvpnChoice serializeEvpnRouteKey(@Nonnull ChoiceNode evpnChoice);
+    @Nullable EvpnChoice serializeEvpnRouteKey(@Nonnull ChoiceNode evpnChoice);
 }
index 7d9d380f36c2bed06a38acc3de43cae0ee8a61b3..f9ba582b8724465c373dfc59c4c81cb4f247ac16 100644 (file)
@@ -15,6 +15,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 public interface EvpnSerializer {
     /**
+     * Serialize Evpn.
+     *
      * @param evpn   Evpn
      * @param buffer Encode common Evpn parts to output buffer
      * @return Encode Evpn to output buffer
@@ -23,7 +25,7 @@ public interface EvpnSerializer {
     ByteBuf serializeEvpn(@Nonnull EvpnChoice evpn, @Nonnull ByteBuf buffer);
 
     /**
-     * Serialize Evpn
+     * Serialize Evpn Model.
      *
      * @param evpn ChoiceNode containing Evpn
      * @return Evpn
@@ -32,7 +34,7 @@ public interface EvpnSerializer {
     EvpnChoice serializeEvpnModel(@Nonnull ContainerNode evpn);
 
     /**
-     * create Route key from Evpn model
+     * create Route key from Evpn model.
      *
      * @param evpn ContainerNode containing Evpn
      * @return Evpn
index c23221dbbe7ce54255d59815a16a9d70a72a47b7..c8e56a5c415ce0baf0c5daf3141410cf2b259ec3 100644 (file)
@@ -49,14 +49,16 @@ public final class SimpleEsiTypeRegistry implements EsiRegistry {
         return this.handlers.registerSerializer(esiType, serializer);
     }
 
-    public AutoCloseable registerEsiModelSerializer(final QName qName, final EsiSerializer serializer) {
-        return this.modelHandlers.register(new NodeIdentifier(qName), serializer);
+    public AutoCloseable registerEsiModelSerializer(final QName qname, final EsiSerializer serializer) {
+        return this.modelHandlers.register(new NodeIdentifier(qname), serializer);
     }
 
     @Override
     public Esi parseEsi(final ByteBuf buffer) {
-        Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
-        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH, "Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ";");
+        Preconditions.checkArgument(buffer != null && buffer.isReadable(),
+                "Array of bytes is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(buffer.readableBytes() == CONTENT_LENGTH,
+                "Wrong length of array of bytes. Passed: " + buffer.readableBytes() + ";");
 
         final EsiParser parser = this.handlers.getParser(EsiType.forValue(buffer.readByte()).getIntValue());
         if (parser == null) {
@@ -67,7 +69,8 @@ public final class SimpleEsiTypeRegistry implements EsiRegistry {
 
     @Override
     public Esi parseEsiModel(final ChoiceNode esiChoice) {
-        Preconditions.checkArgument(esiChoice != null && !esiChoice.getValue().isEmpty(), "ESI is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(esiChoice != null && !esiChoice.getValue().isEmpty(),
+                "ESI is mandatory. Can't be null or empty.");
         final ContainerNode cont = (ContainerNode) Iterables.getOnlyElement(esiChoice.getValue());
         final EsiSerializer serializer = this.modelHandlers.get(cont.getIdentifier());
         if (serializer != null) {
index 93d41f12909d7cfdfc7064a62474cf84f94288f0..c73fcf88060a3e87e66c71423f377e878c5f7273 100644 (file)
@@ -45,17 +45,19 @@ public final class SimpleEvpnNlriRegistry implements EvpnRegistry {
         return this.handlers.registerParser(esiType.getIntValue(), parser);
     }
 
-    public AutoCloseable registerNlriSerializer(final Class<? extends EvpnChoice> evpnClass, final EvpnSerializer serializer) {
+    public AutoCloseable registerNlriSerializer(final Class<? extends EvpnChoice> evpnClass,
+            final EvpnSerializer serializer) {
         return this.handlers.registerSerializer(evpnClass, serializer);
     }
 
-    public AutoCloseable registerNlriModelSerializer(final QName qName, final EvpnSerializer serializer) {
-        return this.modelHandlers.register(new NodeIdentifier(qName), serializer);
+    public AutoCloseable registerNlriModelSerializer(final QName qname, final EvpnSerializer serializer) {
+        return this.modelHandlers.register(new NodeIdentifier(qname), serializer);
     }
 
     @Override
     public EvpnChoice parseEvpn(final NlriType type, final ByteBuf buffer) {
-        Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(buffer != null && buffer.isReadable(),
+                "Array of bytes is mandatory. Can't be null or empty.");
         final EvpnParser parser = this.handlers.getParser(type.getIntValue());
         if (parser == null) {
             return null;
@@ -83,7 +85,8 @@ public final class SimpleEvpnNlriRegistry implements EvpnRegistry {
     }
 
     private EvpnChoice getEvpnCase(final ChoiceNode evpnChoice, final SerializerInterface serializerInterface) {
-        Preconditions.checkArgument(evpnChoice != null && !evpnChoice.getValue().isEmpty(), "Evpn case is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(evpnChoice != null && !evpnChoice.getValue().isEmpty(),
+                "Evpn case is mandatory. Can't be null or empty.");
         final ContainerNode cont = (ContainerNode) Iterables.getOnlyElement(evpnChoice.getValue());
         final EvpnSerializer serializer = this.modelHandlers.get(cont.getIdentifier());
         if (serializer == null) {
index 145b49b71e6a37a5d26c45965805e9d581482aa1..fcf62ed4a7f89c7e1d3e94a314e8f188ac6c7fd1 100644 (file)
@@ -9,6 +9,8 @@ package org.opendaylight.protocol.bgp.evpn.impl;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.opendaylight.protocol.bgp.evpn.impl.BGPActivator.EVPN_SAFI;
+import static org.opendaylight.protocol.bgp.evpn.impl.BGPActivator.L2VPN_AFI;
 
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.parser.spi.BGPExtensionProviderContext;
@@ -21,11 +23,12 @@ public class BGPActivatorTest {
     public void testActivator() throws Exception {
         final BGPActivator act = new BGPActivator();
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
-        assertNull(context.getAddressFamilyRegistry().classForFamily(25));
-        assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(70));
+        assertNull(context.getAddressFamilyRegistry().classForFamily(L2VPN_AFI));
+        assertNull(context.getSubsequentAddressFamilyRegistry().classForFamily(EVPN_SAFI));
         act.start(context);
-        assertEquals(L2vpnAddressFamily.class, context.getAddressFamilyRegistry().classForFamily(25));
-        assertEquals(EvpnSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry().classForFamily(70));
+        assertEquals(L2vpnAddressFamily.class, context.getAddressFamilyRegistry().classForFamily(L2VPN_AFI));
+        assertEquals(EvpnSubsequentAddressFamily.class, context.getSubsequentAddressFamilyRegistry()
+                .classForFamily(EVPN_SAFI));
         act.close();
     }
 }
\ No newline at end of file
index 2ba829d20dc7fffeac22bc5cd2fa4a1c2c78f15b..20a4790adc4c886fb5d53e236ec7444da5ce4b3c 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.protocol.bgp.evpn.impl;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.RD;
@@ -56,23 +55,32 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
     private static final EvpnRibSupport RIB_SUPPORT = EvpnRibSupport.getInstance();
     private static final EvpnRoute ROUTE;
     private static final EvpnRouteKey ROUTE_KEY;
-    private static final EvpnDestination EVPN_DESTINATION = new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE).build();
-    private static final DestinationEvpnCase REACH_NLRI = new DestinationEvpnCaseBuilder().setDestinationEvpn(new DestinationEvpnBuilder()
-        .setEvpnDestination(Collections.singletonList(EVPN_DESTINATION)).build()).build();
-    private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase UNREACH_NLRI =
-        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.
-            DestinationEvpnCaseBuilder().setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.evpn._case.
-            DestinationEvpnBuilder().setEvpnDestination(Collections.singletonList(EVPN_DESTINATION)).build()).build();
+    private static final EvpnDestination EVPN_DESTINATION = new EvpnDestinationBuilder().setRouteDistinguisher(RD)
+            .setEvpnChoice(ETHERNET_AD_ROUTE_CASE).build();
+    private static final DestinationEvpnCase REACH_NLRI = new DestinationEvpnCaseBuilder()
+            .setDestinationEvpn(new DestinationEvpnBuilder()
+                    .setEvpnDestination(Collections.singletonList(EVPN_DESTINATION)).build()).build();
+    private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update
+            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase UNREACH_NLRI =
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes
+                    .mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder()
+                    .setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
+                            .rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                            .destination.evpn._case.DestinationEvpnBuilder()
+                            .setEvpnDestination(Collections.singletonList(EVPN_DESTINATION)).build()).build();
 
     private static final EvpnRoutes EVPN_ROUTES;
+
     static {
         final BGPActivator act = new BGPActivator();
         final BGPExtensionProviderContext context = new SimpleBGPExtensionProviderContext();
         act.start(context);
         final ByteBuf buffer = Unpooled.buffer();
-        EvpnNlriParser.serializeNlri(Collections.singletonList(new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE_KEY).build()), buffer);
+        EvpnNlriParser.serializeNlri(Collections.singletonList(new EvpnDestinationBuilder()
+                .setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE_KEY).build()), buffer);
         ROUTE_KEY = new EvpnRouteKey(ByteArray.encodeBase64(buffer));
-        ROUTE = new EvpnRouteBuilder().setRouteKey(ROUTE_KEY.getRouteKey()).setAttributes(ATTRIBUTES).setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE).build();
+        ROUTE = new EvpnRouteBuilder().setRouteKey(ROUTE_KEY.getRouteKey())
+                .setAttributes(ATTRIBUTES).setRouteDistinguisher(RD).setEvpnChoice(ETHERNET_AD_ROUTE_CASE).build();
         EVPN_ROUTES = new EvpnRoutesBuilder().setEvpnRoute(Collections.singletonList(ROUTE)).build();
     }
 
@@ -86,7 +94,8 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testDeleteRoutes() {
         RIB_SUPPORT.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<EvpnRoute> instanceIdentifier = (InstanceIdentifier<EvpnRoute>) this.deletedRoutes.get(0);
+        @SuppressWarnings("unchecked") final InstanceIdentifier<EvpnRoute> instanceIdentifier =
+                (InstanceIdentifier<EvpnRoute>) this.deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(EvpnRoute.class));
     }
 
@@ -100,7 +109,8 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testEmptyRoute() throws Exception {
-        final Routes empty = new EvpnRoutesCaseBuilder().setEvpnRoutes(new EvpnRoutesBuilder().setEvpnRoute(Collections.emptyList()).build()).build();
+        final Routes empty = new EvpnRoutesCaseBuilder().setEvpnRoutes(
+                new EvpnRoutesBuilder().setEvpnRoute(Collections.emptyList()).build()).build();
         final ChoiceNode emptyRoutes = RIB_SUPPORT.emptyRoutes();
         assertEquals(createRoutes(empty), emptyRoutes);
     }
@@ -108,14 +118,16 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Update update = RIB_SUPPORT.buildUpdate(Collections.emptyList(), createRoutes(EVPN_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(EVPN_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));
     }
 
@@ -126,12 +138,12 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testCacheableNlriObjects() {
-        Assert.assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableNlriObjects());
+        assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        Assert.assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
+        assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
     }
 
     @Test
@@ -142,39 +154,41 @@ public final class EvpnRibSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(EVPN_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() {
-        Assert.assertEquals((Long) NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
+        assertEquals((Long) NON_PATH_ID, RIB_SUPPORT.extractPathId(null));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
-        Assert.assertEquals(new NodeIdentifier(QName.create(EvpnRoutes.QNAME, Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT
-            .routeAttributesIdentifier());
+        assertEquals(new NodeIdentifier(QName.create(EvpnRoutes.QNAME,
+                Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        Assert.assertEquals(EvpnRoutesCase.class, RIB_SUPPORT.routesCaseClass());
+        assertEquals(EvpnRoutesCase.class, RIB_SUPPORT.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        Assert.assertEquals(EvpnRoutes.class, RIB_SUPPORT.routesContainerClass());
+        assertEquals(EvpnRoutes.class, RIB_SUPPORT.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        Assert.assertEquals(EvpnRoute.class, RIB_SUPPORT.routesListClass());
+        assertEquals(EvpnRoute.class, RIB_SUPPORT.routesListClass());
     }
 
     @Test
     public void testChangedRoutes() {
         final Routes emptyCase = new EvpnRoutesCaseBuilder().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 EvpnRoutesCaseBuilder().setEvpnRoutes(new EvpnRoutesBuilder().build()).build();
index cd156ba3e0721cf182ba7cb9a8783877fa91ea59..4d328497f27712231793574fa513dff1fd10992e 100644 (file)
@@ -16,7 +16,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.RouteDistinguisher;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.RouteDistinguisherBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.MplsLabel;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeSchemaAwareBuilder;
@@ -43,12 +43,12 @@ public final class EvpnTestUtil {
     public static final String RD_MODEL = "1.2.3.4:258";
     public static final RouteDistinguisher RD = RouteDistinguisherBuilder.getDefaultInstance(RD_MODEL);
 
-    public static DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> createContBuilder(final YangInstanceIdentifier
-        .NodeIdentifier nid) {
+    public static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> createContBuilder(
+            final NodeIdentifier nid) {
         return ImmutableContainerNodeSchemaAwareBuilder.create().withNodeIdentifier(nid);
     }
 
-    public static <T> ImmutableLeafNodeBuilder<T> createValueBuilder(final T value, YangInstanceIdentifier.NodeIdentifier nid) {
+    public static <T> ImmutableLeafNodeBuilder<T> createValueBuilder(final T value, NodeIdentifier nid) {
         final ImmutableLeafNodeBuilder<T> valueBuilder = new ImmutableLeafNodeBuilder<>();
         valueBuilder.withNodeIdentifier(nid).withValue(value);
         return valueBuilder;
index db967c6a2969c57f8a96f492ddc13a39ac09c906..ac130fe8a7935c6bfdef43fe66978b01f9e68eff 100644 (file)
@@ -21,7 +21,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mult
 
 public class TableTypeActivatorTest {
 
-    private static final BgpTableType EVPN = new BgpTableTypeImpl(L2vpnAddressFamily.class, EvpnSubsequentAddressFamily.class);
+    private static final BgpTableType EVPN = new BgpTableTypeImpl(
+            L2vpnAddressFamily.class, EvpnSubsequentAddressFamily.class);
 
     @Test
     public void testActivator() {
index be712ff80720302ac94314e6ee89f5229cf6b4ce..247cc5dcdbaa63ed701c6024ac2ab87ffbcaf417 100644 (file)
@@ -14,8 +14,6 @@ import static org.junit.Assert.assertEquals;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 import java.util.List;
 import org.junit.Test;
@@ -26,7 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tun
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.mldp.p2mp.lsp.OpaqueValueBuilder;
 
 public class OpaqueUtilTest {
-    private static final byte[] OPAQUE_WRONG= {
+    private static final byte[] OPAQUE_WRONG = {
         (byte) 0xfc, (byte) 0x00, (byte) 0x03, // Opaque Type - Length
         (byte) 0xb5, (byte) 0xeb, (byte) 0x2d,  //Value
     };
@@ -65,14 +63,16 @@ public class OpaqueUtilTest {
     };
 
     static final HexString OPAQUE_TEST = new HexString("07:00:0b:00:00:01:00:00:00:01:00:00:00:00");
-    static final HexString OPAQUE_TEST2 = new HexString ("07:00:0b:00:00:01:00:00:00:01:00:00:00:00:01:02");
-    private static final Opaque OPAQUE = new OpaqueValueBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build();
-    private static final Opaque OPAQUE_EXTENDED = new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2).setOpaqueType((short) 2)
-        .setOpaqueType(OpaqueUtil.EXTENDED_TYPE).setOpaqueExtendedType(4).build();
-    private static final List<OpaqueValue> OPAQUE_VALUE_LIST = Arrays.asList((OpaqueValue) OPAQUE, (OpaqueValue) OPAQUE_EXTENDED);
+    static final HexString OPAQUE_TEST2 = new HexString("07:00:0b:00:00:01:00:00:00:01:00:00:00:00:01:02");
+    private static final Opaque OPAQUE = new OpaqueValueBuilder().setOpaque(OPAQUE_TEST)
+            .setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build();
+    private static final Opaque OPAQUE_EXTENDED = new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2)
+            .setOpaqueType((short) 2).setOpaqueType(OpaqueUtil.EXTENDED_TYPE).setOpaqueExtendedType(4).build();
+    private static final List<OpaqueValue> OPAQUE_VALUE_LIST = Arrays.asList((OpaqueValue) OPAQUE,
+            (OpaqueValue) OPAQUE_EXTENDED);
 
     @Test
-    public void serializeOpaque() throws Exception {
+    public void serializeOpaque() {
         final ByteBuf actualOpaque = Unpooled.buffer();
         OpaqueUtil.serializeOpaque(OPAQUE, actualOpaque);
         assertArrayEquals(OPAQUE_EXPECTED, ByteArray.readAllBytes(actualOpaque));
@@ -95,21 +95,10 @@ public class OpaqueUtilTest {
     }
 
     @Test
-    public void parseOpaqueList() throws Exception {
+    public void parseOpaqueList() {
         final ByteBuf opaqueValues = Unpooled.buffer();
         OpaqueUtil.serializeOpaqueList(OPAQUE_VALUE_LIST, opaqueValues);
         assertArrayEquals(OPAQUE_VALUES_EXPECTED, ByteArray.readAllBytes(opaqueValues));
         assertEquals(OPAQUE_VALUE_LIST, OpaqueUtil.parseOpaqueList(Unpooled.wrappedBuffer(OPAQUE_VALUES_EXPECTED)));
     }
-
-    @Test(expected = UnsupportedOperationException.class)
-    public void testPrivateConstructor() throws Throwable {
-        final Constructor<OpaqueUtil> c = OpaqueUtil.class.getDeclaredConstructor();
-        c.setAccessible(true);
-        try {
-            c.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
-    }
 }
\ No newline at end of file
index c7a2d7f26bccb48f85cdf85ca8bce58aed98d53d..0d53773fd39090add72ceb446ad5c455dbc29ecf 100644 (file)
@@ -12,13 +12,11 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.IPV6;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.P_ADDRESS;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.IP_ADDRESS;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.P_MULTICAST;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
 import org.opendaylight.protocol.util.Ipv4Util;
@@ -43,7 +41,7 @@ public class PAddressPMulticastGroupUtilTest {
     private static class MyPAddressPMulticastGroup implements PAddressPMulticastGroup {
         @Override
         public IpAddress getPAddress() {
-            return P_ADDRESS;
+            return IP_ADDRESS;
         }
 
         @Override
@@ -60,37 +58,30 @@ public class PAddressPMulticastGroupUtilTest {
     @Test
     public void parseIpAddress() throws Exception {
         final ByteBuf ipv4Actual = Unpooled.buffer();
-        PAddressPMulticastGroupUtil.serializeIpAddress(P_ADDRESS, ipv4Actual);
+        PAddressPMulticastGroupUtil.serializeIpAddress(IP_ADDRESS, ipv4Actual);
         assertArrayEquals(IPV4_ADDRESS_EXPECTED, ByteArray.readAllBytes(ipv4Actual));
         final ByteBuf ipv6Actual = Unpooled.buffer();
         PAddressPMulticastGroupUtil.serializeIpAddress(IPV6, ipv6Actual);
         assertArrayEquals(IPV6_ADDRESS_EXPECTED, ByteArray.readAllBytes(ipv6Actual));
-        assertEquals(P_ADDRESS, PAddressPMulticastGroupUtil.parseIpAddress(Ipv4Util.IP4_LENGTH, Unpooled.wrappedBuffer(IPV4_ADDRESS_EXPECTED)));
-        assertEquals(IPV6, PAddressPMulticastGroupUtil.parseIpAddress(Ipv6Util.IPV6_LENGTH, Unpooled.wrappedBuffer(IPV6_ADDRESS_EXPECTED)));
-        assertNull(PAddressPMulticastGroupUtil.parseIpAddress(6, Unpooled.wrappedBuffer(IPV4_ADDRESS_EXPECTED)));
+        assertEquals(IP_ADDRESS, PAddressPMulticastGroupUtil.parseIpAddress(Ipv4Util.IP4_LENGTH,
+                Unpooled.wrappedBuffer(IPV4_ADDRESS_EXPECTED)));
+        assertEquals(IPV6, PAddressPMulticastGroupUtil.parseIpAddress(Ipv6Util.IPV6_LENGTH,
+                Unpooled.wrappedBuffer(IPV6_ADDRESS_EXPECTED)));
+        assertNull(PAddressPMulticastGroupUtil.parseIpAddress(6,
+                Unpooled.wrappedBuffer(IPV4_ADDRESS_EXPECTED)));
     }
 
     @Test
     public void parseIpAddressPMulticastGroup() throws Exception {
         final PAddressPMulticastGroup pAddressPMulticastGroup = new MyPAddressPMulticastGroup();
         final ByteBuf pAddressPMulticastGroupActual = Unpooled.buffer();
-        PAddressPMulticastGroupUtil.serializeSenderPMulticastGroup(pAddressPMulticastGroup, pAddressPMulticastGroupActual);
+        PAddressPMulticastGroupUtil.serializeSenderPMulticastGroup(pAddressPMulticastGroup,
+                pAddressPMulticastGroupActual);
         assertArrayEquals(SENDER_P_MULTICAST_GROUP_EXPECTED, ByteArray.readAllBytes(pAddressPMulticastGroupActual));
 
-        final PAddressPMulticastGroup actual = PAddressPMulticastGroupUtil.parseSenderPMulticastGroup(Unpooled.wrappedBuffer
-            (SENDER_P_MULTICAST_GROUP_EXPECTED));
-        assertEquals(pAddressPMulticastGroup.getPAddress(), actual.getPAddress());
-        assertEquals(pAddressPMulticastGroup.getPMulticastGroup(), actual.getPMulticastGroup());
-    }
-
-    @Test(expected = UnsupportedOperationException.class)
-    public void testPrivateConstructor() throws Throwable {
-        final Constructor<PAddressPMulticastGroupUtil> constructor = PAddressPMulticastGroupUtil.class.getDeclaredConstructor();
-        constructor.setAccessible(true);
-        try {
-            constructor.newInstance();
-        } catch (final InvocationTargetException e) {
-            throw e.getCause();
-        }
+        final PAddressPMulticastGroup actual = PAddressPMulticastGroupUtil
+                .parseSenderPMulticastGroup(Unpooled.wrappedBuffer(SENDER_P_MULTICAST_GROUP_EXPECTED));
+        assertEquals(IP_ADDRESS, actual.getPAddress());
+        assertEquals(P_MULTICAST, actual.getPMulticastGroup());
     }
 }
\ No newline at end of file
index 884059ac7ce3b332c7b369f693d329919e577965..57a8fb48b92a681b12b2b8bf686487b53d31cc4f 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier;
 
-
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
@@ -27,17 +26,17 @@ import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifi
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.PIM_SSM_TREE_EXPECTED;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.RSVP_TE_P2MP_LSP_LSP_EXPECTED;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildBidirPimTreeAttribute;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildINGRESSREPLICATIONAttribute;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMLDPMP2MPLSPAttribute;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMLDPMP2MPLSPWrongAttribute;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMLDPP2MPLSPIpv4Attribute;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMLDPP2MPLSPIpv6Attribute;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMLDPP2MPLSPL2vpnAttribute;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildIngressReplicationAttribute;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMLDpMp2mPLspAttribute;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMldpMP2mpLspWrongAttribute;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMldpP2mpLspIpv4Attribute;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMldpP2mpLspIpv6Attribute;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildMldpp2MPLspL2vpnAttribute;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildNoSupportedFamilyAttribute;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildNoSupportedOpaqueAttribute;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildPimSMTreeAttribute;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildPimSSMTreeAttribute;
-import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildRSVPTEP2MPLSPLSPAttribute;
+import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildRsvpTep2MPLspAttribute;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.PMSITunnelAttributeHandlerTestUtil.buildWOTunnelInfAttribute;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.TunnelIdentifierHandler.NO_TUNNEL_INFORMATION_PRESENT;
 
@@ -63,7 +62,8 @@ public class PMSITunnelAttributeHandlerTest {
     public void setUp() {
         final BGPExtensionProviderContext ctx = new SimpleBGPExtensionProviderContext();
 
-        final org.opendaylight.protocol.bgp.parser.impl.BGPActivator inetActivator = new org.opendaylight.protocol.bgp.parser.impl.BGPActivator();
+        final org.opendaylight.protocol.bgp.parser.impl.BGPActivator inetActivator =
+                new org.opendaylight.protocol.bgp.parser.impl.BGPActivator();
         inetActivator.start(ctx);
         final BGPActivator bgpActivator = new BGPActivator();
         bgpActivator.start(ctx);
@@ -77,7 +77,8 @@ public class PMSITunnelAttributeHandlerTest {
         this.handler.serializeAttribute(attributes, actual);
         assertArrayEquals(BIDIR_PIM_EXPECTED, ByteArray.readAllBytes(actual));
         final Attributes expected = buildBidirPimTreeAttribute();
-        final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(BIDIR_PIM_EXPECTED), null);
+        final Attributes actualAttr = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(BIDIR_PIM_EXPECTED), null);
         assertEquals(expected, actualAttr);
     }
 
@@ -88,7 +89,8 @@ public class PMSITunnelAttributeHandlerTest {
         this.handler.serializeAttribute(attributes, actual);
         assertArrayEquals(PIM_SM_TREE_EXPECTED, ByteArray.readAllBytes(actual));
         final Attributes expected = buildPimSMTreeAttribute();
-        final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(PIM_SM_TREE_EXPECTED), null);
+        final Attributes actualAttr = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(PIM_SM_TREE_EXPECTED), null);
         assertEquals(expected, actualAttr);
     }
 
@@ -103,28 +105,32 @@ public class PMSITunnelAttributeHandlerTest {
     @Test
     public void parsePimSSMTree() throws Exception {
         final Attributes expected = buildPimSSMTreeAttribute();
-        final Attributes actual = this.handler.parseAttributes(Unpooled.wrappedBuffer(PIM_SSM_TREE_EXPECTED), null);
+        final Attributes actual = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(PIM_SSM_TREE_EXPECTED), null);
         assertEquals(expected, actual);
     }
 
     @Test
     public void testMldpP2MpLsp() throws Exception {
         final ByteBuf actualIpv4 = Unpooled.buffer();
-        final Attributes expectedIpv4Att = buildMLDPP2MPLSPIpv4Attribute();
+        final Attributes expectedIpv4Att = buildMldpP2mpLspIpv4Attribute();
 
-        final BGPExtensionProviderContext providerContext = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance();
+        final BGPExtensionProviderContext providerContext = ServiceLoaderBGPExtensionProviderContext
+                .getSingletonInstance();
         providerContext.getAttributeRegistry().serializeAttribute(expectedIpv4Att, actualIpv4);
         assertArrayEquals(M_LDP_P2MP_LSP_EXPECTED_IPV4, ByteArray.readAllBytes(actualIpv4));
 
-        final Attributes actualIpv4Attribute = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_IPV4_2), null);
+        final Attributes actualIpv4Attribute = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_IPV4_2), null);
         assertEquals(expectedIpv4Att, actualIpv4Attribute);
 
-        final Attributes expectedIpv6Att = buildMLDPP2MPLSPIpv6Attribute();
+        final Attributes expectedIpv6Att = buildMldpP2mpLspIpv6Attribute();
         final ByteBuf actualIpv6 = Unpooled.buffer();
         this.handler.serializeAttribute(expectedIpv6Att, actualIpv6);
         assertArrayEquals(M_LDP_P2MP_LSP_EXPECTED_IPV6, ByteArray.readAllBytes(actualIpv6));
 
-        final Attributes actualIpv6Attribute = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_IPV6), null);
+        final Attributes actualIpv6Attribute = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_IPV6), null);
         assertEquals(expectedIpv6Att, actualIpv6Attribute);
 
         final ByteBuf actualL2vpn = Unpooled.buffer();
@@ -132,11 +138,13 @@ public class PMSITunnelAttributeHandlerTest {
         assertArrayEquals(new byte[0], ByteArray.readAllBytes(actualIpv4));
 
 
-        final Attributes actualWrongFamily = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_WRONG_FAMILY), null);
+        final Attributes actualWrongFamily = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_WRONG_FAMILY), null);
         assertEquals(buildWOTunnelInfAttribute(), actualWrongFamily);
 
-        final Attributes expectedL2vpnAtt = buildMLDPP2MPLSPL2vpnAttribute();
-        final Attributes actualL2vpnAttribute = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_L2VPN), null);
+        final Attributes expectedL2vpnAtt = buildMldpp2MPLspL2vpnAttribute();
+        final Attributes actualL2vpnAttribute = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(M_LDP_P2MP_LSP_EXPECTED_L2VPN), null);
         assertEquals(expectedL2vpnAtt, actualL2vpnAttribute);
 
         final ByteBuf actualL2vp = Unpooled.buffer();
@@ -150,38 +158,42 @@ public class PMSITunnelAttributeHandlerTest {
 
     @Test
     public void testRsvpteP2MplspLsp() throws Exception {
-        final Attributes expected = buildRSVPTEP2MPLSPLSPAttribute();
+        final Attributes expected = buildRsvpTep2MPLspAttribute();
         final ByteBuf actual = Unpooled.buffer();
         this.handler.serializeAttribute(expected, actual);
         assertArrayEquals(RSVP_TE_P2MP_LSP_LSP_EXPECTED, ByteArray.readAllBytes(actual));
-        final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(RSVP_TE_P2MP_LSP_LSP_EXPECTED), null);
+        final Attributes actualAttr = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(RSVP_TE_P2MP_LSP_LSP_EXPECTED), null);
         assertEquals(expected, actualAttr);
     }
 
     @Test
     public void testIngressReplication() throws Exception {
-        final Attributes expected = buildINGRESSREPLICATIONAttribute();
+        final Attributes expected = buildIngressReplicationAttribute();
         final ByteBuf actual = Unpooled.buffer();
         this.handler.serializeAttribute(expected, actual);
         assertArrayEquals(INGRESS_REPLICATION_EXPECTED, ByteArray.readAllBytes(actual));
-        final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(INGRESS_REPLICATION_EXPECTED), null);
+        final Attributes actualAttr = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(INGRESS_REPLICATION_EXPECTED), null);
         assertEquals(expected, actualAttr);
     }
 
     @Test
     public void testMldpmP2MpLsp() throws Exception {
-        final Attributes expected = buildMLDPMP2MPLSPAttribute();
+        final Attributes expected = buildMLDpMp2mPLspAttribute();
         final ByteBuf actual = Unpooled.buffer();
         this.handler.serializeAttribute(expected, actual);
         assertArrayEquals(M_LDP_MP_2_MP_LSP_EXPECTED, ByteArray.readAllBytes(actual));
 
-        final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_MP_2_MP_LSP_EXPECTED), null);
+        final Attributes actualAttr = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(M_LDP_MP_2_MP_LSP_EXPECTED), null);
         assertEquals(expected, actualAttr);
 
-        final Attributes actualWrong = this.handler.parseAttributes(Unpooled.wrappedBuffer(M_LDP_MP_2_MP_LSP_WRONG), null);
+        final Attributes actualWrong = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(M_LDP_MP_2_MP_LSP_WRONG), null);
         assertEquals(buildWOTunnelInfAttribute(), actualWrong);
 
-        final Attributes wrongAttribute = buildMLDPMP2MPLSPWrongAttribute();
+        final Attributes wrongAttribute = buildMldpMP2mpLspWrongAttribute();
         final ByteBuf actualWrongBuf = Unpooled.buffer();
         this.handler.serializeAttribute(wrongAttribute, actualWrongBuf);
         assertArrayEquals(NO_TUNNEL_INFORMATION_PRESENT_EXPECTED, ByteArray.readAllBytes(actualWrongBuf));
@@ -195,23 +207,27 @@ public class PMSITunnelAttributeHandlerTest {
         this.handler.serializeAttribute(attributes, actual);
         assertArrayEquals(NO_TUNNEL_INFORMATION_PRESENT_EXPECTED, ByteArray.readAllBytes(actual));
         final Attributes expected = buildWOTunnelInfAttribute();
-        final Attributes actualAttr = this.handler.parseAttributes(Unpooled.wrappedBuffer(NO_TUNNEL_INFORMATION_PRESENT_EXPECTED), null);
+        final Attributes actualAttr = this.handler.parseAttributes(
+                Unpooled.wrappedBuffer(NO_TUNNEL_INFORMATION_PRESENT_EXPECTED), null);
         assertEquals(expected, actualAttr);
     }
 
     @Test
-    public void testTunnelIdentifierUtil() throws Throwable {
-        final TunnelIdentifierHandler tunnelIdentifierHandler = new TunnelIdentifierHandler(ServiceLoaderBGPExtensionProviderContext
-            .getSingletonInstance().getAddressFamilyRegistry());
+    public void testTunnelIdentifierUtil() {
+        final TunnelIdentifierHandler tunnelIdentifierHandler =
+                new TunnelIdentifierHandler(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance()
+                        .getAddressFamilyRegistry());
         assertNull(tunnelIdentifierHandler.parse(1, Unpooled.buffer()));
         assertNull(tunnelIdentifierHandler.parse(125, Unpooled.buffer()));
-        assertEquals(NO_TUNNEL_INFORMATION_PRESENT, tunnelIdentifierHandler.serialize(new MockTunnelIdentifier(), Unpooled.buffer()));
+        assertEquals(NO_TUNNEL_INFORMATION_PRESENT, tunnelIdentifierHandler
+                .serialize(new MockTunnelIdentifier(), Unpooled.buffer()));
     }
 
     @Test
-    public void testPMSITunnelAttributeParser() throws Throwable {
-        final PMSITunnelAttributeHandler pmsiHandler = new PMSITunnelAttributeHandler(ServiceLoaderBGPExtensionProviderContext
-            .getSingletonInstance().getAddressFamilyRegistry());
+    public void testPMSITunnelAttributeParser() {
+        final PMSITunnelAttributeHandler pmsiHandler =
+                new PMSITunnelAttributeHandler(ServiceLoaderBGPExtensionProviderContext.getSingletonInstance()
+                        .getAddressFamilyRegistry());
         assertEquals(22, pmsiHandler.getType());
         final AttributesBuilder builder = new AttributesBuilder();
         final ByteBuf emptyBuffer = Unpooled.buffer();
index 736e8eb5716c398b7fe9264e06044e65c0be8d42..8caf7b84a969e8d87def0d5269b7074af0d57428 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier;
 
+import static java.util.Collections.singletonList;
 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.IPV6;
 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.MPLS_LABEL;
 import static org.opendaylight.protocol.bgp.evpn.impl.attributes.tunnel.identifier.OpaqueUtilTest.OPAQUE_TEST;
@@ -42,7 +43,7 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 final class PMSITunnelAttributeHandlerTestUtil {
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 0- MPLS LABEL
      * No tunnel information present
      */
@@ -51,7 +52,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x01, (byte) 0x00, (byte) 0x05, (byte) 0xdc, (byte) 0x10
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 1- MPLS LABEL
      * mLDP P2MP LSP
      */
@@ -63,7 +64,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01,
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
      * mLDP P2MP LSP
      */
@@ -88,7 +89,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x02
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
      * mLDP P2MP LSP
      */
@@ -104,7 +105,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0xb5, (byte) 0xeb, (byte) 0x2d, (byte) 0xd7, (byte) 0x6d, (byte) 0xf8, //Value
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
      * mLDP P2MP LSP L2VPN
      */
@@ -129,7 +130,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x02
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
      * mLDP P2MP LSP IPV4
      */
@@ -156,7 +157,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x02
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 2- MPLS LABEL
      * mLDP P2MP LSP IPV6
      */
@@ -184,7 +185,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x02
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 3- MPLS LABEL
      * PIM-SSM Tree
      */
@@ -195,7 +196,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 4- MPLS LABEL
      * PIM-SM Tree
      */
@@ -206,7 +207,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 5- MPLS LABEL
      * BIDIR-PIM Tree
      */
@@ -217,7 +218,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x17, (byte) 0x01, (byte) 0x01, (byte) 0x01
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 6- MPLS LABEL
      * Ingress Replication
      */
@@ -227,7 +228,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 7- MPLS LABEL
      * mLDP MP2MP LSP
      */
@@ -242,7 +243,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
         (byte) 0x00, (byte) 0x00
     };
     /**
-     * ATT - TYPE - ATT LENGTH
+     * ATT - TYPE - ATT LENGTH.
      * PMSI FLAG - PMSI TYPE 7- MPLS LABEL
      * mLDP MP2MP LSP
      */
@@ -254,7 +255,7 @@ final class PMSITunnelAttributeHandlerTestUtil {
     };
 
     static final IpAddress P_MULTICAST = new IpAddress(new Ipv4Address("23.1.1.1"));
-    static final IpAddress P_ADDRESS = new IpAddress(new Ipv4Address("1.1.1.1"));
+    static final IpAddress IP_ADDRESS = new IpAddress(new Ipv4Address("1.1.1.1"));
     private static final Short NO_SUPPORTED_OPAQUE = 200;
 
     static class MockTunnelIdentifier implements TunnelIdentifier {
@@ -264,12 +265,13 @@ final class PMSITunnelAttributeHandlerTestUtil {
         }
     }
 
-    static abstract class NonSupportedAddressFamily extends AddressFamily {
+    private abstract static class NonSupportedAddressFamily extends AddressFamily {
     }
 
     private static PAddressPMulticastGroup buildPAddressPMulticastGroup() {
-        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier
-            .bidir.pim.tree.BidirPimTreeBuilder().setPAddress(P_ADDRESS).setPMulticastGroup(P_MULTICAST).build();
+        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel
+                .pmsi.tunnel.tunnel.identifier.bidir.pim.tree.BidirPimTreeBuilder()
+                .setPAddress(IP_ADDRESS).setPMulticastGroup(P_MULTICAST).build();
     }
 
     private static PmsiTunnelBuilder getPmsiTunnelBuilder() {
@@ -280,51 +282,59 @@ final class PMSITunnelAttributeHandlerTestUtil {
     }
 
     private static Attributes buildAttribute(final PmsiTunnelBuilder pmsiTunnelBuilder) {
-        return new AttributesBuilder().setUnrecognizedAttributes(Collections.emptyList()).addAugmentation(PmsiTunnelAugmentation.class,
+        return new AttributesBuilder().setUnrecognizedAttributes(Collections.emptyList())
+                .addAugmentation(PmsiTunnelAugmentation.class,
             new PmsiTunnelAugmentationBuilder().setPmsiTunnel(pmsiTunnelBuilder.build()).build()).build();
     }
 
     static Attributes buildBidirPimTreeAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(new BidirPimTreeBuilder().setBidirPimTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params
-            .xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.bidir.pim.tree.BidirPimTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(new BidirPimTreeBuilder()
+                .setBidirPimTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
+                        .rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.bidir.pim.tree
+                        .BidirPimTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
         return buildAttribute(pmsiTunnelBuilder);
     }
 
     static Attributes buildPimSMTreeAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(new PimSmTreeBuilder().setPimSmTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
-            .yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.pim.sm.tree.PimSmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(new PimSmTreeBuilder().setPimSmTree(new org.opendaylight.yang.gen.v1
+                .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel
+                .identifier.pim.sm.tree.PimSmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
         return buildAttribute(pmsiTunnelBuilder);
     }
 
     static Attributes buildPimSSMTreeAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(new PimSsmTreeBuilder().setPimSsmTree(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
-            .yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.pim.ssm.tree.PimSsmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(new PimSsmTreeBuilder().setPimSsmTree(new org.opendaylight.yang.gen.v1
+                .urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel
+                .identifier.pim.ssm.tree.PimSsmTreeBuilder(buildPAddressPMulticastGroup()).build()).build());
         return buildAttribute(pmsiTunnelBuilder);
     }
 
     static Attributes buildNoSupportedOpaqueAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        final List<OpaqueValue> nonSupported = Collections.singletonList(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE).build());
-        pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(P_ADDRESS, Ipv4AddressFamily.class, nonSupported));
+        final List<OpaqueValue> nonSupported = singletonList(new OpaqueValueBuilder()
+                .setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, nonSupported));
         return buildAttribute(pmsiTunnelBuilder);
     }
 
     static Attributes buildNoSupportedFamilyAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(P_ADDRESS, NonSupportedAddressFamily.class, createOpaqueList()));
+        pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(IP_ADDRESS, NonSupportedAddressFamily.class,
+                createOpaqueList()));
         return buildAttribute(pmsiTunnelBuilder);
     }
 
-    static Attributes buildMLDPP2MPLSPIpv4Attribute() {
+    static Attributes buildMldpP2mpLspIpv4Attribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(P_ADDRESS, Ipv4AddressFamily.class, createOpaqueList()));
+        pmsiTunnelBuilder.setTunnelIdentifier(
+                buildMldpP2mpLsp(IP_ADDRESS, Ipv4AddressFamily.class, createOpaqueList()));
         return buildAttribute(pmsiTunnelBuilder);
     }
 
-    static Attributes buildMLDPP2MPLSPIpv6Attribute() {
+    static Attributes buildMldpP2mpLspIpv6Attribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = new PmsiTunnelBuilder();
         pmsiTunnelBuilder.setLeafInformationRequired(true);
         pmsiTunnelBuilder.setMplsLabel(MPLS_LABEL);
@@ -332,54 +342,62 @@ final class PMSITunnelAttributeHandlerTestUtil {
         return buildAttribute(pmsiTunnelBuilder);
     }
 
-    static Attributes buildMLDPP2MPLSPL2vpnAttribute() {
+    static Attributes buildMldpp2MPLspL2vpnAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(buildMldpP2mpLsp(P_ADDRESS, L2vpnAddressFamily.class, createOpaqueList()));
+        pmsiTunnelBuilder.setTunnelIdentifier(
+                buildMldpP2mpLsp(IP_ADDRESS, L2vpnAddressFamily.class, createOpaqueList()));
         return buildAttribute(pmsiTunnelBuilder);
     }
 
-    private static TunnelIdentifier buildMldpP2mpLsp(final IpAddress pAddress, final Class<? extends AddressFamily> family, final List<OpaqueValue> opaqueList) {
+    private static TunnelIdentifier buildMldpP2mpLsp(final IpAddress ipAddress,
+            final Class<? extends AddressFamily> family, final List<OpaqueValue> opaqueList) {
         return new MldpP2mpLspBuilder().setMldpP2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
             .ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.p2mp.lsp.MldpP2mpLspBuilder()
-            .setRootNodeAddress(pAddress).setAddressFamily(family).setOpaqueValue(opaqueList).build()).build();
+            .setRootNodeAddress(ipAddress).setAddressFamily(family).setOpaqueValue(opaqueList).build()).build();
     }
 
-    static Attributes buildRSVPTEP2MPLSPLSPAttribute() {
+    static Attributes buildRsvpTep2MPLspAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(new RsvpTeP2mpLspBuilder().setRsvpTeP2mpLps(new org.opendaylight.yang.gen.v1.urn.opendaylight.params
-            .xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.rsvp.te.p2mp.lsp.RsvpTeP2mpLpsBuilder()
-            .setP2mpId(3458L).setTunnelId(15).setExtendedTunnelId(P_ADDRESS).build()).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(new RsvpTeP2mpLspBuilder()
+                .setRsvpTeP2mpLps(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel
+                        .rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.rsvp.te.p2mp.lsp.RsvpTeP2mpLpsBuilder()
+            .setP2mpId(3458L).setTunnelId(15).setExtendedTunnelId(IP_ADDRESS).build()).build());
         return buildAttribute(pmsiTunnelBuilder);
     }
 
-    static Attributes buildINGRESSREPLICATIONAttribute() {
+    static Attributes buildIngressReplicationAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(new IngressReplicationBuilder().setIngressReplication(new org.opendaylight.yang.gen.v1.urn
-            .opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
-            .setReceivingEndpointAddress(P_ADDRESS).build()).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(new IngressReplicationBuilder().setIngressReplication(new org
+                .opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi
+                .tunnel.tunnel.identifier.ingress.replication.IngressReplicationBuilder()
+                .setReceivingEndpointAddress(IP_ADDRESS).build()).build());
         return buildAttribute(pmsiTunnelBuilder);
     }
 
-    static Attributes buildMLDPMP2MPLSPWrongAttribute() {
+    static Attributes buildMldpMP2mpLspWrongAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params
-            .xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.mp2mp.lsp
-            .MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE).build()).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
+                .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier
+                .mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(NO_SUPPORTED_OPAQUE)
+                .build()).build());
         return buildAttribute(pmsiTunnelBuilder);
     }
 
-    static Attributes buildMLDPMP2MPLSPAttribute() {
+    static Attributes buildMLDpMp2mPLspAttribute() {
         final PmsiTunnelBuilder pmsiTunnelBuilder = getPmsiTunnelBuilder();
-        pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen.v1.urn.opendaylight.params
-            .xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel.identifier.mldp.mp2mp.lsp
-            .MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build()).build());
+        pmsiTunnelBuilder.setTunnelIdentifier(new MldpMp2mpLspBuilder().setMldpMp2mpLsp(new org.opendaylight.yang.gen
+                .v1.urn.opendaylight.params.xml.ns.yang.pmsi.tunnel.rev160812.pmsi.tunnel.pmsi.tunnel.tunnel
+                .identifier.mldp.mp2mp.lsp.MldpMp2mpLspBuilder().setOpaque(OPAQUE_TEST)
+                .setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build()).build());
         return buildAttribute(pmsiTunnelBuilder);
     }
 
     private static List<OpaqueValue> createOpaqueList() {
         final List<OpaqueValue> opaqueValues = new ArrayList<>();
-        opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST).setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build());
-        opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2).setOpaqueType((short) 2).setOpaqueType(OpaqueUtil.EXTENDED_TYPE)
+        opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST)
+                .setOpaqueType(OpaqueUtil.GENERIC_LSP_IDENTIFIER).build());
+        opaqueValues.add(new OpaqueValueBuilder().setOpaque(OPAQUE_TEST2)
+                .setOpaqueType((short) 2).setOpaqueType(OpaqueUtil.EXTENDED_TYPE)
             .setOpaqueExtendedType(4).build());
         return opaqueValues;
     }
index 9ac2ee77d2bef88e646eed07e5223be30f6c1ea3..cb3b6e225a1e80a4d7caf6d5a0558fe97248dd1b 100644 (file)
@@ -33,10 +33,10 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 public final class ASGenParserTest {
-    private static final byte[] VALUE = {(byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
-    private static final byte[] RESULT = {(byte) 0x05, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x02, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
+    private static final byte[] VALUE = {(byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x02,
+        (byte) 0x02, (byte) 0x02, (byte) 0x00};
+    private static final byte[] RESULT = {(byte) 0x05, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x02,
+        (byte) 0x02, (byte) 0x02, (byte) 0x02, (byte) 0x00};
     private ASGenParser parser;
 
     @Before
@@ -48,15 +48,16 @@ public final class ASGenParserTest {
     public void parserTest() {
         final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
 
-        final AsGeneratedCase asGen = new AsGeneratedCaseBuilder().setAsGenerated(new AsGeneratedBuilder().setAs(AS_NUMBER).setLocalDiscriminator(LD)
-            .build()).build();
+        final AsGeneratedCase asGen = new AsGeneratedCaseBuilder().setAsGenerated(new AsGeneratedBuilder()
+                .setAs(AS_NUMBER).setLocalDiscriminator(LD).build()).build();
         this.parser.serializeEsi(asGen, buff);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
 
         final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
         assertEquals(asGen, acResult);
 
-        final ContainerNode cont = createContBuilder(new NodeIdentifier(AsGenerated.QNAME)).addChild(createValueBuilder(AS_MODEL, AS_NID).build())
+        final ContainerNode cont = createContBuilder(new NodeIdentifier(AsGenerated.QNAME))
+                .addChild(createValueBuilder(AS_MODEL, AS_NID).build())
             .addChild(createValueBuilder(LD, LD_NID).build()).build();
         final Esi acmResult = this.parser.serializeEsi(cont);
         assertEquals(asGen, acmResult);
index f0f65ae87f29ad3333cf5ceac3477e7d268731a0..6ed2c35f83a5767d1d13cd5301bcbd3a4a1908bc 100644 (file)
@@ -29,10 +29,10 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 public final class ArbitraryParserTest {
-    private static final byte[] ARB_VALUE = {(byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06, (byte) 0x07,
-        (byte) 0x08, (byte) 0x09};
-    private static final byte[] ARB_RESULT = {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05, (byte) 0x06,
-        (byte) 0x07, (byte) 0x08, (byte) 0x09};
+    private static final byte[] ARB_VALUE = {(byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x05,
+        (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09};
+    private static final byte[] ARB_RESULT = {(byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04,
+        (byte) 0x05, (byte) 0x06, (byte) 0x07, (byte) 0x08, (byte) 0x09};
     private ArbitraryParser parser;
 
     @Before
@@ -44,7 +44,8 @@ public final class ArbitraryParserTest {
     public void parserTest() {
         final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
 
-        final ArbitraryCase arbitrary = new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder().setArbitrary(ARB_VALUE).build()).build();
+        final ArbitraryCase arbitrary = new ArbitraryCaseBuilder().setArbitrary(new ArbitraryBuilder()
+                .setArbitrary(ARB_VALUE).build()).build();
         this.parser.serializeEsi(arbitrary, buff);
         assertArrayEquals(ARB_RESULT, ByteArray.getAllBytes(buff));
 
@@ -52,7 +53,7 @@ public final class ArbitraryParserTest {
         assertEquals(arbitrary, acResult);
 
         final ContainerNode cont = createContBuilder(new NodeIdentifier(Arbitrary.QNAME))
-            .addChild(createValueBuilder(ARB_VALUE, ARB_NID).build()).build();
+                .addChild(createValueBuilder(ARB_VALUE, ARB_NID).build()).build();
         final Esi acmResult = this.parser.serializeEsi(cont);
         assertEquals(arbitrary, acmResult);
     }
index 735dcf208a66f91fa5477e98db17175f1344fb59..01fe7b1aadaa011f3ae5fb2bda14ba761810e160 100644 (file)
@@ -33,10 +33,10 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 public final class LacpParserTest {
-    private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
-    private static final byte[] RESULT = {(byte) 0x01, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
+    private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7,
+        (byte) 0x02, (byte) 0x02, (byte) 0x00};
+    private static final byte[] RESULT = {(byte) 0x01, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f,
+        (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00};
     private LacpParser parser;
 
     @Before
@@ -48,18 +48,19 @@ public final class LacpParserTest {
     public void parserTest() {
         final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
 
-        final LacpAutoGeneratedCase lanAuto = new LacpAutoGeneratedCaseBuilder().setLacpAutoGenerated(new LacpAutoGeneratedBuilder()
-            .setCeLacpMacAddress(MAC).setCeLacpPortKey(PORT).build()).build();
+        final LacpAutoGeneratedCase lanAuto = new LacpAutoGeneratedCaseBuilder()
+                .setLacpAutoGenerated(new LacpAutoGeneratedBuilder()
+                        .setCeLacpMacAddress(MAC).setCeLacpPortKey(PORT).build()).build();
         this.parser.serializeEsi(lanAuto, buff);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
 
         final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
         assertEquals(lanAuto, acResult);
 
-        final ContainerNode cont = createContBuilder( new NodeIdentifier(LacpAutoGenerated.QNAME))
-            .addChild(createValueBuilder(MAC_MODEL, LACP_MAC_NID).build())
-            .addChild(createValueBuilder(PORT, PK_NID).build())
-            .build();
+        final ContainerNode cont = createContBuilder(new NodeIdentifier(LacpAutoGenerated.QNAME))
+                .addChild(createValueBuilder(MAC_MODEL, LACP_MAC_NID).build())
+                .addChild(createValueBuilder(PORT, PK_NID).build())
+                .build();
         final Esi acmResult = this.parser.serializeEsi(cont);
         assertEquals(lanAuto, acmResult);
     }
index a662d024a2804cd1d78296fa156859d9690fd26b..084828af6eadc9ada6a4687f8ee2edf526469b0f 100644 (file)
@@ -36,12 +36,13 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine
 
 public class LanParserTest {
     private static final Integer PRIORITY = 514;
-    public static final LanAutoGeneratedCase LAN_AUT_GEN_CASE = new LanAutoGeneratedCaseBuilder().setLanAutoGenerated(new LanAutoGeneratedBuilder()
+    public static final LanAutoGeneratedCase LAN_AUT_GEN_CASE = new LanAutoGeneratedCaseBuilder()
+            .setLanAutoGenerated(new LanAutoGeneratedBuilder()
         .setRootBridgeMacAddress(MAC).setRootBridgePriority(PRIORITY).build()).build();
-    private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
-    private static final byte[] RESULT = {(byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
+    private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7,
+        (byte) 0x02, (byte) 0x02, (byte) 0x00};
+    private static final byte[] RESULT = {(byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f,
+        (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00};
     private LanParser parser;
 
     @Before
@@ -74,7 +75,8 @@ public class LanParserTest {
     }
 
     private static ContainerNode createLanCont() {
-        return createContBuilder(new NodeIdentifier(LanAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, BRIDGE_MAC_NID).build())
-            .addChild(createValueBuilder(PRIORITY, RBP_NID).build()).build();
+        return createContBuilder(new NodeIdentifier(LanAutoGenerated.QNAME))
+                .addChild(createValueBuilder(MAC_MODEL, BRIDGE_MAC_NID).build())
+                .addChild(createValueBuilder(PRIORITY, RBP_NID).build()).build();
     }
 }
\ No newline at end of file
index 5eb229b0b07abb9def7bce4bc95cd7136a2fed0a..259598d56e1c6279ee8dd70b4d05499a686747c6 100644 (file)
@@ -33,10 +33,10 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 public final class MacParserTest {
-    private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
-    private static final byte[] RESULT = {(byte) 0x03, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
+    private static final byte[] VALUE = {(byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7,
+        (byte) 0x02, (byte) 0x02, (byte) 0x00};
+    private static final byte[] RESULT = {(byte) 0x03, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f,
+        (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00};
     private static final long UINT24_LD_MODEL = 131584L;
     private static final Uint24 UINT24_LD = new Uint24(UINT24_LD_MODEL);
     private MacParser parser;
@@ -50,16 +50,19 @@ public final class MacParserTest {
     public void parserTest() {
         final ByteBuf buff = Unpooled.buffer(VALUE_SIZE);
 
-        final MacAutoGeneratedCase macAuto = new MacAutoGeneratedCaseBuilder().setMacAutoGenerated(new MacAutoGeneratedBuilder()
-            .setLocalDiscriminator(UINT24_LD).setSystemMacAddress(MAC).build()).build();
+        final MacAutoGeneratedCase macAuto = new MacAutoGeneratedCaseBuilder()
+                .setMacAutoGenerated(new MacAutoGeneratedBuilder()
+                        .setLocalDiscriminator(UINT24_LD)
+                        .setSystemMacAddress(MAC).build()).build();
         this.parser.serializeEsi(macAuto, buff);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
 
         final Esi acResult = this.parser.parseEsi(Unpooled.wrappedBuffer(VALUE));
         assertEquals(macAuto, acResult);
 
-        final ContainerNode cont = createContBuilder(new NodeIdentifier(MacAutoGenerated.QNAME)).addChild(createValueBuilder(MAC_MODEL, SYSTEM_MAC_NID).build())
-            .addChild(createValueBuilder(UINT24_LD_MODEL, LD_NID).build()).build();
+        final ContainerNode cont = createContBuilder(new NodeIdentifier(MacAutoGenerated.QNAME))
+                .addChild(createValueBuilder(MAC_MODEL, SYSTEM_MAC_NID).build())
+                .addChild(createValueBuilder(UINT24_LD_MODEL, LD_NID).build()).build();
         final Esi acmResult = this.parser.serializeEsi(cont);
         assertEquals(macAuto, acmResult);
     }
index c643ea4dd7ae81b43e0c6ed7a5aa8a215a20063c..5844562bfdd4683592ea9e73141ef8fc272299f6 100644 (file)
@@ -35,13 +35,14 @@ import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
 
 public class RouterIdParserTest {
-    public static final byte[] RESULT = {(byte) 0x04, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x02, (byte) 0x02, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
-    private static final byte[] VALUE = {(byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x02, (byte) 0x02, (byte) 0x02,
-        (byte) 0x02, (byte) 0x00};
+    public static final byte[] RESULT = {(byte) 0x04, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x02,
+        (byte) 0x02, (byte) 0x02, (byte) 0x02, (byte) 0x00};
+    private static final byte[] VALUE = {(byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x2A, (byte) 0x02, (byte) 0x02,
+        (byte) 0x02, (byte) 0x02, (byte) 0x00};
     private static final Ipv4Address ROUTE_ID = new Ipv4Address("42.42.42.42");
-    public static final RouterIdGeneratedCase ROUTE_ID_CASE = new RouterIdGeneratedCaseBuilder().setRouterIdGenerated(new RouterIdGeneratedBuilder()
-        .setLocalDiscriminator(LD).setRouterId(ROUTE_ID).build()).build();
+    public static final RouterIdGeneratedCase ROUTE_ID_CASE = new RouterIdGeneratedCaseBuilder()
+            .setRouterIdGenerated(new RouterIdGeneratedBuilder()
+                    .setLocalDiscriminator(LD).setRouterId(ROUTE_ID).build()).build();
     private static final String ROUTE_ID_MODEL = "42.42.42.42";
     private RouterIdParser parser;
 
index 04073e821a3b005058a989fee86687eef30839de..130e279c8687dc614aed150a4ca0d96a0ca88803 100644 (file)
@@ -37,8 +37,9 @@ public class DefaultGatewayExtComTest {
     public void parserTest() throws BGPParsingException, BGPDocumentedException {
         final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
-        final DefaultGatewayExtendedCommunityCase expected = new DefaultGatewayExtendedCommunityCaseBuilder().setDefaultGatewayExtendedCommunity(
-            new DefaultGatewayExtendedCommunityBuilder().build()).build();
+        final DefaultGatewayExtendedCommunityCase expected = new DefaultGatewayExtendedCommunityCaseBuilder()
+                .setDefaultGatewayExtendedCommunity(
+                        new DefaultGatewayExtendedCommunityBuilder().build()).build();
         this.parser.serializeExtendedCommunity(expected, buff);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
 
index eeb93a2e480c20fcbfc0bcd41913015ccb1efeac..e5699f8c29c058ac9afb45742809b9bdef126038 100644 (file)
@@ -38,8 +38,9 @@ public class ESILabelExtComTest {
     public void parserTest() throws BGPParsingException, BGPDocumentedException {
         final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
-        final EsiLabelExtendedCommunityCase expected = new EsiLabelExtendedCommunityCaseBuilder().setEsiLabelExtendedCommunity(
-            new EsiLabelExtendedCommunityBuilder().setSingleActiveMode(true).setEsiLabel(MPLS_LABEL).build()).build();
+        final EsiLabelExtendedCommunityCase expected = new EsiLabelExtendedCommunityCaseBuilder()
+                .setEsiLabelExtendedCommunity(new EsiLabelExtendedCommunityBuilder()
+                        .setSingleActiveMode(true).setEsiLabel(MPLS_LABEL).build()).build();
         this.parser.serializeExtendedCommunity(expected, buff);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
 
index 4a1994582dd57593a969d56d7a379a73959825ed..efac6296abccc436c28e289160d2d298b980f6f0 100644 (file)
@@ -38,8 +38,9 @@ public class ESImpRouteTargetExtComTest {
     public void parserTest() throws BGPParsingException, BGPDocumentedException {
         final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
-        final EsImportRouteExtendedCommunityCase expected = new EsImportRouteExtendedCommunityCaseBuilder().setEsImportRouteExtendedCommunity(
-            new EsImportRouteExtendedCommunityBuilder().setEsImport(MAC).build()).build();
+        final EsImportRouteExtendedCommunityCase expected = new EsImportRouteExtendedCommunityCaseBuilder()
+                .setEsImportRouteExtendedCommunity(
+                        new EsImportRouteExtendedCommunityBuilder().setEsImport(MAC).build()).build();
         this.parser.serializeExtendedCommunity(expected, buff);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
 
index efe236272451169ebcf3b1ad496930294fec5882..4c1bb85616f8c981972f2ababcdd091e6004c319 100644 (file)
@@ -28,9 +28,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.extended.community.ExtendedCommunity;
 
 public class Layer2AttributesExtComTest {
-    private static final byte[] EXPECTEDS = {(byte) 0x00, (byte) 0x07, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00};
-    private static final byte[] EVPN_VPWS = {(byte) 0x00, (byte) 0x2f, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00};
-    private static final byte[] EVPN_VPWS_2 = {(byte) 0x00, (byte) 0x57, (byte) 0x01, (byte) 0x01, (byte) 0x00, (byte) 0x00};
+    private static final byte[] EXPECTEDS = {(byte) 0x00, (byte) 0x07, (byte) 0x01, (byte) 0x01,
+        (byte) 0x00, (byte) 0x00};
+    private static final byte[] EVPN_VPWS = {(byte) 0x00, (byte) 0x2f, (byte) 0x01, (byte) 0x01,
+        (byte) 0x00, (byte) 0x00};
+    private static final byte[] EVPN_VPWS_2 = {(byte) 0x00, (byte) 0x57, (byte) 0x01, (byte) 0x01,
+        (byte) 0x00, (byte) 0x00};
     private Layer2AttributesExtCom parser;
 
     @Before
@@ -43,8 +46,8 @@ public class Layer2AttributesExtComTest {
         final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
         final Layer2AttributesExtendedCommunityCase expected = new Layer2AttributesExtendedCommunityCaseBuilder()
-            .setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true)
-                .setControlWord(true).setPrimaryPe(true).setL2Mtu(257).build()).build();
+                .setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true)
+                        .setControlWord(true).setPrimaryPe(true).setL2Mtu(257).build()).build();
         this.parser.serializeExtendedCommunity(expected, buff);
         final byte[] resultByte = ByteArray.getAllBytes(buff);
         assertArrayEquals(EXPECTEDS, resultByte);
@@ -58,11 +61,11 @@ public class Layer2AttributesExtComTest {
         final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
         final Layer2AttributesExtendedCommunityCase expected = new Layer2AttributesExtendedCommunityCaseBuilder()
-            .setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true)
-                .setControlWord(true).setPrimaryPe(true).setL2Mtu(257)
-                .setModeOfOperation(OperationalMode.VlanAwareFxc)
-                .setOperatingPer(NormalizationType.SingleVid)
-                .build()).build();
+                .setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true)
+                        .setControlWord(true).setPrimaryPe(true).setL2Mtu(257)
+                        .setModeOfOperation(OperationalMode.VlanAwareFxc)
+                        .setOperatingPer(NormalizationType.SingleVid)
+                        .build()).build();
         this.parser.serializeExtendedCommunity(expected, buff);
         final byte[] resultByte = ByteArray.getAllBytes(buff);
         assertArrayEquals(EVPN_VPWS, resultByte);
@@ -72,11 +75,11 @@ public class Layer2AttributesExtComTest {
 
         final ByteBuf buff2 = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
         final Layer2AttributesExtendedCommunityCase expected2 = new Layer2AttributesExtendedCommunityCaseBuilder()
-            .setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true)
-                .setControlWord(true).setPrimaryPe(true).setL2Mtu(257)
-                .setModeOfOperation(OperationalMode.VlanUnawareFxc)
-                .setOperatingPer(NormalizationType.DoubleVid)
-                .build()).build();
+                .setLayer2AttributesExtendedCommunity(new Layer2AttributesExtendedCommunityBuilder().setBackupPe(true)
+                        .setControlWord(true).setPrimaryPe(true).setL2Mtu(257)
+                        .setModeOfOperation(OperationalMode.VlanUnawareFxc)
+                        .setOperatingPer(NormalizationType.DoubleVid)
+                        .build()).build();
         this.parser.serializeExtendedCommunity(expected2, buff2);
         final byte[] resultByte2 = ByteArray.getAllBytes(buff2);
         assertArrayEquals(EVPN_VPWS_2, resultByte2);
index 461c6899f2ad345bce7c9864a24e77db45143ced..ddbcb87673502df31f416dc5d19693d56a67c9b1 100644 (file)
@@ -38,8 +38,9 @@ public class MACMobExtComTest {
     public void parserTest() throws BGPParsingException, BGPDocumentedException {
         final ByteBuf buff = Unpooled.buffer(COMMUNITY_VALUE_SIZE);
 
-        final MacMobilityExtendedCommunityCase expected = new MacMobilityExtendedCommunityCaseBuilder().setMacMobilityExtendedCommunity(
-            new MacMobilityExtendedCommunityBuilder().setStatic(true).setSeqNumber(LD).build()).build();
+        final MacMobilityExtendedCommunityCase expected = new MacMobilityExtendedCommunityCaseBuilder()
+                .setMacMobilityExtendedCommunity(new MacMobilityExtendedCommunityBuilder()
+                        .setStatic(true).setSeqNumber(LD).build()).build();
         this.parser.serializeExtendedCommunity(expected, buff);
         assertArrayEquals(RESULT, ByteArray.getAllBytes(buff));
 
index 8b6048c2504727b54913ca6590baf93499124b60..99ea159e1d588adcb02ed32493129ef3a512a191 100644 (file)
@@ -44,7 +44,8 @@ public class EthADRParserTest {
     public static final byte[] RESULT = {
         (byte) 0x01, (byte) 0x19,
         (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x01, (byte) 0x02,
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a, (byte) 0x05, (byte) 0xdc, (byte) 0x10
     };
     public static final byte[] ROUDE_DISTIN = {
@@ -52,12 +53,15 @@ public class EthADRParserTest {
     };
     static final EthernetTagId ETI = new EthernetTagIdBuilder().setVlanId(VLAN).build();
     public static final EthernetADRouteCase ETHERNET_AD_ROUTE_CASE_KEY = new EthernetADRouteCaseBuilder()
-        .setEthernetADRoute(new EthernetADRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setEthernetTagId(ETI).build()).build();
-    public static final EthernetADRouteCase ETHERNET_AD_ROUTE_CASE = new EthernetADRouteCaseBuilder().setEthernetADRoute(new EthernetADRouteBuilder()
+        .setEthernetADRoute(new EthernetADRouteBuilder().setEsi(LAN_AUT_GEN_CASE)
+                .setEthernetTagId(ETI).build()).build();
+    public static final EthernetADRouteCase ETHERNET_AD_ROUTE_CASE = new EthernetADRouteCaseBuilder()
+            .setEthernetADRoute(new EthernetADRouteBuilder()
         .setEsi(LAN_AUT_GEN_CASE).setEthernetTagId(ETI).setMplsLabel(MPLS_LABEL).build()).build();
     static final byte[] WRONG_VALUE = {(byte) 0x00};
     private static final byte[] VALUE = {
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a, (byte) 0x05, (byte) 0xdc, (byte) 0x10
     };
     private EthADRParser parser;
index 5a26a910f00ac922b1f8a3864c932003614f0cdb..0284e6c414df99e59ec6d272a160141aa95428f0 100644 (file)
@@ -40,17 +40,18 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine
 
 public class EthSegRParserTest {
     private static final byte[] VALUE = {
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
-        (byte) 0x20, (byte) 0x7f, (byte) 0x00, (byte) 0x00, (byte) 0x01
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00, (byte) 0x20, (byte) 0x7f, (byte) 0x00, (byte) 0x00, (byte) 0x01
     };
     private static final byte[] RESULT = {
         (byte) 0x04, (byte) 0x17,
         (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x01, (byte) 0x02,
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
-        (byte) 0x20, (byte) 0x7f, (byte) 0x00, (byte) 0x00, (byte) 0x01
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00, (byte) 0x20, (byte) 0x7f, (byte) 0x00, (byte) 0x00, (byte) 0x01
     };
     private static final byte[] VALUE2 = {
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00,
         (byte) 0x80,//IPV6
         (byte) 0x20, (byte) 0x01, (byte) 0x00, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
@@ -60,7 +61,8 @@ public class EthSegRParserTest {
     private static final byte[] RESULT2 = {
         (byte) 0x04, (byte) 0x23,
         (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x01, (byte) 0x02,
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00,
         (byte) 0x80,//IPV6
         (byte) 0x20, (byte) 0x01, (byte) 0x00, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
@@ -77,16 +79,20 @@ public class EthSegRParserTest {
 
     @Test
     public void parserTest() {
-        final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IP).build()).build();
-        assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
+        final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder()
+                .setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IP).build()).build();
+        assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
+                Unpooled.wrappedBuffer(ROUDE_DISTIN))));
 
         final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE));
         assertEquals(expected, result);
 
-        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders
+                .choiceBuilder();
         choice.withNodeIdentifier(EthSegRParser.ES_ROUTE_NID);
-        final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID).addChild(LanParserTest.createLanChoice())
-            .addChild(createValueBuilder(IP_MODEL, ORI_NID).build()).build();
+        final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID)
+                .addChild(LanParserTest.createLanChoice())
+                .addChild(createValueBuilder(IP_MODEL, ORI_NID).build()).build();
         final EvpnChoice modelResult = this.parser.serializeEvpnModel(arbitraryC);
         assertEquals(expected, modelResult);
 
@@ -96,16 +102,20 @@ public class EthSegRParserTest {
 
     @Test
     public void parser2Test() {
-        final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IPV6).build()).build();
-        assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
+        final EsRouteCase expected = new EsRouteCaseBuilder().setEsRoute(new EsRouteBuilder()
+                .setEsi(LAN_AUT_GEN_CASE).setOrigRouteIp(IPV6).build()).build();
+        assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
+                Unpooled.wrappedBuffer(ROUDE_DISTIN))));
 
         final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE2));
         assertEquals(expected, result);
 
-        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
+        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders
+                .choiceBuilder();
         choice.withNodeIdentifier(EthSegRParser.ES_ROUTE_NID);
-        final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID).addChild(LanParserTest.createLanChoice())
-            .addChild(createValueBuilder(IPV6_MODEL, ORI_NID).build()).build();
+        final ContainerNode arbitraryC = createContBuilder(EthSegRParser.ES_ROUTE_NID)
+                .addChild(LanParserTest.createLanChoice())
+                .addChild(createValueBuilder(IPV6_MODEL, ORI_NID).build()).build();
         final EvpnChoice modelResult = this.parser.serializeEvpnModel(arbitraryC);
         assertEquals(expected, modelResult);
 
index b14a581be0111ddd4910d6d0e20d2e6c2649c0e0..e7f202879b701f21117df5042105bb662c1b25ee 100644 (file)
@@ -7,13 +7,13 @@
  */
 package org.opendaylight.protocol.bgp.evpn.impl.nlri;
 
-import static org.junit.Assert.assertArrayEquals;
+import static java.util.Collections.singletonList;
 import static org.opendaylight.protocol.bgp.evpn.impl.EvpnTestUtil.RD;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
-import java.util.Collections;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.evpn.impl.esi.types.ESIActivator;
@@ -53,14 +53,17 @@ public class EvpnNlriAttributesParserTest {
         final Attributes att = new AttributesBuilder().addAugmentation(Attributes1.class,
             new Attributes1Builder().setMpReachNlri(createReach()).build()).build();
         this.parser.serializeAttribute(att, buffer);
-        assertArrayEquals(IncMultEthTagRParserTest.RESULT, ByteArray.getAllBytes(buffer));
+        Assert.assertArrayEquals(IncMultEthTagRParserTest.RESULT, ByteArray.getAllBytes(buffer));
     }
 
     private static MpReachNlri createReach() {
         final MpReachNlriBuilder mpReachExpected = new MpReachNlriBuilder();
         final AdvertizedRoutes wd = new AdvertizedRoutesBuilder().setDestinationType(new DestinationEvpnCaseBuilder()
-            .setDestinationEvpn(new DestinationEvpnBuilder().setEvpnDestination(Collections.singletonList(new EvpnDestinationBuilder()
-                .setRouteDistinguisher(RD).setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build())).build()).build()).build();
+            .setDestinationEvpn(new DestinationEvpnBuilder().setEvpnDestination(
+                    singletonList(new EvpnDestinationBuilder()
+                            .setRouteDistinguisher(RD)
+                            .setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase())
+                            .build())).build()).build()).build();
         return mpReachExpected.setAdvertizedRoutes(wd).build();
     }
 
@@ -70,14 +73,20 @@ public class EvpnNlriAttributesParserTest {
         final Attributes att = new AttributesBuilder().addAugmentation(Attributes2.class,
             new Attributes2Builder().setMpUnreachNlri(createUnreach()).build()).build();
         this.parser.serializeAttribute(att, buffer);
-        assertArrayEquals(IncMultEthTagRParserTest.RESULT, ByteArray.getAllBytes(buffer));
+        Assert.assertArrayEquals(IncMultEthTagRParserTest.RESULT, ByteArray.getAllBytes(buffer));
     }
 
     private static MpUnreachNlri createUnreach() {
         final MpUnreachNlriBuilder mpReachExpected = new MpUnreachNlriBuilder();
-        final WithdrawnRoutes wd = new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder()
-            .setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.evpn._case.DestinationEvpnBuilder().setEvpnDestination(Collections.singletonList(new EvpnDestinationBuilder()
-                .setRouteDistinguisher(RD).setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build())).build()).build()).build();
+        final WithdrawnRoutes wd = new WithdrawnRoutesBuilder()
+                .setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
+                        .rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                        .DestinationEvpnCaseBuilder().setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn
+                        .opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn
+                        .routes.destination.type.destination.evpn._case.DestinationEvpnBuilder()
+                        .setEvpnDestination(singletonList(new EvpnDestinationBuilder()
+                        .setRouteDistinguisher(RD).setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase())
+                                .build())).build()).build()).build();
         return mpReachExpected.setWithdrawnRoutes(wd).build();
     }
 
index a22a336f2a820e4c24894c98a1a567415139c934..007299857ec31726213a2ff5d9104dabd0f2354c 100644 (file)
@@ -50,13 +50,19 @@ public class EvpnNlriParserTest {
     private List<EvpnDestination> dest;
     private EvpnNlriParser parser;
 
+    static ChoiceNode createMACIpAdvChoice() {
+        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
+        choice.withNodeIdentifier(EVPN_CHOICE_NID);
+        return choice.addChild(MACIpAdvRParserTest.createMacIpCont()).build();
+    }
+
     @Before
     public void setUp() {
         ESIActivator.registerEsiTypeParsers(new ArrayList<>());
         NlriActivator.registerNlriParsers(new ArrayList<>());
         this.dest = Collections.singletonList(new EvpnDestinationBuilder()
-            .setRouteDistinguisher(RD)
-            .setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build());
+                .setRouteDistinguisher(RD)
+                .setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build());
         this.parser = new EvpnNlriParser();
     }
 
@@ -77,10 +83,13 @@ public class EvpnNlriParserTest {
 
     private MpUnreachNlri createUnreach() {
         final MpUnreachNlriBuilder mpReachExpected = new MpUnreachNlriBuilder();
-        final WithdrawnRoutes wd = new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.
-            bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder().setDestinationEvpn(
-            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.
-                destination.type.destination.evpn._case.DestinationEvpnBuilder().setEvpnDestination(this.dest).build()).build()).build();
+        final WithdrawnRoutes wd = new WithdrawnRoutesBuilder().setDestinationType(
+                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.update
+                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder()
+                        .setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+                                .evpn.rev171213.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type
+                                .destination.evpn._case.DestinationEvpnBuilder()
+                                .setEvpnDestination(this.dest).build()).build()).build();
         return mpReachExpected.setWithdrawnRoutes(wd).build();
     }
 
@@ -90,8 +99,9 @@ public class EvpnNlriParserTest {
         this.parser.parseNlri(Unpooled.wrappedBuffer(IncMultEthTagRParserTest.RESULT), mpReach);
 
         final MpReachNlriBuilder mpReachExpected = new MpReachNlriBuilder();
-        final AdvertizedRoutes wd = new AdvertizedRoutesBuilder().setDestinationType(new DestinationEvpnCaseBuilder().setDestinationEvpn(
-            new DestinationEvpnBuilder().setEvpnDestination(this.dest).build()).build()).build();
+        final AdvertizedRoutes wd = new AdvertizedRoutesBuilder().setDestinationType(new DestinationEvpnCaseBuilder()
+                .setDestinationEvpn(new DestinationEvpnBuilder().setEvpnDestination(this.dest).build())
+                .build()).build();
         mpReachExpected.setAdvertizedRoutes(wd);
         assertEquals(mpReachExpected.build(), mpReach.build());
     }
@@ -112,30 +122,28 @@ public class EvpnNlriParserTest {
 
     @Test
     public void testExtractEvpnDestination() throws BGPParsingException {
-        final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI =
+                ImmutableUnkeyedListEntryNodeBuilder.create();
         evpnBI.withNodeIdentifier(EVPN_NID);
         evpnBI.withChild(createMACIpAdvChoice());
         evpnBI.withChild(createValueBuilder(RD_MODEL, RD_NID).build());
         final EvpnDestination destResult = EvpnNlriParser.extractEvpnDestination(evpnBI.build());
-        final EvpnDestination expected = new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(MACIpAdvRParserTest.createdExpectedResult()).build();
+        final EvpnDestination expected = new EvpnDestinationBuilder()
+                .setRouteDistinguisher(RD)
+                .setEvpnChoice(MACIpAdvRParserTest.createdExpectedResult()).build();
         assertEquals(expected, destResult);
     }
 
-
-    public static ChoiceNode createMACIpAdvChoice() {
-        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
-        choice.withNodeIdentifier(EVPN_CHOICE_NID);
-        return choice.addChild(MACIpAdvRParserTest.createMacIpCont()).build();
-    }
-
     @Test
     public void testExtractRouteKey() throws BGPParsingException {
-        final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI = ImmutableUnkeyedListEntryNodeBuilder.create();
+        final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> evpnBI =
+                ImmutableUnkeyedListEntryNodeBuilder.create();
         evpnBI.withNodeIdentifier(EVPN_CHOICE_NID);
         evpnBI.withChild(createValueBuilder(RD_MODEL, RD_NID).build());
         evpnBI.withChild(createMACIpAdvChoice());
         final EvpnDestination destResult = EvpnNlriParser.extractRouteKeyDestination(evpnBI.build());
-        final EvpnDestination expected = new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(MACIpAdvRParserTest.createdExpectedRouteKey()).build();
+        final EvpnDestination expected = new EvpnDestinationBuilder().setRouteDistinguisher(RD)
+                .setEvpnChoice(MACIpAdvRParserTest.createdExpectedRouteKey()).build();
         assertEquals(expected, destResult);
     }
 }
\ No newline at end of file
index 82ae30660132403725ceb9306356b9ec6c27c48e..6fac50b3fb68efc56cc511e249d04903efefd017 100644 (file)
@@ -59,7 +59,8 @@ public class IncMultEthTagRParserTest {
     public void parserTest() {
 
         final IncMultiEthernetTagResCase expected = IncMultEthTagRParserTest.createIncMultiCase();
-        assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
+        assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
+                Unpooled.wrappedBuffer(ROUDE_DISTIN))));
 
         final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE));
         assertEquals(expected, result);
@@ -75,9 +76,9 @@ public class IncMultEthTagRParserTest {
         assertEquals(expected, keyResult);
     }
 
-    public static IncMultiEthernetTagResCase createIncMultiCase() {
-        return new IncMultiEthernetTagResCaseBuilder().setIncMultiEthernetTagRes(new IncMultiEthernetTagResBuilder().setEthernetTagId(ETI)
-            .setOrigRouteIp(IP).build()).build();
+    static IncMultiEthernetTagResCase createIncMultiCase() {
+        return new IncMultiEthernetTagResCaseBuilder().setIncMultiEthernetTagRes(
+                new IncMultiEthernetTagResBuilder().setEthernetTagId(ETI).setOrigRouteIp(IP).build()).build();
     }
 
     @Test(expected = IllegalArgumentException.class)
index 702e8e4cd432382e365623a0fd282987005dfcfe..1458980d9315ac96479e0078866472ba0b997df0 100644 (file)
@@ -52,7 +52,8 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine
 
 public class MACIpAdvRParserTest {
     private static final byte[] VALUE = {
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a,
         (byte) 0x30, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7,
         (byte) 0x20, (byte) 0x7f, (byte) 0x00, (byte) 0x00, (byte) 0x01,
@@ -62,7 +63,8 @@ public class MACIpAdvRParserTest {
     private static final byte[] RESULT = {
         (byte) 0x02, (byte) 0x28,
         (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x01, (byte) 0x02,
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a,
         (byte) 0x30, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7,
         (byte) 0x20, (byte) 0x7f, (byte) 0x00, (byte) 0x00, (byte) 0x01,
@@ -70,16 +72,18 @@ public class MACIpAdvRParserTest {
         (byte) 0x05, (byte) 0xdc, (byte) 0x20
     };
     private static final byte[] VALUE2 = {
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00,
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00,
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a,
         (byte) 0x30, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7,
-        (byte) 0x80, 0x20, (byte) 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
-        (byte) 0x05, (byte) 0xdc, (byte) 0x10,
+        (byte) 0x80, 0x20, (byte) 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+        0x01, (byte) 0x05, (byte) 0xdc, (byte) 0x10,
     };
     private static final byte[] RESULT2 = {
         (byte) 0x02, (byte) 0x31,
         (byte) 0x00, (byte) 0x01, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x01, (byte) 0x02,  //RD
-        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02, (byte) 0x02, (byte) 0x00, //ESI
+        (byte) 0x02, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, (byte) 0x02,
+        (byte) 0x02, (byte) 0x00, //ESI
         (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x0a, // ETI
         (byte) 0x30, (byte) 0xf2, (byte) 0x0c, (byte) 0xdd, (byte) 0x80, (byte) 0x9f, (byte) 0xf7, // MAC
         (byte) 0x80,//IPV6
@@ -101,7 +105,8 @@ public class MACIpAdvRParserTest {
     @Test
     public void parserCase1Test() {
         final MacIpAdvRouteCase expected = createdExpectedResult();
-        assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected, Unpooled.wrappedBuffer(ROUDE_DISTIN))));
+        assertArrayEquals(RESULT, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
+                Unpooled.wrappedBuffer(ROUDE_DISTIN))));
 
         final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE));
         assertEquals(expected, result);
@@ -113,13 +118,14 @@ public class MACIpAdvRParserTest {
     }
 
     static MacIpAdvRouteCase createdExpectedResult() {
-        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder().setEsi(LAN_AUT_GEN_CASE).setEthernetTagId(ETI)
-            .setMacAddress(MAC).setIpAddress(IP).setMplsLabel1(MPLS_LABEL).setMplsLabel2(MPLS_LABEL2).build()).build();
+        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder().setEsi(LAN_AUT_GEN_CASE)
+                .setEthernetTagId(ETI).setMacAddress(MAC).setIpAddress(IP).setMplsLabel1(MPLS_LABEL)
+                .setMplsLabel2(MPLS_LABEL2).build()).build();
     }
 
     static MacIpAdvRouteCase createdExpectedRouteKey() {
-        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder().setEthernetTagId(ETI).setMacAddress(MAC)
-            .setIpAddress(IP).build()).build();
+        return new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder().setEthernetTagId(ETI)
+                .setMacAddress(MAC).setIpAddress(IP).build()).build();
     }
 
     static ContainerNode createMacIpCont() {
@@ -140,17 +146,21 @@ public class MACIpAdvRParserTest {
     @Test
     public void parserCase2Test() {
 
-        final MacIpAdvRouteCase expected = new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder().setEsi(LAN_AUT_GEN_CASE)
-            .setEthernetTagId(ETI).setMacAddress(MAC).setIpAddress(IPV6).setMplsLabel1(MPLS_LABEL).build()).build();
-        assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,  Unpooled.wrappedBuffer(ROUDE_DISTIN))));
+        final MacIpAdvRouteCase expected = new MacIpAdvRouteCaseBuilder().setMacIpAdvRoute(new MacIpAdvRouteBuilder()
+                .setEsi(LAN_AUT_GEN_CASE).setEthernetTagId(ETI).setMacAddress(MAC).setIpAddress(IPV6)
+                .setMplsLabel1(MPLS_LABEL).build()).build();
+        assertArrayEquals(RESULT2, ByteArray.getAllBytes(this.parser.serializeEvpn(expected,
+                Unpooled.wrappedBuffer(ROUDE_DISTIN))));
 
         final EvpnChoice result = this.parser.parseEvpn(Unpooled.wrappedBuffer(VALUE2));
         assertEquals(expected, result);
 
         final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder();
         choice.withNodeIdentifier(MACIpAdvRParser.MAC_IP_ADV_ROUTE_NID);
-        final ContainerNode macIp = createContBuilder(MACIpAdvRParser.MAC_IP_ADV_ROUTE_NID).addChild(LanParserTest.createLanChoice()).addChild(createEti())
-            .addChild(createValueBuilder(MAC_MODEL, MAC_NID).build()).addChild(createValueBuilder(IPV6_MODEL, IP_NID).build())
+        final ContainerNode macIp = createContBuilder(MACIpAdvRParser.MAC_IP_ADV_ROUTE_NID)
+                .addChild(LanParserTest.createLanChoice()).addChild(createEti())
+            .addChild(createValueBuilder(MAC_MODEL, MAC_NID).build())
+                .addChild(createValueBuilder(IPV6_MODEL, IP_NID).build())
             .addChild(createValueBuilder(MPLS_LABEL_MODEL, MPLS1_NID).build()).build();
         final EvpnChoice modelResult = this.parser.serializeEvpnModel(macIp);
 
index 3207003b41c14b23436685fb3077fc150d2eec75..bb59949abbefc7b38d7f9fe5d1ef06037cb037a4 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.routes.evpn.routes.EvpnRoute;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
@@ -32,10 +32,10 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine
 public class SimpleEsiTypeRegistryTest {
     private static final int ESI_TYPE_LENGTH = 10;
 
-    private class notRegistered implements Esi {
+    private class NotRegistered implements Esi {
         @Override
         public Class<? extends DataContainer> getImplementedInterface() {
-            return notRegistered.class;
+            return NotRegistered.class;
         }
     }
 
@@ -47,10 +47,12 @@ public class SimpleEsiTypeRegistryTest {
     @Test
     public void registryTest() {
         final ByteBuf buff = Unpooled.buffer(ESI_TYPE_LENGTH);
+
+        final SimpleEsiTypeRegistry reg = SimpleEsiTypeRegistry.getInstance();
         SimpleEsiTypeRegistry.getInstance().serializeEsi(ROUTE_ID_CASE, buff);
         assertArrayEquals(RouterIdParserTest.RESULT, ByteArray.getAllBytes(buff));
-        assertEquals(ROUTE_ID_CASE, SimpleEsiTypeRegistry.getInstance().parseEsiModel(RouterIdParserTest.createRouterIdCase()));
-        assertEquals(RouterIdParserTest.ROUTE_ID_CASE, SimpleEsiTypeRegistry.getInstance().parseEsi(Unpooled.wrappedBuffer(buff)));
+        assertEquals(ROUTE_ID_CASE, reg.parseEsiModel(RouterIdParserTest.createRouterIdCase()));
+        assertEquals(RouterIdParserTest.ROUTE_ID_CASE, reg.parseEsi(Unpooled.wrappedBuffer(buff)));
     }
 
     @Test(expected = IllegalArgumentException.class)
@@ -61,14 +63,16 @@ public class SimpleEsiTypeRegistryTest {
     @Test
     public void registryNullTest() {
         final ByteBuf body = Unpooled.buffer();
-        SimpleEsiTypeRegistry.getInstance().serializeEsi(new notRegistered(), body);
+        SimpleEsiTypeRegistry.getInstance().serializeEsi(new NotRegistered(), body);
         assertEquals(0, body.readableBytes());
     }
 
     @Test(expected = IllegalArgumentException.class)
     public void registryNullModelTest() {
-        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> noRegister = Builders.choiceBuilder();
-        noRegister.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(QName.create(EvpnRoute.QNAME, "no-register").intern()));
+        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> noRegister =
+                Builders.choiceBuilder();
+        noRegister.withNodeIdentifier(new NodeIdentifier(QName.create(EvpnRoute.QNAME,
+                "no-register").intern()));
         assertNull(SimpleEsiTypeRegistry.getInstance().parseEsiModel(noRegister.build()));
     }
 
index 1a229d51fadd4644ef54dc134cf8d52a4a419990..39626615265a38bb01793f1f6e9831cc83a42c98 100644 (file)
@@ -30,13 +30,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.evpn.EvpnChoice;
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
 
 public final class SimpleEvpnNlriRegistryTest {
-    public static final YangInstanceIdentifier.NodeIdentifier EVPN_NID = new YangInstanceIdentifier.NodeIdentifier(EvpnChoice.QNAME);
+    public static final NodeIdentifier EVPN_NID = new NodeIdentifier(EvpnChoice.QNAME);
 
     private class NotRegistered implements EvpnChoice {
         @Override
@@ -54,7 +54,8 @@ public final class SimpleEvpnNlriRegistryTest {
 
     @Test
     public void registryTest() {
-        final ByteBuf buff = SimpleEvpnNlriRegistry.getInstance().serializeEvpn(ETHERNET_AD_ROUTE_CASE, Unpooled.wrappedBuffer(ROUDE_DISTIN));
+        final ByteBuf buff = SimpleEvpnNlriRegistry.getInstance().serializeEvpn(ETHERNET_AD_ROUTE_CASE,
+                Unpooled.wrappedBuffer(ROUDE_DISTIN));
         assertArrayEquals(EthADRParserTest.RESULT, ByteArray.getAllBytes(buff));
         final EvpnChoice resultModel = SimpleEvpnNlriRegistry.getInstance().serializeEvpnModel(createEthADRModel());
         assertEquals(ETHERNET_AD_ROUTE_CASE, resultModel);
@@ -77,8 +78,10 @@ public final class SimpleEvpnNlriRegistryTest {
 
     @Test
     public void registryNullModelTest() {
-        final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder().withNodeIdentifier(EVPN_NID);
-        choice.addChild(createContBuilder(new YangInstanceIdentifier.NodeIdentifier(QName.create(Evpn.QNAME, "test").intern())).build()).build();
+        final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> choice = Builders.choiceBuilder()
+                .withNodeIdentifier(EVPN_NID);
+        choice.addChild(createContBuilder(new NodeIdentifier(QName.create(Evpn.QNAME, "test").intern()))
+                .build()).build();
         assertNull(SimpleEvpnNlriRegistry.getInstance().serializeEvpnModel(choice.build()));
     }
 }
\ No newline at end of file