StatisticsGatheringUtils.markDeviceStateSnapshotStart(deviceContext);
lastDataGathering = collectingStatType.stream().reduce(
- lastDataGathering,
- this::statChainFuture,
- (a, b) -> Futures.transformAsync(a, (AsyncFunction<Boolean, Boolean>) result -> b));
+ lastDataGathering,
+ this::statChainFuture,
+ (input, function) -> Futures
+ .transformAsync(input, (AsyncFunction<Boolean, Boolean>) result -> function));
// write end timestamp to state snapshot container
Futures.addCallback(lastDataGathering, new FutureCallback<Boolean>() {
}
@Override
- public void onFailure(final Throwable t) {
- if (!(t instanceof TransactionChainClosedException)) {
+ public void onFailure(final Throwable throwable) {
+ if (!(throwable instanceof TransactionChainClosedException)) {
StatisticsGatheringUtils.markDeviceStateSnapshotEnd(deviceContext, false);
}
}
return lastDataGathering;
}
- private ListenableFuture<Boolean> chooseStat(final MultipartType multipartType){
+ private ListenableFuture<Boolean> chooseStat(final MultipartType multipartType) {
ListenableFuture<Boolean> result = Futures.immediateCheckedFuture(Boolean.TRUE);
switch (multipartType) {
this.pollTimeout = pollTimeout;
}
- private ListenableFuture<Boolean> statChainFuture(final ListenableFuture<Boolean> prevFuture, final MultipartType multipartType) {
- return Futures.transformAsync(deviceConnectionCheck(), (AsyncFunction<Boolean, Boolean>) connectionResult -> Futures
+ private ListenableFuture<Boolean> statChainFuture(final ListenableFuture<Boolean> prevFuture,
+ final MultipartType multipartType) {
+ return Futures
+ .transformAsync(deviceConnectionCheck(), (AsyncFunction<Boolean, Boolean>) connectionResult -> Futures
.transformAsync(prevFuture, (AsyncFunction<Boolean, Boolean>) result -> {
LOG.debug("Status of previous stat iteration for node {}: {}", deviceInfo.getLOGValue(), result);
LOG.debug("Stats iterating to next type for node {} of type {}",
@VisibleForTesting
ListenableFuture<Boolean> deviceConnectionCheck() {
- if (ConnectionContext.CONNECTION_STATE.RIP.equals(deviceContext.getPrimaryConnectionContext().getConnectionState())) {
+ if (ConnectionContext.CONNECTION_STATE.RIP
+ .equals(deviceContext.getPrimaryConnectionContext().getConnectionState())) {
final String errMsg = String
.format("Device connection for node %s doesn't exist anymore. Primary connection status : %s",
getDeviceInfo().getNodeId(),
}
@VisibleForTesting
- void setStatisticsGatheringOnTheFlyService(final StatisticsGatheringOnTheFlyService<T> statisticsGatheringOnTheFlyService) {
+ void setStatisticsGatheringOnTheFlyService(
+ final StatisticsGatheringOnTheFlyService<T> statisticsGatheringOnTheFlyService) {
this.statisticsGatheringOnTheFlyService = statisticsGatheringOnTheFlyService;
}
@Override
- public ItemLifecycleListener getItemLifeCycleListener () {
+ public ItemLifecycleListener getItemLifeCycleListener() {
return itemLifeCycleListener;
}
Futures.addCallback(this.gatherDynamicData(), new FutureCallback<Boolean>() {
@Override
- public void onSuccess(@Nullable Boolean aBoolean) {
+ public void onSuccess(@Nullable Boolean isSuccess) {
contextChainMastershipWatcher.onMasterRoleAcquired(
deviceInfo,
ContextChainMastershipState.INITIAL_GATHERING
import org.slf4j.LoggerFactory;
/**
- * Utils for gathering statistics
+ * Utils for gathering statistics.
*/
public final class StatisticsGatheringUtils {
throw new IllegalStateException("This class should not be instantiated.");
}
- static <T extends OfHeader>ListenableFuture<Boolean> gatherStatistics(final StatisticsGatherer<T> statisticsGatheringService,
- final DeviceInfo deviceInfo,
- final MultipartType type,
- final TxFacade txFacade,
- final DeviceRegistry registry,
- final ConvertorExecutor convertorExecutor,
- final MultipartWriterProvider statisticsWriterProvider) {
+ static <T extends OfHeader> ListenableFuture<Boolean> gatherStatistics(
+ final StatisticsGatherer<T> statisticsGatheringService,
+ final DeviceInfo deviceInfo,
+ final MultipartType type,
+ final TxFacade txFacade,
+ final DeviceRegistry registry,
+ final ConvertorExecutor convertorExecutor,
+ final MultipartWriterProvider statisticsWriterProvider) {
return Futures.transformAsync(
statisticsGatheringService.getStatisticsOfType(
new EventIdentifier(QUEUE2_REQCTX + type.toString(), deviceInfo.getNodeId().toString()),
new AsyncFunction<RpcResult<List<T>>, Boolean>() {
@Nullable
@Override
+ @SuppressWarnings("checkstyle:IllegalCatch")
public ListenableFuture<Boolean> apply(@Nonnull final RpcResult<List<T>> rpcResult) {
boolean isMultipartProcessed = Boolean.TRUE;
if (rpcResult.isSuccessful()) {
- LOG.debug("Stats reply successfully received for node {} of type {}", deviceInfo.getNodeId(), type);
+ LOG.debug("Stats reply successfully received for node {} of type {}",
+ deviceInfo.getNodeId(), type);
- // TODO: in case the result value is null then multipart data probably got processed on the fly -
- // TODO: this contract should by clearly stated and enforced - now simple true value is returned
+ // TODO: in case the result value is null then multipart data probably got processed
+ // TODO: on the fly. This contract should by clearly stated and enforced.
+ // TODO: Now simple true value is returned
if (Objects.nonNull(rpcResult.getResult()) && !rpcResult.getResult().isEmpty()) {
final List<DataContainer> allMultipartData;
.map(java.util.Optional::get)
.collect(Collectors.toList());
} catch (final Exception e) {
- LOG.warn("Stats processing of type {} for node {} failed during transformation step",
+ LOG.warn("Stats processing of type {} for node {} "
+ + "failed during transformation step",
type, deviceInfo.getLOGValue(), e);
return Futures.immediateFailedFuture(e);
}
case OFPMPGROUPDESC:
deleteAllKnownGroups(txFacade, instanceIdentifier, deviceRegistry.getDeviceGroupRegistry());
break;
+ default:
+ LOG.warn("Unsupported statistics type {}", type);
}
if (writeStatistics(type, statistics, deviceInfo, statisticsWriterProvider)) {
case OFPMPGROUPDESC:
deviceRegistry.getDeviceGroupRegistry().processMarks();
break;
+ default:
+ LOG.warn("Unsupported statistics type {}", type);
}
LOG.debug("Stats reply added to transaction for node {} of type {}", deviceInfo.getNodeId(), type);
return true;
}
- LOG.warn("Stats processing of type {} for node {} failed during write-to-tx step", type, deviceInfo.getLOGValue());
+ LOG.warn("Stats processing of type {} for node {} "
+ + "failed during write-to-tx step", type, deviceInfo.getLOGValue());
return false;
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
private static boolean writeStatistics(final MultipartType type,
final List<? extends DataContainer> statistics,
final DeviceInfo deviceInfo,
}
}));
} catch (final Exception ex) {
- LOG.warn("Stats processing of type {} for node {} failed during write-to-tx step", type, deviceInfo.getLOGValue(), ex);
+ LOG.warn("Stats processing of type {} for node {} "
+ + "failed during write-to-tx step", type, deviceInfo.getLOGValue(), ex);
}
return result.get();
try {
Futures.transform(Futures
- .catchingAsync(readTx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier),
- Throwable.class,
- t -> {
+ .catchingAsync(readTx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier), Throwable.class,
+ t -> {
// we wish to close readTx for fallBack
readTx.close();
return Futures.immediateFailedFuture(t);
}), (Function<Optional<FlowCapableNode>, Void>)
- flowCapNodeOpt -> {
- // we have to read actual tables with all information before we set empty Flow list, merge is expensive and
- // not applicable for lists
- if (flowCapNodeOpt != null && flowCapNodeOpt.isPresent()) {
- for (final Table tableData : flowCapNodeOpt.get().getTable()) {
- final Table table = new TableBuilder(tableData).setFlow(Collections.emptyList()).build();
- final InstanceIdentifier<Table> iiToTable = instanceIdentifier.child(Table.class, tableData.getKey());
- txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, iiToTable, table);
- }
+ flowCapNodeOpt -> {
+ // we have to read actual tables with all information before we set empty Flow list,
+ // merge is expensive and not applicable for lists
+ if (flowCapNodeOpt != null && flowCapNodeOpt.isPresent()) {
+ for (final Table tableData : flowCapNodeOpt.get().getTable()) {
+ final Table table =
+ new TableBuilder(tableData).setFlow(Collections.emptyList()).build();
+ final InstanceIdentifier<Table> iiToTable =
+ instanceIdentifier.child(Table.class, tableData.getKey());
+ txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, iiToTable, table);
}
+ }
- readTx.close();
- return null;
- }).get();
+ readTx.close();
+ return null;
+ }).get();
} catch (InterruptedException | ExecutionException ex) {
LOG.debug("Failed to delete {} flows, exception: {}", deviceFlowRegistry.size(), ex);
}
}
/**
- * Writes snapshot gathering start timestamp + cleans end mark
+ * Writes snapshot gathering start timestamp + cleans end mark.
*
* @param deviceContext txManager + node path keeper
*/
}
/**
- * Writes snapshot gathering end timestamp + outcome
+ * Writes snapshot gathering end timestamp + outcome.
*
* @param deviceContext txManager + node path keeper
* @param succeeded outcome of currently finished gathering
final ListenableFuture<Boolean> deviceStatisticsCollectionFuture = statisticsContext.gatherDynamicData();
Futures.addCallback(deviceStatisticsCollectionFuture, new FutureCallback<Boolean>() {
@Override
- public void onSuccess(final Boolean o) {
+ public void onSuccess(final Boolean isSuccess) {
timeCounter.addTimeMark();
calculateTimerDelay(timeCounter);
scheduleNextPolling(deviceState, deviceInfo, statisticsContext, timeCounter);
} else if (throwable instanceof CancellationException) {
LOG.info("Statistics gathering for device {} was cancelled.", deviceInfo);
} else {
- LOG.warn("Unexpected error occurred during statistics collection for device {}, rescheduling " +
- "statistics collections", deviceInfo, throwable);
+ LOG.warn("Unexpected error occurred during statistics collection for device {}, rescheduling "
+ + "statistics collections", deviceInfo, throwable);
scheduleNextPolling(deviceState, deviceInfo, statisticsContext, timeCounter);
}
final long statsTimeoutSec = averageTime > 0 ? 3 * averageTime : DEFAULT_STATS_TIMEOUT_SEC;
final TimerTask timerTask = timeout -> {
if (!deviceStatisticsCollectionFuture.isDone()) {
- LOG.info("Statistics collection for node {} still in progress even after {} secs", deviceInfo, statsTimeoutSec);
+ LOG.info("Statistics collection for node {} still in progress even after {} secs",
+ deviceInfo, statsTimeoutSec);
deviceStatisticsCollectionFuture.cancel(true);
}
};
if (isStatisticsEnabled()) {
final Timeout pollTimeout = hashedWheelTimer.newTimeout(
- timeout -> pollStatistics(
- deviceState,
- statisticsContext,
- timeCounter,
- deviceInfo),
- currentTimerDelay,
- TimeUnit.MILLISECONDS);
+ timeout -> pollStatistics(
+ deviceState,
+ statisticsContext,
+ timeCounter,
+ deviceInfo),
+ currentTimerDelay,
+ TimeUnit.MILLISECONDS);
statisticsContext.setPollTimeout(pollTimeout);
}
final DeviceContext deviceContext = statisticsContext.gainDeviceContext();
switch (targetWorkMode) {
case COLLECTALL:
- scheduleNextPolling(statisticsContext.gainDeviceState(), deviceInfo, statisticsContext, new TimeCounter());
- for (final ItemLifeCycleSource lifeCycleSource : deviceContext.getItemLifeCycleSourceRegistry().getLifeCycleSources()) {
+ scheduleNextPolling(statisticsContext.gainDeviceState(),
+ deviceInfo,
+ statisticsContext,
+ new TimeCounter());
+ for (final ItemLifeCycleSource lifeCycleSource :
+ deviceContext.getItemLifeCycleSourceRegistry().getLifeCycleSources()) {
lifeCycleSource.setItemLifecycleListener(null);
}
break;
case FULLYDISABLED:
statisticsContext.stopGatheringData();
- for (final ItemLifeCycleSource lifeCycleSource : deviceContext.getItemLifeCycleSourceRegistry().getLifeCycleSources()) {
+ for (final ItemLifeCycleSource lifeCycleSource :
+ deviceContext.getItemLifeCycleSourceRegistry().getLifeCycleSources()) {
lifeCycleSource.setItemLifecycleListener(statisticsContext.getItemLifeCycleListener());
}
break;
.createDefaultProvider(deviceContext);
final StatisticsContext statisticsContext =
- deviceContext.canUseSingleLayerSerialization() ?
- new StatisticsContextImpl<MultipartReply>(
+ deviceContext.canUseSingleLayerSerialization()
+ ? new StatisticsContextImpl<MultipartReply>(
isStatisticsEnabled(),
deviceContext,
converterExecutor,
this,
statisticsWriterProvider,
- reconciliationFrameworkRegistrar.isReconciliationFrameworkRegistered()) :
- new StatisticsContextImpl<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
- .MultipartReply>(
+ reconciliationFrameworkRegistrar.isReconciliationFrameworkRegistered())
+ : new StatisticsContextImpl<org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.protocol.rev130731.MultipartReply>(
isStatisticsEnabled(),
deviceContext,
converterExecutor,
import java.util.concurrent.TimeUnit;
/**
- * Moving average - measure and compute
+ * Moving average - measure and compute.
*/
public class TimeCounter {
private long beginningOfLap;
import java.util.concurrent.TimeUnit;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
-/**
- * Created by Martin Bobak <mbobak@cisco.com> on 28.5.2015.
- */
public final class EventsTimeCounter {
private static final Map<String, Map<String, EventTimeCounter>> DEVICES_EVENTS = new HashMap<>();
eventTimeCounter.markEnd();
}
- private static EventTimeCounter getOrCreateEventOfType(final String event, final Map<String, EventTimeCounter> deviceEvents) {
+ private static EventTimeCounter getOrCreateEventOfType(final String event,
+ final Map<String, EventTimeCounter> deviceEvents) {
EventTimeCounter lookup = deviceEvents.get(event);
if (null == lookup) {
lookup = new EventTimeCounter();
}
}
-
-
}
import org.slf4j.LoggerFactory;
/**
- * Implementation of {@link org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency}.
- * Class counts message of {@link StatisticsGroup} type
- * and provides info as debug log.
+ * Implementation of
+ * {@link org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.MessageIntelligenceAgency}.
+ * Class counts message of {@link StatisticsGroup} type and provides info as debug log.
*/
public class MessageIntelligenceAgencyImpl implements MessageIntelligenceAgency, MessageIntelligenceAgencyMXBean {
private static final Logger LOG = LoggerFactory.getLogger(MessageIntelligenceAgencyImpl.class);
private static final class MessageCounters {
- private static final AtomicLongFieldUpdater<MessageCounters> UPDATER = AtomicLongFieldUpdater.newUpdater(MessageCounters.class, "current");
+ private static final AtomicLongFieldUpdater<MessageCounters> UPDATER =
+ AtomicLongFieldUpdater.newUpdater(MessageCounters.class, "current");
@SuppressWarnings("unused")
private volatile long current;
private long cumulative;
}
}
- private ConcurrentMap<StatisticsGroup, ConcurrentMap<Class<?>, MessageCounters>> inputStats = new ConcurrentHashMap<>();
+ private ConcurrentMap<StatisticsGroup, ConcurrentMap<Class<?>, MessageCounters>> inputStats =
+ new ConcurrentHashMap<>();
@Override
public void spyMessage(@Nonnull final Class<?> message, final StatisticsGroup statGroup) {
}
/**
+ * Get counters.
* @param message counted element
* @param statGroup statistic counter group
* @return corresponding counter
return counters;
}
- private static MessageCounters getOrCreateCountersPair(final Class<?> msgType, final ConcurrentMap<Class<?>, MessageCounters> groupData) {
+ private static MessageCounters getOrCreateCountersPair(final Class<?> msgType,
+ final ConcurrentMap<Class<?>, MessageCounters> groupData) {
final MessageCounters lookup = groupData.get(msgType);
if (lookup != null) {
return lookup;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLongFieldUpdater;
-/**
- * Created by Martin Bobak <mbobak@cisco.com> on 5.6.2015.
- */
public class SessionStatistics {
private static final Map<String, Map<ConnectionStatus, EventCounter>> SESSION_EVENTS = new HashMap<>();
Map<ConnectionStatus, EventCounter> sessionEvents = sessionEntries.getValue();
dump.add(String.format("SESSION : %s", sessionEntries.getKey()));
for (Map.Entry<ConnectionStatus, EventCounter> sessionEvent : sessionEvents.entrySet()) {
- dump.add(String.format(" %s : %d", sessionEvent.getKey().toString(), sessionEvent.getValue().getCount()));
+ dump.add(String.format(" %s : %d", sessionEvent.getKey().toString(),
+ sessionEvent.getValue().getCount()));
}
}
return dump;
}
private static final class EventCounter {
- private final AtomicLongFieldUpdater<EventCounter> updater = AtomicLongFieldUpdater.newUpdater(EventCounter.class, "count");
+ private final AtomicLongFieldUpdater<EventCounter> updater =
+ AtomicLongFieldUpdater.newUpdater(EventCounter.class, "count");
private volatile long count;
public long getCount() {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder;
-public final class AggregateFlowsInTableService extends AbstractCompatibleStatService<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput,
- GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput, AggregateFlowStatisticsUpdate> {
+public final class AggregateFlowsInTableService extends
+ AbstractCompatibleStatService<GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput,
+ GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput,
+ AggregateFlowStatisticsUpdate> {
final TranslatorLibrary translatorLibrary;
public static AggregateFlowsInTableService createWithOook(final RequestContextStack requestContextStack,
final DeviceContext deviceContext,
AtomicLong compatibilityXidSeed) {
- return new AggregateFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, deviceContext.oook());
+ return new AggregateFlowsInTableService(requestContextStack,
+ deviceContext,
+ compatibilityXidSeed,
+ deviceContext.oook());
}
- public AggregateFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
- AtomicLong compatibilityXidSeed, TranslatorLibrary translatorLibrary) {
+ public AggregateFlowsInTableService(final RequestContextStack requestContextStack,
+ final DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ TranslatorLibrary translatorLibrary) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.translatorLibrary = translatorLibrary;
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid, final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input)
+ throws ServiceException {
// Create multipart request body for fetch all the group stats
- final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
+ final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder =
+ new MultipartRequestAggregateCaseBuilder();
final MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
mprAggregateRequestBuilder.setTableId(input.getTableId().getValue());
mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
@Override
public GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput buildTxCapableResult(TransactionId emulatedTxId) {
- return new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder().setTransactionId(emulatedTxId).build();
+ return new GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutputBuilder().setTransactionId(emulatedTxId)
+ .build();
}
@Override
- public AggregateFlowStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
+ public AggregateFlowStatisticsUpdate transformToNotification(List<MultipartReply> result,
+ TransactionId emulatedTxId) {
final int mpSize = result.size();
Preconditions.checkArgument(mpSize == 1, "unexpected (!=1) mp-reply size received: {}", mpSize);
MultipartReply mpReply = result.get(0);
- final TranslatorKey translatorKey = new TranslatorKey(mpReply.getVersion(), MultipartReplyAggregateCase.class.getName());
- final MessageTranslator<MultipartReply, AggregatedFlowStatistics> messageTranslator = translatorLibrary.lookupTranslator(translatorKey);
+ final TranslatorKey translatorKey =
+ new TranslatorKey(mpReply.getVersion(), MultipartReplyAggregateCase.class.getName());
+ final MessageTranslator<MultipartReply, AggregatedFlowStatistics> messageTranslator =
+ translatorLibrary.lookupTranslator(translatorKey);
final AggregatedFlowStatistics flowStatistics = messageTranslator.translate(mpReply, getDeviceInfo(), null);
- final AggregateFlowStatisticsUpdateBuilder notification = new AggregateFlowStatisticsUpdateBuilder(flowStatistics)
+ final AggregateFlowStatisticsUpdateBuilder notification =
+ new AggregateFlowStatisticsUpdateBuilder(flowStatistics)
.setId(getDeviceInfo().getNodeId())
.setMoreReplies(Boolean.FALSE)
.setTransactionId(emulatedTxId);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
-public final class AllFlowsInAllTablesService extends AbstractCompatibleStatService<GetAllFlowsStatisticsFromAllFlowTablesInput,
- GetAllFlowsStatisticsFromAllFlowTablesOutput, FlowsStatisticsUpdate> {
+public final class AllFlowsInAllTablesService extends
+ AbstractCompatibleStatService<GetAllFlowsStatisticsFromAllFlowTablesInput,
+ GetAllFlowsStatisticsFromAllFlowTablesOutput,
+ FlowsStatisticsUpdate> {
private final MultipartRequestFlowCase flowCase;
private final ConvertorExecutor convertorExecutor;
- public AllFlowsInAllTablesService(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
- final AtomicLong compatibilityXidSeed, final ConvertorExecutor convertorExecutor) {
+ public AllFlowsInAllTablesService(final RequestContextStack requestContextStack,
+ final DeviceContext deviceContext,
+ final AtomicLong compatibilityXidSeed,
+ final ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetAllFlowsStatisticsFromAllFlowTablesInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetAllFlowsStatisticsFromAllFlowTablesInput input) throws ServiceException {
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPFLOW, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(flowCase);
@Override
public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
+ return FlowStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId,
+ convertorExecutor);
}
}
private final ConvertorExecutor convertorExecutor;
- public AllFlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ public AllFlowsInTableService(final RequestContextStack requestContextStack,
+ final DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetAllFlowStatisticsFromFlowTableInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetAllFlowStatisticsFromFlowTableInput input) throws ServiceException {
final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
mprFlowRequestBuilder.setTableId(input.getTableId().getValue());
mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
@Override
public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> mpResult, TransactionId emulatedTxId) {
- return FlowStatisticsToNotificationTransformer.transformToNotification(mpResult, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
+ return FlowStatisticsToNotificationTransformer.transformToNotification(mpResult,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId,
+ convertorExecutor);
}
}
private final ConvertorExecutor convertorExecutor;
- public AllGroupsStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ AllGroupsStatsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
-
@Override
protected OfHeader buildRequest(final Xid xid, final GetAllGroupStatisticsInput input) throws ServiceException {
// Create multipart request header
@Override
public GroupStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId, convertorExecutor);
+ return GroupStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ emulatedTxId,
+ convertorExecutor);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter.config._case.MultipartRequestMeterConfigBuilder;
final class AllMeterConfigStatsService
- extends AbstractCompatibleStatService<GetAllMeterConfigStatisticsInput, GetAllMeterConfigStatisticsOutput, MeterConfigStatsUpdated> {
+ extends AbstractCompatibleStatService<GetAllMeterConfigStatisticsInput,
+ GetAllMeterConfigStatisticsOutput,
+ MeterConfigStatsUpdated> {
private static final MultipartRequestMeterConfigCase METER_CONFIG_CASE;
private final ConvertorExecutor convertorExecutor;
private final VersionConvertorData data;
- public AllMeterConfigStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ AllMeterConfigStatsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
data = new VersionConvertorData(getVersion());
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetAllMeterConfigStatisticsInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetAllMeterConfigStatisticsInput input) throws ServiceException {
MultipartRequestInputBuilder mprInput = RequestInputUtils
.createMultipartHeader(MultipartType.OFPMPMETERCONFIG, xid.getValue(), getVersion());
return mprInput.setMultipartRequestBody(METER_CONFIG_CASE).build();
MultipartReplyMeterConfigCase caseBody = (MultipartReplyMeterConfigCase) mpReply.getMultipartReplyBody();
MultipartReplyMeterConfig replyBody = caseBody.getMultipartReplyMeterConfig();
- final Optional<List<MeterConfigStats>> meterConfigStatsList = convertorExecutor.convert(replyBody.getMeterConfig(), data);
+ final Optional<List<MeterConfigStats>> meterConfigStatsList =
+ convertorExecutor.convert(replyBody.getMeterConfig(), data);
if (meterConfigStatsList.isPresent()) {
message.getMeterConfigStats().addAll(meterConfigStatsList.get());
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
-final class AllMeterStatsService
- extends AbstractCompatibleStatService<GetAllMeterStatisticsInput, GetAllMeterStatisticsOutput, MeterStatisticsUpdated> {
+final class AllMeterStatsService extends AbstractCompatibleStatService<GetAllMeterStatisticsInput,
+ GetAllMeterStatisticsOutput,
+ MeterStatisticsUpdated> {
private static final MultipartRequestMeterCase METER_CASE;
static {
private final ConvertorExecutor convertorExecutor;
- public AllMeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ AllMeterStatsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
@Override
public MeterStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
+ return MeterStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId,
+ convertorExecutor);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
final class AllPortStatsService
- extends AbstractCompatibleStatService<GetAllNodeConnectorsStatisticsInput, GetAllNodeConnectorsStatisticsOutput, NodeConnectorStatisticsUpdate> {
+ extends AbstractCompatibleStatService<GetAllNodeConnectorsStatisticsInput,
+ GetAllNodeConnectorsStatisticsOutput,
+ NodeConnectorStatisticsUpdate> {
private static final MultipartRequestPortStatsCase PORT_STATS_CASE;
PORT_STATS_CASE = caseBuilder.build();
}
- public AllPortStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ AllPortStatsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetAllNodeConnectorsStatisticsInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetAllNodeConnectorsStatisticsInput input) throws ServiceException {
MultipartRequestInputBuilder mprInput = RequestInputUtils
.createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(PORT_STATS_CASE);
}
@Override
- public NodeConnectorStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return NodeConnectorStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ public NodeConnectorStatisticsUpdate transformToNotification(List<MultipartReply> result,
+ TransactionId emulatedTxId) {
+ return NodeConnectorStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
-final class AllQueuesAllPortsService
- extends AbstractCompatibleStatService<GetAllQueuesStatisticsFromAllPortsInput, GetAllQueuesStatisticsFromAllPortsOutput, QueueStatisticsUpdate> {
+final class AllQueuesAllPortsService extends AbstractCompatibleStatService<GetAllQueuesStatisticsFromAllPortsInput,
+ GetAllQueuesStatisticsFromAllPortsOutput,
+ QueueStatisticsUpdate> {
private static final MultipartRequestQueueCase QUEUE_CASE;
QUEUE_CASE = caseBuilder.build();
}
- public AllQueuesAllPortsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ AllQueuesAllPortsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetAllQueuesStatisticsFromAllPortsInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetAllQueuesStatisticsFromAllPortsInput input) throws ServiceException {
// Set request body to main multipart request
MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPQUEUE, xid.getValue(), getVersion());
@Override
public QueueStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return QueueStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return QueueStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
-final class AllQueuesOnePortService
- extends AbstractCompatibleStatService<GetAllQueuesStatisticsFromGivenPortInput, GetAllQueuesStatisticsFromGivenPortOutput, QueueStatisticsUpdate> {
+final class AllQueuesOnePortService extends AbstractCompatibleStatService<GetAllQueuesStatisticsFromGivenPortInput,
+ GetAllQueuesStatisticsFromGivenPortOutput,
+ QueueStatisticsUpdate> {
- public AllQueuesOnePortService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ AllQueuesOnePortService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetAllQueuesStatisticsFromGivenPortInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetAllQueuesStatisticsFromGivenPortInput input) throws ServiceException {
MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
// Select all queues
@Override
public QueueStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return QueueStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return QueueStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId);
}
}
private final ConvertorExecutor convertorExecutor;
- public FlowsInTableService(final RequestContextStack requestContextStack, final DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ public FlowsInTableService(final RequestContextStack requestContextStack,
+ final DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetFlowStatisticsFromFlowTableInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetFlowStatisticsFromFlowTableInput input) throws ServiceException {
final MultipartRequestFlowCaseBuilder multipartRequestFlowCaseBuilder = new MultipartRequestFlowCaseBuilder();
final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
@Override
public FlowsStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return FlowStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
+ return FlowStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId,
+ convertorExecutor);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
final class GroupDescriptionService
- extends AbstractCompatibleStatService<GetGroupDescriptionInput, GetGroupDescriptionOutput, GroupDescStatsUpdated> {
- private static final MultipartRequestGroupDescCase GROUP_DESC_CASE = new MultipartRequestGroupDescCaseBuilder().build();
+ extends AbstractCompatibleStatService<GetGroupDescriptionInput,
+ GetGroupDescriptionOutput,
+ GroupDescStatsUpdated> {
+ private static final MultipartRequestGroupDescCase GROUP_DESC_CASE =
+ new MultipartRequestGroupDescCaseBuilder().build();
private final ConvertorExecutor convertorExecutor;
- public GroupDescriptionService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ GroupDescriptionService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
private static final MultipartRequestGroupFeaturesCase GROUP_FEAT_CASE =
new MultipartRequestGroupFeaturesCaseBuilder().build();
- public GroupFeaturesService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ GroupFeaturesService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
}
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
- MultipartReplyGroupFeaturesCase caseBody = (MultipartReplyGroupFeaturesCase) result.get(0).getMultipartReplyBody();
+ MultipartReplyGroupFeaturesCase caseBody =
+ (MultipartReplyGroupFeaturesCase) result.get(0).getMultipartReplyBody();
MultipartReplyGroupFeatures replyBody = caseBody.getMultipartReplyGroupFeatures();
notification.setGroupTypesSupported(extractSupportedGroupTypes(replyBody.getTypes()));
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
-final class GroupStatsService
- extends AbstractCompatibleStatService<GetGroupStatisticsInput, GetGroupStatisticsOutput, GroupStatisticsUpdated> {
+final class GroupStatsService extends AbstractCompatibleStatService<GetGroupStatisticsInput,
+ GetGroupStatisticsOutput,
+ GroupStatisticsUpdated> {
private final ConvertorExecutor convertorExecutor;
- public GroupStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ GroupStatsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
@Override
public GroupStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return GroupStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), emulatedTxId, convertorExecutor);
+ return GroupStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ emulatedTxId,
+ convertorExecutor);
}
}
final class MeterFeaturesService
extends AbstractCompatibleStatService<GetMeterFeaturesInput, GetMeterFeaturesOutput, MeterFeaturesUpdated> {
- private static final MultipartRequestMeterFeaturesCase METER_FEATURES_CASE = new MultipartRequestMeterFeaturesCaseBuilder().build();
+ private static final MultipartRequestMeterFeaturesCase METER_FEATURES_CASE =
+ new MultipartRequestMeterFeaturesCaseBuilder().build();
- public MeterFeaturesService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ MeterFeaturesService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
}
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
- MultipartReplyMeterFeaturesCase caseBody = (MultipartReplyMeterFeaturesCase) result.get(0).getMultipartReplyBody();
+ MultipartReplyMeterFeaturesCase caseBody =
+ (MultipartReplyMeterFeaturesCase) result.get(0).getMultipartReplyBody();
MultipartReplyMeterFeatures replyBody = caseBody.getMultipartReplyMeterFeatures();
notification.setMaxBands(replyBody.getMaxBands());
notification.setMaxColor(replyBody.getMaxColor());
}
@VisibleForTesting
- protected List<Class<? extends MeterBand>> extractSupportedMeterBand(MultipartReplyMeterFeatures replyBody, MeterBandTypeBitmap bandTypes) {
+ protected List<Class<? extends MeterBand>> extractSupportedMeterBand(MultipartReplyMeterFeatures replyBody,
+ MeterBandTypeBitmap bandTypes) {
List<Class<? extends MeterBand>> supportedMeterBand = new ArrayList<>();
if (bandTypes.isOFPMBTDROP()) {
supportedMeterBand.add(MeterBandDrop.class);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder;
-final class MeterStatsService
- extends AbstractCompatibleStatService<GetMeterStatisticsInput, GetMeterStatisticsOutput, MeterStatisticsUpdated> {
+final class MeterStatsService extends AbstractCompatibleStatService<GetMeterStatisticsInput,
+ GetMeterStatisticsOutput,
+ MeterStatisticsUpdated> {
private final ConvertorExecutor convertorExecutor;
- public MeterStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ MeterStatsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
@Override
public MeterStatisticsUpdated transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return MeterStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId, convertorExecutor);
+ return MeterStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId,
+ convertorExecutor);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
final class OneQueueOnePortService
- extends AbstractCompatibleStatService<GetQueueStatisticsFromGivenPortInput, GetQueueStatisticsFromGivenPortOutput, QueueStatisticsUpdate> {
+ extends AbstractCompatibleStatService<GetQueueStatisticsFromGivenPortInput,
+ GetQueueStatisticsFromGivenPortOutput,
+ QueueStatisticsUpdate> {
- public OneQueueOnePortService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ OneQueueOnePortService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetQueueStatisticsFromGivenPortInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetQueueStatisticsFromGivenPortInput input) throws ServiceException {
MultipartRequestQueueCaseBuilder caseBuilder = new MultipartRequestQueueCaseBuilder();
MultipartRequestQueueBuilder mprQueueBuilder = new MultipartRequestQueueBuilder();
// Select specific queue
@Override
public QueueStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return QueueStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ return QueueStatisticsToNotificationTransformer
+ .transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
import org.opendaylight.yangtools.yang.common.RpcResult;
-/**
- * @author joe
- */
-public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowStatisticsService, Delegator<OpendaylightFlowStatisticsService> {
+public class OpendaylightFlowStatisticsServiceImpl implements OpendaylightFlowStatisticsService,
+ Delegator<OpendaylightFlowStatisticsService> {
private final SingleLayerAggregateFlowMultipartService singleLayerService;
private final MultiLayerAggregateFlowMultipartService multiLayerService;
private OpendaylightFlowStatisticsService delegate;
public static OpendaylightFlowStatisticsServiceImpl createWithOook(final RequestContextStack requestContextStack,
- final DeviceContext deviceContext, final ConvertorExecutor convertorExecutor) {
- return new OpendaylightFlowStatisticsServiceImpl(requestContextStack, deviceContext, deviceContext.oook(), convertorExecutor);
+ final DeviceContext deviceContext,
+ final ConvertorExecutor convertorExecutor) {
+ return new OpendaylightFlowStatisticsServiceImpl(requestContextStack,
+ deviceContext,
+ deviceContext.oook(),
+ convertorExecutor);
}
public OpendaylightFlowStatisticsServiceImpl(final RequestContextStack requestContextStack,
}
/**
- * @deprecated provided for Be-release as backward compatibility relic
+ * Get aggregate statistics.
+ *
+ * @deprecated provided for Be-release as backward compatibility relic.
*/
@Override
@Deprecated
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
- final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
+ public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
+ getAggregateFlowStatisticsFromFlowTableForAllFlows(
+ final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
if (delegate != null) {
return delegate.getAggregateFlowStatisticsFromFlowTableForAllFlows(input);
} else {
}
@Override
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
- final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
+ public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
+ getAggregateFlowStatisticsFromFlowTableForGivenMatch(
+ final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
return singleLayerService.canUseSingleLayerSerialization()
? singleLayerService.handleAndReply(input)
: multiLayerService.handleAndReply(input);
}
/**
- * @deprecated provided for Be-release as backward compatibility relic
+ * Get flow statistics.
+ *
+ * @deprecated provided for Be-release as backward compatibility relic.
*/
@Override
@Deprecated
}
/**
- * @deprecated provided for Be-release as backward compatibility relic
+ * Get flow statistics.
+ *
+ * @deprecated provided for Be-release as backward compatibility relic.
*/
@Override
@Deprecated
}
/**
- * @deprecated provided for Be-release as backward compatibility relic
+ * Get flow statistics.
+ *
+ * @deprecated provided for Be-release as backward compatibility relic.
*/
@Override
@Deprecated
import org.opendaylight.yangtools.yang.common.RpcResult;
public final class OpendaylightFlowTableStatisticsServiceImpl extends
- AbstractCompatibleStatService<GetFlowTablesStatisticsInput, GetFlowTablesStatisticsOutput, FlowTableStatisticsUpdate> implements
+ AbstractCompatibleStatService<GetFlowTablesStatisticsInput,
+ GetFlowTablesStatisticsOutput,
+ FlowTableStatisticsUpdate> implements
OpendaylightFlowTableStatisticsService {
private final NotificationPublishService notificationPublishService;
@Override
protected OfHeader buildRequest(final Xid xid, final GetFlowTablesStatisticsInput input) throws ServiceException {
// Create multipart request body for fetch all the group stats
- final MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder = new MultipartRequestTableCaseBuilder();
+ final MultipartRequestTableCaseBuilder multipartRequestTableCaseBuilder =
+ new MultipartRequestTableCaseBuilder();
final MultipartRequestTableBuilder multipartRequestTableBuilder = new MultipartRequestTableBuilder();
multipartRequestTableBuilder.setEmpty(true);
multipartRequestTableCaseBuilder.setMultipartRequestTable(multipartRequestTableBuilder.build());
}
@Override
- public FlowTableStatisticsUpdate transformToNotification(List<MultipartReply> mpReplyList, TransactionId emulatedTxId) {
+ public FlowTableStatisticsUpdate transformToNotification(List<MultipartReply> mpReplyList,
+ TransactionId emulatedTxId) {
FlowTableStatisticsUpdateBuilder notification = new FlowTableStatisticsUpdateBuilder();
notification.setId(getDeviceInfo().getNodeId());
notification.setMoreReplies(Boolean.FALSE);
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsService;
import org.opendaylight.yangtools.yang.common.RpcResult;
-/**
- * @author joe
- */
public class OpendaylightGroupStatisticsServiceImpl implements OpendaylightGroupStatisticsService {
private final AllGroupsStatsService allGroups;
private final GroupDescriptionService groupDesc;
private final GroupStatsService groupStats;
private final NotificationPublishService notificationPublishService;
- public OpendaylightGroupStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
+ public OpendaylightGroupStatisticsServiceImpl(final RequestContextStack requestContextStack,
+ final DeviceContext deviceContext,
final AtomicLong compatibilityXidSeed,
final NotificationPublishService notificationPublishService,
final ConvertorExecutor convertorExecutor) {
this.notificationPublishService = notificationPublishService;
- allGroups = new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
- groupDesc = new GroupDescriptionService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ allGroups =
+ new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ groupDesc = new GroupDescriptionService(requestContextStack,
+ deviceContext,
+ compatibilityXidSeed,
+ convertorExecutor);
groupFeat = new GroupFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
groupStats = new GroupStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
}
@Override
- public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(final GetAllGroupStatisticsInput input) {
+ public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(
+ final GetAllGroupStatisticsInput input) {
return allGroups.handleAndNotify(input, notificationPublishService);
}
final ConvertorExecutor convertorExecutor) {
this.notificationPublishService = notificationPublishService;
- allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
- allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ allMeterConfig = new AllMeterConfigStatsService(requestContextStack,
+ deviceContext,
+ compatibilityXidSeed,
+ convertorExecutor);
+ allMeterStats = new AllMeterStatsService(requestContextStack,
+ deviceContext,
+ compatibilityXidSeed,
+ convertorExecutor);
meterFeatures = new MeterFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
meterStats = new MeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
}
}
@Override
- public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(final GetAllMeterStatisticsInput input) {
+ public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(
+ final GetAllMeterStatisticsInput input) {
return allMeterStats.handleAndNotify(input, notificationPublishService);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
-final class PortStatsService
- extends AbstractCompatibleStatService<GetNodeConnectorStatisticsInput, GetNodeConnectorStatisticsOutput, NodeConnectorStatisticsUpdate> {
+final class PortStatsService extends AbstractCompatibleStatService<GetNodeConnectorStatisticsInput,
+ GetNodeConnectorStatisticsOutput,
+ NodeConnectorStatisticsUpdate> {
- public PortStatsService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ PortStatsService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetNodeConnectorStatisticsInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetNodeConnectorStatisticsInput input) throws ServiceException {
MultipartRequestPortStatsCaseBuilder caseBuilder =
new MultipartRequestPortStatsCaseBuilder();
MultipartRequestPortStatsBuilder mprPortStatsBuilder =
}
@Override
- public NodeConnectorStatisticsUpdate transformToNotification(List<MultipartReply> result, TransactionId emulatedTxId) {
- return NodeConnectorStatisticsToNotificationTransformer.transformToNotification(result, getDeviceInfo(), getOfVersion(), emulatedTxId);
+ public NodeConnectorStatisticsUpdate transformToNotification(List<MultipartReply> result,
+ TransactionId emulatedTxId) {
+ return NodeConnectorStatisticsToNotificationTransformer.transformToNotification(result,
+ getDeviceInfo(),
+ getOfVersion(),
+ emulatedTxId);
}
}
import org.slf4j.LoggerFactory;
/**
- * pulled up common functionality of notification emitting stats services (backward compatibility relic)
+ * Pulled up common functionality of notification emitting stats services (backward compatibility relic).
*/
-public abstract class AbstractCompatibleStatService<I extends DataContainer, O, N extends Notification> extends AbstractMultipartService<I, MultipartReply> implements BackwardCompatibleAtomicService<I, O> {
+public abstract class AbstractCompatibleStatService<I extends DataContainer, O, N extends Notification> extends
+ AbstractMultipartService<I, MultipartReply> implements BackwardCompatibleAtomicService<I, O> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractCompatibleStatService.class);
private final AtomicLong compatibilityXidSeed;
private final OpenflowVersion ofVersion;
- public AbstractCompatibleStatService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed) {
+ public AbstractCompatibleStatService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed) {
super(requestContextStack, deviceContext);
this.compatibilityXidSeed = compatibilityXidSeed;
ofVersion = OpenflowVersion.get(getVersion());
}
@Override
- public ListenableFuture<RpcResult<O>> handleAndNotify(final I input, final NotificationPublishService notificationPublishService) {
+ public ListenableFuture<RpcResult<O>> handleAndNotify(final I input,
+ final NotificationPublishService notificationPublishService) {
// prepare emulated xid
final long emulatedXid = compatibilityXidSeed.incrementAndGet();
final TransactionId emulatedTxId = new TransactionId(BigInteger.valueOf(emulatedXid));
final N flowNotification = transformToNotification(result.getResult(), emulatedTxId);
notificationPublishService.offerNotification(flowNotification);
} else {
- LOG.debug("compatibility callback failed - NOT emitting notification: {}", input.getClass().getSimpleName());
+ LOG.debug("compatibility callback failed - NOT emitting notification: {}",
+ input.getClass().getSimpleName());
}
}
@Override
- public void onFailure(Throwable t) {
- LOG.debug("compatibility callback crashed - NOT emitting notification: {}", input.getClass().getSimpleName(), t);
+ public void onFailure(Throwable throwable) {
+ LOG.debug("compatibility callback crashed - NOT emitting notification: {}",
+ input.getClass().getSimpleName(), throwable);
}
});
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow;
/**
- * pulled out flow stats to notification transformation
+ * Pulled out flow stats to notification transformation.
*/
public class FlowStatisticsToNotificationTransformer {
}
/**
+ * Transform to notification.
+ *
* @param mpResult raw multipart response from device
- * @param deviceInfo device state
+ * @param deviceInfo device state
* @param ofVersion device version
- * @param emulatedTxId
- * @param convertorExecutor
+ * @param emulatedTxId emulated transaction Id
+ * @param convertorExecutor convertor executor
* @return notification containing flow stats
*/
public static FlowsStatisticsUpdate transformToNotification(final List<MultipartReply> mpResult,
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.MultipartReplyGroup;
/**
- * pulled out group stats to notification transformation
+ * Pulled out group stats to notification transformation.
*/
public class GroupStatisticsToNotificationTransformer {
+
private GroupStatisticsToNotificationTransformer() {
// Hide implicit constructor
}
+
/**
+ * Transform statistics to notification.
* @param mpReplyList raw multipart response from device
* @param deviceInfo device state
- * @param emulatedTxId
- * @param convertorExecutor
+ * @param emulatedTxId emulated transaction id
+ * @param convertorExecutor convertor executor
* @return notification containing flow stats
*/
public static GroupStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList,
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.meter._case.MultipartReplyMeter;
/**
- * pulled out meter stats to notification transformation
+ * Pulled out meter stats to notification transformation.
*/
public class MeterStatisticsToNotificationTransformer {
private MeterStatisticsToNotificationTransformer() {
// Hide implicit constructor
}
+
/**
+ * Transform statistics to notification.
+ *
* @param mpReplyList raw multipart response from device
- * @param deviceInfo device state
+ * @param deviceInfo device state
* @param ofVersion device version
- * @param emulatedTxId
- * @param convertorExecutor
+ * @param emulatedTxId emulated transaction Id
+ * @param convertorExecutor convertor executor
* @return notification containing flow stats
*/
public static MeterStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList,
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
- final Optional<List<MeterStats>> meterStatsList = convertorExecutor.convert(replyBody.getMeterStats(), data);
+ final Optional<List<MeterStats>> meterStatsList =
+ convertorExecutor.convert(replyBody.getMeterStats(), data);
if (meterStatsList.isPresent()) {
notification.getMeterStats().addAll(meterStatsList.get());
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapKey;
/**
- * pulled out port stats to notification transformation
+ * Pulled out port stats to notification transformation.
*/
public class NodeConnectorStatisticsToNotificationTransformer {
}
/**
+ * Transform statistics to notification.
+ *
* @param mpReplyList raw multipart response from device
* @param deviceInfo device basic info
* @param ofVersion device version
- * @param emulatedTxId
+ * @param emulatedTxId emulated transaction Id
* @return notification containing flow stats
*/
public static NodeConnectorStatisticsUpdate transformToNotification(final List<MultipartReply> mpReplyList,
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
- notification.setNodeConnectorStatisticsAndPortNumberMap(new ArrayList<NodeConnectorStatisticsAndPortNumberMap>());
+ notification
+ .setNodeConnectorStatisticsAndPortNumberMap(new ArrayList<NodeConnectorStatisticsAndPortNumberMap>());
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyPortStatsCase caseBody = (MultipartReplyPortStatsCase) mpReply.getMultipartReplyBody();
}
@VisibleForTesting
- static NodeConnectorStatisticsAndPortNumberMapBuilder processSingleNodeConnectorStats(DeviceInfo deviceInfo, OpenflowVersion ofVersion, PortStats portStats) {
+ static NodeConnectorStatisticsAndPortNumberMapBuilder processSingleNodeConnectorStats(DeviceInfo deviceInfo,
+ OpenflowVersion ofVersion,
+ PortStats portStats) {
NodeConnectorStatisticsAndPortNumberMapBuilder statsBuilder =
new NodeConnectorStatisticsAndPortNumberMapBuilder();
statsBuilder.setNodeConnectorId(
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-/**
- * @author joe
- */
public class OpendaylightFlowStatisticsServiceDelegateImpl implements OpendaylightFlowStatisticsService {
private static final Logger LOG = LoggerFactory.getLogger(OpendaylightFlowStatisticsServiceDelegateImpl.class);
final AtomicLong compatibilityXidSeed,
final ConvertorExecutor convertorExecutor) {
this.notificationService = notificationService;
- aggregateFlowsInTable = AggregateFlowsInTableService.createWithOook(requestContextStack, deviceContext, compatibilityXidSeed);
- allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
- allFlowsInTable = new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
- flowsInTable = new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ aggregateFlowsInTable =
+ AggregateFlowsInTableService.createWithOook(requestContextStack, deviceContext, compatibilityXidSeed);
+ allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack,
+ deviceContext,
+ compatibilityXidSeed,
+ convertorExecutor);
+ allFlowsInTable =
+ new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
+ flowsInTable =
+ new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
}
/**
- * @deprecated this is the only method with real implementation provided, in delegate it makes no sense
+ * Get statistics for the given match.
+ *
+ * @deprecated this is the only method with real implementation provided, in delegate it makes no sense.
*/
@Override
@Deprecated
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
+ public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
+ getAggregateFlowStatisticsFromFlowTableForGivenMatch(
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
- throw new IllegalAccessError("unsupported by backward compatibility delegate service " +
- "- this rpc is always provided by default service implementation");
+ throw new IllegalAccessError("unsupported by backward compatibility delegate service "
+ + "- this rpc is always provided by default service implementation");
}
@Override
- public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
+ public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
+ getAggregateFlowStatisticsFromFlowTableForAllFlows(
final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
return aggregateFlowsInTable.handleAndNotify(input, notificationService);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder;
/**
- * pulled out queue stats to notification transformation
+ * Pulled out queue stats to notification transformation.
*/
public class QueueStatisticsToNotificationTransformer {
}
/**
+ * Transform statistics to notification.
+ *
* @param mpReplyList raw multipart response from device
- * @param deviceInfo device state
+ * @param deviceInfo device state
* @param ofVersion device version
- * @param emulatedTxId
+ * @param emulatedTxId emulated transaction Id
* @return notification containing flow stats
*/
public static QueueStatisticsUpdate transformToNotification(final List<MultipartReply> mpReplyList,
}
return notification.build();
}
-
-
}
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.StatisticsGatherer;
import org.opendaylight.openflowplugin.impl.common.MultipartRequestInputFactory;
+import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
import org.opendaylight.openflowplugin.impl.services.AbstractMultipartOnTheFlyService;
import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
-import org.opendaylight.openflowplugin.impl.datastore.MultipartWriterProvider;
import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.slf4j.LoggerFactory;
/**
- * collects statistics and processes them on the fly
+ * Collects statistics and processes them on the fly.
*/
public class StatisticsGatheringOnTheFlyService<T extends OfHeader>
extends AbstractMultipartOnTheFlyService<MultipartType, T>
}
@Override
- public ListenableFuture<RpcResult<List<T>>> getStatisticsOfType(final EventIdentifier eventIdentifier, final MultipartType type) {
+ public ListenableFuture<RpcResult<List<T>>> getStatisticsOfType(final EventIdentifier eventIdentifier,
+ final MultipartType type) {
LOG.debug("Getting statistics (onTheFly) for node {} of type {}", getDeviceInfo().getNodeId(), type);
EventsTimeCounter.markStart(eventIdentifier);
setEventIdentifier(eventIdentifier);
@Override
protected OfHeader buildRequest(final Xid xid, final MultipartType input) throws ServiceException {
- return MultipartRequestInputFactory.makeMultipartRequest(xid.getValue(), getVersion(), input, canUseSingleLayerSerialization());
+ return MultipartRequestInputFactory.makeMultipartRequest(xid.getValue(),
+ getVersion(),
+ input,
+ canUseSingleLayerSerialization());
}
-
}
private static final Logger LOG = LoggerFactory.getLogger(StatisticsGatheringService.class);
- public StatisticsGatheringService(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
+ public StatisticsGatheringService(final RequestContextStack requestContextStack,
+ final DeviceContext deviceContext) {
super(requestContextStack, deviceContext);
}
@Override
- public ListenableFuture<RpcResult<List<T>>> getStatisticsOfType(final EventIdentifier eventIdentifier, final MultipartType type) {
+ public ListenableFuture<RpcResult<List<T>>> getStatisticsOfType(final EventIdentifier eventIdentifier,
+ final MultipartType type) {
LOG.debug("Getting statistics for node {} of type {}", getDeviceInfo().getNodeId(), type);
EventsTimeCounter.markStart(eventIdentifier);
setEventIdentifier(eventIdentifier);
@Override
protected OfHeader buildRequest(final Xid xid, final MultipartType input) throws ServiceException {
- return MultipartRequestInputFactory.makeMultipartRequest(xid.getValue(), getVersion(), input, canUseSingleLayerSerialization());
+ return MultipartRequestInputFactory.makeMultipartRequest(xid.getValue(),
+ getVersion(),
+ input,
+ canUseSingleLayerSerialization());
}
-
}
* @param <I> the input type parameter
* @param <O> the output type parameter
*/
-abstract class AbstractDirectStatisticsService<I extends StoreStatsGrouping, O extends DataContainer, T extends OfHeader>
+abstract class AbstractDirectStatisticsService<I extends StoreStatsGrouping,
+ O extends DataContainer,
+ T extends OfHeader>
extends AbstractMultipartService<I, T> {
private final MultipartType multipartType;
}
/**
- * Get multipart type
+ * Get multipart type.
* @return multipart type
*/
protected MultipartType getMultipartType() {
}
/**
- * Get convertor executor
+ * Get convertor executor.
* @return convertor executor
*/
protected ConvertorExecutor getConvertorExecutor() {
/**
* Get flow ID from #{@link org.opendaylight.openflowplugin.api.openflow.registry.flow.DeviceFlowRegistry} or
- * create alien ID
+ * create alien ID.
* @param flowStatistics flow statistics
* @return generated flow ID
*/
final DeviceContext deviceContext,
final ConvertorExecutor convertorExecutor,
final MultipartWriterProvider statisticsWriterProvider) {
- super(MultipartType.OFPMPGROUP, requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);
+ super(MultipartType.OFPMPGROUP,
+ requestContextStack,
+ deviceContext,
+ convertorExecutor,
+ statisticsWriterProvider);
}
-
}
final DeviceContext deviceContext,
final ConvertorExecutor convertorExecutor,
final MultipartWriterProvider statisticsWriterProvider) {
- super(MultipartType.OFPMPMETER, requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);
+ super(MultipartType.OFPMPMETER, requestContextStack, deviceContext, convertorExecutor,
+ statisticsWriterProvider);
}
}
final DeviceContext deviceContext,
final ConvertorExecutor convertorExecutor,
final MultipartWriterProvider statisticsWriterProvider) {
- super(MultipartType.OFPMPPORTSTATS, requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);
+ super(MultipartType.OFPMPPORTSTATS,
+ requestContextStack,
+ deviceContext,
+ convertorExecutor,
+ statisticsWriterProvider);
}
}
final DeviceContext deviceContext,
final ConvertorExecutor convertorExecutor,
final MultipartWriterProvider statisticsWriterProvider) {
- super(MultipartType.OFPMPQUEUE, requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);
+ super(MultipartType.OFPMPQUEUE, requestContextStack, deviceContext, convertorExecutor,
+ statisticsWriterProvider);
}
-
}
@Override
@SuppressWarnings("unchecked")
- public Future<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(GetNodeConnectorStatisticsInput input) {
+ public Future<RpcResult<GetNodeConnectorStatisticsOutput>>
+ getNodeConnectorStatistics(GetNodeConnectorStatisticsInput input) {
return provider.lookup(AbstractPortDirectStatisticsService.class)
.map(service -> service.handleAndReply(input))
.orElse(missingImplementation(AbstractPortDirectStatisticsService.class));
* The Opendaylight direct statistics service provider.
*/
public class OpendaylightDirectStatisticsServiceProvider {
- private Map<Class<? extends AbstractDirectStatisticsService>, AbstractDirectStatisticsService> services = new HashMap<>();
+ private Map<Class<? extends AbstractDirectStatisticsService>, AbstractDirectStatisticsService> services =
+ new HashMap<>();
/**
* Register direct statistics service.
* @param type the service type
* @param service the service instance
*/
- public void register(Class<? extends AbstractDirectStatisticsService> type, AbstractDirectStatisticsService service) {
+ public void register(Class<? extends AbstractDirectStatisticsService> type,
+ AbstractDirectStatisticsService service) {
services.put(type, service);
}
* @param type the service type
* @return the service instance
*/
- public Optional<? extends AbstractDirectStatisticsService> lookup(Class<? extends AbstractDirectStatisticsService> type) {
+ public Optional<? extends AbstractDirectStatisticsService>
+ lookup(Class<? extends AbstractDirectStatisticsService> type) {
return Optional.ofNullable(services.get(type)).map(type::cast);
}
}
mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
}
- MatchReactor.getInstance().convert(input.getMatch(), getVersion(), mprFlowRequestBuilder, getConvertorExecutor());
+ MatchReactor.getInstance().convert(input.getMatch(),
+ getVersion(),
+ mprFlowRequestBuilder,
+ getConvertorExecutor());
return RequestInputUtils.createMultipartHeader(getMultipartType(), xid.getValue(), getVersion())
.setMultipartRequestBody(new MultipartRequestFlowCaseBuilder()
.build())
.build();
}
-
}
for (final MultipartReply mpReply : input) {
final MultipartReplyMeterCase caseBody = (MultipartReplyMeterCase) mpReply.getMultipartReplyBody();
final MultipartReplyMeter replyBody = caseBody.getMultipartReplyMeter();
- final Optional<List<MeterStats>> meterStatsList = getConvertorExecutor().convert(replyBody.getMeterStats(), data);
+ final Optional<List<MeterStats>> meterStatsList =
+ getConvertorExecutor().convert(replyBody.getMeterStats(), data);
meterStatsList.ifPresent(meterStats::addAll);
}
}
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
/**
- * Utility class for instantiating #{@link org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider}
- * with all multi-layer services already in
+ * Utility class for instantiating
+ * #{@link org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider}
+ * with all multi-layer services already in.
*/
public class MultiLayerDirectStatisticsProviderInitializer {
return provider;
}
-
}
if (success) {
for (final MultipartReply mpReply : input) {
- final MultipartReplyPortStatsCase caseBody = (MultipartReplyPortStatsCase) mpReply.getMultipartReplyBody();
+ final MultipartReplyPortStatsCase caseBody =
+ (MultipartReplyPortStatsCase) mpReply.getMultipartReplyBody();
final MultipartReplyPortStats replyBody = caseBody.getMultipartReplyPortStats();
for (final PortStats portStats : replyBody.getPortStats()) {
durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
}
- final NodeConnectorStatisticsAndPortNumberMap stats = new NodeConnectorStatisticsAndPortNumberMapBuilder()
+ final NodeConnectorStatisticsAndPortNumberMap stats =
+ new NodeConnectorStatisticsAndPortNumberMapBuilder()
.setBytes(bytesBuilder.build())
.setPackets(packetsBuilder.build())
.setNodeConnectorId(nodeConnectorId)
final MultipartRequestPortStatsBuilder mprPortStatsBuilder = new MultipartRequestPortStatsBuilder();
if (input.getNodeConnectorId() != null) {
- mprPortStatsBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(getOfVersion(), input.getNodeConnectorId()));
+ mprPortStatsBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(getOfVersion(),
+ input.getNodeConnectorId()));
} else {
mprPortStatsBuilder.setPortNo(OFConstants.OFPP_ANY);
}
.build())
.build();
}
-
}
}
if (input.getNodeConnectorId() != null) {
- mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(getOfVersion(), input.getNodeConnectorId()));
+ mprQueueBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(getOfVersion(),
+ input.getNodeConnectorId()));
} else {
mprQueueBuilder.setPortNo(OFConstants.OFPP_ANY);
}
final DeviceContext deviceContext,
final ConvertorExecutor convertorExecutor,
final MultipartWriterProvider statisticsWriterProvider) {
- super(requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider); }
+ super(requestContextStack, deviceContext, convertorExecutor, statisticsWriterProvider);
+ }
@Override
protected GetFlowStatisticsOutput buildReply(List<MultipartReply> input, boolean success) {
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetNodeConnectorStatisticsInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid,
+ final GetNodeConnectorStatisticsInput input) throws ServiceException {
return new MultipartRequestBuilder()
.setXid(xid.getValue())
.setVersion(getVersion())
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
/**
- * Utility class for instantiating #{@link org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider}
- * with all multi-layer services already in
+ * Utility class for instantiating
+ * #{@link org.opendaylight.openflowplugin.impl.statistics.services.direct.OpendaylightDirectStatisticsServiceProvider}
+ * with all multi-layer services already in.
*/
public class SingleLayerDirectStatisticsProviderInitializer {
private static final Long DUMMY_REF_COUNT = 1234L;
private static final GroupTypes DUMMY_GROUPS_TYPE = GroupTypes.GroupAll;
private static final GroupType DUMMY_GROUP_TYPE = GroupType.OFPGTALL;
- private static final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
+ private static final ConvertorManager CONVERTOR_MANAGER = ConvertorManagerFactory.createDefaultManager();
@Before
public void setUp() {
public void testTranslateFlow() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
- MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyFlow(), MultipartType.OFPMPFLOW);
+ MultipartReplyMessage multipartReplyMessage =
+ prepareMocks(mockedDeviceContext, prepareMultipartReplyFlow(), MultipartType.OFPMPFLOW);
DataContainer result = MultipartReplyTranslatorUtil.translate(
multipartReplyMessage,
mockedDeviceContext.getDeviceInfo(),
- convertorManager,
+ CONVERTOR_MANAGER,
mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
public void testTranslateAggregate() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
- MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyAggregate(), MultipartType.OFPMPAGGREGATE);
+ MultipartReplyMessage multipartReplyMessage =
+ prepareMocks(mockedDeviceContext, prepareMultipartReplyAggregate(), MultipartType.OFPMPAGGREGATE);
DataContainer result = MultipartReplyTranslatorUtil.translate(
multipartReplyMessage,
mockedDeviceContext.getDeviceInfo(),
- convertorManager,
+ CONVERTOR_MANAGER,
mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
public void testTranslatePortStats() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
- MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyPortStats(), MultipartType.OFPMPPORTSTATS);
+ MultipartReplyMessage multipartReplyMessage =
+ prepareMocks(mockedDeviceContext, prepareMultipartReplyPortStats(), MultipartType.OFPMPPORTSTATS);
DataContainer result = MultipartReplyTranslatorUtil.translate(
multipartReplyMessage,
mockedDeviceContext.getDeviceInfo(),
- convertorManager,
+ CONVERTOR_MANAGER,
mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
- assertTrue(dataObject instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap);
- org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatisticsUpdate = (org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap)dataObject;
- List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMaps = nodeConnectorStatisticsUpdate.getNodeConnectorStatisticsAndPortNumberMap();
+ assertTrue(dataObject instanceof org.opendaylight.yang.gen.v1.urn
+ .opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap);
+ org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap
+ nodeConnectorStatisticsUpdate = (org.opendaylight.yang.gen.v1.urn
+ .opendaylight.port.statistics.rev131214.NodeConnectorStatisticsAndPortNumberMap) dataObject;
+ List<NodeConnectorStatisticsAndPortNumberMap> nodeConnectorStatisticsAndPortNumberMaps =
+ nodeConnectorStatisticsUpdate.getNodeConnectorStatisticsAndPortNumberMap();
assertEquals(1, nodeConnectorStatisticsAndPortNumberMaps.size());
- NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatisticsAndPortNumberMap = nodeConnectorStatisticsAndPortNumberMaps.get(0);
- assertEquals("openflow:"+DUMMY_DATAPATH_ID +":"+ DUMMY_PORT_NO, nodeConnectorStatisticsAndPortNumberMap.getNodeConnectorId().getValue());
+ NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatisticsAndPortNumberMap =
+ nodeConnectorStatisticsAndPortNumberMaps.get(0);
+ assertEquals("openflow:" + DUMMY_DATAPATH_ID + ":" + DUMMY_PORT_NO,
+ nodeConnectorStatisticsAndPortNumberMap.getNodeConnectorId().getValue());
assertEquals(DUMMY_RX_BYTES, nodeConnectorStatisticsAndPortNumberMap.getBytes().getReceived());
assertEquals(DUMMY_TX_BYTES, nodeConnectorStatisticsAndPortNumberMap.getBytes().getTransmitted());
assertEquals(DUMMY_RX_PACKETS, nodeConnectorStatisticsAndPortNumberMap.getPackets().getReceived());
public void testTranslateGroup() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
- MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyGroup(), MultipartType.OFPMPGROUP);
+ MultipartReplyMessage multipartReplyMessage =
+ prepareMocks(mockedDeviceContext, prepareMultipartReplyGroup(), MultipartType.OFPMPGROUP);
DataContainer result = MultipartReplyTranslatorUtil.translate(
multipartReplyMessage,
mockedDeviceContext.getDeviceInfo(),
- convertorManager,
+ CONVERTOR_MANAGER,
mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
assertTrue(dataObject instanceof GroupStatisticsReply);
GroupStatisticsReply groupStatisticsUpdate = (GroupStatisticsReply)dataObject;
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> groupStats = groupStatisticsUpdate.getGroupStats();
+ List<org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> groupStats =
+ groupStatisticsUpdate.getGroupStats();
assertEquals(1, groupStats.size());
- org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats groupStat = groupStats.get(0);
+ org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats groupStat = groupStats.get(0);
assertEquals(DUMMY_BYTE_COUNT, groupStat.getByteCount().getValue());
assertEquals(DUMMY_DURATION_SEC, groupStat.getDuration().getSecond().getValue());
public void testTranslateGroupDesc() {
DeviceContext mockedDeviceContext = mock(DeviceContext.class);
- MultipartReplyMessage multipartReplyMessage = prepareMocks(mockedDeviceContext, prepareMultipartReplyGroupDesc(), MultipartType.OFPMPGROUPDESC);
+ MultipartReplyMessage multipartReplyMessage =
+ prepareMocks(mockedDeviceContext, prepareMultipartReplyGroupDesc(), MultipartType.OFPMPGROUPDESC);
DataContainer result = MultipartReplyTranslatorUtil.translate(
multipartReplyMessage,
mockedDeviceContext.getDeviceInfo(),
- convertorManager,
+ CONVERTOR_MANAGER,
mockedDeviceContext.oook()).get();
DataContainer dataObject = validateOutput(result);
assertEquals(1, groupDescStats.size());
GroupDescStats groupDescStat = groupDescStats.get(0);
assertEquals(DUMMY_GROUP_ID.getValue(),groupDescStat.getGroupId().getValue());
- assertEquals(DUMMY_GROUPS_TYPE,groupDescStat.getGroupType() );
+ assertEquals(DUMMY_GROUPS_TYPE,groupDescStat.getGroupType());
}
private MultipartReplyBody prepareMultipartReplyGroupDesc() {
- MultipartReplyGroupDescCaseBuilder multipartReplyGroupDescCaseBuilder = new MultipartReplyGroupDescCaseBuilder();
- MultipartReplyGroupDescBuilder multipartReplyGroupDescBuilder = new MultipartReplyGroupDescBuilder();
GroupDescBuilder groupDescBuilder = new GroupDescBuilder();
groupDescBuilder.setGroupId(DUMMY_GROUP_ID);
groupDescBuilder.setBucketsList(Collections.<BucketsList>emptyList());
groupDescBuilder.setType(DUMMY_GROUP_TYPE);
+ MultipartReplyGroupDescBuilder multipartReplyGroupDescBuilder = new MultipartReplyGroupDescBuilder();
multipartReplyGroupDescBuilder.setGroupDesc(Lists.newArrayList(groupDescBuilder.build()));
+ MultipartReplyGroupDescCaseBuilder multipartReplyGroupDescCaseBuilder =
+ new MultipartReplyGroupDescCaseBuilder();
multipartReplyGroupDescCaseBuilder.setMultipartReplyGroupDesc(multipartReplyGroupDescBuilder.build());
return multipartReplyGroupDescCaseBuilder.build();
}
private MultipartReplyBody prepareMultipartReplyGroup() {
- MultipartReplyGroupCaseBuilder multipartReplyGroupCaseBuilder = new MultipartReplyGroupCaseBuilder();
- MultipartReplyGroupBuilder multipartReplyGroupBuilder = new MultipartReplyGroupBuilder();
GroupStatsBuilder groupStatsBuilder = new GroupStatsBuilder();
groupStatsBuilder.setByteCount(DUMMY_BYTE_COUNT);
groupStatsBuilder.setBucketStats(Collections.<BucketStats>emptyList());
groupStatsBuilder.setGroupId(DUMMY_GROUP_ID);
groupStatsBuilder.setPacketCount(DUMMY_PACKET_COUNT);
groupStatsBuilder.setRefCount(DUMMY_REF_COUNT);
-
-
+ MultipartReplyGroupBuilder multipartReplyGroupBuilder = new MultipartReplyGroupBuilder();
multipartReplyGroupBuilder.setGroupStats(Lists.newArrayList(groupStatsBuilder.build()));
+ MultipartReplyGroupCaseBuilder multipartReplyGroupCaseBuilder = new MultipartReplyGroupCaseBuilder();
multipartReplyGroupCaseBuilder.setMultipartReplyGroup(multipartReplyGroupBuilder.build());
return multipartReplyGroupCaseBuilder.build();
}
private MultipartReplyBody prepareMultipartReplyPortStats() {
- MultipartReplyPortStatsCaseBuilder multipartReplyPortStatsCaseBuilder = new MultipartReplyPortStatsCaseBuilder();
- MultipartReplyPortStatsBuilder multipartReplyPortStatsBuilder = new MultipartReplyPortStatsBuilder();
PortStatsBuilder dummyPortStatBuilder = new PortStatsBuilder();
dummyPortStatBuilder.setPortNo(DUMMY_PORT_NO);
dummyPortStatBuilder.setRxBytes(DUMMY_RX_BYTES);
dummyPortStatBuilder.setRxOverErr(DUMMY_OVER_ERR);
dummyPortStatBuilder.setTxDropped(DUMMY_TX_DROPPED);
dummyPortStatBuilder.setTxErrors(DUMMY_TX_ERRORS);
-
+ MultipartReplyPortStatsBuilder multipartReplyPortStatsBuilder = new MultipartReplyPortStatsBuilder();
multipartReplyPortStatsBuilder.setPortStats(Lists.newArrayList(dummyPortStatBuilder.build()));
+ MultipartReplyPortStatsCaseBuilder multipartReplyPortStatsCaseBuilder =
+ new MultipartReplyPortStatsCaseBuilder();
multipartReplyPortStatsCaseBuilder.setMultipartReplyPortStats(multipartReplyPortStatsBuilder.build());
return multipartReplyPortStatsCaseBuilder.build();
}
private MultipartReplyBody prepareMultipartReplyAggregate() {
- MultipartReplyAggregateCaseBuilder multipartReplyAggregateCaseBuilder = new MultipartReplyAggregateCaseBuilder();
MultipartReplyAggregateBuilder multipartReplyAggregateBuilder = new MultipartReplyAggregateBuilder();
multipartReplyAggregateBuilder.setByteCount(DUMMY_BYTE_COUNT);
multipartReplyAggregateBuilder.setPacketCount(DUMMY_PACKET_COUNT);
multipartReplyAggregateBuilder.setFlowCount(DUMMY_FLOW_COUNT);
+ MultipartReplyAggregateCaseBuilder multipartReplyAggregateCaseBuilder =
+ new MultipartReplyAggregateCaseBuilder();
multipartReplyAggregateCaseBuilder.setMultipartReplyAggregate(multipartReplyAggregateBuilder.build());
return multipartReplyAggregateCaseBuilder.build();
}
return multipartReplyFlowCaseBuilder.build();
}
- private MultipartReplyMessage prepareMocks(DeviceContext mockedDeviceContext, MultipartReplyBody multipartReplyBody, final MultipartType multipartType) {
+ private MultipartReplyMessage prepareMocks(DeviceContext mockedDeviceContext,
+ MultipartReplyBody multipartReplyBody,
+ final MultipartType multipartType) {
ConnectionContext mockedConnectionContext = mock(ConnectionContext.class);
FeaturesReply mockedFeaturesReply = mock(FeaturesReply.class);
when(mockedFeaturesReply.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
return multipartReplyMessage;
}
-
private DataContainer validateOutput(DataContainer dataObject) {
return dataObject;
}
DeviceInfo mockedDeviceInfo;
StatisticsManager mockedStatisticsManager;
- static final KeyedInstanceIdentifier<Node, NodeKey> dummyNodeII = InstanceIdentifier.create(Nodes.class)
+ static final KeyedInstanceIdentifier<Node, NodeKey> DUMMY_NODE_ID = InstanceIdentifier.create(Nodes.class)
.child(Node.class, new NodeKey(new NodeId("dummyNodeId")));
@Before
when(mockedDeviceState.isMetersAvailable()).thenReturn(isMeter);
when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(isPort);
when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(isQueue);
- when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(dummyNodeII);
+ when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_ID);
when(mockedDeviceInfo.getDatapathId()).thenReturn(BigInteger.TEN);
when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedConnectionContext);
when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessageSpy);
- when(mockedDeviceInfo.getNodeId()).thenReturn(dummyNodeII.getKey().getId());
+ when(mockedDeviceInfo.getNodeId()).thenReturn(DUMMY_NODE_ID.getKey().getId());
- when(mockedConnectionContext.getNodeId()).thenReturn(dummyNodeII.getKey().getId());
+ when(mockedConnectionContext.getNodeId()).thenReturn(DUMMY_NODE_ID.getKey().getId());
when(mockedConnectionContext.getFeatures()).thenReturn(mockedFeatures);
when(mockedConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.WORKING);
when(mockedConnectionContext.getOutboundQueueProvider()).thenReturn(mockedOutboundQueue);
@RunWith(Parameterized.class)
public class StatisticsContextImplParamTest extends StatisticsContextImpMockInitiation {
-
- public StatisticsContextImplParamTest(final boolean isTable, final boolean isFlow, final boolean isGroup, final boolean isMeter, final boolean isPort,
+ public StatisticsContextImplParamTest(final boolean isTable,
+ final boolean isFlow,
+ final boolean isGroup,
+ final boolean isMeter,
+ final boolean isPort,
final boolean isQueue) {
super();
this.isTable = isTable;
});
}
-
-
-
@Test
public void gatherDynamicDataTest() {
MultipartWriterProviderFactory.createDefaultProvider(mockedDeviceContext),
false);
- final ListenableFuture<RpcResult<List<MultipartReply>>> rpcResult = immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build());
+ final ListenableFuture<RpcResult<List<MultipartReply>>> rpcResult =
+ immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build());
when(mockedStatisticsGatheringService.getStatisticsOfType(any(EventIdentifier.class), any(MultipartType
.class))).thenReturn(rpcResult);
when(mockedStatisticsOnFlyGatheringService.getStatisticsOfType(any(EventIdentifier.class), any(MultipartType
} catch (InterruptedException | ExecutionException e) {
fail("Exception wasn't expected.");
}
-
}
-
}
\ No newline at end of file
}
/**
- * There is nothing to check in close method
+ * There is nothing to check in close method.
*/
@Test
public void testClose() throws Exception {
Assert.assertTrue(requestContext.getFuture().isDone());
final RpcResult<?> rpcResult = requestContext.getFuture().get();
Assert.assertFalse(rpcResult.isSuccessful());
- Assert.assertFalse(rpcResult.isSuccessful());
- } catch (final Exception e) {
+ } catch (final ExecutionException e) {
LOG.error("request future value should be finished", e);
Assert.fail("request context closing failed");
}
when(mockedDeviceState.isMetersAvailable()).thenReturn(Boolean.TRUE);
when(mockedDeviceState.isPortStatisticsAvailable()).thenReturn(Boolean.TRUE);
when(mockedDeviceState.isQueueStatisticsAvailable()).thenReturn(Boolean.TRUE);
- when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(dummyNodeII);
+ when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(DUMMY_NODE_ID);
initStatisticsContext();
- when(mockedStatisticsGatheringService.getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)))
+ when(mockedStatisticsGatheringService
+ .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)))
.thenReturn(
- Futures.immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build())
- );
- when(mockedStatisticsOnFlyGatheringService.getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)))
+ Futures.immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build())
+ );
+ when(mockedStatisticsOnFlyGatheringService
+ .getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.any(MultipartType.class)))
.thenReturn(
- Futures.immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build())
- );
+ Futures.immediateFuture(RpcResultBuilder.success(Collections.<MultipartReply>emptyList()).build())
+ );
final ListenableFuture<Boolean> gatheringResult = statisticsContext.gatherDynamicData();
Assert.assertTrue(gatheringResult.isDone());
}
@Test
- public void testDeviceConnectionCheck_WORKING() throws Exception {
+ public void testDeviceConnectionCheckWorking() throws Exception {
final ListenableFuture<Boolean> deviceConnectionCheckResult = statisticsContext.deviceConnectionCheck();
Assert.assertTrue(deviceConnectionCheckResult.get());
}
@Test
- public void testDeviceConnectionCheck_RIP() throws Exception {
+ public void testDeviceConnectionCheckRip() throws Exception {
Mockito.reset(mockedConnectionContext);
when(mockedConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.RIP);
final ListenableFuture<Boolean> deviceConnectionCheckResult = statisticsContext.deviceConnectionCheck();
try {
deviceConnectionCheckResult.get();
Assert.fail("connection in state RIP should have caused exception here");
- } catch (final Exception e) {
+ } catch (final ExecutionException e) {
LOG.debug("expected behavior for RIP connection achieved");
Assert.assertTrue(e instanceof ExecutionException);
}
}
@Test
- public void testDeviceConnectionCheck_HANSHAKING() throws Exception {
+ public void testDeviceConnectionCheckHandshaking() throws Exception {
Mockito.reset(mockedConnectionContext);
when(mockedConnectionContext.getConnectionState()).thenReturn(ConnectionContext.CONNECTION_STATE.HANDSHAKING);
final ListenableFuture<Boolean> deviceConnectionCheckResult = statisticsContext.deviceConnectionCheck();
try {
final Boolean checkPositive = deviceConnectionCheckResult.get();
Assert.assertTrue(checkPositive);
- } catch (final Exception e) {
+ } catch (final ExecutionException e) {
Assert.fail("connection in state HANDSHAKING should NOT have caused exception here");
}
}
fireAndCheck(type, statsData);
final InstanceIdentifier<GroupStatistics> groupPath = dummyNodePath.augmentation(FlowCapableNode.class)
- .child(Group.class, new GroupKey(new org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId(groupIdValue)))
+ .child(Group.class, new GroupKey(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.GroupId(groupIdValue)))
.augmentation(NodeGroupStatistics.class)
.child(GroupStatistics.class);
verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
fireAndCheck(type, statsData);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId storedGroupId = new org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId(groupIdValue);
- final KeyedInstanceIdentifier<Group, GroupKey> groupPath = dummyNodePath.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(storedGroupId));
+ final org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId storedGroupId =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId(groupIdValue);
+ final KeyedInstanceIdentifier<Group, GroupKey> groupPath =
+ dummyNodePath.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(storedGroupId));
- verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.<InstanceIdentifier<?>> any());
+ verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
+ Matchers.<InstanceIdentifier<?>>any());
verify(deviceGroupRegistry).processMarks();
verify(deviceGroupRegistry).store(storedGroupId);
- verify(deviceContext).writeToTransaction(
- Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(groupPath), Matchers.any(Group.class));
+ verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
+ Matchers.eq(groupPath), Matchers.any(Group.class));
}
@Test
fireAndCheck(type, statsData);
final InstanceIdentifier<MeterStatistics> meterPath = dummyNodePath.augmentation(FlowCapableNode.class)
- .child(Meter.class, new MeterKey(new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(meterIdValue)))
+ .child(Meter.class, new MeterKey(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.MeterId(meterIdValue)))
.augmentation(NodeMeterStatistics.class)
.child(MeterStatistics.class);
verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
fireAndCheck(type, statsData);
final InstanceIdentifier<FlowCapableNodeConnectorStatistics> portPath = dummyNodePath
- .child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("openflow:" + DUMMY_NODE_ID_VALUE + ":11")))
+ .child(NodeConnector.class,
+ new NodeConnectorKey(new NodeConnectorId("openflow:" + DUMMY_NODE_ID_VALUE + ":11")))
.augmentation(FlowCapableNodeConnectorStatisticsData.class)
.child(FlowCapableNodeConnectorStatistics.class);
verify(deviceContext).writeToTransaction(
fireAndCheck(type, statsData);
final KeyedInstanceIdentifier<Queue, QueueKey> queuePath = dummyNodePath
- .child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("openflow:" + DUMMY_NODE_ID_VALUE + ":11")))
+ .child(NodeConnector.class,
+ new NodeConnectorKey(new NodeConnectorId("openflow:" + DUMMY_NODE_ID_VALUE + ":11")))
.augmentation(FlowCapableNodeConnector.class)
.child(Queue.class, new QueueKey(new QueueId(queueIdValue)));
verify(deviceContext).writeToTransaction(
final short tableId = 0;
final MultipartType type = MultipartType.OFPMPFLOW;
- final InstanceIdentifier<FlowCapableNode> nodePath = deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableNode.class);
+ final InstanceIdentifier<FlowCapableNode> nodePath =
+ deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableNode.class);
final TableBuilder tableDataBld = new TableBuilder();
tableDataBld.setId(tableId);
final FlowCapableNodeBuilder flowNodeBuilder = new FlowCapableNodeBuilder();
flowNodeBuilder.setTable(Collections.singletonList(tableDataBld.build()));
final Optional<FlowCapableNode> flowNodeOpt = Optional.of(flowNodeBuilder.build());
- final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> flowNodeFuture = Futures.immediateCheckedFuture(flowNodeOpt);
+ final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> flowNodeFuture =
+ Futures.immediateCheckedFuture(flowNodeOpt);
when(readTx.read(LogicalDatastoreType.OPERATIONAL, nodePath)).thenReturn(flowNodeFuture);
when(flowDescriptor.getFlowId()).thenReturn(flowId);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder matchBld =
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder matchBld =
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder()
.setMatchEntry(Collections.<MatchEntry>emptyList());
final FlowStatsBuilder flowStatsBld = new FlowStatsBuilder()
.child(Table.class, new TableKey((short) 0));
final KeyedInstanceIdentifier<Flow, FlowKey> flowPath = tablePath.child(Flow.class, new FlowKey(flowId));
- verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.<InstanceIdentifier<?>>any());
+ verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
+ Matchers.<InstanceIdentifier<?>>any());
final InOrder inOrder = Mockito.inOrder(deviceContext);
- inOrder.verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL),Matchers.any(), Matchers.any());
+ inOrder.verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
+ Matchers.any(),
+ Matchers.any());
}
@Test
final MultipartReplyMeterConfigBuilder mpReplyMeterConfigBld = new MultipartReplyMeterConfigBuilder();
mpReplyMeterConfigBld.setMeterConfig(Lists.newArrayList(meterConfigBld.build()));
- final MultipartReplyMeterConfigCaseBuilder mpReplyMeterConfigCaseBld = new MultipartReplyMeterConfigCaseBuilder();
+ final MultipartReplyMeterConfigCaseBuilder mpReplyMeterConfigCaseBld =
+ new MultipartReplyMeterConfigCaseBuilder();
mpReplyMeterConfigCaseBld.setMultipartReplyMeterConfig(mpReplyMeterConfigBld.build());
final MultipartReply meterConfigUpdated = assembleMPReplyMessage(type, mpReplyMeterConfigCaseBld.build());
new org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId(meterIdValue);
final KeyedInstanceIdentifier<Meter, MeterKey> meterPath = dummyNodePath.augmentation(FlowCapableNode.class)
.child(Meter.class, new MeterKey(meterId));
- verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.<InstanceIdentifier<?>>any());
+ verify(deviceContext, Mockito.never()).addDeleteToTxChain(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
+ Matchers.<InstanceIdentifier<?>>any());
verify(deviceMeterRegistry).store(meterId);
- verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(meterPath), Matchers.any(Meter.class));
+ verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL),
+ Matchers.eq(meterPath), Matchers.any(Meter.class));
}
- private void fireAndCheck(final MultipartType type, final List<MultipartReply> statsData) throws InterruptedException, ExecutionException, TimeoutException {
+ private void fireAndCheck(final MultipartType type, final List<MultipartReply> statsData)
+ throws InterruptedException, ExecutionException, TimeoutException {
when(statisticsService.getStatisticsOfType(Matchers.any(EventIdentifier.class), Matchers.eq(type)))
.thenReturn(Futures.immediateFuture(RpcResultBuilder.success(statsData).build()));
verify(deviceContext).submitTransaction();
}
- private static MultipartReplyMessage assembleMPReplyMessage(final MultipartType type, final MultipartReplyBody mpReplyGroupCaseBld) {
+ private static MultipartReplyMessage assembleMPReplyMessage(final MultipartType type,
+ final MultipartReplyBody mpReplyGroupCaseBld) {
return new MultipartReplyMessageBuilder()
.setMultipartReplyBody(mpReplyGroupCaseBld)
.setType(type)
}
private static BucketStats createBucketStat(final long byteCount, final long packetCount) {
- return new BucketStatsBuilder().setByteCount(BigInteger.valueOf(byteCount)).setPacketCount(BigInteger.valueOf(packetCount)).build();
+ return new BucketStatsBuilder()
+ .setByteCount(BigInteger.valueOf(byteCount)).setPacketCount(BigInteger.valueOf(packetCount)).build();
}
@Test
public void testDeleteAllKnownFlows() throws Exception {
final short tableId = 0;
- final InstanceIdentifier<FlowCapableNode> nodePath = deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableNode.class);
+ final InstanceIdentifier<FlowCapableNode> nodePath =
+ deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableNode.class);
final TableBuilder tableDataBld = new TableBuilder();
tableDataBld.setId(tableId);
final FlowCapableNodeBuilder flowNodeBuilder = new FlowCapableNodeBuilder();
flowNodeBuilder.setTable(Collections.singletonList(tableDataBld.build()));
final Optional<FlowCapableNode> flowNodeOpt = Optional.of(flowNodeBuilder.build());
- final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> flowNodeFuture = Futures.immediateCheckedFuture(flowNodeOpt);
+ final CheckedFuture<Optional<FlowCapableNode>, ReadFailedException> flowNodeFuture =
+ Futures.immediateCheckedFuture(flowNodeOpt);
when(readTx.read(LogicalDatastoreType.OPERATIONAL, nodePath)).thenReturn(flowNodeFuture);
StatisticsGatheringUtils.deleteAllKnownFlows(deviceContext, deviceInfo.getNodeInstanceIdentifier()
.augmentation(FlowCapableNode.class), deviceFlowRegistry);
verify(deviceContext).isTransactionsEnabled();
verify(deviceContext).getReadTransaction();
- verify(deviceContext).writeToTransaction(Mockito.eq(LogicalDatastoreType.OPERATIONAL), Mockito.any(), Mockito.any());
+ verify(deviceContext).writeToTransaction(Mockito.eq(LogicalDatastoreType.OPERATIONAL),
+ Mockito.any(),
+ Mockito.any());
}
}
when(mockedDeviceContext.getDeviceInfo()).thenReturn(mockedDeviceInfo);
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimConnectionContext);
when(mockedDeviceContext.getMessageSpy()).thenReturn(mockedMessagSpy);
- when(mockedDeviceContext.getDeviceFlowRegistry()).thenReturn(new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodePath));
+ when(mockedDeviceContext.getDeviceFlowRegistry())
+ .thenReturn(new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodePath));
when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
when(mockedDeviceContext.getMultiMsgCollector(
Matchers.<RequestContext<List<MultipartReply>>>any())).thenAnswer(
}
/**
- * switching to {@link StatisticsWorkMode#FULLYDISABLED}; no pollTimeout and no lifecycleRegistry
+ * Switching to {@link StatisticsWorkMode#FULLYDISABLED}; no pollTimeout and no lifecycleRegistry.
*
- * @throws Exception
+ * @throws Exception if work mode change failed
*/
@Test
public void testChangeStatisticsWorkMode1() throws Exception {
verify(statisticContext).stopGatheringData();
}
- private static void checkWorkModeChangeOutcome(Future<RpcResult<Void>> workMode) throws InterruptedException, ExecutionException {
+ private static void checkWorkModeChangeOutcome(Future<RpcResult<Void>> workMode)
+ throws InterruptedException, ExecutionException {
Assert.assertTrue(workMode.isDone());
Assert.assertTrue(workMode.get().isSuccessful());
}
-
/**
- * switching to {@link StatisticsWorkMode#FULLYDISABLED}; with pollTimeout and lifecycleRegistry
+ * Switching to {@link StatisticsWorkMode#FULLYDISABLED}; with pollTimeout and lifecycleRegistry.
*
- * @throws Exception
+ * @throws Exception if work mode change failed
*/
@Test
public void testChangeStatisticsWorkMode2() throws Exception {
new ChangeStatisticsWorkModeInputBuilder()
.setMode(StatisticsWorkMode.FULLYDISABLED);
- Future<RpcResult<Void>> workMode = statisticsManager.changeStatisticsWorkMode(changeStatisticsWorkModeInputBld.build());
+ Future<RpcResult<Void>> workMode =
+ statisticsManager.changeStatisticsWorkMode(changeStatisticsWorkModeInputBld.build());
checkWorkModeChangeOutcome(workMode);
verify(itemLifeCycleRegistry).getLifeCycleSources();
}
/**
- * switching to {@link StatisticsWorkMode#FULLYDISABLED} and back
- * to {@link StatisticsWorkMode#COLLECTALL}; with lifecycleRegistry and pollTimeout
+ * Switching to {@link StatisticsWorkMode#FULLYDISABLED} and back
+ * to {@link StatisticsWorkMode#COLLECTALL}; with lifecycleRegistry and pollTimeout.
*
- * @throws Exception
+ * @throws Exception if work mode change failed
*/
@Test
public void testChangeStatisticsWorkMode3() throws Exception {
final StatisticsContext statisticsContext = Mockito.mock(StatisticsContext.class);
final TimeCounter mockTimerCounter = Mockito.mock(TimeCounter.class);
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
verify(mockedDeviceContext).getDeviceState();
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
when(statisticsContext.gatherDynamicData()).thenReturn(Futures.immediateCheckedFuture(Boolean.TRUE));
when(statisticsContext.isSchedulingEnabled()).thenReturn(Boolean.TRUE);
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
verify(mockTimerCounter).markStart();
verify(mockTimerCounter).addTimeMark();
- when(statisticsContext.gatherDynamicData()).thenReturn(Futures.immediateFailedFuture(new Throwable("error msg")));
- statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(), statisticsContext, mockTimerCounter, mockedDeviceInfo);
+ when(statisticsContext.gatherDynamicData())
+ .thenReturn(Futures.immediateFailedFuture(new Throwable("error msg")));
+ statisticsManager.pollStatistics(mockedDeviceContext.getDeviceState(),
+ statisticsContext,
+ mockTimerCounter,
+ mockedDeviceInfo);
verify(mockTimerCounter,times(2)).addTimeMark();
}
* - tm1 at time 2 ms
* - tm2 at time 4 ms
* - tm3 at time 9 ms
- *
* awaited average time:
* - tm1 = 2/1 = 2 ms
* - tm2 = 4/2 = 2 ms
* - tm3 = 9/3 = 3 ms
- *
* But this times are only theoretical if whole test is executed without latency and atomically. Therefore awaited
* average times can't be compared to exact values of awaited average time (therefore == was replaced with >=)
- * @throws Exception
+ * @throws Exception if interrupted
*/
@Test
public void testGetAverageTimeBetweenMarks() throws Exception {
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");
+ findExpectedStatistics(intelligence,
+ "FROM_SWITCH: MSG[String] -> +1 | 1", "TO_SWITCH_ENTERED: MSG[Integer] -> +1 | 1");
}
private void findExpectedStatistics(final List<String> statisticsInfo, String ... expectedValues) {
for (String expectedValue : expectedValues) {
- assertTrue("Expected value " + expectedValue + "wasn't found.", findValueInStatistics(statisticsInfo, expectedValue));
+ assertTrue("Expected value " + expectedValue + "wasn't found.",
+ findValueInStatistics(statisticsInfo, expectedValue));
}
}
}
return false;
}
-
-
}
import org.opendaylight.openflowplugin.impl.rpc.AbstractRequestContext;
import org.opendaylight.yangtools.yang.common.RpcResult;
-/**
- * Created by mirehak on 9/9/15.
- */
public abstract class AbstractSingleStatsServiceTest extends AbstractStatsServiceTest {
@Mock
Mockito.when(rqContextStack.<Object>createRequestContext()).thenReturn(rqContext);
Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(null);
- Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
+ Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector)
+ .endCollecting(Matchers.any(EventIdentifier.class));
}
}
public void init() throws Exception {
Mockito.when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionContext);
Mockito.when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
- Mockito.when(deviceContext.getMultiMsgCollector(Matchers.any(RequestContext.class))).thenReturn(multiMsgCollector);
+ Mockito.when(deviceContext.getMultiMsgCollector(Matchers.any(RequestContext.class)))
+ .thenReturn(multiMsgCollector);
Mockito.when(deviceContext.oook()).thenReturn(translatorLibrary);
Mockito.when(deviceContext.getDeviceState()).thenReturn(deviceState);
Mockito.when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
import org.opendaylight.yangtools.yang.common.RpcResult;
/**
- * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods (failing)
+ * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods (failing).
*/
public class OpendaylightFlowStatisticsServiceImpl1Test extends AbstractStatsServiceTest {
public void setUp() {
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
- flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
+ flowStatisticsService =
+ OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
rqContext = new AbstractRequestContext<Object>(42L) {
@Override
@Test(expected = IllegalAccessError.class)
public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
- GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
+ GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input =
+ new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
.setNode(createNodeRef("unitProt:123"))
.setTableId(new TableId((short) 1));
@Test(expected = IllegalAccessError.class)
public void testGetAllFlowsStatisticsFromAllFlowTables() throws Exception {
- GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
+ GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
+ new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
.setNode(createNodeRef("unitProt:123"));
flowStatisticsService.getAllFlowsStatisticsFromAllFlowTables(input.build());
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
/**
- * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only not delegated method
+ * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only not delegated method.
*/
public class OpendaylightFlowStatisticsServiceImpl2Test extends AbstractStatsServiceTest {
public void setUp() {
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
- flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
+ flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack,
+ deviceContext,
+ convertorManager);
rqContextMp = new AbstractRequestContext<List<MultipartReply>>(42L) {
@Override
}
};
Mockito.when(rqContextStack.<List<MultipartReply>>createRequestContext()).thenReturn(rqContextMp);
- Mockito.when(translatorLibrary.<MultipartReply, AggregatedFlowStatistics>lookupTranslator(Matchers.any(TranslatorKey.class)))
+ Mockito.when(translatorLibrary
+ .<MultipartReply, AggregatedFlowStatistics>lookupTranslator(Matchers.any(TranslatorKey.class)))
.thenReturn(translator);
}
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
.commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
Mockito.doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) throws Throwable {
- final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder()
- .setVersion(OFConstants.OFP_VERSION_1_3);
- rqContextMp.setResult(RpcResultBuilder.success(
- Collections.<MultipartReply>singletonList(messageBuilder.build())).build());
- return null;
- }
- }
- ).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
+ @Override
+ public Void answer(InvocationOnMock invocation) throws Throwable {
+ final MultipartReplyMessageBuilder messageBuilder = new MultipartReplyMessageBuilder()
+ .setVersion(OFConstants.OFP_VERSION_1_3);
+
+ rqContextMp.setResult(RpcResultBuilder
+ .success(Collections.<MultipartReply>singletonList(messageBuilder.build()))
+ .build());
+ return null;
+ }
+ }).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
Mockito.when(translator.translate(
Matchers.any(MultipartReply.class), Matchers.same(deviceInfo), Matchers.isNull())
).thenReturn(new AggregatedFlowStatisticsBuilder().build());
-
GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder input =
new GetAggregateFlowStatisticsFromFlowTableForGivenMatchInputBuilder()
.setNode(createNodeRef("unitProt:123"))
Assert.assertEquals(1, rpcResult.getResult().getAggregatedFlowStatistics().size());
Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
}
-
-
}
\ No newline at end of file
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
/**
- * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods
+ * Test for {@link OpendaylightFlowStatisticsServiceImpl} - only delegated methods.
*/
public class OpendaylightFlowStatisticsServiceImpl3Test extends AbstractStatsServiceTest {
public void setUp() {
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
- flowStatisticsService = OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
+ flowStatisticsService =
+ OpendaylightFlowStatisticsServiceImpl.createWithOook(rqContextStack, deviceContext, convertorManager);
flowStatisticsService.setDelegate(flowStatisticsDelegate);
}
@Test
public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
- GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
+ GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input =
+ new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
.setNode(createNodeRef("unitProt:123"))
.setTableId(new TableId((short) 1))
.build();
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
/**
- * Test for {@link OpendaylightFlowTableStatisticsServiceImpl}
+ * Test for {@link OpendaylightFlowTableStatisticsServiceImpl}.
*/
public class OpendaylightFlowTableStatisticsServiceImplTest extends AbstractSingleStatsServiceTest {
final MultipartRequestInput mpRequest = (MultipartRequestInput) request;
Assert.assertEquals(MultipartType.OFPMPTABLE, mpRequest.getType());
Assert.assertTrue(mpRequest.getMultipartRequestBody() instanceof MultipartRequestTableCase);
- final MultipartRequestTableCase mpRequestBody = (MultipartRequestTableCase) (mpRequest.getMultipartRequestBody());
+ final MultipartRequestTableCase mpRequestBody =
+ (MultipartRequestTableCase) (mpRequest.getMultipartRequestBody());
Assert.assertTrue(mpRequestBody.getMultipartRequestTable().isEmpty());
}
}
\ No newline at end of file
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
/**
- * Test for {@link OpendaylightGroupStatisticsServiceImpl}
+ * Test for {@link OpendaylightGroupStatisticsServiceImpl}.
*/
public class OpendaylightGroupStatisticsServiceImplTest extends AbstractSingleStatsServiceTest {
- private static final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId GROUP_ID =
+ private static final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.common.types.rev130731.GroupId GROUP_ID =
new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId(123L);
@Captor
private ArgumentCaptor<MultipartRequestInput> requestInput;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
/**
- * Test for {@link OpendaylightMeterStatisticsServiceImpl}
+ * Test for {@link OpendaylightMeterStatisticsServiceImpl}.
*/
public class OpendaylightMeterStatisticsServiceImplTest extends AbstractSingleStatsServiceTest {
- private static final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId METER_ID = new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId(123L);
+ private static final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.common.types.rev130731.MeterId METER_ID =
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId(123L);
@Captor
private ArgumentCaptor<MultipartRequestInput> requestInput;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
/**
- * Test for {@link OpendaylightPortStatisticsServiceImpl}
+ * Test for {@link OpendaylightPortStatisticsServiceImpl}.
*/
public class OpendaylightPortStatisticsServiceImplTest extends AbstractSingleStatsServiceTest {
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
/**
- * Test for {@link OpendaylightQueueStatisticsServiceImpl}
+ * Test for {@link OpendaylightQueueStatisticsServiceImpl}.
*/
public class OpendaylightQueueStatisticsServiceImplTest extends AbstractSingleStatsServiceTest {
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInputBuilder;
/**
- * Test of {@link PortStatsService}
+ * Test of {@link PortStatsService}.
*/
public class PortStatsServiceTest extends AbstractStatsServiceTest {
Assert.assertTrue(request instanceof MultipartRequestInput);
final MultipartRequestInput mpRequest = (MultipartRequestInput) request;
Assert.assertTrue(mpRequest.getMultipartRequestBody() instanceof MultipartRequestPortStatsCase);
- final MultipartRequestPortStatsCase mpRequestBody = (MultipartRequestPortStatsCase) mpRequest.getMultipartRequestBody();
+ final MultipartRequestPortStatsCase mpRequestBody =
+ (MultipartRequestPortStatsCase) mpRequest.getMultipartRequestBody();
Assert.assertEquals(12L, mpRequestBody.getMultipartRequestPortStats().getPortNo().longValue());
}
Mockito.when(deviceInfo.getNodeId()).thenReturn(NODE_ID);
Mockito.when(deviceInfo.getVersion()).thenReturn(OFConstants.OFP_VERSION_1_3);
Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(null);
- Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector).endCollecting(Matchers.any(EventIdentifier.class));
+ Mockito.doAnswer(closeRequestFutureAnswer).when(multiMsgCollector)
+ .endCollecting(Matchers.any(EventIdentifier.class));
Mockito.doAnswer(answerVoidToCallback).when(outboundQueueProvider)
.commitEntry(Matchers.eq(42L), requestInput.capture(), Matchers.any(FutureCallback.class));
final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResult = resultFuture.get();
Assert.assertTrue(rpcResult.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
- Mockito.verify(notificationPublishService, Mockito.timeout(500)).offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class));
+ Mockito.verify(notificationPublishService, Mockito.timeout(500))
+ .offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class));
}
-
}
@Test
public void testGetAggregateFlowStatisticsFromFlowTableForAllFlows() throws Exception {
- GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input = new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
+ GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder input =
+ new GetAggregateFlowStatisticsFromFlowTableForAllFlowsInputBuilder()
.setNode(createNodeRef("unitProt:123"))
.setTableId(new TableId((short) 1));
= flowStatisticsServiceDelegate.getAggregateFlowStatisticsFromFlowTableForAllFlows(input.build());
Assert.assertTrue(resultFuture.isDone());
- final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResultCompatible = resultFuture.get();
+ final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResultCompatible =
+ resultFuture.get();
Assert.assertTrue(rpcResultCompatible.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
- Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)).offerNotification(Matchers.any(Notification.class));
+ Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS))
+ .offerNotification(Matchers.any(Notification.class));
}
@Test
Assert.assertTrue(rpcResultCompatible.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPFLOW, requestInput.getValue().getType());
- Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)).offerNotification(Matchers.any(Notification.class));
+ Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS))
+ .offerNotification(Matchers.any(Notification.class));
}
private static RpcResult<Object> buildFlowStatsReply() {
.setApplyActions(new ApplyActionsBuilder()
.setAction(Collections.singletonList(new ActionBuilder()
.setActionChoice(new OutputActionCaseBuilder()
- .setOutputAction(new OutputActionBuilder()
+ .setOutputAction(
+ new OutputActionBuilder()
.setMaxLength(17)
.setPort(new PortNumber(18L))
.build())
@Test
public void testGetAllFlowsStatisticsFromAllFlowTables() throws Exception {
- GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input = new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
+ GetAllFlowsStatisticsFromAllFlowTablesInputBuilder input =
+ new GetAllFlowsStatisticsFromAllFlowTablesInputBuilder()
.setNode(createNodeRef("unitProt:123"));
rpcResult = buildFlowStatsReply();
Assert.assertTrue(rpcResultCompatible.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPFLOW, requestInput.getValue().getType());
- Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)).offerNotification(Matchers.any(Notification.class));
+ Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS))
+ .offerNotification(Matchers.any(Notification.class));
}
@Test
Assert.assertTrue(rpcResultCompatible.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPFLOW, requestInput.getValue().getType());
- Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS)).offerNotification(Matchers.any(Notification.class));
+ Mockito.verify(notificationPublishService, Mockito.timeout(NOTIFICATION_WAIT_TIMEOUT_MS))
+ .offerNotification(Matchers.any(Notification.class));
}
}
@Override
protected void setup() {
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
- statisticsGatheringService = new StatisticsGatheringOnTheFlyService<>(mockedRequestContextStack, mockedDeviceContext, convertorManager, MultipartWriterProviderFactory.createDefaultProvider(mockedDeviceContext));
+ statisticsGatheringService =
+ new StatisticsGatheringOnTheFlyService<>(mockedRequestContextStack,
+ mockedDeviceContext,
+ convertorManager,
+ MultipartWriterProviderFactory
+ .createDefaultProvider(mockedDeviceContext));
Mockito.doReturn(NODE_ID).when(mockedPrimConnectionContext).getNodeId();
Mockito.when(mockedDeviceInfo.getNodeId()).thenReturn(NODE_ID);
Mockito.when(mockedDeviceContext.getDeviceInfo().getNodeId()).thenReturn(NODE_ID);
protected KeyedInstanceIdentifier<Node, NodeKey> nodeInstanceIdentifier;
protected ConvertorManager convertorManager;
protected MultipartWriterProvider multipartWriterProvider;
+
protected static NodeRef createNodeRef(String nodeIdValue) {
InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class)
.child(Node.class, new NodeKey(new NodeId(nodeIdValue)));
@Override
public void setUp() throws Exception {
- service = new FlowDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new FlowDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
final DeviceFlowRegistry registry = mock(DeviceFlowRegistry.class);
when(registry.retrieveDescriptor(any())).thenReturn(FlowDescriptorFactory.create(TABLE_NO, new FlowId("1")));
when(deviceContext.getDeviceFlowRegistry()).thenReturn(registry);
.setByteCount(BigInteger.ONE)
.setPacketCount(BigInteger.ONE)
.setFlags(mock(FlowModFlags.class))
- .setMatch(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder()
+ .setMatch(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.oxm.rev150225.match.grouping.MatchBuilder()
.setMatchEntry(Collections.emptyList())
.build())
.build();
@Override
public void setUp() throws Exception {
- service = new GroupDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new GroupDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override
final MultipartReplyGroupCase groupCase = mock(MultipartReplyGroupCase.class);
final MultipartReplyGroup group = mock(MultipartReplyGroup.class);
final GroupStats groupStat = new GroupStatsBuilder()
- .setGroupId(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId(GROUP_NO))
+ .setGroupId(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.common.types.rev130731.GroupId(GROUP_NO))
.setByteCount(BigInteger.ONE)
.setPacketCount(BigInteger.ONE)
.setBucketStats(Collections.emptyList())
final GetGroupStatisticsOutput output = service.buildReply(input, true);
assertTrue(output.getGroupStats().size() > 0);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats =
- output.getGroupStats().get(0);
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats = output.getGroupStats().get(0);
assertEquals(stats.getGroupId().getValue(), GROUP_NO);
}
@Override
public void testStoreStatistics() throws Exception {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stat = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats.class);
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stat =
+ mock(org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats.class);
when(stat.getGroupId()).thenReturn(new GroupId(GROUP_NO));
- final List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> stats = Arrays.asList(stat);
+ final List<org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> stats = Arrays.asList(stat);
final GetGroupStatisticsOutput output = mock(GetGroupStatisticsOutput.class);
when(output.getGroupStats()).thenReturn(stats);
@Override
public void setUp() throws Exception {
- service = new MeterDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new MeterDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override
final MultipartReplyMeterCase MeterCase = mock(MultipartReplyMeterCase.class);
final MultipartReplyMeter meter = mock(MultipartReplyMeter.class);
final MeterStats meterStat = new MeterStatsBuilder()
- .setMeterId(new org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId(METER_NO))
+ .setMeterId(new org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflow.common.types.rev130731.MeterId(METER_NO))
.setByteInCount(BigInteger.ONE)
.setPacketInCount(BigInteger.ONE)
.setDurationSec(1L)
final GetMeterStatisticsOutput output = service.buildReply(input, true);
assertTrue(output.getMeterStats().size() > 0);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stats =
- output.getMeterStats().get(0);
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stats = output.getMeterStats().get(0);
assertEquals(stats.getMeterId().getValue(), METER_NO);
}
@Override
public void testStoreStatistics() throws Exception {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stat = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats.class);
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stat =
+ mock(org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats.class);
when(stat.getMeterId()).thenReturn(new MeterId(METER_NO));
- final List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats> stats = Arrays.asList(stat);
+ final List<org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats> stats = Arrays.asList(stat);
final GetMeterStatisticsOutput output = mock(GetMeterStatisticsOutput.class);
when(output.getMeterStats()).thenReturn(stats);
@Override
public void setUp() throws Exception {
- service = new PortDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new PortDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override
@Override
public void setUp() throws Exception {
- service = new QueueDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new QueueDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override
@Override
public void setUp() throws Exception {
- service = new FlowDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new FlowDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
final DeviceFlowRegistry registry = mock(DeviceFlowRegistry.class);
when(registry.retrieveDescriptor(any())).thenReturn(FlowDescriptorFactory.create(TABLE_NO, new FlowId("1")));
when(deviceContext.getDeviceFlowRegistry()).thenReturn(registry);
@Override
public void setUp() throws Exception {
- service = new GroupDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new GroupDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override
final GetGroupStatisticsOutput output = service.buildReply(input, true);
assertTrue(output.getGroupStats().size() > 0);
- final org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats =
- output.getGroupStats().get(0);
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stats = output.getGroupStats().get(0);
assertEquals(stats.getGroupId().getValue(), GROUP_NO);
}
@Override
public void testStoreStatistics() throws Exception {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stat = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats.class);
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats stat =
+ mock(org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats.class);
when(stat.getGroupId()).thenReturn(new GroupId(GROUP_NO));
- final List<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> stats = Arrays.asList(stat);
+ final List<org.opendaylight.yang.gen.v1.urn
+ .opendaylight.group.types.rev131018.group.statistics.reply.GroupStats> stats = Arrays.asList(stat);
final GetGroupStatisticsOutput output = mock(GetGroupStatisticsOutput.class);
when(output.getGroupStats()).thenReturn(stats);
@Override
public void setUp() throws Exception {
- service = new MeterDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new MeterDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override
@Override
public void testStoreStatistics() throws Exception {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stat = mock(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats.class);
+ final org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats stat =
+ mock(org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats.class);
when(stat.getMeterId()).thenReturn(new MeterId(METER_NO));
- final List<org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats> stats = Arrays.asList(stat);
+ final List<org.opendaylight.yang.gen.v1.urn
+ .opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats> stats = Arrays.asList(stat);
final GetMeterStatisticsOutput output = mock(GetMeterStatisticsOutput.class);
when(output.getMeterStats()).thenReturn(stats);
@Override
public void setUp() throws Exception {
- service = new PortDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new PortDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override
@Override
public void setUp() throws Exception {
- service = new QueueDirectStatisticsService(requestContextStack, deviceContext, convertorManager, multipartWriterProvider);
+ service = new QueueDirectStatisticsService(requestContextStack,
+ deviceContext,
+ convertorManager,
+ multipartWriterProvider);
}
@Override