Fix more rib-impl checkstyle 15/78815/1
authorRobert Varga <robert.varga@pantheon.tech>
Sat, 15 Dec 2018 10:54:30 +0000 (11:54 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 15 Dec 2018 10:55:04 +0000 (11:55 +0100)
This brings the number of violations below 60.

Change-Id: I177545b21da1f965a6db936341223a732560d4d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 files changed:
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractBGPSessionNegotiator.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibInWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/ApplicationPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPDispatcherImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPMessageHeaderDecoder.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPMessageToByteEncoder.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/BGPSessionImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/StrictBGPPeerRegistry.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/OpenConfigMappingUtil.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/spi/BGPMessagesListener.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/spi/BGPPeerRegistry.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/spi/RIBSupportContext.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/state/BGPPeerStateImpl.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AbstractAddPathTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AddPathNPathsTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java

index 1389359b2cd89b0dd3794293a6d329a084262516..059f82a6cd5a102f1fc4037bd8bee559bba9d4e1 100644 (file)
@@ -47,9 +47,7 @@ abstract class AbstractBGPSessionNegotiator extends ChannelInboundHandlerAdapter
     // 4 minutes recommended in http://tools.ietf.org/html/rfc4271#section-8.2.2
     private static final int INITIAL_HOLDTIMER = 4;
 
-    /**
-     * @see <a href="http://tools.ietf.org/html/rfc6793">BGP Support for 4-Octet AS Number Space</a>
-     */
+    // <a href="http://tools.ietf.org/html/rfc6793">BGP Support for 4-Octet AS Number Space</a>
     private static final int AS_TRANS = 23456;
     private static final Logger LOG = LoggerFactory.getLogger(AbstractBGPSessionNegotiator.class);
     private final BGPPeerRegistry registry;
@@ -234,6 +232,8 @@ abstract class AbstractBGPSessionNegotiator extends ChannelInboundHandlerAdapter
     }
 
     /**
+     * Get destination identifier.
+     *
      * @param openMsg Open message received from remote BGP speaker
      * @param preferences Local BGP speaker preferences
      * @return BGP Id of device that accepted the connection
@@ -241,6 +241,8 @@ abstract class AbstractBGPSessionNegotiator extends ChannelInboundHandlerAdapter
     protected abstract Ipv4Address getDestinationId(Open openMsg, BGPSessionPreferences preferences);
 
     /**
+     * Get source identifier.
+     *
      * @param openMsg Open message received from remote BGP speaker
      * @param preferences Local BGP speaker preferences
      * @return BGP Id of device that accepted the connection
index f17dbdad5c098ecc823ab847284948c863f0780b..89885ce6c438d0ec95e2daaa38808e798c622b2c 100644 (file)
@@ -142,10 +142,10 @@ final class AdjRibInWriter {
      * method returns, the old instance must not be reasonably used.
      *
      * @param newPeerId         new peer BGP identifier
-     * @param peerPath
+     * @param peerPath          path of the peer in the datastore
      * @param registry          RIB extension registry
      * @param tableTypes        New tables, must not be null
-     * @param addPathTablesType
+     * @param addPathTablesType supported add path tables
      * @return New writer
      */
     AdjRibInWriter transform(final PeerId newPeerId, final YangInstanceIdentifier peerPath,
@@ -187,7 +187,7 @@ final class AdjRibInWriter {
     }
 
     /**
-     * Create new table instances, potentially creating their empty entries
+     * Create new table instances, potentially creating their empty entries.
      */
     private static ImmutableMap<TablesKey, TableContext> createNewTableInstances(
             final YangInstanceIdentifier newPeerPath, final RIBSupportContextRegistry registry,
@@ -387,7 +387,7 @@ final class AdjRibInWriter {
                             LOG.warn("Failed to store stale routes for table {}", tablesKey, throwable);
                             latch.countDown();
                         }
-                }, MoreExecutors.directExecutor());
+                    }, MoreExecutors.directExecutor());
             }
         }
 
index 96e55c8d92fc28c69affce072e119df2d48e7b64..06844d17e4b658c7446f80b2c31c8b308f6f5dc9 100644 (file)
@@ -70,12 +70,15 @@ import org.slf4j.LoggerFactory;
  * Application Peer is a special case of BGP peer. It serves as an interface
  * for user to advertise user routes to ODL and through ODL to other BGP peers.
  *
+ * <p>
  * This peer has it's own RIB, where it stores all user routes. This RIB is
  * located in configurational datastore. Routes are added through RESTCONF.
  *
+ * <p>
  * They are then processed as routes from any other peer, through AdjRib,
  * EffectiveRib,LocRib and if they are advertised further, through AdjRibOut.
  *
+ * <p>
  * For purposed of import policies such as Best Path Selection, application
  * peer needs to have a BGP-ID that is configurable.
  */
@@ -244,8 +247,8 @@ public class ApplicationPeer extends AbstractPeer implements ClusteredDOMDataTre
                     // No-op
                     break;
                 case SUBTREE_MODIFIED:
-                    //For be ables to use DELETE when we remove specific routes as we do when we remove the whole routes,
-                    // we need to go deeper three levels
+                    // For be ables to use DELETE when we remove specific routes as we do when we remove the whole
+                    // routes, we need to go deeper three levels
                     if (!routeTableIdentifier.equals(childIdentifier.getParent().getParent().getParent())) {
                         processRoutesTable(child, childIdentifier, tx, routeTableIdentifier);
                         break;
index e7fd673692e7ab775cc5d95f131d6a25c0ef71d3..60d9cf0221a70a831efb4e00fc1f586f39ec0023 100644 (file)
@@ -154,8 +154,8 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
     @Override
     public synchronized ChannelFuture createServer(final InetSocketAddress serverAddress) {
         final BGPServerSessionNegotiatorFactory snf = new BGPServerSessionNegotiatorFactory(this.bgpPeerRegistry);
-        final ChannelPipelineInitializer<?> initializer = BGPChannel.
-                createChannelPipelineInitializer(this.handlerFactory, snf);
+        final ChannelPipelineInitializer<?> initializer = BGPChannel.createChannelPipelineInitializer(
+            this.handlerFactory, snf);
         final ServerBootstrap serverBootstrap = createServerBootstrap(initializer);
         final ChannelFuture channelFuture = serverBootstrap.bind(serverAddress);
         LOG.debug("Initiated server {} at {}.", channelFuture, serverAddress);
@@ -199,7 +199,7 @@ public class BGPDispatcherImpl implements BGPDispatcher, AutoCloseable {
         }
 
         static <S extends BGPSession, T extends BGPSessionNegotiatorFactory<S>> ChannelPipelineInitializer<S>
-        createChannelPipelineInitializer(final BGPHandlerFactory hf, final T snf) {
+            createChannelPipelineInitializer(final BGPHandlerFactory hf, final T snf) {
             return (channel, promise) -> {
                 channel.pipeline().addLast(hf.getDecoders());
                 channel.pipeline().addLast(NEGOTIATOR, snf.getSessionNegotiator(channel, promise));
index 308b542950891cfa08bdca74afe513efbd4842ae..2645401c61e84fa91a188621055c9bcb5e43e741 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.protocol.bgp.rib.impl;
 import io.netty.handler.codec.LengthFieldBasedFrameDecoder;
 
 /**
+ * Decoder for BGP message headers.
  * @see <a href="http://tools.ietf.org/html/rfc4271#section-4.1">BGP Message Header</a>
  */
 final class BGPMessageHeaderDecoder extends LengthFieldBasedFrameDecoder {
index 58c35513e2cf83f5c4d885e92cbf37d3c9c6145c..965eae8b0aa12015e9415300e3253d9198f96d6b 100644 (file)
@@ -19,9 +19,6 @@ import org.opendaylight.yangtools.yang.binding.Notification;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-/**
- *
- */
 @Sharable
 final class BGPMessageToByteEncoder extends MessageToByteEncoder<Notification> {
     private static final Logger LOG = LoggerFactory.getLogger(BGPMessageToByteEncoder.class);
index d6a837ad4bd089e4af38a0456ccd17fccead6ba9..b2fa31e8aa61059ac159bf8e1c4313ac453496b5 100644 (file)
@@ -110,7 +110,8 @@ import org.slf4j.LoggerFactory;
  */
 public class BGPPeer extends AbstractPeer implements BGPSessionListener {
     private static final Logger LOG = LoggerFactory.getLogger(BGPPeer.class);
-    private static final TablesKey IPV4_UCAST_TABLE_KEY = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
+    private static final TablesKey IPV4_UCAST_TABLE_KEY = new TablesKey(Ipv4AddressFamily.class,
+        UnicastSubsequentAddressFamily.class);
 
     private Set<TablesKey> tables = Collections.emptySet();
     private final RIB rib;
@@ -354,8 +355,9 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
         }
         final GracefulRestartCapability advertisedGracefulRestartCapability =
                 session.getAdvertisedGracefulRestartCapability();
-        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp.capabilities.graceful.restart.capability.Tables> advertisedTables =
-                advertisedGracefulRestartCapability.getTables();
+        final List<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.mp
+                .capabilities.graceful.restart.capability.Tables> advertisedTables =
+                    advertisedGracefulRestartCapability.getTables();
         final List<AddressFamilies> addPathTablesType = session.getAdvertisedAddPathTableTypes();
         final Set<BgpTableType> advertizedTableTypes = session.getAdvertisedTableTypes();
         LOG.info("Session with peer {} went up with tables {} and Add Path tables {}", this.name,
@@ -386,8 +388,8 @@ public class BGPPeer extends AbstractPeer implements BGPSessionListener {
                         new BgpPeerRpc(this, session, this.tables));
                 final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib
                         .rev180329.bgp.rib.rib.Peer, PeerKey> path = this.rib.getInstanceIdentifier()
-                        .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp.rib
-                                .rib.Peer.class, new PeerKey(this.peerId));
+                        .child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.bgp
+                            .rib.rib.Peer.class, new PeerKey(this.peerId));
                 this.rpcRegistration.registerPath(PeerContext.class, path);
             }
         } else {
index 5804ee0f9f2cf8bf7094483c1137899fd9e67528..abf3b7f09a7146c67c2cd8754b0cc4e0967683d1 100644 (file)
@@ -99,7 +99,7 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
     private long lastMessageSentAt;
 
     /**
-     * System.nanoTime value about when was received the last message
+     * System.nanoTime value about when was received the last message.
      */
     private long lastMessageReceivedAt;
 
@@ -236,8 +236,6 @@ public class BGPSessionImpl extends SimpleChannelInboundHandler<Notification> im
      * message arrived already in the channel buffer. Thus #AbstractBGPSessionNegotiator.handleMessage(..)
      * gets invoked again and a deadlock is caused.  A BGP final state machine error will happen as BGP
      * negotiator is still in OPEN_SENT state as the session constructor hasn't returned yet.
-     *
-     * @param remoteOpen
      */
     public synchronized void setChannelExtMsgCoder(final Open remoteOpen) {
         final boolean enableExMess = BgpExtendedMessageUtil.advertizedBgpExtendedMessageCapability(remoteOpen);
index f5179dbdcbeb244fe15e93d834a79e17072db92f..95c40129dcf41dbba6c97c40e0c65db90ff9e34e 100644 (file)
@@ -81,8 +81,10 @@ import org.slf4j.LoggerFactory;
 /**
  * Implementation of the BGP import policy. Listens on peer's Adj-RIB-In, inspects all inbound
  * routes in the context of the advertising peer's role and applies the inbound policy.
+ *
  * <p>
  * Inbound policy is applied as follows:
+ *
  * <p>
  * 1) if the peer is an eBGP peer, perform attribute replacement and filtering
  * 2) check if a route is admissible based on attributes attached to it, as well as the
@@ -192,10 +194,9 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
                 case DELETE:
                     final Tables removeTable = table.getDataBefore();
                     final TablesKey tableKey = removeTable.key();
-                    final KeyedInstanceIdentifier<Tables, TablesKey> effectiveTablePath
-                            = this.effRibTables.child(Tables.class, tableKey);
-                    LOG.debug("Delete Effective Table {} modification type {}, "
-                            , effectiveTablePath, modificationType);
+                    final KeyedInstanceIdentifier<Tables, TablesKey> effectiveTablePath = this.effRibTables
+                            .child(Tables.class, tableKey);
+                    LOG.debug("Delete Effective Table {} modification type {}, ", effectiveTablePath, modificationType);
                     tx.delete(LogicalDatastoreType.OPERATIONAL, effectiveTablePath);
                     CountersUtil.decrement(this.prefixesInstalled.get(tableKey), tableKey);
                     break;
@@ -354,7 +355,7 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
             final R route, final WriteTransaction tx) {
         final Optional<RouteTarget> rtMembership = RouteTargetMembeshipUtil.getRT(route);
         if (rtMembership.isPresent()) {
-            if(PeerRole.Ebgp != this.peerImportParameters.getFromPeerRole()) {
+            if (PeerRole.Ebgp != this.peerImportParameters.getFromPeerRole()) {
                 this.rtCache.uncacheRoute(route);
             }
             this.rtMemberships.remove(rtMembership.get());
index 4c6e5faf8a5bb7c740f7ff215c3979d591ba2bbe..d20060fb1ab6761ee03077603a89ef737fd5e1cc 100755 (executable)
@@ -144,7 +144,8 @@ public final class RIBImpl extends BGPRIBStateImpl implements RIB, TransactionCh
         this.ribPolicies = requireNonNull(ribPolicies);
         this.codecsRegistry = codecsRegistry;
         this.ribContextRegistry = RIBSupportContextRegistryImpl.create(extensions, this.codecsRegistry);
-        final InstanceIdentifierBuilder yangRibIdBuilder = YangInstanceIdentifier.builder().node(BgpRib.QNAME).node(Rib.QNAME);
+        final InstanceIdentifierBuilder yangRibIdBuilder = YangInstanceIdentifier.builder().node(BgpRib.QNAME)
+                .node(Rib.QNAME);
         this.yangRibId = yangRibIdBuilder.nodeWithKey(Rib.QNAME, RIB_ID_QNAME, ribId.getValue()).build();
         this.bestPathSelectionStrategies = requireNonNull(bestPathSelectionStrategies);
         this.ribId = ribId;
@@ -351,11 +352,11 @@ public final class RIBImpl extends BGPRIBStateImpl implements RIB, TransactionCh
                         .addChild(ImmutableNodes.mapNodeBuilder(Tables.QNAME).build())
                         .build()).build();
 
-
         final DOMDataWriteTransaction trans = this.domChain.newWriteOnlyTransaction();
 
         // merge empty BgpRib + Rib, to make sure the top-level parent structure is present
-        trans.merge(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().node(BgpRib.QNAME).build(), bgpRib);
+        trans.merge(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().node(BgpRib.QNAME).build(),
+            bgpRib);
         trans.put(LogicalDatastoreType.OPERATIONAL, this.yangRibId, ribInstance);
 
         try {
index 04267568400781ef49bdf5e2b6c4f4dbb0fb3220..748d56df76d99dcad99645a0cd25d7dd85102c02 100644 (file)
@@ -287,7 +287,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
 
     /**
      * Session identifier that contains (source Bgp Id) -> (destination Bgp Id) AsNumber is the remoteAs coming from
-     * remote Open message
+     * remote Open message.
      */
     private static final class BGPSessionId {
 
@@ -302,7 +302,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
         }
 
         /**
-         * Equals does not take direction of connection into account id1 -> id2 and id2 -> id1 are equal
+         * Equals does not take direction of connection into account id1 -> id2 and id2 -> id1 are equal.
          */
         @Override
         public boolean equals(final Object obj) {
@@ -334,7 +334,7 @@ public final class StrictBGPPeerRegistry implements BGPPeerRegistry {
         }
 
         /**
-         * Check if this connection is equal to other and if it contains higher source bgp id
+         * Check if this connection is equal to other and if it contains higher source bgp id.
          */
         boolean isHigherDirection(final BGPSessionId other) {
             return toLong(this.from) > toLong(other.from);
index 33d459b6b3da22b69c9fb412b6009b113d88a0b2..51d7ab7f9297d1c087818d4356c77a16e5062784 100644 (file)
@@ -87,44 +87,6 @@ final class OpenConfigMappingUtil {
         return rootIdentifier.firstKeyOf(Protocol.class).getName();
     }
 
-    @Nullable
-    private static Integer getHoldTimer(final Timers timers) {
-        if (timers == null) {
-            return null;
-        }
-        final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
-                .Config config = timers.getConfig();
-        if (config != null && config.getHoldTime() != null) {
-            return config.getHoldTime().intValue();
-        }
-        return null;
-    }
-
-    @Nullable
-    private static AsNumber getRemotePeerAs(final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
-            .rev151009.bgp.neighbor.group.Config config) {
-        if (config != null) {
-            final AsNumber peerAs = config.getPeerAs();
-            if (peerAs != null) {
-                return peerAs;
-            }
-        }
-        return null;
-    }
-
-    @Nullable
-    private static Integer getRetryTimer(final Timers timers) {
-        if (timers == null) {
-            return null;
-        }
-        final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
-                .Config config = timers.getConfig();
-        if (config != null && config.getConnectRetry() != null) {
-            return config.getConnectRetry().intValue();
-        }
-        return null;
-    }
-
     static KeyMapping getNeighborKey(final Neighbor neighbor) {
         if (neighbor.getConfig() != null) {
             final String authPassword = neighbor.getConfig().getAuthPassword();
@@ -145,21 +107,6 @@ final class OpenConfigMappingUtil {
         return Ipv4Util.toStringIP(rootIdentifier.firstKeyOf(Neighbor.class).getNeighborAddress());
     }
 
-    @Nullable
-    private static <T extends TransportConfig & Augmentation<Config>> PortNumber getPort(
-            @Nullable final Transport transport, final Class<T> augment) {
-        if (transport != null) {
-            final Config config = transport.getConfig();
-            if (config != null) {
-                final T peerTc = config.augmentation(augment);
-                if (peerTc != null) {
-                    return peerTc.getRemotePort();
-                }
-            }
-        }
-        return null;
-    }
-
     //make sure IPv4 Unicast (RFC 4271) when required
     static List<AfiSafi> getAfiSafiWithDefault(
             final BgpCommonAfiSafiList afiSAfis, final boolean setDeafultIPv4) {
@@ -374,6 +321,19 @@ final class OpenConfigMappingUtil {
         return hold;
     }
 
+    @Nullable
+    private static Integer getHoldTimer(final Timers timers) {
+        if (timers == null) {
+            return null;
+        }
+        final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
+                .Config config = timers.getConfig();
+        if (config != null && config.getHoldTime() != null) {
+            return config.getHoldTime().intValue();
+        }
+        return null;
+    }
+
     static int getGracefulRestartTimer(final Neighbor neighbor, final PeerGroup peerGroup, final int holdTimer) {
         Integer timer = null;
         if (peerGroup != null) {
@@ -425,6 +385,12 @@ final class OpenConfigMappingUtil {
         return neighborAs;
     }
 
+    @Nullable
+    private static AsNumber getRemotePeerAs(final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
+            .rev151009.bgp.neighbor.group.Config config) {
+        return config == null ? null : config.getPeerAs();
+    }
+
     @Nonnull
     static AsNumber getLocalPeerAs(@Nullable final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
             .rev151009.bgp.neighbor.group.Config config, @Nonnull final AsNumber globalAs) {
@@ -454,6 +420,19 @@ final class OpenConfigMappingUtil {
         return retryTimer;
     }
 
+    @Nullable
+    private static Integer getRetryTimer(final Timers timers) {
+        if (timers == null) {
+            return null;
+        }
+        final org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.timers
+                .Config config = timers.getConfig();
+        if (config != null && config.getConnectRetry() != null) {
+            return config.getConnectRetry().intValue();
+        }
+        return null;
+    }
+
     @Nonnull
     static PortNumber getPort(final Neighbor neighbor, final PeerGroup peerGroup) {
         PortNumber port = null;
@@ -472,6 +451,21 @@ final class OpenConfigMappingUtil {
         return port;
     }
 
+    @Nullable
+    private static <T extends TransportConfig & Augmentation<Config>> PortNumber getPort(
+            @Nullable final Transport transport, final Class<T> augment) {
+        if (transport != null) {
+            final Config config = transport.getConfig();
+            if (config != null) {
+                final T peerTc = config.augmentation(augment);
+                if (peerTc != null) {
+                    return peerTc.getRemotePort();
+                }
+            }
+        }
+        return null;
+    }
+
     @Nullable
     static IpAddress getLocalAddress(@Nullable final Transport transport) {
         if (transport != null && transport.getConfig() != null) {
index 66e056ead453b52d7e1c976b304830cbfabe42ad..3fa117d83faf57f521b67e71187fc898e2b6febe 100644 (file)
@@ -12,7 +12,7 @@ import javax.annotation.Nonnull;
 import org.opendaylight.yangtools.yang.binding.Notification;
 
 /**
- * BGP Operational Messages Listener State
+ * BGP Operational Messages Listener State.
  */
 public interface BGPMessagesListener {
     /**
index 2bb2fcc1638019ec49e9aa338e9e99a453e11ff5..05400e0fe8c51056394482e4c9d7c25204bf8c94 100644 (file)
@@ -5,7 +5,6 @@
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.protocol.bgp.rib.impl.spi;
 
 import javax.annotation.Nonnull;
@@ -68,10 +67,11 @@ public interface BGPPeerRegistry extends AutoCloseable {
             throws BGPDocumentedException;
 
     /**
+     * Get preferences for a remote peer.
+     *
      * @param ip address of remote peer
      * @return BGP session preferences for configured peer
-     *
-     * @throws java.lang.IllegalStateException if there is no peer configured for provided ip address
+     * @throws IllegalStateException if there is no peer configured for provided ip address
      */
     BGPSessionPreferences getPeerPreferences(IpAddress ip);
 
index 00c9152aa6ddc6f583ee4019fa9348e6ad952c56..2dd8ca8fa6dc97e6244ee1f63c43c27fb6de5ee4 100644 (file)
@@ -25,16 +25,12 @@ import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 
 /**
- *
  * {@link RIBSupport} wrapper which provides additional functionality
  * such as logic to update / remove routes using Binding DTOs
  * for BGP messages.
- *
  */
 public abstract class RIBSupportContext {
-
     /**
-     *
      * Create specified Rib table structure using supplied transaction.
      *
      * @param tx Transaction to to be used
@@ -52,10 +48,8 @@ public abstract class RIBSupportContext {
     public abstract void deleteRoutes(DOMDataWriteTransaction tx, YangInstanceIdentifier tableId, MpUnreachNlri nlri);
 
     /**
-     *
      * Writes supplied routes and attributes to RIB table using supplied transaction.
      *
-     *
      * @param tx Transaction to be used
      * @param tableId Instance Identifier of table to be updated
      * @param nlri ReachNlri which contains routes to be written.
index cbfcc173150b3b4e35bacd9221c1cf9e8670b7e6..12d2c441cf8d9c1b8f273aadc3bb55889c96e18d 100644 (file)
@@ -118,8 +118,8 @@ public abstract class BGPPeerStateImpl extends DefaultRibReference implements BG
 
     @Override
     public final synchronized boolean isAfiSafiSupported(final TablesKey tablesKey) {
-        return this.prefixesReceived != null && this.prefixesReceived.isSupported(tablesKey) &&
-            this.afiSafisAdvertized.contains(tablesKey);
+        return this.prefixesReceived != null && this.prefixesReceived.isSupported(tablesKey)
+                && this.afiSafisAdvertized.contains(tablesKey);
     }
 
     @Override
@@ -188,7 +188,7 @@ public abstract class BGPPeerStateImpl extends DefaultRibReference implements BG
         return this.peerRestarting;
     }
 
-    public synchronized final void setAfiSafiGracefulRestartState(final int peerRestartTime,
+    public final synchronized void setAfiSafiGracefulRestartState(final int peerRestartTime,
             final boolean peerRestarting, final boolean localRestarting) {
         this.peerRestartTime = peerRestartTime;
         this.peerRestarting = peerRestarting;
@@ -311,11 +311,11 @@ public abstract class BGPPeerStateImpl extends DefaultRibReference implements BG
     }
 
     @Override
-    public final synchronized int getLlGracefulRestartTimer(@Nonnull TablesKey tablesKey) {
-        final int timerAdvertised = isLlGracefulRestartAdvertised(tablesKey) ?
-                this.afiSafisLlGracefulAdvertised.get(tablesKey) : 0;
-        final int timerReceived = isLlGracefulRestartReceived(tablesKey) ?
-                this.afiSafisLlGracefulReceived.get(tablesKey) : 0;
+    public final synchronized int getLlGracefulRestartTimer(@Nonnull final TablesKey tablesKey) {
+        final int timerAdvertised = isLlGracefulRestartAdvertised(tablesKey)
+                this.afiSafisLlGracefulAdvertised.get(tablesKey) : 0;
+        final int timerReceived = isLlGracefulRestartReceived(tablesKey)
+                this.afiSafisLlGracefulReceived.get(tablesKey) : 0;
         return Integer.min(timerAdvertised, timerReceived);
     }
 }
index 96b016f18952a3ba39aec730bd5056a80105d99c..65ec08fdf4b43796257a720f745a8c78983c4901 100644 (file)
@@ -249,9 +249,9 @@ public abstract class AbstractAddPathTest extends DefaultRibPoliciesMockTest {
         return connectPeer(peer, clientDispatcher);
     }
 
-    static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry,
-                                 final Ipv4Address peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters,
-                                 final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry) {
+    static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry, final Ipv4Address peerAddress,
+            final RIBImpl ribImpl, final BgpParameters bgpParameters, final PeerRole peerRole,
+            final BGPPeerRegistry bgpPeerRegistry) {
         return configurePeer(tableRegistry, peerAddress, ribImpl, bgpParameters, peerRole, bgpPeerRegistry,
                 AFI_SAFIS_ADVERTIZED, Collections.emptySet());
     }
@@ -266,11 +266,10 @@ public abstract class AbstractAddPathTest extends DefaultRibPoliciesMockTest {
                 afiSafiAdvertised, gracefulAfiSafiAdvertised, bgpPeer);
     }
 
-    static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry,
-                                 final Ipv4Address peerAddress, final RIBImpl ribImpl, final BgpParameters bgpParameters,
-                                 final PeerRole peerRole, final BGPPeerRegistry bgpPeerRegistry,
-                                 final Set<TablesKey> afiSafiAdvertised, final Set<TablesKey> gracefulAfiSafiAdvertised,
-                                 final BgpPeer peer) {
+    static BGPPeer configurePeer(final BGPTableTypeRegistryConsumer tableRegistry, final Ipv4Address peerAddress,
+            final RIBImpl ribImpl, final BgpParameters bgpParameters, final PeerRole peerRole,
+            final BGPPeerRegistry bgpPeerRegistry, final Set<TablesKey> afiSafiAdvertised,
+            final Set<TablesKey> gracefulAfiSafiAdvertised, final BgpPeer peer) {
         final IpAddress ipAddress = new IpAddress(peerAddress);
 
         final BGPPeer bgpPeer = new BGPPeer(tableRegistry, new IpAddress(peerAddress), null, ribImpl, peerRole,
index 6b5504fa8f79328bc69fd3f8a68891c5722c5205..d9530eaad7e8a6b1560d0cbd549d938ce7536a10 100644 (file)
@@ -80,7 +80,7 @@ public class AddPathNPathsTest extends AbstractAddPathTest {
         final BGPSessionImpl session1 = createPeerSession(PEER1, nonAddPathParams, new SimpleSessionListener());
 
         configurePeer(this.tableRegistry, PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
-       final BGPSessionImpl session2 = createPeerSession(PEER2, nonAddPathParams, new SimpleSessionListener());
+        final BGPSessionImpl session2 = createPeerSession(PEER2, nonAddPathParams, new SimpleSessionListener());
 
         configurePeer(this.tableRegistry, PEER3, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
         final BGPSessionImpl session3 = createPeerSession(PEER3, nonAddPathParams, new SimpleSessionListener());
index 79c1d7ce90d3261908e48ce03e0e873144db9336..9e741291155afd1f8ff69b91c5bcbfe1c6d0c6f3 100644 (file)
@@ -10,8 +10,8 @@ package org.opendaylight.protocol.bgp.rib.impl;
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.doAnswer;
 import static org.mockito.Mockito.doCallRealMethod;
 import static org.mockito.Mockito.doReturn;
@@ -179,8 +179,8 @@ public class PeerTest extends AbstractRIBTestSetup {
         assertEquals(3, this.routes.size());
 
         //create new peer so that it gets advertized routes from RIB
-        final BGPPeer testingPeer = AbstractAddPathTest.configurePeer(this.tableRegistry, this.neighborAddress.getIpv4Address(),
-                getRib(), null, PeerRole.Ibgp, new StrictBGPPeerRegistry());
+        final BGPPeer testingPeer = AbstractAddPathTest.configurePeer(this.tableRegistry,
+            this.neighborAddress.getIpv4Address(), getRib(), null, PeerRole.Ibgp, new StrictBGPPeerRegistry());
         testingPeer.instantiateServiceInstance();
         testingPeer.onSessionUp(this.session);
         assertEquals(3, this.routes.size());