/** 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";
}
*/
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;
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 */
* 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.
import javax.annotation.Nonnull;
/**
- * Manages OpenFlowPlugin configuration
+ * Manages OpenFlowPlugin configuration.
*/
public interface OpenFlowPluginConfigurationService {
private static final Map<String, PropertyType> 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);
}
}
/**
- * Converts enum name to property key
+ * Converts enum name to property key.
*
* @return the property key
*/
}
/**
- * 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<String,Object> 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
import org.opendaylight.controller.md.sal.binding.api.BindingService;
/**
- * Plugin services provider
+ * Plugin services provider.
*/
public interface OpenFlowPluginProvider extends AutoCloseable, BindingService {
void handshakeSuccessful();
/**
- * Handle received port status message
+ * Handle received port status message.
* @param portStatusMessage port status message
*/
void handlePortStatusMessage(PortStatusMessage portStatusMessage);
* 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.
MessageSpy getMessageSpy();
- <T extends OfHeader> MultiMsgCollector<T> getMultiMsgCollector(final RequestContext<List<T>> requestContext);
+ <T extends OfHeader> MultiMsgCollector<T> getMultiMsgCollector(RequestContext<List<T>> requestContext);
/**
* indicates that device context is fully published (e.g.: packetIn messages should be passed).
* Setter for sal role service.
* @param salRoleService Role Service
*/
- void setSalRoleService(@Nonnull final SalRoleService salRoleService);
+ void setSalRoleService(@Nonnull SalRoleService salRoleService);
/**
* Make device slave.
void setBarrierInterval(long barrierTimeoutLimit);
- CheckedFuture<Void, TransactionCommitFailedException> removeDeviceFromOperationalDS(DeviceInfo deviceInfo);
+ CheckedFuture<Void, TransactionCommitFailedException> removeDeviceFromOperationalDS(
+ DeviceInfo deviceInfo);
- CheckedFuture<Void, TransactionCommitFailedException> removeDeviceFromOperationalDS(final KeyedInstanceIdentifier<Node, NodeKey> ii);
+ CheckedFuture<Void, TransactionCommitFailedException> removeDeviceFromOperationalDS(
+ KeyedInstanceIdentifier<Node, NodeKey> 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);
}
/**
* Method creates put operation using provided data in underlying transaction chain.
*/
- <T extends DataObject> void writeToTransaction(final LogicalDatastoreType store,
- final InstanceIdentifier<T> path,
- final T data);
+ <T extends DataObject> void writeToTransaction(LogicalDatastoreType store, InstanceIdentifier<T> path, T data);
/**
* Method creates put operation using provided data in underlying transaction
* WARNING: This method is slow because of additional reading cost.
* Use it only if you really need to create parents.
*/
- <T extends DataObject> void writeToTransactionWithParentsSlow(final LogicalDatastoreType store,
- final InstanceIdentifier<T> path,
- final T data);
+ <T extends DataObject> void writeToTransactionWithParentsSlow(LogicalDatastoreType store,
+ InstanceIdentifier<T> path,
+ T data);
/**
* Method creates delete operation for provided path in underlying transaction chain.
*/
- <T extends DataObject> void addDeleteToTxChain(final LogicalDatastoreType store,
- final InstanceIdentifier<T> path);
+ <T extends DataObject> void addDeleteToTxChain(LogicalDatastoreType store, InstanceIdentifier<T> path);
/**
* Method submits Transaction to DataStore.
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();
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;
}
* 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;
}
* 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
/**
* Method is used to propagate information about device being removed from manager.
*/
- void onDeviceRemoved(final DeviceInfo deviceInfo);
+ void onDeviceRemoved(DeviceInfo deviceInfo);
}
* Add context to the chain, if reference already exist ignore it.
* @param context child of OFPContext
*/
- <T extends OFPContext> void addContext(final T context);
+ <T extends OFPContext> void addContext(T context);
- void addLifecycleService(final LifecycleService lifecycleService);
+ void addLifecycleService(LifecycleService lifecycleService);
/**
* Stop the working contexts, but not release them.
* 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.
* @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.
* @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);
}
MastershipChangeListener,
DeviceDisconnectedHandler,
EntityOwnershipListener,
- AutoCloseable{
+ AutoCloseable {
/**
* Managers need to be added before.
* @param manager a child class of {@link OFPManager}
* @param <T> {@link OFPManager}
*/
- <T extends OFPManager> void addManager(final T manager);
+ <T extends OFPManager> 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<Void> destroyContextChain(final DeviceInfo deviceInfo);
+ ListenableFuture<Void> 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;
-/*\r
- * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowplugin.api.openflow.lifecycle;\r
-\r
-public enum ContextChainMastershipState {\r
- /**\r
- * Device has role MASTER set.\r
- */\r
- MASTER_ON_DEVICE,\r
- /**\r
- * Initial statics gathering done ok.\r
- */\r
- INITIAL_GATHERING,\r
- /**\r
- * Initial submit ok.\r
- */\r
- INITIAL_SUBMIT,\r
- /**\r
- * Initial flow registry fill is done.\r
- */\r
- INITIAL_FLOW_REGISTRY_FILL,\r
- /**\r
- * Check mastership.\r
- */\r
- CHECK\r
-\r
-}\r
+/*
+ * 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
+
+}
-/*\r
- * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.openflowplugin.api.openflow.lifecycle;\r
-\r
-public enum ContextChainState {\r
- /**\r
- * Context chain is working as MASTER.\r
- */\r
- WORKING_MASTER,\r
- /**\r
- * Context chain is working as SLAVE, initial gathering already done.\r
- */\r
- WORKING_SLAVE,\r
- /**\r
- * Context chain is undefined.\r
- */\r
- UNDEFINED\r
-\r
-}\r
+/*
+ * 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
+
+}
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);
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;
/**
* @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();
* @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.
* @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);
}
* @param match Openflow match
* @return true if matched
*/
- boolean matchTypeCheck(final Match match);
+ boolean matchTypeCheck(Match match);
}
\ No newline at end of file
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
Registration registerLifeCycleSource(ItemLifeCycleSource lifeCycleSource);
/**
- * close all existing registrations
+ * close all existing registrations.
*/
void clear();
/**
+ * Registered sources.
* @return registered sources
*/
Iterable<ItemLifeCycleSource> getLifeCycleSources();
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;
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
public interface ItemLifeCycleSource {
/**
+ * lifecycle changes.
* @param itemLifecycleListener acts upon lifecycle changes
*/
void setItemLifecycleListener(@Nullable ItemLifecycleListener itemLifecycleListener);
* 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.
- * <p>
*/
public interface RpcContext extends RequestContextStack, OFPContext {
+
<S extends RpcService> void registerRpcServiceImplementation(Class<S> serviceClass, S serviceInstance);
<S extends RpcService> S lookupRpcService(Class<S> serviceClass);
+
<S extends RpcService> void unregisterRpcServiceImplementation(Class<S> serviceClass);
}
void setRpcRequestQuota(int rpcRequestQuota);
- RpcContext createContext(final @Nonnull DeviceInfo deviceInfo,
- final @Nonnull DeviceContext deviceContext);
+ RpcContext createContext(@Nonnull DeviceInfo deviceInfo, @Nonnull DeviceContext deviceContext);
}
public interface ItemLifecycleListener {
/**
- * react upon item added event
+ * react upon item added event.
*
* @param itemPath keyed path in DS
* @param itemBody item body
*/
- <I extends Identifiable<K> & DataObject, K extends Identifier<I>> void onAdded(KeyedInstanceIdentifier<I, K> itemPath, I itemBody);
+ <I extends Identifiable<K> & DataObject, K extends Identifier<I>> void onAdded(
+ KeyedInstanceIdentifier<I, K> itemPath, I itemBody);
/**
- * react upon item removed event
+ * react upon item removed event.
*
* @param itemPath keyed path in DS
*/
- <I extends Identifiable<K> & DataObject, K extends Identifier<I>> void onRemoved(KeyedInstanceIdentifier<I, K> itemPath);
+ <I extends Identifiable<K> & DataObject, K extends Identifier<I>> void onRemoved(
+ KeyedInstanceIdentifier<I, K> itemPath);
/**
- * react upon item updated event
+ * react upon item updated event.
*
* @param itemPath keyed path in DS
* @param itemBody item body
*/
- <I extends Identifiable<K> & DataObject, K extends Identifier<I>> void onUpdated(KeyedInstanceIdentifier<I, K> itemPath, I itemBody);
+ <I extends Identifiable<K> & DataObject, K extends Identifier<I>> void onUpdated(
+ KeyedInstanceIdentifier<I, K> itemPath, I itemBody);
}
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<String> dumpMessageCounts();
package org.opendaylight.openflowplugin.api.openflow.statistics;
-/**
- * @param <M> message type
- */
@Deprecated
public interface MessageObservatory<M> extends MessageSpy<M>, MessageCountDumper {
/**
- * ticket spy - aimed on collecting intel about tickets
+ * ticket spy - aimed on collecting intel about tickets.
* @param <M> type of watched message
*/
@Deprecated
public interface MessageSpy<M> 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);
+}
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<Boolean> gatherDynamicData();
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();
}
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);
}
/**
* Prescribes handling and transforming of backward compatible services in order to provide simple to use service
- * with notification support
+ * with notification support.
*
* @param <O> rpc input
* @param <I> rpc input
public interface BackwardCompatibleAtomicService<I, O> {
/**
- * 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
package org.opendaylight.openflowplugin.api.openflow.statistics.compatibility;
/**
- * Simple delegator pattern support
+ * Simple delegator pattern support.
*/
public interface Delegator<D> {
/**
+ * Setter.
* @param delegate backend task executor
*/
void setDelegate(D delegate);
import java.util.List;
-/**
- * Created by Martin Bobak <mbobak@cisco.com> on 20.4.2015.
- */
public interface MessageIntelligenceAgency extends MessageSpy {
List<String> provideIntelligence();
+
void resetStatistics();
}
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,
/**
*/
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
}
/**
+ *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);
}
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);
}
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;
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;
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
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
@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 {
@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;
Futures.addCallback(offerNotification, new FutureCallback<Object>() {
@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();
@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);
}
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;
}
}
@Override
- public CONTEXT_STATE getState() {
+ public ContextState getState() {
return this.state;
}
@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());
}
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;
// TODO: add private Sal salBroker
private final ConcurrentMap<Class<?>, RoutedRpcRegistration<?>> rpcRegistrations = new ConcurrentHashMap<>();
private final KeyedInstanceIdentifier<Node, NodeKey> 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;
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);
}
};
}
}
@Override
- public CONTEXT_STATE getState() {
+ public ContextState getState() {
return this.state;
}
@Override
public ListenableFuture<Void> stopClusterServices() {
- if (CONTEXT_STATE.TERMINATION.equals(this.state)) {
+ if (ContextState.TERMINATION.equals(this.state)) {
return Futures.immediateCancelledFuture();
}
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;
private final TxFacade txFacade;
private final MultipartWriterProvider statisticsWriterProvider;
private final DeviceRegistry deviceRegistry;
- private volatile CONTEXT_STATE gatheringState = CONTEXT_STATE.INITIALIZATION;
+ private volatile ContextState gatheringState = ContextState.INITIALIZATION;
private ConvertorExecutor convertorExecutor;
public AbstractMultipartRequestOnTheFlyCallback(final RequestContext<List<T>> context, Class<?> requestType,
if (Objects.isNull(result)) {
LOG.warn("Response received was null.");
- if (!CONTEXT_STATE.TERMINATION.equals(gatheringState)) {
+ if (!ContextState.TERMINATION.equals(gatheringState)) {
endCollecting(true);
}
return;
- } else if (CONTEXT_STATE.TERMINATION.equals(gatheringState)) {
+ } else if (ContextState.TERMINATION.equals(gatheringState)) {
LOG.warn("Unexpected response received: xid={}, {}", result.getXid(), result.getImplementedInterface());
return;
}
} else {
final T resultCast = (T) result;
- if (CONTEXT_STATE.INITIALIZATION.equals(gatheringState)) {
+ if (ContextState.INITIALIZATION.equals(gatheringState)) {
startCollecting();
}
*/
private synchronized void startCollecting() {
EventsTimeCounter.markStart(doneEventIdentifier);
- gatheringState = CONTEXT_STATE.WORKING;
+ gatheringState = ContextState.WORKING;
final InstanceIdentifier<FlowCapableNode> instanceIdentifier = deviceInfo
.getNodeInstanceIdentifier()
* @param setResult set empty success result
*/
private void endCollecting(final boolean setResult) {
- gatheringState = CONTEXT_STATE.TERMINATION;
+ gatheringState = ContextState.TERMINATION;
EventsTimeCounter.markEnd(doneEventIdentifier);
EventsTimeCounter.markEnd(getEventIdentifier());
- spyMessage(MessageSpy.STATISTIC_GROUP.FROM_SWITCH_TRANSLATE_OUT_SUCCESS);
+ spyMessage(MessageSpy.StatisticsGroup.FROM_SWITCH_TRANSLATE_OUT_SUCCESS);
if (setResult) {
setResult(RpcResultBuilder.success(Collections.<T>emptyList()).build());
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;
context.close();
}
- protected final void spyMessage(@Nonnull final STATISTIC_GROUP group) {
+ protected final void spyMessage(@Nonnull final StatisticsGroup group) {
spy.spyMessage(requestType, Preconditions.checkNotNull(group));
}
final String errorString = String.format("Device reported error type %s code %s", err.getTypeString(), err.getCodeString());
builder = RpcResultBuilder.<T>failed().withError(RpcError.ErrorType.APPLICATION, errorString, t);
- spyMessage(MessageSpy.STATISTIC_GROUP.TO_SWITCH_SUBMIT_FAILURE);
+ spyMessage(StatisticsGroup.TO_SWITCH_SUBMIT_FAILURE);
} else {
builder = RpcResultBuilder.<T>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());
? 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<O> 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
.<O>failed()
.withError(RpcError.ErrorType.APPLICATION, "", "Request quota exceeded")
}
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;
@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.<T>success().build());
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;
@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);
}
}
private final StatisticsManager myManager;
private volatile boolean schedulingEnabled;
- private volatile CONTEXT_STATE state;
+ private volatile ContextState state;
private ClusterInitializationPhaseHandler clusterInitializationPhaseHandler;
private ClusterInitializationPhaseHandler initialSubmitHandler;
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;
@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<RequestContext<?>> iterator = Iterators.consumingIterator(requestContexts.iterator());
}
@Override
- public CONTEXT_STATE getState() {
+ public ContextState getState() {
return this.state;
}
@Override
public ListenableFuture<Void> stopClusterServices() {
- if (CONTEXT_STATE.TERMINATION.equals(this.state)) {
+ if (ContextState.TERMINATION.equals(this.state)) {
return Futures.immediateCancelledFuture();
}
/**
* 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 {
}
}
- private ConcurrentMap<STATISTIC_GROUP, ConcurrentMap<Class<?>, MessageCounters>> inputStats = new ConcurrentHashMap<>();
+ private ConcurrentMap<StatisticsGroup, ConcurrentMap<Class<?>, 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();
}
* @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<Class<?>, MessageCounters> groupData = getOrCreateGroupData(statGroup);
MessageCounters counters = getOrCreateCountersPair(message, groupData);
return counters;
}
- private ConcurrentMap<Class<?>, MessageCounters> getOrCreateGroupData(final STATISTIC_GROUP statGroup) {
+ private ConcurrentMap<Class<?>, MessageCounters> getOrCreateGroupData(final StatisticsGroup statGroup) {
final ConcurrentMap<Class<?>, MessageCounters> lookup = inputStats.get(statGroup);
if (lookup != null) {
return lookup;
public List<String> provideIntelligence() {
List<String> dump = new ArrayList<>();
- for (STATISTIC_GROUP statGroup : STATISTIC_GROUP.values()) {
+ for (StatisticsGroup statGroup : StatisticsGroup.values()) {
Map<Class<?>, MessageCounters> groupData = inputStats.get(statGroup);
if (groupData != null) {
for (Entry<Class<?>, MessageCounters> statEntry : groupData.entrySet()) {
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
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
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
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
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);
}
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);
}
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);
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);
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);
}
}
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
@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<String> intelligence = messageIntelligenceAgency.provideIntelligence();
findExpectedStatistics(intelligence, "FROM_SWITCH: MSG[String] -> +1 | 1", "TO_SWITCH_ENTERED: MSG[Integer] -> +1 | 1");
}
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);
}
}
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;
} 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);
}
}
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);
}
}
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;
@Override
public void enqueueQueueItem(QueueItem<OfHeader> queueItem) {
- messageSpy.spyMessage(queueItem.getMessage(), STATISTIC_GROUP.FROM_SWITCH_ENQUEUED);
+ messageSpy.spyMessage(queueItem.getMessage(), StatisticsGroup.FROM_SWITCH_ENQUEUED);
TicketImpl<OfHeader, DataObject> ticket = new TicketImpl<>();
ticket.setConductor(queueItem.getConnectionConductor());
ticket.setMessage(queueItem.getMessage());
@Override
public void directProcessQueueItem(QueueItem<OfHeader> queueItem) {
- messageSpy.spyMessage(queueItem.getMessage(), STATISTIC_GROUP.FROM_SWITCH_ENQUEUED);
+ messageSpy.spyMessage(queueItem.getMessage(), StatisticsGroup.FROM_SWITCH_ENQUEUED);
TicketImpl<OfHeader, DataObject> ticket = new TicketImpl<>();
ticket.setConductor(queueItem.getConnectionConductor());
ticket.setMessage(queueItem.getMessage());
}
}
- private final ConcurrentMap<STATISTIC_GROUP, ConcurrentMap<Class<? extends DataContainer>, MessageCounters>> inputStats = new ConcurrentHashMap<>();
+ private final ConcurrentMap<StatisticsGroup, ConcurrentMap<Class<? extends DataContainer>, 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();
}
* @param statGroup TODO
* @return
*/
- private MessageCounters getCounters(final DataContainer message, final STATISTIC_GROUP statGroup) {
+ private MessageCounters getCounters(final DataContainer message, final StatisticsGroup statGroup) {
Class<? extends DataContainer> msgType = message.getImplementedInterface();
ConcurrentMap<Class<? extends DataContainer>, MessageCounters> groupData = getOrCreateGroupData(statGroup);
MessageCounters counters = getOrCreateCountersPair(msgType, groupData);
}
- private ConcurrentMap<Class<? extends DataContainer>, MessageCounters> getOrCreateGroupData(final STATISTIC_GROUP statGroup) {
+ private ConcurrentMap<Class<? extends DataContainer>, MessageCounters> getOrCreateGroupData(final StatisticsGroup statGroup) {
final ConcurrentMap<Class<? extends DataContainer>, MessageCounters> lookup = inputStats.get(statGroup);
if (lookup != null) {
return lookup;
public List<String> dumpMessageCounts() {
List<String> dump = new ArrayList<>();
- for (STATISTIC_GROUP statGroup : STATISTIC_GROUP.values()) {
+ for (StatisticsGroup statGroup : StatisticsGroup.values()) {
Map<Class<? extends DataContainer>, MessageCounters> groupData = inputStats.get(statGroup);
if (groupData != null) {
for (Entry<Class<? extends DataContainer>, MessageCounters> statEntry : groupData.entrySet()) {
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));