Clean up
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / FromInternalImportPolicy.java
index 31e0d2ea22d6a0850ca86f0e62deae3539e8767d..a078dac4a79eab4686851ae8897a993efd754bbf 100644 (file)
@@ -7,8 +7,10 @@
  */
 package org.opendaylight.protocol.bgp.rib.impl;
 
-import com.google.common.base.Preconditions;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
+import static java.util.Objects.requireNonNull;
+
+import org.opendaylight.protocol.bgp.rib.impl.spi.AbstractImportPolicy;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@@ -25,12 +27,12 @@ class FromInternalImportPolicy extends AbstractImportPolicy {
     private final Ipv4Address bgpIdentifier;
 
     FromInternalImportPolicy(final Ipv4Address bgpIdentifier, final ClusterIdentifier clusterIdentifier) {
-        this.bgpIdentifier = Preconditions.checkNotNull(bgpIdentifier);
-        this.clusterIdentifier = Preconditions.checkNotNull(clusterIdentifier);
+        this.bgpIdentifier = requireNonNull(bgpIdentifier);
+        this.clusterIdentifier = requireNonNull(clusterIdentifier);
     }
 
     @Override
-    ContainerNode effectiveAttributes(final ContainerNode attributes) {
+    public ContainerNode effectiveAttributes(final ContainerNode attributes) {
         final AttributeOperations oper = AttributeOperations.getInstance(attributes);
 
         /*
@@ -40,8 +42,8 @@ class FromInternalImportPolicy extends AbstractImportPolicy {
          * we filter the route.
          */
         final Object originatorId = oper.getOriginatorId(attributes);
-        if (bgpIdentifier.getValue().equals(originatorId)) {
-            LOG.debug("Filtering route with our ORIGINATOR_ID {}", bgpIdentifier);
+        if (this.bgpIdentifier.getValue().equals(originatorId)) {
+            LOG.debug("Filtering route with our ORIGINATOR_ID {}", this.bgpIdentifier);
             return null;
         }
 
@@ -51,9 +53,9 @@ class FromInternalImportPolicy extends AbstractImportPolicy {
          */
         final LeafSetNode<?> clusterList = oper.getClusterList(attributes);
         if (clusterList != null) {
-            for (LeafSetEntryNode<?> node : clusterList.getValue()) {
-                if (clusterIdentifier.getValue().equals(node.getValue())) {
-                    LOG.info("Received a route with our CLUSTER_ID {} in CLUSTER_LIST {}, filtering it", clusterIdentifier.getValue(), clusterList);
+            for (final LeafSetEntryNode<?> node : clusterList.getValue()) {
+                if (this.clusterIdentifier.getValue().equals(node.getValue())) {
+                    LOG.info("Received a route with our CLUSTER_ID {} in CLUSTER_LIST {}, filtering it", this.clusterIdentifier.getValue(), clusterList);
                     return null;
                 }
             }