MVPN Extension Clean up 31/72831/2
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 11 Jun 2018 03:45:44 +0000 (05:45 +0200)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 11 Jun 2018 03:52:11 +0000 (05:52 +0200)
- initialize Ipv6 Registry before start Ipv6Ribsupport Test
- remove unnecesary variables
- make final when possible variables

Change-Id: I6704d1ef732c6092b85c4fa3bae422a6ca2a10b4
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
21 files changed:
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/AbstractMvpnRIBSupport.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/AbstractMvpnNlri.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/Ipv4NlriHandler.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/Ipv6NlriHandler.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/LeafADHandler.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/MulticastGroupOpaqueUtil.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/spi/nlri/MvpnRegistry.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/spi/nlri/MvpnSerializer.java
bgp/mvpn/src/main/java/org/opendaylight/protocol/bgp/mvpn/spi/pojo/nlri/SimpleMvpnNlriRegistry.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/MvpnIpv4RIBSupportTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/MvpnIpv6RIBSupportTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/extended/community/SourceASHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/attributes/extended/community/VrfRouteImportHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/InterASIPmsiADHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/IntraAsIPmsiADHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/LeafADHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/SPmsiADHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/SharedTreeJoinHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/SourceActiveADHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/impl/nlri/SourceTreeJoinHandlerTest.java
bgp/mvpn/src/test/java/org/opendaylight/protocol/bgp/mvpn/spi/pojo/nlri/SimpleMvpnNlriRegistryTest.java

index ae81ca31fe8de93a5d27f0ad818457af14ef35cf..dc28372154034d6535e421ecd696e5c50b173e5a 100644 (file)
@@ -114,13 +114,13 @@ abstract class AbstractMvpnRIBSupport<C extends Routes & DataObject & ChoiceIn<T
             final ApplyRoute function) {
         if (destination != null) {
             final Optional<DataContainerChild<? extends PathArgument, ?>> maybeRoutes = destination
-                    .getChild(nlriRoutesList);
+                    .getChild(this.nlriRoutesList);
             if (maybeRoutes.isPresent()) {
                 final DataContainerChild<? extends PathArgument, ?> routes = maybeRoutes.get();
                 if (routes instanceof UnkeyedListNode) {
                     final YangInstanceIdentifier base = routesPath.node(routesContainerIdentifier()).node(routeNid());
                     for (final UnkeyedListEntryNode mvpnDest : ((UnkeyedListNode) routes).getValue()) {
-                        final YangInstanceIdentifier.NodeIdentifierWithPredicates routeKey = createRouteKey(mvpnDest);
+                        final NodeIdentifierWithPredicates routeKey = createRouteKey(mvpnDest);
                         function.apply(tx, base, routeKey, mvpnDest, attributes);
                     }
                 } else {
index 7e8c8631470a87c84b2fd6b8c93d3ddeb84fbd0d..9c8b054469e45617ab92ff8d62185c537e20ac2f 100644 (file)
@@ -18,8 +18,6 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.MulticastSourceRdGrouping;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.mvpn.MvpnChoice;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.s.pmsi.a.d.grouping.SPmsiADBuilder;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 
 /**
  * Abstract Mvpn Nlri.
@@ -27,32 +25,7 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdent
  * @author Claudio D. Gasparini
  */
 abstract class AbstractMvpnNlri<T extends MvpnChoice> implements MvpnSerializer<T>, MvpnParser<T> {
-    static final NodeIdentifier RD_NID = NodeIdentifier.create(QName.create(MvpnChoice.QNAME,
-            "route-distinguisher").intern());
-    static final NodeIdentifier ORI_NID = NodeIdentifier.create(QName.create(MvpnChoice.QNAME,
-            "orig-route-ip").intern());
-    static final NodeIdentifier SOURCE_AS_NID = NodeIdentifier.create(QName.create(MvpnChoice.QNAME,
-            "source-as").intern());
-    static final NodeIdentifier MULTICAST_SOURCE_NID = NodeIdentifier.create(QName.create(MvpnChoice.QNAME,
-            "multicast-source").intern());
-    static final NodeIdentifier MULTICAST_GROUP_NID = NodeIdentifier.create(QName.create(MvpnChoice.QNAME,
-            "multicast-group").intern());
-
-    @Override
-    public final ByteBuf serializeMvpn(final T mvpn, final ByteBuf common) {
-        final ByteBuf output = Unpooled.buffer();
-        final ByteBuf body = serializeBody(mvpn);
-        output.writeByte(getType());
-        output.writeByte(body.readableBytes() + common.readableBytes());
-        output.writeBytes(common);
-        output.writeBytes(body);
-        return output;
-    }
-
-    protected abstract ByteBuf serializeBody(T mvpn);
-
-
-    static final MulticastSourceRdGrouping parseRDMulticastSource(final ByteBuf buffer) {
+    static MulticastSourceRdGrouping parseRDMulticastSource(final ByteBuf buffer) {
         final SPmsiADBuilder builder = new SPmsiADBuilder();
         builder.setRouteDistinguisher(RouteDistinguisherUtil.parseRouteDistinguisher(buffer));
         final IpAddress address = IpAddressUtil.addressForByteBuf(buffer);
@@ -60,8 +33,20 @@ abstract class AbstractMvpnNlri<T extends MvpnChoice> implements MvpnSerializer<
         return builder.build();
     }
 
-    static final void serializeRDMulticastSource(final MulticastSourceRdGrouping route, final ByteBuf output) {
+    static void serializeRDMulticastSource(final MulticastSourceRdGrouping route, final ByteBuf output) {
         RouteDistinguisherUtil.serializeRouteDistinquisher(route.getRouteDistinguisher(), output);
         output.writeBytes(IpAddressUtil.bytesFor(route.getMulticastSource()));
     }
+
+    @Override
+    public final ByteBuf serializeMvpn(final T mvpn) {
+        final ByteBuf output = Unpooled.buffer();
+        final ByteBuf body = serializeBody(mvpn);
+        output.writeByte(getType());
+        output.writeByte(body.readableBytes());
+        output.writeBytes(body);
+        return output;
+    }
+
+    protected abstract ByteBuf serializeBody(T mvpn);
 }
index 2d1272075effc988c41631f8c4ff864cfcd47153..e8d6bbfc0f2e11402a43765969d930bf9b6ef311 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 
 import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.bgp.mvpn.spi.pojo.nlri.SimpleMvpnNlriRegistry;
@@ -34,9 +33,9 @@ public final class Ipv4NlriHandler {
     }
 
     static DestinationMvpnIpv4AdvertizedCase parseIpv4ReachNlri(
-            final ByteBuf nlri,
-            final boolean addPathSupported) {
-        List<MvpnDestination> dests = new ArrayList<>();
+        final ByteBuf nlri,
+        final boolean addPathSupported) {
+        final List<MvpnDestination> dests = new ArrayList<>();
 
         while (nlri.isReadable()) {
             final MvpnDestinationBuilder builder = new MvpnDestinationBuilder();
@@ -51,13 +50,13 @@ public final class Ipv4NlriHandler {
         }
 
         return new DestinationMvpnIpv4AdvertizedCaseBuilder()
-                .setDestinationMvpn(new DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
+            .setDestinationMvpn(new DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
     }
 
     static DestinationMvpnIpv4WithdrawnCase parseIpv4UnreachNlri(
-            final ByteBuf nlri,
-            final boolean addPathSupported) {
-        List<MvpnDestination> dests = new ArrayList<>();
+        final ByteBuf nlri,
+        final boolean addPathSupported) {
+        final List<MvpnDestination> dests = new ArrayList<>();
 
         while (nlri.isReadable()) {
             final MvpnDestinationBuilder builder = new MvpnDestinationBuilder();
@@ -72,17 +71,14 @@ public final class Ipv4NlriHandler {
         }
 
         return new DestinationMvpnIpv4WithdrawnCaseBuilder().setDestinationMvpn(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.update
-                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn.ipv4
-                        .withdrawn._case.DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv4.rev180417.update
+                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn.ipv4
+                .withdrawn._case.DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
     }
 
     public static void serializeNlri(final List<MvpnDestination> destinationList, final ByteBuf output) {
-        ByteBuf nlriOutput = null;
         for (final MvpnDestination dest : destinationList) {
-            final ByteBuf nlriCommon = Unpooled.buffer();
-            nlriOutput = SimpleMvpnNlriRegistry.getInstance().serializeMvpn(dest.getMvpnChoice(), nlriCommon);
+            output.writeBytes(SimpleMvpnNlriRegistry.getInstance().serializeMvpn(dest.getMvpnChoice()));
         }
-        output.writeBytes(nlriOutput);
     }
 }
index 4fd7c8bc1a8a51a2ebea927694cab13e61db6329..552c4d49b0f2eb83da043260715c4bb7b82abeaa 100644 (file)
@@ -9,7 +9,6 @@
 package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 
 import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import java.util.List;
 import org.opendaylight.protocol.bgp.mvpn.spi.pojo.nlri.SimpleMvpnNlriRegistry;
@@ -34,9 +33,9 @@ public final class Ipv6NlriHandler {
     }
 
     static DestinationMvpnIpv6AdvertizedCase parseIpv6ReachNlri(
-            final ByteBuf nlri,
-            final boolean addPathSupported) {
-        List<MvpnDestination> dests = new ArrayList<>();
+        final ByteBuf nlri,
+        final boolean addPathSupported) {
+        final List<MvpnDestination> dests = new ArrayList<>();
 
         while (nlri.isReadable()) {
             final MvpnDestinationBuilder builder = new MvpnDestinationBuilder();
@@ -51,13 +50,13 @@ public final class Ipv6NlriHandler {
         }
 
         return new DestinationMvpnIpv6AdvertizedCaseBuilder().setDestinationMvpn(
-                new DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
+            new DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
     }
 
     static DestinationMvpnIpv6WithdrawnCase parseIpv6UnreachNlri(
-            final ByteBuf nlri,
-            final boolean addPathSupported) {
-        List<MvpnDestination> dests = new ArrayList<>();
+        final ByteBuf nlri,
+        final boolean addPathSupported) {
+        final List<MvpnDestination> dests = new ArrayList<>();
 
         while (nlri.isReadable()) {
             final MvpnDestinationBuilder builder = new MvpnDestinationBuilder();
@@ -72,17 +71,14 @@ public final class Ipv6NlriHandler {
         }
 
         return new DestinationMvpnIpv6WithdrawnCaseBuilder().setDestinationMvpn(
-                new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update
-                        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn.ipv6.withdrawn
-                        ._case.DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.ipv6.rev180417.update
+                .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.mvpn.ipv6.withdrawn
+                ._case.DestinationMvpnBuilder().setMvpnDestination(dests).build()).build();
     }
 
     public static void serializeNlri(final List<MvpnDestination> destinationList, final ByteBuf output) {
-        ByteBuf nlriOutput = null;
         for (final MvpnDestination dest : destinationList) {
-            final ByteBuf nlriCommon = Unpooled.buffer();
-            nlriOutput = SimpleMvpnNlriRegistry.getInstance().serializeMvpn(dest.getMvpnChoice(), nlriCommon);
+            output.writeBytes(SimpleMvpnNlriRegistry.getInstance().serializeMvpn(dest.getMvpnChoice()));
         }
-        output.writeBytes(nlriOutput);
     }
 }
index 5a29f08dbb543308bc4d0142743f671fb6a275c4..8510b1252d91484d3faea3dc31136d58f7e2d035 100644 (file)
@@ -68,7 +68,7 @@ public final class LeafADHandler extends AbstractMvpnNlri<LeafADCase> {
             keyCase = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mvpn.rev180417.mvpn
                     .mvpn.choice.SPmsiADCaseBuilder((SPmsiADCase) key).build();
         }
-        nlriByteBuf.writeBytes(SimpleMvpnNlriRegistry.getInstance().serializeMvpn(keyCase, nlriByteBuf));
+        nlriByteBuf.writeBytes(SimpleMvpnNlriRegistry.getInstance().serializeMvpn(keyCase));
         final ByteBuf orig = IpAddressUtil.bytesWOLengthFor(leaf.getOrigRouteIp());
         Preconditions.checkArgument(orig.readableBytes() > 0);
         nlriByteBuf.writeBytes(orig);
index 57bcf831c22e42c8a0b85b8aacb950c072874205..535a082ec5c27da619c07ed6a8b3a4a6db89d2c2 100644 (file)
@@ -34,12 +34,15 @@ final class MulticastGroupOpaqueUtil {
 
     static MulticastGroup multicastGroupForByteBuf(final ByteBuf buffer) {
         final short multicastGroupLength = buffer.readUnsignedByte();
-        if (multicastGroupLength == Ipv4Util.IP4_BITS_LENGTH) {
-            return new CGAddressCaseBuilder().setCGAddress(new IpAddress(Ipv4Util.addressForByteBuf(buffer))).build();
-        } else if (multicastGroupLength == Ipv6Util.IPV6_BITS_LENGTH) {
-            return new CGAddressCaseBuilder().setCGAddress(new IpAddress(Ipv6Util.addressForByteBuf(buffer))).build();
-        } else {
-            return new LdpMpOpaqueValueCaseBuilder()
+        switch (multicastGroupLength) {
+            case Ipv4Util.IP4_BITS_LENGTH:
+                return new CGAddressCaseBuilder()
+                    .setCGAddress(new IpAddress(Ipv4Util.addressForByteBuf(buffer))).build();
+            case Ipv6Util.IPV6_BITS_LENGTH:
+                return new CGAddressCaseBuilder()
+                    .setCGAddress(new IpAddress(Ipv6Util.addressForByteBuf(buffer))).build();
+            default:
+                return new LdpMpOpaqueValueCaseBuilder()
                     .setLdpMpOpaqueValue(new LdpMpOpaqueValueBuilder(OpaqueUtil.parseOpaque(buffer)).build()).build();
         }
     }
index 60899a31fe38d9c7bb77a5fa1c2bd18023210796..e8f994ae1719844fac1b55da29f5c28ab372cefb 100644 (file)
@@ -28,9 +28,8 @@ public interface MvpnRegistry {
      * Encode input BGP mvpn to output buffer.
      *
      * @param mvpn   MvpnChoice
-     * @param common encoded common mvpn
      * @return encoded MvpnChoice body in Bytebuf
      */
     @Nonnull
-    ByteBuf serializeMvpn(@Nonnull MvpnChoice mvpn, @Nonnull ByteBuf common);
+    ByteBuf serializeMvpn(@Nonnull MvpnChoice mvpn);
 }
index 71ea5bae25aa12b86b8e1f9312685f624d313a42..a846bc07ab884bb845943b7309e19801969e7606 100644 (file)
@@ -17,11 +17,10 @@ public interface MvpnSerializer<T extends MvpnChoice> {
      * Serialize mvpn.
      *
      * @param mvpn   mvpn
-     * @param buffer Encode common mvpn parts to output buffer
      * @return Encode mvpn to output buffer
      */
     @Nonnull
-    ByteBuf serializeMvpn(@Nonnull T mvpn, @Nonnull ByteBuf buffer);
+    ByteBuf serializeMvpn(@Nonnull T mvpn);
 
     /**
      * returns class of MvpnChoice handled by serializer.
index a9a156d30d54e37e120057e2a8736a506a1e8c44..aa70dc3f87c7520dea9491bdbbae838b8339ae7c 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bgp.mvpn.spi.pojo.nlri;
 
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
 import org.opendaylight.protocol.bgp.mvpn.spi.nlri.MvpnParser;
 import org.opendaylight.protocol.bgp.mvpn.spi.nlri.MvpnRegistry;
 import org.opendaylight.protocol.bgp.mvpn.spi.nlri.MvpnSerializer;
@@ -54,11 +55,11 @@ public final class SimpleMvpnNlriRegistry implements MvpnRegistry {
         return parser.parseMvpn(nlriBuf);
     }
 
-    public ByteBuf serializeMvpn(final MvpnChoice mvpn, final ByteBuf nlriBuf) {
+    public ByteBuf serializeMvpn(final MvpnChoice mvpn) {
         final MvpnSerializer serializer = this.handlers.getSerializer(mvpn.getImplementedInterface());
         if (serializer == null) {
-            return nlriBuf;
+            return Unpooled.buffer();
         }
-        return serializer.serializeMvpn(mvpn, nlriBuf);
+        return serializer.serializeMvpn(mvpn);
     }
 }
index 9f8a9b529a36168d221899117c90a93a9f1992e6..de25a670d54c8f5878b1464dcc71e8859a5bdef8 100644 (file)
@@ -90,8 +90,8 @@ public class MvpnIpv4RIBSupportTest extends AbstractRIBSupportTest<MvpnRoutesIpv
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        ribSupport = MvpnIpv4RIBSupport.getInstance(this.mappingService);
-        setUpTestCustomizer(ribSupport);
+        this.ribSupport = MvpnIpv4RIBSupport.getInstance(this.mappingService);
+        setUpTestCustomizer(this.ribSupport);
         NlriActivator.registerNlriParsers(new ArrayList<>());
     }
 
index cac43513505ea12b5c9d6eeb88b608e61e0e3d77..49c7073680ca82134ac3d0774dade81c5230856e 100644 (file)
@@ -14,6 +14,7 @@ import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import com.google.common.collect.ImmutableSet;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import org.junit.Test;
@@ -90,8 +91,9 @@ public final class MvpnIpv6RIBSupportTest extends AbstractRIBSupportTest<MvpnRou
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        ribSupport = MvpnIpv6RIBSupport.getInstance(this.mappingService);
-        setUpTestCustomizer(ribSupport);
+        this.ribSupport = MvpnIpv6RIBSupport.getInstance(this.mappingService);
+        setUpTestCustomizer(this.ribSupport);
+        NlriActivator.registerNlriParsers(new ArrayList<>());
     }
 
     @Test
index 26d5391e5f0b46691f3fe746cb3dc9a0d0c5d57f..69b22226494ad72983dcd7a4eec1b8ad355be80a 100644 (file)
@@ -33,11 +33,11 @@ public class SourceASHandlerTest {
                         .setGlobalAdministrator(new ShortAsNumber(1L))
                         .build()).build();
 
-        final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
+        final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
         Assert.assertEquals(expected, exComm);
 
         final ByteBuf output = Unpooled.buffer(INPUT.length);
-        handler.serializeExtendedCommunity(expected, output);
+        this.handler.serializeExtendedCommunity(expected, output);
         Assert.assertArrayEquals(INPUT, output.array());
 
         assertEquals(9, this.handler.getSubType());
index 247d3f6c454e14dabf5e191ecb92be3fa8c06eb8..b8fb2b5379c15e79181dac6261a3db9534cb48a3 100644 (file)
@@ -37,11 +37,11 @@ public class VrfRouteImportHandlerTest {
                         .build())
                 .build();
 
-        final ExtendedCommunity exComm = handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
-        Assert.assertEquals(expected, exComm);
+        final ExtendedCommunity exComm = this.handler.parseExtendedCommunity(Unpooled.copiedBuffer(INPUT));
+        assertEquals(expected, exComm);
 
         final ByteBuf output = Unpooled.buffer(INPUT.length);
-        handler.serializeExtendedCommunity(expected, output);
+        this.handler.serializeExtendedCommunity(expected, output);
         Assert.assertArrayEquals(INPUT, output.array());
 
         assertEquals(11, this.handler.getSubType());
index 74c127f4f1e3008c97087f935250f8f9f5b2bc29..1a8ce927943d354e72820f396963e7c1042b0719 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
@@ -52,8 +51,7 @@ public final class InterASIPmsiADHandlerTest {
 
     @Test
     public void testInterASIPmsiADSerializer() {
-        final ByteBuf buff = Unpooled.buffer(INTER_AS_TYPE_LENGTH.length);
-        assertArrayEquals(INTER_AS_TYPE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected, buff)));
+        assertArrayEquals(INTER_AS_TYPE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected)));
     }
 
     @Test
index cd6dcdc2030c9bdd01861c026d1c83d5ca97ba4f..c25d95f27b5bd9372b93bed713dc083c2eab0052 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
@@ -48,8 +47,7 @@ public class IntraAsIPmsiADHandlerTest {
 
     @Test
     public void testIntraASIPmsiADSerializer() {
-        final ByteBuf buff = Unpooled.buffer(INTRA_AS_TYPE_LENGTH.length);
-        assertArrayEquals(INTRA_AS_TYPE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected, buff)));
+        assertArrayEquals(INTRA_AS_TYPE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected)));
     }
 
     @Test
index 8073806b108d2d1bae0ee2772a399b82c063fc55..f2ef83c19952fef6bbc829236fcb11a16b14bd64 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
 import org.junit.Before;
@@ -71,8 +70,7 @@ public class LeafADHandlerTest {
 
     @Test
     public void testSerializer() {
-        final ByteBuf buffer = Unpooled.buffer(LEAF_AD_LENGTH.length);
-        assertArrayEquals(LEAF_AD_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected, buffer)));
+        assertArrayEquals(LEAF_AD_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected)));
     }
 
     @Test
index 6a5b854d1b2c25867d5dab53d86bcfd5a83cc8d5..29acbd97e99cac05200dd7aa14d054a80669806f 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
@@ -57,8 +56,7 @@ public final class SPmsiADHandlerTest {
 
     @Test
     public void testIntraASIPmsiADSerializer() {
-        final ByteBuf buffer = Unpooled.buffer(SP_MSI_AD_LENGTH.length);
-        assertArrayEquals(SP_MSI_AD_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected, buffer)));
+        assertArrayEquals(SP_MSI_AD_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected)));
     }
 
     @Test
index 46ccdc04d1be866e47adabf6236cb346828cba03..20232ddce8495a0395f4217a20230d47e5cb69db 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
@@ -60,8 +59,7 @@ public final class SharedTreeJoinHandlerTest {
 
     @Test
     public void testSerializer() {
-        final ByteBuf buffer = Unpooled.buffer(SHARED_TREE_LENGTH.length);
-        assertArrayEquals(SHARED_TREE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected, buffer)));
+        assertArrayEquals(SHARED_TREE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected)));
     }
 
     @Test
index 83aa6799fd08af3116b802cfcbe6ec304f2f2e8a..3f0d73d005cc52eefafa14c939e48bcafc62a875 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
@@ -53,8 +52,7 @@ public final class SourceActiveADHandlerTest {
 
     @Test
     public void testSerializer() {
-        final ByteBuf buff = Unpooled.buffer(SOURCE_ACTIVE_LENGTH.length);
-        assertArrayEquals(SOURCE_ACTIVE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected, buff)));
+        assertArrayEquals(SOURCE_ACTIVE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected)));
     }
 
     @Test
index 750b9838ce8a1332e42158ee834ffc7255f06418..38f301efdddf3740420c24f553dd10fa32bdb1f9 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.protocol.bgp.mvpn.impl.nlri;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
 import org.opendaylight.protocol.util.ByteArray;
@@ -60,8 +59,7 @@ public final class SourceTreeJoinHandlerTest {
 
     @Test
     public void testSerializer() {
-        final ByteBuf buffer = Unpooled.buffer(SHARED_TREE_LENGTH.length);
-        assertArrayEquals(SHARED_TREE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected, buffer)));
+        assertArrayEquals(SHARED_TREE_LENGTH, ByteArray.getAllBytes(this.handler.serializeMvpn(this.expected)));
     }
 
     @Test
index 4040c93a23527a7dddded0b4907b3a5c989e2cd3..8654430009470d74a48c1eaba43237b0b316234c 100644 (file)
@@ -34,7 +34,7 @@ public final class SimpleMvpnNlriRegistryTest {
     @Test
     public void registryNullTest() {
         final ByteBuf body = Unpooled.buffer();
-        SimpleMvpnNlriRegistry.getInstance().serializeMvpn(new NotRegistered(), body);
+        SimpleMvpnNlriRegistry.getInstance().serializeMvpn(new NotRegistered());
         assertEquals(0, body.readableBytes());
     }