-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
*/
package org.opendaylight.openflowplugin.impl.statistics.services;
+import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicLong;
-import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
+import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
+import org.opendaylight.openflowplugin.impl.services.util.RequestInputUtils;
+import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter32;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.Counter64;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInput;
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
- public Future<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
+ public ListenableFuture<RpcResult<GetFlowTablesStatisticsOutput>> getFlowTablesStatistics(
final GetFlowTablesStatisticsInput input) {
return handleAndNotify(input, notificationPublishService);
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetFlowTablesStatisticsInput input) {
+ 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(getDeviceContext().getDeviceState().getNodeId());
+ notification.setId(getDeviceInfo().getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
MultipartReplyTable replyBody = caseBody.getMultipartReplyTable();
List<TableStats> swTablesStats = replyBody.getTableStats();
+ //TODO: Duplicate code: look at MultiReplyTranslatorUtil method translateTable
for (TableStats swTableStats : swTablesStats) {
FlowTableAndStatisticsMapBuilder statisticsBuilder = new FlowTableAndStatisticsMapBuilder();
statisticsBuilder.setActiveFlows(new Counter32(swTableStats.getActiveCount()));