Remove duplicated code 98/71198/2
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Sat, 21 Apr 2018 21:09:45 +0000 (23:09 +0200)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Mon, 23 Apr 2018 10:01:31 +0000 (10:01 +0000)
by implementing default behaviour under
interface.

Change-Id: Ida088bc8d78df7d5cc4bb04fe94fb7946b50073b
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/evpn/src/main/java/org/opendaylight/protocol/bgp/evpn/impl/EvpnRibSupport.java
bgp/flowspec/src/main/java/org/opendaylight/protocol/bgp/flowspec/AbstractFlowspecRIBSupport.java
bgp/inet/src/main/java/org/opendaylight/protocol/bgp/inet/AbstractIPRibSupport.java
bgp/l3vpn/src/main/java/org/opendaylight/protocol/bgp/l3vpn/AbstractVpnRIBSupport.java
bgp/labeled-unicast/src/main/java/org/opendaylight/protocol/bgp/labeled/unicast/AbstractLabeledUnicastRIBSupport.java
bgp/linkstate/src/main/java/org/opendaylight/protocol/bgp/linkstate/impl/LinkstateRIBSupport.java
bgp/rib-spi/src/main/java/org/opendaylight/protocol/bgp/rib/spi/RIBSupport.java
bgp/rib-spi/src/test/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/bgp/inet/rev150305/ipv4/routes/ipv4/routes/RIBSupportTestImp.java

index 06ba62084b6f9c960fcd6c224fdcb03bd239d9d7..26bdc96352f7a26dc1399ad6f61d9526789cf7c4 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.protocol.bgp.evpn.impl;
 
-import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
@@ -38,7 +36,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.mess
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
-import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
@@ -67,21 +64,6 @@ final class EvpnRibSupport extends AbstractRIBSupport<EvpnRoute, EvpnRouteKey> {
         return SINGLETON;
     }
 
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public boolean isComplexRoute() {
-        return true;
-    }
-
     @Override
     protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
         return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev180329.update
index 9cff3cf88122fe7beaea267772215671029b132b..ed1cb6eecb17ed8481855f3c19a4c07ac885f872 100644 (file)
@@ -10,8 +10,6 @@ package org.opendaylight.protocol.bgp.flowspec;
 import static java.util.Objects.requireNonNull;
 
 import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import java.util.Collection;
 import java.util.Optional;
@@ -53,21 +51,6 @@ public abstract class AbstractFlowspecRIBSupport<T extends AbstractFlowspecNlriP
         this.nlriParser = requireNonNull(nlriParser);
     }
 
-    @Override
-    public final ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public final ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public final boolean isComplexRoute() {
-        return true;
-    }
-
     @Override
     protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
         final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
index 91691d252254529b93a95bc3fbc218f05afba6bc..d39c6727c92b6545d7df304c879d58495fe4059d 100644 (file)
@@ -58,21 +58,11 @@ abstract class AbstractIPRibSupport<R extends Route, N extends Identifier>
         return this.prefixNid;
     }
 
-    @Override
-    public final ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
-        return ImmutableSet.of();
-    }
-
     @Override
     public final ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
         return this.cacheableNlriObjects;
     }
 
-    @Override
-    public final boolean isComplexRoute() {
-        return true;
-    }
-
     @Override
     protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
         final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
index 8b8c96e051bf43636b9b51e92c61a9b164bb1bc7..47cdd59dfe65290732bf1d8fd2a53ad2439fe1c4 100644 (file)
@@ -8,8 +8,6 @@
 package org.opendaylight.protocol.bgp.l3vpn;
 
 import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Collection;
@@ -127,21 +125,6 @@ public abstract class AbstractVpnRIBSupport extends AbstractRIBSupport<VpnRoute,
         return routes.stream().map(this::extractVpnDestination).collect(Collectors.toList());
     }
 
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public boolean isComplexRoute() {
-        return true;
-    }
-
     @Override
     protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
         final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
index 8d575bb0f5fbed467334cff7d4e69dd82ecabf99..2e3b56f11ff33795072032af54216b695490be8e 100644 (file)
@@ -8,8 +8,6 @@
 
 package org.opendaylight.protocol.bgp.labeled.unicast;
 
-import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.ArrayList;
@@ -84,21 +82,6 @@ abstract class AbstractLabeledUnicastRIBSupport
         super(cazeClass, containerClass, listClass, addressFamilyClass, safiClass, destinationQname);
     }
 
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public boolean isComplexRoute() {
-        return true;
-    }
-
     @Override
     protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
         final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
index 73342451129685994b128d0854a09ed354deae69..f5a59e86e9e96a8389c55c77f80a91d3ace764ff 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.protocol.bgp.linkstate.impl;
 
-import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableSet;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import java.util.Arrays;
@@ -83,21 +81,6 @@ public final class LinkstateRIBSupport extends AbstractRIBSupport<LinkstateRoute
         return routes.stream().map(LinkstateNlriParser::extractLinkstateDestination).collect(Collectors.toList());
     }
 
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
-        return ImmutableSet.of();
-    }
-
-    @Override
-    public boolean isComplexRoute() {
-        return true;
-    }
-
     @Override
     protected void processDestination(final DOMDataWriteTransaction tx, final YangInstanceIdentifier routesPath,
             final ContainerNode destination, final ContainerNode attributes, final ApplyRoute function) {
index 29a63a5f003f2fcc30d860ea9005e86cf11622df..b0b0cd73a0eea35065929ccdacb1f313d18ebb67 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.protocol.bgp.rib.spi;
 
 import com.google.common.collect.ImmutableCollection;
+import com.google.common.collect.ImmutableSet;
 import java.util.Collection;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
@@ -84,10 +85,14 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
     Class<? extends Route> routesListClass();
 
     @Nonnull
-    ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects();
+    default ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
+        return ImmutableSet.of();
+    }
 
     @Nonnull
-    ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects();
+    default ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
+        return ImmutableSet.of();
+    }
 
     /**
      * Given the NLRI as ContainerNode, this method should extract withdrawn routes
@@ -176,7 +181,9 @@ public interface RIBSupport<R extends Route, N extends Identifier> extends AddPa
      * @deprecated All routes are complex.
      */
     @Deprecated
-    boolean isComplexRoute();
+    default boolean isComplexRoute() {
+        return true;
+    }
 
     /**
      * To send routes out, we'd need to transform the DOM representation of route to
index f72a8524d4176eeaa72cf3922fb170626dfbd3c7..44810266749dbde79c31fc8fc11c85aa9a01c5bc 100644 (file)
@@ -62,21 +62,6 @@ public final class RIBSupportTestImp extends AbstractRIBSupport {
                 .bgp.inet.rev180329.ipv4.routes.ipv4.routes.Ipv4Route.QNAME), PREFIX_NII, destination, attributes);
     }
 
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
-        return null;
-    }
-
-    @Override
-    public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
-        return null;
-    }
-
-    @Override
-    public boolean isComplexRoute() {
-        return false;
-    }
-
     @Override
     public Route createRoute(final Route route, final String routeKey, final long pathId, final Attributes attributes) {
         return null;