From d3464a585a22e59c22cb5098442d2276a2ff3ad4 Mon Sep 17 00:00:00 2001 From: Jozef Bacigal Date: Tue, 20 Jun 2017 14:55:06 +0200 Subject: [PATCH] Fix checkstyle API. Change-Id: Ia25e794c95722f9ff9bf60393bbd18d803296581 Signed-off-by: Jozef Bacigal --- .../openflowplugin/api/OFConstants.java | 2 +- .../api/openflow/OFPContext.java | 9 +-- .../OpenFlowPluginConfigurationService.java | 12 ++-- .../api/openflow/OpenFlowPluginProvider.java | 2 +- .../connection/ConnectionContext.java | 2 +- .../connection/ConnectionManager.java | 6 +- .../api/openflow/device/DeviceContext.java | 4 +- .../api/openflow/device/DeviceManager.java | 10 +-- .../api/openflow/device/TxFacade.java | 15 ++--- .../ClusterInitializationPhaseHandler.java | 6 +- .../handlers/DeviceConnectedHandler.java | 2 +- .../handlers/DeviceDisconnectedHandler.java | 2 +- .../device/handlers/DeviceRemovedHandler.java | 2 +- .../api/openflow/lifecycle/ContextChain.java | 12 ++-- .../lifecycle/ContextChainHolder.java | 12 ++-- .../ContextChainMastershipState.java | 64 +++++++++---------- .../openflow/lifecycle/ContextChainState.java | 48 +++++++------- .../lifecycle/ContextChainStateListener.java | 4 +- .../openflow/lifecycle/LifecycleService.java | 11 ++-- .../lifecycle/MastershipChangeListener.java | 12 ++-- .../serialization/MatchEntrySerializer.java | 2 +- .../registry/ItemLifeCycleRegistry.java | 5 +- .../registry/flow/DeviceFlowRegistry.java | 1 - .../api/openflow/rpc/ItemLifeCycleKeeper.java | 3 +- .../api/openflow/rpc/ItemLifeCycleSource.java | 1 + .../api/openflow/rpc/RpcContext.java | 3 +- .../api/openflow/rpc/RpcManager.java | 3 +- .../rpc/listener/ItemLifecycleListener.java | 15 +++-- .../statistics/MessageCountDumper.java | 3 +- .../statistics/MessageObservatory.java | 3 - .../api/openflow/statistics/MessageSpy.java | 64 +++++++++++++------ .../statistics/StatisticsContext.java | 18 +++--- .../statistics/StatisticsManager.java | 16 ++--- .../BackwardCompatibleAtomicService.java | 4 +- .../statistics/compatibility/Delegator.java | 3 +- .../MessageIntelligenceAgency.java | 4 +- .../statistics/ofpspecific/MessageSpy.java | 49 +++++++------- .../translator/TranslatorLibrarian.java | 12 ++-- .../impl/device/DeviceContextImpl.java | 36 +++++------ .../impl/device/PacketInRateLimiter.java | 4 +- .../impl/rpc/RpcContextImpl.java | 9 ++- ...tractMultipartRequestOnTheFlyCallback.java | 16 ++--- .../services/AbstractRequestCallback.java | 8 +-- .../impl/services/AbstractService.java | 8 +-- .../impl/services/SimpleRequestCallback.java | 2 +- .../impl/services/VoidRequestCallback.java | 4 +- .../statistics/StatisticsContextImpl.java | 12 ++-- .../MessageIntelligenceAgencyImpl.java | 12 ++-- .../impl/device/DeviceContextImplTest.java | 12 ++-- .../impl/device/PacketInRateLimiterTest.java | 4 +- .../karaf/ClearStatsCommandProviderTest.java | 2 +- .../karaf/ShowStatsCommandProviderTest.java | 2 +- .../impl/rpc/RpcContextImplTest.java | 4 +- .../MessageIntelligenceAgencyImplTest.java | 4 +- .../md/core/NotificationPopListener.java | 4 +- .../md/core/RpcListeningExecutorService.java | 4 +- .../openflow/md/core/sal/OFRpcTaskUtil.java | 4 +- .../md/queue/QueueProcessorLightImpl.java | 6 +- .../statistics/MessageSpyCounterImpl.java | 14 ++-- .../statistics/MessageSpyCounterImplTest.java | 2 +- 60 files changed, 315 insertions(+), 304 deletions(-) diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java index 7a5a4a2a48..6148f5fbcd 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/OFConstants.java @@ -74,6 +74,6 @@ public final class OFConstants { /** RpcError tag - timeout. */ public static final String ERROR_TAG_TIMEOUT = "TIMOUT"; - /** Persistent ID of OpenFlowPlugin configuration file */ + /** Persistent ID of OpenFlowPlugin configuration file. */ public static final String CONFIG_FILE_ID = "org.opendaylight.openflowplugin"; } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OFPContext.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OFPContext.java index 43d6b5bdc2..4d9a11c4da 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OFPContext.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OFPContext.java @@ -7,11 +7,8 @@ */ package org.opendaylight.openflowplugin.api.openflow; -import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import java.util.concurrent.RejectedExecutionException; import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier; -import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.handlers.ClusterInitializationPhaseHandler; import org.opendaylight.openflowplugin.api.openflow.device.handlers.ClusterLifecycleSupervisor; @@ -22,12 +19,10 @@ import org.opendaylight.openflowplugin.api.openflow.device.handlers.ClusterLifec public interface OFPContext extends AutoCloseable, ClusterLifecycleSupervisor, ClusterInitializationPhaseHandler { - String MESSAGE = "Cannot stop abstract services, check implementation of cluster services"; - /** * Context state. */ - enum CONTEXT_STATE { + enum ContextState { /* Initialization phase, context not yet fully initialized */ INITIALIZATION, /* Standard working phase everything is fine */ @@ -40,7 +35,7 @@ public interface OFPContext extends AutoCloseable, ClusterLifecycleSupervisor, C * Get actual context state. * @return actual context state */ - CONTEXT_STATE getState(); + ContextState getState(); /** * About to stop services in cluster not master anymore or going down. diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginConfigurationService.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginConfigurationService.java index 23b98651e8..1f7adb61fd 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginConfigurationService.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginConfigurationService.java @@ -13,7 +13,7 @@ import java.util.Map; import javax.annotation.Nonnull; /** - * Manages OpenFlowPlugin configuration + * Manages OpenFlowPlugin configuration. */ public interface OpenFlowPluginConfigurationService { @@ -93,12 +93,12 @@ public interface OpenFlowPluginConfigurationService { private static final Map KEY_VALUE_MAP; /** - * Get property type from property key + * Get property type from property key. * * @param key the property key * @return the property type */ - public static PropertyType forValue(final String key) { + public static PropertyType forValue(String key) { return KEY_VALUE_MAP.get(key); } @@ -114,7 +114,7 @@ public interface OpenFlowPluginConfigurationService { } /** - * Converts enum name to property key + * Converts enum name to property key. * * @return the property key */ @@ -126,14 +126,14 @@ public interface OpenFlowPluginConfigurationService { } /** - * Parses key-value pairs of properties read from OpenFlowPlugin configuration file and processes them + * Parses key-value pairs of properties read from OpenFlowPlugin configuration file and processes them. * * @param properties properties */ void update(@Nonnull Map properties); /** - * Parse and process single property key-value pair + * Parse and process single property key-value pair. * * @see org.opendaylight.openflowplugin.api.openflow.OpenFlowPluginConfigurationService.PropertyType * @param key property type diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginProvider.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginProvider.java index 5eb41b5a92..cef86f8b0f 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginProvider.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/OpenFlowPluginProvider.java @@ -11,7 +11,7 @@ package org.opendaylight.openflowplugin.api.openflow; import org.opendaylight.controller.md.sal.binding.api.BindingService; /** - * Plugin services provider + * Plugin services provider. */ public interface OpenFlowPluginProvider extends AutoCloseable, BindingService { diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionContext.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionContext.java index 2c63354270..2e4a88fd1c 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionContext.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionContext.java @@ -157,7 +157,7 @@ public interface ConnectionContext { void handshakeSuccessful(); /** - * Handle received port status message + * Handle received port status message. * @param portStatusMessage port status message */ void handlePortStatusMessage(PortStatusMessage portStatusMessage); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionManager.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionManager.java index 7356f5b034..f2f4467ab9 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionManager.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/connection/ConnectionManager.java @@ -24,13 +24,13 @@ public interface ConnectionManager extends SwitchConnectionHandler { * device is connected. * @param deviceConnectedHandler device connected handler */ - void setDeviceConnectedHandler(final DeviceConnectedHandler deviceConnectedHandler); + void setDeviceConnectedHandler(DeviceConnectedHandler deviceConnectedHandler); /** - * Method registers handler responsible handling device disconnected event + * Method registers handler responsible handling device disconnected event. * @param deviceDisconnectedHandler device disconnected handler */ - void setDeviceDisconnectedHandler(final DeviceDisconnectedHandler deviceDisconnectedHandler); + void setDeviceDisconnectedHandler(DeviceDisconnectedHandler deviceDisconnectedHandler); /** * Setter for echo reply timeout. diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceContext.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceContext.java index b4fd0469b2..1e7e15b7eb 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceContext.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceContext.java @@ -112,7 +112,7 @@ public interface DeviceContext extends MessageSpy getMessageSpy(); - MultiMsgCollector getMultiMsgCollector(final RequestContext> requestContext); + MultiMsgCollector getMultiMsgCollector(RequestContext> requestContext); /** * indicates that device context is fully published (e.g.: packetIn messages should be passed). @@ -139,7 +139,7 @@ public interface DeviceContext extends * Setter for sal role service. * @param salRoleService Role Service */ - void setSalRoleService(@Nonnull final SalRoleService salRoleService); + void setSalRoleService(@Nonnull SalRoleService salRoleService); /** * Make device slave. diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java index d57c86e9f2..4ee0781507 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/DeviceManager.java @@ -46,16 +46,18 @@ public interface DeviceManager extends void setBarrierInterval(long barrierTimeoutLimit); - CheckedFuture removeDeviceFromOperationalDS(DeviceInfo deviceInfo); + CheckedFuture removeDeviceFromOperationalDS( + DeviceInfo deviceInfo); - CheckedFuture removeDeviceFromOperationalDS(final KeyedInstanceIdentifier ii); + CheckedFuture removeDeviceFromOperationalDS( + KeyedInstanceIdentifier ii); - DeviceContext createContext(@Nonnull final ConnectionContext connectionContext); + DeviceContext createContext(@Nonnull ConnectionContext connectionContext); long getBarrierIntervalNanos(); int getBarrierCountLimit(); - void sendNodeAddedNotification(@Nonnull final DeviceInfo deviceInfo); + void sendNodeAddedNotification(@Nonnull DeviceInfo deviceInfo); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/TxFacade.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/TxFacade.java index e19fb62d49..02661467c2 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/TxFacade.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/TxFacade.java @@ -21,9 +21,7 @@ public interface TxFacade { /** * Method creates put operation using provided data in underlying transaction chain. */ - void writeToTransaction(final LogicalDatastoreType store, - final InstanceIdentifier path, - final T data); + void writeToTransaction(LogicalDatastoreType store, InstanceIdentifier path, T data); /** * Method creates put operation using provided data in underlying transaction @@ -31,15 +29,14 @@ public interface TxFacade { * WARNING: This method is slow because of additional reading cost. * Use it only if you really need to create parents. */ - void writeToTransactionWithParentsSlow(final LogicalDatastoreType store, - final InstanceIdentifier path, - final T data); + void writeToTransactionWithParentsSlow(LogicalDatastoreType store, + InstanceIdentifier path, + T data); /** * Method creates delete operation for provided path in underlying transaction chain. */ - void addDeleteToTxChain(final LogicalDatastoreType store, - final InstanceIdentifier path); + void addDeleteToTxChain(LogicalDatastoreType store, InstanceIdentifier path); /** * Method submits Transaction to DataStore. @@ -57,7 +54,7 @@ public interface TxFacade { ReadOnlyTransaction getReadTransaction(); /** - * Method returns true if transaction chain manager is enabled + * Method returns true if transaction chain manager is enabled. * @return is transaction chain manager enabled */ boolean isTransactionsEnabled(); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/ClusterInitializationPhaseHandler.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/ClusterInitializationPhaseHandler.java index c46d3e0706..72520b04b5 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/ClusterInitializationPhaseHandler.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/ClusterInitializationPhaseHandler.java @@ -15,15 +15,15 @@ import org.opendaylight.openflowplugin.api.openflow.lifecycle.MastershipChangeLi public interface ClusterInitializationPhaseHandler { /** - * Method for initialization cycle between contexts + * Method for initialization cycle between contexts. * @param mastershipChangeListener - listener if something goes wrong with initialization */ - boolean onContextInstantiateService(final MastershipChangeListener mastershipChangeListener); + boolean onContextInstantiateService(MastershipChangeListener mastershipChangeListener); /** * Method for initial submit transaction after successful initial gathering. */ - default boolean initialSubmitTransaction(){ + default boolean initialSubmitTransaction() { //This method need to be override only in device context to submit initial data. return false; } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceConnectedHandler.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceConnectedHandler.java index d4a833a2c3..04fdff9df3 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceConnectedHandler.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceConnectedHandler.java @@ -21,7 +21,7 @@ public interface DeviceConnectedHandler { * Method is used to propagate information about established connection with device. * It propagates connected device's connection context. */ - ConnectionStatus deviceConnected(final ConnectionContext connectionContext) + ConnectionStatus deviceConnected(ConnectionContext connectionContext) throws Exception; } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceDisconnectedHandler.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceDisconnectedHandler.java index 290d9db9ae..d992e733b2 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceDisconnectedHandler.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceDisconnectedHandler.java @@ -20,5 +20,5 @@ public interface DeviceDisconnectedHandler { * Method is used to propagate information about closed connection with device. * It propagates connected device's connection context. */ - void onDeviceDisconnected(final ConnectionContext connectionContext); + void onDeviceDisconnected(ConnectionContext connectionContext); } \ No newline at end of file diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceRemovedHandler.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceRemovedHandler.java index 0a9bbad8b0..168522b42e 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceRemovedHandler.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/device/handlers/DeviceRemovedHandler.java @@ -18,5 +18,5 @@ public interface DeviceRemovedHandler { /** * Method is used to propagate information about device being removed from manager. */ - void onDeviceRemoved(final DeviceInfo deviceInfo); + void onDeviceRemoved(DeviceInfo deviceInfo); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChain.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChain.java index f876e677a9..5e8cc28908 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChain.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChain.java @@ -22,9 +22,9 @@ public interface ContextChain extends AutoCloseable { * Add context to the chain, if reference already exist ignore it. * @param context child of OFPContext */ - void addContext(final T context); + void addContext(T context); - void addLifecycleService(final LifecycleService lifecycleService); + void addLifecycleService(LifecycleService lifecycleService); /** * Stop the working contexts, but not release them. @@ -50,7 +50,7 @@ public interface ContextChain extends AutoCloseable { * Registers context chain into cluster singleton service. * @param clusterSingletonServiceProvider provider */ - void registerServices(final ClusterSingletonServiceProvider clusterSingletonServiceProvider); + void registerServices(ClusterSingletonServiceProvider clusterSingletonServiceProvider); /** * After connect of device make this device SLAVE. @@ -62,7 +62,7 @@ public interface ContextChain extends AutoCloseable { * @param mastershipState - state master on device, initial gather, initial submit, initial registry fill * @return true if everything done fine */ - boolean isMastered(@Nonnull final ContextChainMastershipState mastershipState); + boolean isMastered(@Nonnull ContextChainMastershipState mastershipState); /** * Device need to be in state SLAVE or MASTER. @@ -75,12 +75,12 @@ public interface ContextChain extends AutoCloseable { * @param connectionContext new connection to the device. * @return false if primary connection is broken */ - boolean addAuxiliaryConnection(@Nonnull final ConnectionContext connectionContext); + boolean addAuxiliaryConnection(@Nonnull ConnectionContext connectionContext); /** * Check if connection is auxiliary and if yes then continue working. * @param connectionContext connection to the device * @return false if this is primary connection */ - boolean auxiliaryConnectionDropped(@Nonnull final ConnectionContext connectionContext); + boolean auxiliaryConnectionDropped(@Nonnull ConnectionContext connectionContext); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainHolder.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainHolder.java index 205c854aed..b6462523ec 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainHolder.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainHolder.java @@ -28,7 +28,7 @@ public interface ContextChainHolder extends MastershipChangeListener, DeviceDisconnectedHandler, EntityOwnershipListener, - AutoCloseable{ + AutoCloseable { /** * Managers need to be added before. @@ -38,32 +38,32 @@ public interface ContextChainHolder extends * @param manager a child class of {@link OFPManager} * @param {@link OFPManager} */ - void addManager(final T manager); + void addManager(T manager); /** * Create a new context chain. * @param connectionContext new connection * @return {@link ContextChain} */ - ContextChain createContextChain(final ConnectionContext connectionContext); + ContextChain createContextChain(ConnectionContext connectionContext); /** * Called if connection needs to be destroyed. * @param deviceInfo {@link DeviceInfo} */ - ListenableFuture destroyContextChain(final DeviceInfo deviceInfo); + ListenableFuture destroyContextChain(DeviceInfo deviceInfo); /** * Provider is needed to register cluster singleton service. * @param singletonServicesProvider provider */ - void addSingletonServicesProvider(final ClusterSingletonServiceProvider singletonServicesProvider); + void addSingletonServicesProvider(ClusterSingletonServiceProvider singletonServicesProvider); /** * Register EOS listener. * @param entityOwnershipService EOS services */ - void changeEntityOwnershipService(final EntityOwnershipService entityOwnershipService); + void changeEntityOwnershipService(EntityOwnershipService entityOwnershipService); @Override void close() throws Exception; diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainMastershipState.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainMastershipState.java index 9f97861cd3..2dd2bbfcb3 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainMastershipState.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainMastershipState.java @@ -1,32 +1,32 @@ -/* - * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * 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.openflowplugin.api.openflow.lifecycle; - -public enum ContextChainMastershipState { - /** - * Device has role MASTER set. - */ - MASTER_ON_DEVICE, - /** - * Initial statics gathering done ok. - */ - INITIAL_GATHERING, - /** - * Initial submit ok. - */ - INITIAL_SUBMIT, - /** - * Initial flow registry fill is done. - */ - INITIAL_FLOW_REGISTRY_FILL, - /** - * Check mastership. - */ - CHECK - -} +/* + * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * 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.openflowplugin.api.openflow.lifecycle; + +public enum ContextChainMastershipState { + /** + * Device has role MASTER set. + */ + MASTER_ON_DEVICE, + /** + * Initial statics gathering done ok. + */ + INITIAL_GATHERING, + /** + * Initial submit ok. + */ + INITIAL_SUBMIT, + /** + * Initial flow registry fill is done. + */ + INITIAL_FLOW_REGISTRY_FILL, + /** + * Check mastership. + */ + CHECK + +} diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainState.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainState.java index c34a8d19e3..8cfc3eecec 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainState.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainState.java @@ -1,24 +1,24 @@ -/* - * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * 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.openflowplugin.api.openflow.lifecycle; - -public enum ContextChainState { - /** - * Context chain is working as MASTER. - */ - WORKING_MASTER, - /** - * Context chain is working as SLAVE, initial gathering already done. - */ - WORKING_SLAVE, - /** - * Context chain is undefined. - */ - UNDEFINED - -} +/* + * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * 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.openflowplugin.api.openflow.lifecycle; + +public enum ContextChainState { + /** + * Context chain is working as MASTER. + */ + WORKING_MASTER, + /** + * Context chain is working as SLAVE, initial gathering already done. + */ + WORKING_SLAVE, + /** + * Context chain is undefined. + */ + UNDEFINED + +} diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainStateListener.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainStateListener.java index c9dfb393f5..0ddf40e0b0 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainStateListener.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/ContextChainStateListener.java @@ -9,12 +9,12 @@ package org.opendaylight.openflowplugin.api.openflow.lifecycle; /** - * Listens to changes about context chain state + * Listens to changes about context chain state. */ public interface ContextChainStateListener { /** - * Event triggered on context chain state change + * Event triggered on context chain state change. * @param state context chain state */ void onStateAcquired(ContextChainState state); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/LifecycleService.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/LifecycleService.java index ca80254084..92c61fbceb 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/LifecycleService.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/LifecycleService.java @@ -11,10 +11,7 @@ package org.opendaylight.openflowplugin.api.openflow.lifecycle; import javax.annotation.Nonnull; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService; import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider; -import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; -import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; -import org.opendaylight.openflowplugin.api.openflow.device.handlers.ClusterInitializationPhaseHandler; import org.opendaylight.openflowplugin.api.openflow.device.handlers.DeviceRemovedHandler; /** @@ -27,20 +24,20 @@ public interface LifecycleService extends ClusterSingletonService, AutoCloseable * @param singletonServiceProvider from md-sal binding * @param deviceContext device */ - void registerService(@Nonnull final ClusterSingletonServiceProvider singletonServiceProvider, - @Nonnull final DeviceContext deviceContext); + void registerService(@Nonnull ClusterSingletonServiceProvider singletonServiceProvider, + @Nonnull DeviceContext deviceContext); /** * This method registers device removed handler what will be executed when device should be removed. * @param deviceRemovedHandler device removed handler */ - void registerDeviceRemovedHandler(@Nonnull final DeviceRemovedHandler deviceRemovedHandler); + void registerDeviceRemovedHandler(@Nonnull DeviceRemovedHandler deviceRemovedHandler); /** * Make device SLAVE. * @param deviceContext provide device context which can't be stored in lifecycle service. */ - void makeDeviceSlave(final DeviceContext deviceContext); + void makeDeviceSlave(DeviceContext deviceContext); @Override void close(); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/MastershipChangeListener.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/MastershipChangeListener.java index aab1ce1705..22ca8c15f8 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/MastershipChangeListener.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/lifecycle/MastershipChangeListener.java @@ -22,7 +22,7 @@ public interface MastershipChangeListener { * @param reason reason * @param mandatory if it is mandatory connection will be dropped */ - void onNotAbleToStartMastership(final DeviceInfo deviceInfo, @Nonnull final String reason, final boolean mandatory); + void onNotAbleToStartMastership(DeviceInfo deviceInfo, @Nonnull String reason, boolean mandatory); /** * Event occurs if there was a try to acquire MASTER role. @@ -30,26 +30,26 @@ public interface MastershipChangeListener { * @param deviceInfo for this device * @param reason reason */ - default void onNotAbleToStartMastershipMandatory(final DeviceInfo deviceInfo, @Nonnull final String reason) { + default void onNotAbleToStartMastershipMandatory(DeviceInfo deviceInfo, @Nonnull String reason) { onNotAbleToStartMastership(deviceInfo, reason, true); } /** * Changed to MASTER role on device. * @param deviceInfo device - * @param mastershipState + * @param mastershipState state */ - void onMasterRoleAcquired(final DeviceInfo deviceInfo, @Nonnull final ContextChainMastershipState mastershipState); + void onMasterRoleAcquired(DeviceInfo deviceInfo, @Nonnull ContextChainMastershipState mastershipState); /** * Change to SLAVE role on device was successful. * @param deviceInfo device */ - void onSlaveRoleAcquired(final DeviceInfo deviceInfo); + void onSlaveRoleAcquired(DeviceInfo deviceInfo); /** * Change to SLAVE role on device was not able. * @param deviceInfo device */ - void onSlaveRoleNotAcquired(final DeviceInfo deviceInfo); + void onSlaveRoleNotAcquired(DeviceInfo deviceInfo); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/protocol/serialization/MatchEntrySerializer.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/protocol/serialization/MatchEntrySerializer.java index c1a7032c4d..1f923aa822 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/protocol/serialization/MatchEntrySerializer.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/protocol/serialization/MatchEntrySerializer.java @@ -18,6 +18,6 @@ public interface MatchEntrySerializer extends OFSerializer { * @param match Openflow match * @return true if matched */ - boolean matchTypeCheck(final Match match); + boolean matchTypeCheck(Match match); } \ No newline at end of file diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/ItemLifeCycleRegistry.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/ItemLifeCycleRegistry.java index ed51e0fecb..60e061e3f7 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/ItemLifeCycleRegistry.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/ItemLifeCycleRegistry.java @@ -17,7 +17,7 @@ import org.opendaylight.yangtools.concepts.Registration; public interface ItemLifeCycleRegistry { /** - * register given life cycle source to known sources of device + * register given life cycle source to known sources of device. * * @param lifeCycleSource life cycle changes provider * @return closeable registration @@ -25,11 +25,12 @@ public interface ItemLifeCycleRegistry { Registration registerLifeCycleSource(ItemLifeCycleSource lifeCycleSource); /** - * close all existing registrations + * close all existing registrations. */ void clear(); /** + * Registered sources. * @return registered sources */ Iterable getLifeCycleSources(); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/flow/DeviceFlowRegistry.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/flow/DeviceFlowRegistry.java index 6dbd709473..80fbd69253 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/flow/DeviceFlowRegistry.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/registry/flow/DeviceFlowRegistry.java @@ -8,7 +8,6 @@ package org.opendaylight.openflowplugin.api.openflow.registry.flow; - import com.google.common.base.Optional; import com.google.common.util.concurrent.ListenableFuture; import java.util.List; diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleKeeper.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleKeeper.java index c6cc2c3cdc..c47dcdf3a3 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleKeeper.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleKeeper.java @@ -12,11 +12,12 @@ import javax.annotation.Nullable; import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener; /** - * provides read-write access to assigned {@link ItemLifecycleListener} + * provides read-write access to assigned {@link ItemLifecycleListener}. */ public interface ItemLifeCycleKeeper extends ItemLifeCycleSource { /** + * lifecycle listener. * @return assigned item lifecycle listener */ @Nullable diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleSource.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleSource.java index 4bab964e05..a62e909095 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleSource.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/ItemLifeCycleSource.java @@ -19,6 +19,7 @@ import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleLi public interface ItemLifeCycleSource { /** + * lifecycle changes. * @param itemLifecycleListener acts upon lifecycle changes */ void setItemLifecycleListener(@Nullable ItemLifecycleListener itemLifecycleListener); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcContext.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcContext.java index aff71e6ea7..880a59bf3e 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcContext.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcContext.java @@ -15,12 +15,13 @@ import org.opendaylight.yangtools.yang.binding.RpcService; * This context is registered with MD-SAL as a routed RPC provider for the inventory node backed by this switch and * tracks the state of any user requests and how they map onto protocol requests. It uses * {@link org.opendaylight.openflowplugin.api.openflow.device.RequestContext} to perform requests. - *

*/ public interface RpcContext extends RequestContextStack, OFPContext { + void registerRpcServiceImplementation(Class serviceClass, S serviceInstance); S lookupRpcService(Class serviceClass); + void unregisterRpcServiceImplementation(Class serviceClass); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcManager.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcManager.java index 7598ed8a7d..42e7440cef 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcManager.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/RpcManager.java @@ -22,7 +22,6 @@ public interface RpcManager extends OFPManager { void setRpcRequestQuota(int rpcRequestQuota); - RpcContext createContext(final @Nonnull DeviceInfo deviceInfo, - final @Nonnull DeviceContext deviceContext); + RpcContext createContext(@Nonnull DeviceInfo deviceInfo, @Nonnull DeviceContext deviceContext); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/listener/ItemLifecycleListener.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/listener/ItemLifecycleListener.java index 8d0e604850..15180757b7 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/listener/ItemLifecycleListener.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/rpc/listener/ItemLifecycleListener.java @@ -19,27 +19,30 @@ import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier; public interface ItemLifecycleListener { /** - * react upon item added event + * react upon item added event. * * @param itemPath keyed path in DS * @param itemBody item body */ - & DataObject, K extends Identifier> void onAdded(KeyedInstanceIdentifier itemPath, I itemBody); + & DataObject, K extends Identifier> void onAdded( + KeyedInstanceIdentifier itemPath, I itemBody); /** - * react upon item removed event + * react upon item removed event. * * @param itemPath keyed path in DS */ - & DataObject, K extends Identifier> void onRemoved(KeyedInstanceIdentifier itemPath); + & DataObject, K extends Identifier> void onRemoved( + KeyedInstanceIdentifier itemPath); /** - * react upon item updated event + * react upon item updated event. * * @param itemPath keyed path in DS * @param itemBody item body */ - & DataObject, K extends Identifier> void onUpdated(KeyedInstanceIdentifier itemPath, I itemBody); + & DataObject, K extends Identifier> void onUpdated( + KeyedInstanceIdentifier itemPath, I itemBody); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageCountDumper.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageCountDumper.java index d61b41670f..e52044b63c 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageCountDumper.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageCountDumper.java @@ -11,11 +11,12 @@ package org.opendaylight.openflowplugin.api.openflow.statistics; import java.util.List; /** - * simple message counters dumper + * simple message counters dumper. */ public interface MessageCountDumper { /** + * List of counter items. * @return list of counter items */ List dumpMessageCounts(); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageObservatory.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageObservatory.java index 3575650256..4868b11480 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageObservatory.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageObservatory.java @@ -9,9 +9,6 @@ package org.opendaylight.openflowplugin.api.openflow.statistics; -/** - * @param message type - */ @Deprecated public interface MessageObservatory extends MessageSpy, MessageCountDumper { diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageSpy.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageSpy.java index e678adba0d..46b9193775 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageSpy.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/MessageSpy.java @@ -10,55 +10,77 @@ package org.opendaylight.openflowplugin.api.openflow.statistics; /** - * ticket spy - aimed on collecting intel about tickets + * ticket spy - aimed on collecting intel about tickets. * @param type of watched message */ @Deprecated public interface MessageSpy extends Runnable { /** + * Spy In. * @param message content of ticket */ void spyIn(M message); /** + * Spy Out. * @param message content of ticket */ void spyOut(M message); - - + // TODO: temporary solution, should be refactored and moved to managed bean - + /** - * statistic groups overall in OFPlugin + * statistic groups overall in OFPlugin. */ - enum STATISTIC_GROUP { - /** message from switch, enqueued for processing */ + enum StatisticsGroup { + /** + * message from switch, enqueued for processing. + */ FROM_SWITCH_ENQUEUED, - /** message from switch translated successfully - source */ + /** + * message from switch translated successfully - source. + */ FROM_SWITCH_TRANSLATE_IN_SUCCESS, - /** message from switch translated successfully - target */ + /** + * message from switch translated successfully - target. + */ FROM_SWITCH_TRANSLATE_OUT_SUCCESS, - /** message from switch where translation failed - source */ + /** + * message from switch where translation failed - source. + */ FROM_SWITCH_TRANSLATE_SRC_FAILURE, - /** message from switch finally published into MD-SAL */ + /** + * message from switch finally published into MD-SAL. + */ FROM_SWITCH_PUBLISHED_SUCCESS, - /** message from switch - publishing into MD-SAL failed */ + /** + * message from switch - publishing into MD-SAL failed. + */ FROM_SWITCH_PUBLISHED_FAILURE, - - /** message from MD-SAL to switch via RPC enqueued */ + + /** + * message from MD-SAL to switch via RPC enqueued. + */ TO_SWITCH_ENQUEUED_SUCCESS, - /** message from MD-SAL to switch via RPC NOT enqueued */ + /** + * message from MD-SAL to switch via RPC NOT enqueued. + */ TO_SWITCH_ENQUEUED_FAILED, - /** message from MD-SAL to switch - sent to OFJava successfully */ + /** + * message from MD-SAL to switch - sent to OFJava successfully. + */ TO_SWITCH_SUBMITTED_SUCCESS, - /** message from MD-SAL to switch - sent to OFJava but failed*/ + /** + * message from MD-SAL to switch - sent to OFJava but failed. + */ TO_SWITCH_SUBMITTED_FAILURE } - + /** + * Spy message. * @param message from switch or to switch - depends on statGroup - * @param statGroup + * @param statGroup statistics group */ - void spyMessage(M message, STATISTIC_GROUP statGroup); - } + void spyMessage(M message, StatisticsGroup statGroup); +} diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsContext.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsContext.java index 6d78b843d2..1c1e627658 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsContext.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsContext.java @@ -17,12 +17,12 @@ import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack; import org.opendaylight.openflowplugin.api.openflow.rpc.listener.ItemLifecycleListener; /** - * Context for statistics + * Context for statistics. */ public interface StatisticsContext extends RequestContextStack, OFPContext { /** - * Gather data from device + * Gather data from device. * @return true if gathering was successful */ ListenableFuture gatherDynamicData(); @@ -38,41 +38,43 @@ public interface StatisticsContext extends RequestContextStack, OFPContext { void statListForCollectingInitialization(); /** + * Setter. * @param pollTimeout handle to nearest scheduled statistics poll */ void setPollTimeout(Timeout pollTimeout); /** + * Getter. * @return dedicated item life cycle change listener (per device) */ ItemLifecycleListener getItemLifeCycleListener(); /** - * On / Off scheduling + * On / Off scheduling. * @param schedulingEnabled true if scheduling should be enabled */ - void setSchedulingEnabled(final boolean schedulingEnabled); + void setSchedulingEnabled(boolean schedulingEnabled); /** - * Check status + * Check status. * @return true if scheduling is enabled */ boolean isSchedulingEnabled(); /** - * Gain device state + * Gain device state. * @return device state from device context from lifecycle service */ DeviceState gainDeviceState(); /** - * Gain device context + * Gain device context. * @return device context from lifecycle service */ DeviceContext gainDeviceContext(); /** - * In case to change mastership to slave or connection interrupted stop the future and release thread + * In case to change mastership to slave or connection interrupted stop the future and release thread. */ void stopGatheringData(); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsManager.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsManager.java index b1b8ea52ec..faa66f9f51 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsManager.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/StatisticsManager.java @@ -14,31 +14,31 @@ import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; /** - * Manager to start or stop scheduling statistics + * Manager to start or stop scheduling statistics. */ public interface StatisticsManager extends OFPManager { /** - * Start scheduling statistic gathering for given device info + * Start scheduling statistic gathering for given device info. * @param deviceInfo for this device should be running statistics gathering */ - void startScheduling(final DeviceInfo deviceInfo); + void startScheduling(DeviceInfo deviceInfo); /** - * Stop scheduling statistic gathering for given device info + * Stop scheduling statistic gathering for given device info. * @param deviceInfo for this device should be stopped statistics gathering */ - void stopScheduling(final DeviceInfo deviceInfo); + void stopScheduling(DeviceInfo deviceInfo); @Override void close(); void setIsStatisticsPollingOn(boolean isStatisticsPollingOn); - void setBasicTimerDelay(final long basicTimerDelay); + void setBasicTimerDelay(long basicTimerDelay); - void setMaximumTimerDelay(final long maximumTimerDelay); + void setMaximumTimerDelay(long maximumTimerDelay); - StatisticsContext createContext(@Nonnull final DeviceContext deviceContext); + StatisticsContext createContext(@Nonnull DeviceContext deviceContext); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/BackwardCompatibleAtomicService.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/BackwardCompatibleAtomicService.java index 924a757121..c6f96a2033 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/BackwardCompatibleAtomicService.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/BackwardCompatibleAtomicService.java @@ -14,7 +14,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult; /** * Prescribes handling and transforming of backward compatible services in order to provide simple to use service - * with notification support + * with notification support. * * @param rpc input * @param rpc input @@ -24,7 +24,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult; public interface BackwardCompatibleAtomicService { /** - * process rpc request and publish corresponding notification upon success + * process rpc request and publish corresponding notification upon success. * * @param input rpc input * @param notificationPublishService publisher handle diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/Delegator.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/Delegator.java index 72bb7dfdc5..129a5ed87f 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/Delegator.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/compatibility/Delegator.java @@ -9,11 +9,12 @@ package org.opendaylight.openflowplugin.api.openflow.statistics.compatibility; /** - * Simple delegator pattern support + * Simple delegator pattern support. */ public interface Delegator { /** + * Setter. * @param delegate backend task executor */ void setDelegate(D delegate); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageIntelligenceAgency.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageIntelligenceAgency.java index 9a8cbbb924..f303e01075 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageIntelligenceAgency.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageIntelligenceAgency.java @@ -10,11 +10,9 @@ package org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific; import java.util.List; -/** - * Created by Martin Bobak <mbobak@cisco.com> on 20.4.2015. - */ public interface MessageIntelligenceAgency extends MessageSpy { List provideIntelligence(); + void resetStatistics(); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageSpy.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageSpy.java index 14637b17fb..a199d9b127 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageSpy.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/statistics/ofpspecific/MessageSpy.java @@ -8,50 +8,47 @@ package org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific; -/** - * Created by Martin Bobak <mbobak@cisco.com> on 20.4.2015. - */ public interface MessageSpy extends Runnable { /** - * statistic groups overall in OFPlugin + * statistic groups overall in OFPlugin. */ - enum STATISTIC_GROUP { + enum StatisticsGroup { /** - * message from switch + * message from switch. */ FROM_SWITCH, /** - * message from switch translated successfully - source + * message from switch translated successfully - source. */ FROM_SWITCH_TRANSLATE_IN_SUCCESS, /** - * message from switch translated successfully - target + * message from switch translated successfully - target. */ FROM_SWITCH_TRANSLATE_OUT_SUCCESS, /** - * message from switch where translation failed - source + * message from switch where translation failed - source. */ FROM_SWITCH_TRANSLATE_SRC_FAILURE, /** - * packetIn from switch reached processing limit and got dropped + * packetIn from switch reached processing limit and got dropped. */ FROM_SWITCH_PACKET_IN_LIMIT_REACHED_AND_DROPPED, /** - * message from switch to MD-SAL - notification service rejected notfication + * message from switch to MD-SAL - notification service rejected notification. */ FROM_SWITCH_NOTIFICATION_REJECTED, /** - * message from switch finally published into MD-SAL + * message from switch finally published into MD-SAL. */ FROM_SWITCH_PUBLISHED_SUCCESS, /** - * message from switch - publishing into MD-SAL failed + * message from switch - publishing into MD-SAL failed. */ FROM_SWITCH_PUBLISHED_FAILURE, /** - * message from MD-SAL entered service - first point of encounter + * message from MD-SAL entered service - first point of encounter. */ TO_SWITCH_ENTERED, /** @@ -59,39 +56,40 @@ public interface MessageSpy extends Runnable { */ TO_SWITCH_DISREGARDED, /** - * message from MD-SAL to switch - asked for XID reservation in queue, but rejected + * message from MD-SAL to switch - asked for XID reservation in queue, but rejected. */ TO_SWITCH_RESERVATION_REJECTED, /** - * message from MD-SAL to switch - ready to sent to OFJava (might be one-to-multiple ration between entered and sent) + * message from MD-SAL to switch + * - ready to sent to OFJava (might be one-to-multiple ration between entered and sent). */ TO_SWITCH_READY_FOR_SUBMIT, /** - * message from MD-SAL to switch - sent to OFJava successfully + * message from MD-SAL to switch - sent to OFJava successfully. */ TO_SWITCH_SUBMIT_SUCCESS, /** - * message from MD-SAL to switch - sent to OFJava successfully, no response expected + * message from MD-SAL to switch - sent to OFJava successfully, no response expected. */ TO_SWITCH_SUBMIT_SUCCESS_NO_RESPONSE, /** - * message from MD-SAL to switch - sent to OFJava but failed + * message from MD-SAL to switch - sent to OFJava but failed. */ TO_SWITCH_SUBMIT_FAILURE, /** - * message from MD-SAL to switch - sent to OFJava but failed with exception + * message from MD-SAL to switch - sent to OFJava but failed with exception. */ TO_SWITCH_SUBMIT_ERROR, /** - * TEMPORARY STATISTIC VALUE + * TEMPORARY STATISTIC VALUE. */ REQUEST_STACK_FREED, /** - * stop receiving data from device - turned on + * stop receiving data from device - turned on. */ OFJ_BACKPRESSURE_ON, /** - * stop receiving data from device - turned off + * stop receiving data from device - turned off. */ OFJ_BACKPRESSURE_OFF @@ -99,9 +97,10 @@ public interface MessageSpy extends Runnable { } /** + *Spy message. * @param message from switch or to switch - depends on statGroup - * @param statGroup + * @param statGroup statistics group */ - void spyMessage(Class message, STATISTIC_GROUP statGroup); + void spyMessage(Class message, StatisticsGroup statGroup); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/translator/TranslatorLibrarian.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/translator/TranslatorLibrarian.java index 70164a34c6..f8d8b65b1f 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/translator/TranslatorLibrarian.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/translator/TranslatorLibrarian.java @@ -10,22 +10,18 @@ package org.opendaylight.openflowplugin.api.openflow.translator; import org.opendaylight.openflowplugin.api.openflow.device.TranslatorLibrary; -/** - * Created by Martin Bobak <mbobak@cisco.com> on 3.4.2015. - */ public interface TranslatorLibrarian { /** * Method provides translator library held by Librarian. - * @return + * @return translator library */ - public TranslatorLibrary oook(); + TranslatorLibrary oook(); /** * Method registers translator library for translating message objects. - * - * @param translatorLibrary + * @param translatorLibrary translator library */ - public void setTranslatorLibrary(TranslatorLibrary translatorLibrary); + void setTranslatorLibrary(TranslatorLibrary translatorLibrary); } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java index 03543a877c..c7141da52b 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImpl.java @@ -168,7 +168,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi private boolean switchFeaturesMandatory; private DeviceInfo deviceInfo; private final ConvertorExecutor convertorExecutor; - private volatile CONTEXT_STATE state; + private volatile ContextState state; private ClusterInitializationPhaseHandler clusterInitializationPhaseHandler; private final DeviceManager myManager; private final DeviceInitializerProvider deviceInitializerProvider; @@ -212,7 +212,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi this.itemLifeCycleSourceRegistry = new ItemLifeCycleRegistryImpl(); this.flowLifeCycleKeeper = new ItemLifeCycleSourceImpl(); this.itemLifeCycleSourceRegistry.registerLifeCycleSource(flowLifeCycleKeeper); - this.state = CONTEXT_STATE.INITIALIZATION; + this.state = ContextState.INITIALIZATION; this.convertorExecutor = convertorExecutor; this.skipTableFeatures = skipTableFeatures; this.useSingleLayerSerialization = useSingleLayerSerialization; @@ -319,8 +319,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi messageSpy.spyMessage( ofHeader.getImplementedInterface(), (ofHeader instanceof Error) - ? MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_FAILURE - : MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS); + ? MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE + : MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS); } @Override @@ -328,8 +328,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi ofHeaderList.forEach(header -> messageSpy.spyMessage( header.getImplementedInterface(), (header instanceof Error) - ? MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_FAILURE - : MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS)); + ? MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE + : MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); } @Override @@ -369,7 +369,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi @Override public void processPortStatusMessage(final PortStatusMessage portStatus) { - messageSpy.spyMessage(portStatus.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS); + messageSpy.spyMessage(portStatus.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS); if (initialized) { try { @@ -410,29 +410,29 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi @Override public void processPacketInMessage(final PacketInMessage packetInMessage) { - messageSpy.spyMessage(packetInMessage.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH); + messageSpy.spyMessage(packetInMessage.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH); final ConnectionAdapter connectionAdapter = getPrimaryConnectionContext().getConnectionAdapter(); final PacketReceived packetReceived = packetInTranslator.translate(packetInMessage, getDeviceInfo(), null); if (packetReceived == null) { LOG.debug("Received a null packet from switch {}", connectionAdapter.getRemoteAddress()); - messageSpy.spyMessage(packetInMessage.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH_TRANSLATE_SRC_FAILURE); + messageSpy.spyMessage(packetInMessage.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_TRANSLATE_SRC_FAILURE); return; } else { - messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH_TRANSLATE_OUT_SUCCESS); + messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_TRANSLATE_OUT_SUCCESS); } if (!packetInLimiter.acquirePermit()) { LOG.debug("Packet limited"); // TODO: save packet into emergency slot if possible - messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PACKET_IN_LIMIT_REACHED_AND_DROPPED); + messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_PACKET_IN_LIMIT_REACHED_AND_DROPPED); return; } final ListenableFuture offerNotification = notificationPublishService.offerNotification(packetReceived); if (NotificationPublishService.REJECTED.equals(offerNotification)) { LOG.debug("notification offer rejected"); - messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH_NOTIFICATION_REJECTED); + messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED); packetInLimiter.drainLowWaterMark(); packetInLimiter.releasePermit(); return; @@ -441,13 +441,13 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi Futures.addCallback(offerNotification, new FutureCallback() { @Override public void onSuccess(final Object result) { - messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS); + messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS); packetInLimiter.releasePermit(); } @Override public void onFailure(final Throwable t) { - messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.STATISTIC_GROUP.FROM_SWITCH_NOTIFICATION_REJECTED); + messageSpy.spyMessage(packetReceived.getImplementedInterface(), MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED); LOG.debug("notification offer failed: {}", t.getMessage()); LOG.trace("notification offer failed..", t); packetInLimiter.releasePermit(); @@ -510,8 +510,8 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi @Override public void onPublished() { - Verify.verify(CONTEXT_STATE.INITIALIZATION.equals(getState())); - this.state = CONTEXT_STATE.WORKING; + Verify.verify(ContextState.INITIALIZATION.equals(getState())); + this.state = ContextState.WORKING; primaryConnectionContext.getConnectionAdapter().setPacketInFiltering(false); } @@ -545,7 +545,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi if (LOG.isDebugEnabled()) { LOG.debug("Shutdown method for node {}", getDeviceInfo().getLOGValue()); } - if (CONTEXT_STATE.TERMINATION.equals(getState())) { + if (ContextState.TERMINATION.equals(getState())) { LOG.debug("DeviceCtx for Node {} is in termination process.", getDeviceInfo().getLOGValue()); return; } @@ -590,7 +590,7 @@ public class DeviceContextImpl implements DeviceContext, ExtensionConverterProvi } @Override - public CONTEXT_STATE getState() { + public ContextState getState() { return this.state; } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiter.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiter.java index ad0a8b1b74..dae48def27 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiter.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiter.java @@ -30,14 +30,14 @@ final class PacketInRateLimiter extends SimpleRatelimiter { @Override protected void disableFlow() { - messageSpy.spyMessage(DeviceContext.class, MessageSpy.STATISTIC_GROUP.OFJ_BACKPRESSURE_ON); + messageSpy.spyMessage(DeviceContext.class, MessageSpy.StatisticsGroup.OFJ_BACKPRESSURE_ON); connectionAdapter.setPacketInFiltering(true); LOG.debug("PacketIn filtering on: {}", connectionAdapter.getRemoteAddress()); } @Override protected void enableFlow() { - messageSpy.spyMessage(DeviceContext.class, MessageSpy.STATISTIC_GROUP.OFJ_BACKPRESSURE_OFF); + messageSpy.spyMessage(DeviceContext.class, MessageSpy.StatisticsGroup.OFJ_BACKPRESSURE_OFF); connectionAdapter.setPacketInFiltering(false); LOG.debug("PacketIn filtering off: {}", connectionAdapter.getRemoteAddress()); } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImpl.java index 2bb0cbee8d..7d21f862cb 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImpl.java @@ -16,7 +16,6 @@ import java.util.Iterator; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutionException; import java.util.concurrent.Semaphore; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -51,7 +50,7 @@ class RpcContextImpl implements RpcContext { // TODO: add private Sal salBroker private final ConcurrentMap, RoutedRpcRegistration> rpcRegistrations = new ConcurrentHashMap<>(); private final KeyedInstanceIdentifier nodeInstanceIdentifier; - private volatile CONTEXT_STATE state = CONTEXT_STATE.INITIALIZATION; + private volatile ContextState state = ContextState.INITIALIZATION; private final DeviceInfo deviceInfo; private final DeviceContext deviceContext; private final ExtensionConverterProvider extensionConverterProvider; @@ -135,7 +134,7 @@ class RpcContextImpl implements RpcContext { tracker.release(); final long xid = getXid().getValue(); LOG.trace("Removed request context with xid {}", xid); - messageSpy.spyMessage(RpcContextImpl.class, MessageSpy.STATISTIC_GROUP.REQUEST_STACK_FREED); + messageSpy.spyMessage(RpcContextImpl.class, MessageSpy.StatisticsGroup.REQUEST_STACK_FREED); } }; } @@ -157,7 +156,7 @@ class RpcContextImpl implements RpcContext { } @Override - public CONTEXT_STATE getState() { + public ContextState getState() { return this.state; } @@ -173,7 +172,7 @@ class RpcContextImpl implements RpcContext { @Override public ListenableFuture stopClusterServices() { - if (CONTEXT_STATE.TERMINATION.equals(this.state)) { + if (ContextState.TERMINATION.equals(this.state)) { return Futures.immediateCancelledFuture(); } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java index c4c5a90851..1277c78f22 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractMultipartRequestOnTheFlyCallback.java @@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.impl.services; import java.util.Collections; import java.util.List; import java.util.Objects; -import org.opendaylight.openflowplugin.api.openflow.OFPContext.CONTEXT_STATE; +import org.opendaylight.openflowplugin.api.openflow.OFPContext.ContextState; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; import org.opendaylight.openflowplugin.api.openflow.device.DeviceInfo; import org.opendaylight.openflowplugin.api.openflow.device.DeviceRegistry; @@ -39,7 +39,7 @@ public abstract class AbstractMultipartRequestOnTheFlyCallback> context, Class requestType, @@ -62,12 +62,12 @@ public abstract class AbstractMultipartRequestOnTheFlyCallback instanceIdentifier = deviceInfo .getNodeInstanceIdentifier() @@ -157,10 +157,10 @@ public abstract class AbstractMultipartRequestOnTheFlyCallbackemptyList()).build()); diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractRequestCallback.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractRequestCallback.java index 484fbd85d0..4e44288178 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractRequestCallback.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractRequestCallback.java @@ -15,7 +15,7 @@ import org.opendaylight.openflowjava.protocol.api.connection.DeviceRequestFailed import org.opendaylight.openflowplugin.api.openflow.device.RequestContext; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy; -import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy.STATISTIC_GROUP; +import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy.StatisticsGroup; import org.opendaylight.openflowplugin.impl.services.util.RequestContextUtil; import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error; @@ -45,7 +45,7 @@ public abstract class AbstractRequestCallback implements FutureCallback implements FutureCallbackfailed().withError(RpcError.ErrorType.APPLICATION, errorString, t); - spyMessage(MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_FAILURE); + spyMessage(StatisticsGroup.TO_SWITCH_SUBMIT_FAILURE); } else { builder = RpcResultBuilder.failed().withError(RpcError.ErrorType.APPLICATION, t.getMessage(), t); - spyMessage(MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_ERROR); + spyMessage(StatisticsGroup.TO_SWITCH_SUBMIT_ERROR); } context.setResult(builder.build()); diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractService.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractService.java index 3c267c9b42..8a8486944c 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractService.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/AbstractService.java @@ -118,14 +118,14 @@ public abstract class AbstractService { ? DataContainer.class.cast(input).getImplementedInterface() : input.getClass(); - getMessageSpy().spyMessage(requestType, MessageSpy.STATISTIC_GROUP.TO_SWITCH_ENTERED); + getMessageSpy().spyMessage(requestType, MessageSpy.StatisticsGroup.TO_SWITCH_ENTERED); LOG.trace("Handling general service call"); final RequestContext requestContext = requestContextStack.createRequestContext(); if (Objects.isNull(requestContext)) { LOG.trace("Request context refused."); - getMessageSpy().spyMessage(AbstractService.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_DISREGARDED); + getMessageSpy().spyMessage(AbstractService.class, MessageSpy.StatisticsGroup.TO_SWITCH_DISREGARDED); return Futures.immediateFuture(RpcResultBuilder .failed() .withError(RpcError.ErrorType.APPLICATION, "", "Request quota exceeded") @@ -133,11 +133,11 @@ public abstract class AbstractService { } if (Objects.isNull(requestContext.getXid())) { - getMessageSpy().spyMessage(requestContext.getClass(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_RESERVATION_REJECTED); + getMessageSpy().spyMessage(requestContext.getClass(), MessageSpy.StatisticsGroup.TO_SWITCH_RESERVATION_REJECTED); return RequestContextUtil.closeRequestContextWithRpcError(requestContext, "Outbound queue wasn't able to reserve XID."); } - getMessageSpy().spyMessage(requestContext.getClass(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_READY_FOR_SUBMIT); + getMessageSpy().spyMessage(requestContext.getClass(), MessageSpy.StatisticsGroup.TO_SWITCH_READY_FOR_SUBMIT); final Xid xid = requestContext.getXid(); OfHeader request = null; diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SimpleRequestCallback.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SimpleRequestCallback.java index 3f94add007..ad08aad92f 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SimpleRequestCallback.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/SimpleRequestCallback.java @@ -32,7 +32,7 @@ public final class SimpleRequestCallback extends AbstractR @Override public final void onSuccess(final OfHeader result) { - spyMessage(MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS); + spyMessage(MessageSpy.StatisticsGroup.TO_SWITCH_SUBMIT_SUCCESS); if (result == null) { setResult(RpcResultBuilder.success().build()); diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/VoidRequestCallback.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/VoidRequestCallback.java index 97109ad401..94dc3d1a58 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/VoidRequestCallback.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/VoidRequestCallback.java @@ -9,7 +9,7 @@ package org.opendaylight.openflowplugin.impl.services; import org.opendaylight.openflowplugin.api.openflow.device.RequestContext; import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy; -import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy.STATISTIC_GROUP; +import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy.StatisticsGroup; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; @@ -23,7 +23,7 @@ public final class VoidRequestCallback extends AbstractRequestCallback { @Override public void onSuccess(final OfHeader result) { - spyMessage(STATISTIC_GROUP.TO_SWITCH_SUBMIT_SUCCESS_NO_RESPONSE); + spyMessage(StatisticsGroup.TO_SWITCH_SUBMIT_SUCCESS_NO_RESPONSE); setResult(SUCCESS); } } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java index b7f37dbd3f..99192e2abe 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsContextImpl.java @@ -76,7 +76,7 @@ class StatisticsContextImpl implements StatisticsContext { private final StatisticsManager myManager; private volatile boolean schedulingEnabled; - private volatile CONTEXT_STATE state; + private volatile ContextState state; private ClusterInitializationPhaseHandler clusterInitializationPhaseHandler; private ClusterInitializationPhaseHandler initialSubmitHandler; @@ -96,7 +96,7 @@ class StatisticsContextImpl implements StatisticsContext { deviceContext, convertorExecutor, statisticsWriterProvider); itemLifeCycleListener = new ItemLifecycleListenerImpl(deviceContext); statListForCollectingInitialization(); - this.state = CONTEXT_STATE.INITIALIZATION; + this.state = ContextState.INITIALIZATION; this.deviceInfo = deviceContext.getDeviceInfo(); this.myManager = myManager; this.lastDataGathering = null; @@ -222,12 +222,12 @@ class StatisticsContextImpl implements StatisticsContext { @Override public void close() { - if (CONTEXT_STATE.TERMINATION.equals(getState())) { + if (ContextState.TERMINATION.equals(getState())) { if (LOG.isDebugEnabled()) { LOG.debug("StatisticsContext for node {} is already in TERMINATION state.", getDeviceInfo().getLOGValue()); } } else { - this.state = CONTEXT_STATE.TERMINATION; + this.state = ContextState.TERMINATION; stopGatheringData(); for (final Iterator> iterator = Iterators.consumingIterator(requestContexts.iterator()); @@ -308,7 +308,7 @@ class StatisticsContextImpl implements StatisticsContext { } @Override - public CONTEXT_STATE getState() { + public ContextState getState() { return this.state; } @@ -324,7 +324,7 @@ class StatisticsContextImpl implements StatisticsContext { @Override public ListenableFuture stopClusterServices() { - if (CONTEXT_STATE.TERMINATION.equals(this.state)) { + if (ContextState.TERMINATION.equals(this.state)) { return Futures.immediateCancelledFuture(); } diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImpl.java index 0ba31bd14c..4e7aba7317 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImpl.java @@ -23,7 +23,7 @@ import org.slf4j.LoggerFactory; /** * Implementation of {@link org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency}. - * Class counts message of {@link org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageSpy.STATISTIC_GROUP} type + * Class counts message of {@link StatisticsGroup} type * and provides info as debug log. */ public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency, MessageIntelligenceAgencyMXBean { @@ -51,10 +51,10 @@ public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency, } } - private ConcurrentMap, MessageCounters>> inputStats = new ConcurrentHashMap<>(); + private ConcurrentMap, MessageCounters>> inputStats = new ConcurrentHashMap<>(); @Override - public void spyMessage(@Nonnull final Class message, final STATISTIC_GROUP statGroup) { + public void spyMessage(@Nonnull final Class message, final StatisticsGroup statGroup) { Preconditions.checkNotNull(message, "Message can't be null."); getCounters(message, statGroup).increment(); } @@ -64,7 +64,7 @@ public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency, * @param statGroup statistic counter group * @return corresponding counter */ - private MessageCounters getCounters(final Class message, final STATISTIC_GROUP statGroup) { + private MessageCounters getCounters(final Class message, final StatisticsGroup statGroup) { ConcurrentMap, MessageCounters> groupData = getOrCreateGroupData(statGroup); MessageCounters counters = getOrCreateCountersPair(message, groupData); return counters; @@ -82,7 +82,7 @@ public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency, } - private ConcurrentMap, MessageCounters> getOrCreateGroupData(final STATISTIC_GROUP statGroup) { + private ConcurrentMap, MessageCounters> getOrCreateGroupData(final StatisticsGroup statGroup) { final ConcurrentMap, MessageCounters> lookup = inputStats.get(statGroup); if (lookup != null) { return lookup; @@ -108,7 +108,7 @@ public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency, public List provideIntelligence() { List dump = new ArrayList<>(); - for (STATISTIC_GROUP statGroup : STATISTIC_GROUP.values()) { + for (StatisticsGroup statGroup : StatisticsGroup.values()) { Map, MessageCounters> groupData = inputStats.get(statGroup); if (groupData != null) { for (Entry, MessageCounters> statEntry : groupData.entrySet()) { diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java index 207d393e64..b0c98178bb 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/DeviceContextImplTest.java @@ -344,10 +344,10 @@ public class DeviceContextImplTest { public void testProcessReply() { final Error mockedError = mock(Error.class); deviceContext.processReply(mockedError); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_FAILURE)); + verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE)); final OfHeader mockedOfHeader = mock(OfHeader.class); deviceContext.processReply(mockedOfHeader); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS)); + verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); } @Test @@ -356,11 +356,11 @@ public class DeviceContextImplTest { final Error mockedError = mock(Error.class); deviceContext.processReply(dummyXid, Lists.newArrayList(mockedError)); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_FAILURE)); + verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE)); final MultipartReply mockedMultipartReply = mock(MultipartReply.class); deviceContext.processReply(dummyXid, Lists.newArrayList(mockedMultipartReply)); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS)); + verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); } @Test @@ -372,7 +372,7 @@ public class DeviceContextImplTest { when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class))).thenReturn(stringListenableFuture); deviceContext.setNotificationPublishService(mockedNotificationPublishService); deviceContext.processPacketInMessage(mockedPacketInMessage); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS)); + verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS)); } @Test @@ -384,7 +384,7 @@ public class DeviceContextImplTest { when(mockedNotificationPublishService.offerNotification(any(PacketReceived.class))).thenReturn(dummyFuture); deviceContext.setNotificationPublishService(mockedNotificationPublishService); deviceContext.processPacketInMessage(mockedPacketInMessage); - verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_NOTIFICATION_REJECTED)); + verify(messageSpy).spyMessage(any(Class.class), eq(MessageSpy.StatisticsGroup.FROM_SWITCH_NOTIFICATION_REJECTED)); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java index 3b7ba99316..191745c09f 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/device/PacketInRateLimiterTest.java @@ -44,7 +44,7 @@ public class PacketInRateLimiterTest { public void testDisableFlow() throws Exception { rateLimiter.disableFlow(); - Mockito.verify(messageSpy).spyMessage(DeviceContext.class, MessageSpy.STATISTIC_GROUP.OFJ_BACKPRESSURE_ON); + Mockito.verify(messageSpy).spyMessage(DeviceContext.class, MessageSpy.StatisticsGroup.OFJ_BACKPRESSURE_ON); Mockito.verify(connectionAdapter).setPacketInFiltering(true); } @@ -52,7 +52,7 @@ public class PacketInRateLimiterTest { public void testEnableFlow() throws Exception { rateLimiter.enableFlow(); - Mockito.verify(messageSpy).spyMessage(DeviceContext.class, MessageSpy.STATISTIC_GROUP.OFJ_BACKPRESSURE_OFF); + Mockito.verify(messageSpy).spyMessage(DeviceContext.class, MessageSpy.StatisticsGroup.OFJ_BACKPRESSURE_OFF); Mockito.verify(connectionAdapter).setPacketInFiltering(false); } diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java index 73c99047a4..6f0f85f707 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ClearStatsCommandProviderTest.java @@ -70,7 +70,7 @@ public class ClearStatsCommandProviderTest extends AbstractKarafTest { public void testDoExecute_dirty() throws Exception { final MessageIntelligenceAgency mi5 = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency(); Assert.assertTrue(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION)); - mi5.spyMessage(OfHeader.class, MessageSpy.STATISTIC_GROUP.FROM_SWITCH); + mi5.spyMessage(OfHeader.class, MessageSpy.StatisticsGroup.FROM_SWITCH); Assert.assertFalse(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION)); clearStatsCommandProvider.execute(cmdSession); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java index 86a935f64e..29da0da28f 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/karaf/ShowStatsCommandProviderTest.java @@ -71,7 +71,7 @@ public class ShowStatsCommandProviderTest extends AbstractKarafTest { public void testDoExecute_dirty() throws Exception { Assert.assertTrue(checkNoActivity(messageIntelligenceAgency.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION)); - messageIntelligenceAgency.spyMessage(OfHeader.class, MessageSpy.STATISTIC_GROUP.FROM_SWITCH); + messageIntelligenceAgency.spyMessage(OfHeader.class, MessageSpy.StatisticsGroup.FROM_SWITCH); Assert.assertFalse(checkNoActivity(messageIntelligenceAgency.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION)); showStatsCommandProvider.execute(cmdSession); diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java index 6850c36b72..74bfdc3cb8 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/rpc/RpcContextImplTest.java @@ -137,7 +137,7 @@ public class RpcContextImplTest { final RequestContext requestContext = rpcContext.createRequestContext(); assertNotNull(requestContext); requestContext.close(); - verify(messageSpy).spyMessage(RpcContextImpl.class, MessageSpy.STATISTIC_GROUP.REQUEST_STACK_FREED); + verify(messageSpy).spyMessage(RpcContextImpl.class, MessageSpy.StatisticsGroup.REQUEST_STACK_FREED); } } @@ -187,7 +187,7 @@ public class RpcContextImplTest { public void testCreateRequestContext2() throws InterruptedException { RequestContext temp = rpcContext.createRequestContext(); temp.close(); - verify(messageSpy).spyMessage(RpcContextImpl.class,MessageSpy.STATISTIC_GROUP.REQUEST_STACK_FREED); + verify(messageSpy).spyMessage(RpcContextImpl.class, MessageSpy.StatisticsGroup.REQUEST_STACK_FREED); } @Test diff --git a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImplTest.java b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImplTest.java index 0b0228bc46..f4f4051904 100644 --- a/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImplTest.java +++ b/openflowplugin-impl/src/test/java/org/opendaylight/openflowplugin/impl/statistics/ofpspecific/MessageIntelligenceAgencyImplTest.java @@ -19,8 +19,8 @@ public class MessageIntelligenceAgencyImplTest { @Test public void testMessageIntelligenceAgency() { final MessageIntelligenceAgencyImpl messageIntelligenceAgency = new MessageIntelligenceAgencyImpl(); - messageIntelligenceAgency.spyMessage(String.class, MessageSpy.STATISTIC_GROUP.FROM_SWITCH); - messageIntelligenceAgency.spyMessage(Integer.class, MessageSpy.STATISTIC_GROUP.TO_SWITCH_ENTERED); + messageIntelligenceAgency.spyMessage(String.class, MessageSpy.StatisticsGroup.FROM_SWITCH); + messageIntelligenceAgency.spyMessage(Integer.class, MessageSpy.StatisticsGroup.TO_SWITCH_ENTERED); final List intelligence = messageIntelligenceAgency.provideIntelligence(); findExpectedStatistics(intelligence, "FROM_SWITCH: MSG[String] -> +1 | 1", "TO_SWITCH_ENTERED: MSG[Integer] -> +1 | 1"); } diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/NotificationPopListener.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/NotificationPopListener.java index 9b6f40ba1c..c145c5855d 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/NotificationPopListener.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/NotificationPopListener.java @@ -43,13 +43,13 @@ public class NotificationPopListener implements PopListener { if(processedMessage instanceof Notification) { if (notificationProviderService != null) { notificationProviderService.publish((Notification) processedMessage); - messageSpy.spyMessage(processedMessage, MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_SUCCESS); + messageSpy.spyMessage(processedMessage, MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS); published = true; } } if (! published) { - messageSpy.spyMessage(processedMessage, MessageSpy.STATISTIC_GROUP.FROM_SWITCH_PUBLISHED_FAILURE); + messageSpy.spyMessage(processedMessage, MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE); } } diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/RpcListeningExecutorService.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/RpcListeningExecutorService.java index f785a07fdc..7127d8b586 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/RpcListeningExecutorService.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/RpcListeningExecutorService.java @@ -58,13 +58,13 @@ public class RpcListeningExecutorService implements ListeningExecutorService { if (task instanceof OFRpcTask) { if (((OFRpcTask) task).getInput() instanceof DataContainer) { messageSpy.spyMessage((DataContainer) ((OFRpcTask) task).getInput(), - MessageSpy.STATISTIC_GROUP.TO_SWITCH_ENQUEUED_SUCCESS); + MessageSpy.StatisticsGroup.TO_SWITCH_ENQUEUED_SUCCESS); covered = true; } } if (! covered) { - messageSpy.spyMessage(notSupportedTask, MessageSpy.STATISTIC_GROUP.TO_SWITCH_ENQUEUED_FAILED); + messageSpy.spyMessage(notSupportedTask, MessageSpy.StatisticsGroup.TO_SWITCH_ENQUEUED_FAILED); } return resultFuture; diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskUtil.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskUtil.java index 6ef2a029bd..be7295dbc4 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskUtil.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskUtil.java @@ -117,7 +117,7 @@ public abstract class OFRpcTaskUtil { } else { notificationProviderService.publish(notificationComposer.compose(result.getResult().getTransactionId())); task.getTaskContext().getMessageSpy().spyMessage( - task.getInput(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_SUCCESS); + task.getInput(), MessageSpy.StatisticsGroup.TO_SWITCH_SUBMITTED_SUCCESS); } } @@ -125,7 +125,7 @@ public abstract class OFRpcTaskUtil { public void onFailure(final Throwable t) { //TODO: good place to notify MD-SAL about errors task.getTaskContext().getMessageSpy().spyMessage( - task.getInput(), MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMITTED_FAILURE); + task.getInput(), MessageSpy.StatisticsGroup.TO_SWITCH_SUBMITTED_FAILURE); } } diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/queue/QueueProcessorLightImpl.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/queue/QueueProcessorLightImpl.java index 1c610a612b..60f6114b9b 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/queue/QueueProcessorLightImpl.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/queue/QueueProcessorLightImpl.java @@ -26,7 +26,7 @@ import org.opendaylight.openflowplugin.api.openflow.md.queue.QueueItem; import org.opendaylight.openflowplugin.api.openflow.md.queue.QueueKeeper; import org.opendaylight.openflowplugin.api.openflow.md.queue.QueueProcessor; import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy; -import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy.STATISTIC_GROUP; +import org.opendaylight.openflowplugin.api.openflow.statistics.MessageSpy.StatisticsGroup; import org.opendaylight.openflowplugin.openflow.md.core.ThreadPoolLoggingExecutor; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader; import org.opendaylight.yangtools.yang.binding.DataContainer; @@ -135,7 +135,7 @@ public class QueueProcessorLightImpl implements QueueProcessor queueItem) { - messageSpy.spyMessage(queueItem.getMessage(), STATISTIC_GROUP.FROM_SWITCH_ENQUEUED); + messageSpy.spyMessage(queueItem.getMessage(), StatisticsGroup.FROM_SWITCH_ENQUEUED); TicketImpl ticket = new TicketImpl<>(); ticket.setConductor(queueItem.getConnectionConductor()); ticket.setMessage(queueItem.getMessage()); @@ -150,7 +150,7 @@ public class QueueProcessorLightImpl implements QueueProcessor queueItem) { - messageSpy.spyMessage(queueItem.getMessage(), STATISTIC_GROUP.FROM_SWITCH_ENQUEUED); + messageSpy.spyMessage(queueItem.getMessage(), StatisticsGroup.FROM_SWITCH_ENQUEUED); TicketImpl ticket = new TicketImpl<>(); ticket.setConductor(queueItem.getConnectionConductor()); ticket.setMessage(queueItem.getMessage()); diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImpl.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImpl.java index ef594bb7d3..1ff698dd87 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImpl.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImpl.java @@ -48,20 +48,20 @@ public class MessageSpyCounterImpl implements MessageObservatory } } - private final ConcurrentMap, MessageCounters>> inputStats = new ConcurrentHashMap<>(); + private final ConcurrentMap, MessageCounters>> inputStats = new ConcurrentHashMap<>(); @Override public void spyIn(final DataContainer message) { - getCounters(message, STATISTIC_GROUP.FROM_SWITCH_TRANSLATE_IN_SUCCESS).increment(); + getCounters(message, StatisticsGroup.FROM_SWITCH_TRANSLATE_IN_SUCCESS).increment(); } @Override public void spyOut(final DataContainer message) { - getCounters(message, STATISTIC_GROUP.FROM_SWITCH_TRANSLATE_OUT_SUCCESS).increment(); + getCounters(message, StatisticsGroup.FROM_SWITCH_TRANSLATE_OUT_SUCCESS).increment(); } @Override - public void spyMessage(final DataContainer message, final STATISTIC_GROUP statGroup) { + public void spyMessage(final DataContainer message, final StatisticsGroup statGroup) { getCounters(message, statGroup).increment(); } @@ -70,7 +70,7 @@ public class MessageSpyCounterImpl implements MessageObservatory * @param statGroup TODO * @return */ - private MessageCounters getCounters(final DataContainer message, final STATISTIC_GROUP statGroup) { + private MessageCounters getCounters(final DataContainer message, final StatisticsGroup statGroup) { Class msgType = message.getImplementedInterface(); ConcurrentMap, MessageCounters> groupData = getOrCreateGroupData(statGroup); MessageCounters counters = getOrCreateCountersPair(msgType, groupData); @@ -89,7 +89,7 @@ public class MessageSpyCounterImpl implements MessageObservatory } - private ConcurrentMap, MessageCounters> getOrCreateGroupData(final STATISTIC_GROUP statGroup) { + private ConcurrentMap, MessageCounters> getOrCreateGroupData(final StatisticsGroup statGroup) { final ConcurrentMap, MessageCounters> lookup = inputStats.get(statGroup); if (lookup != null) { return lookup; @@ -115,7 +115,7 @@ public class MessageSpyCounterImpl implements MessageObservatory public List dumpMessageCounts() { List dump = new ArrayList<>(); - for (STATISTIC_GROUP statGroup : STATISTIC_GROUP.values()) { + for (StatisticsGroup statGroup : StatisticsGroup.values()) { Map, MessageCounters> groupData = inputStats.get(statGroup); if (groupData != null) { for (Entry, MessageCounters> statEntry : groupData.entrySet()) { diff --git a/openflowplugin/src/test/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImplTest.java b/openflowplugin/src/test/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImplTest.java index 249803836a..49f1a8a2e1 100644 --- a/openflowplugin/src/test/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImplTest.java +++ b/openflowplugin/src/test/java/org/opendaylight/openflowplugin/statistics/MessageSpyCounterImplTest.java @@ -31,7 +31,7 @@ public class MessageSpyCounterImplTest { assertEquals(EXPECTED_MSG_COUNT,messageCounts.size()); assertEquals("FROM_SWITCH_ENQUEUED: no activity detected", messageCounts.get(0)); - messageSpyCounter.spyMessage(msg, MessageSpy.STATISTIC_GROUP.FROM_SWITCH_ENQUEUED); + messageSpyCounter.spyMessage(msg, MessageSpy.StatisticsGroup.FROM_SWITCH_ENQUEUED); messageCounts = messageSpyCounter.dumpMessageCounts(); assertEquals("FROM_SWITCH_ENQUEUED: MSG[Action] -> +1 | 1", messageCounts.get(0)); -- 2.36.6