X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fstatistics-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fstatistics%2Fmanager%2FFlowTableStatsTracker.java;h=2e850580416084c36a1de4c054d21a7860b8d394;hb=67d58d1ab50f3c3bbe19a96fb6f0d9d94211829f;hp=4136b3d0e4e466dab95ce1e0c91c319c86b49e45;hpb=fd3193d2efe85828156e6a670b5c06a0ea485a98;p=controller.git diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/FlowTableStatsTracker.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/FlowTableStatsTracker.java index 4136b3d0e4..2e85058041 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/FlowTableStatsTracker.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/FlowTableStatsTracker.java @@ -21,22 +21,19 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.GetFlowTablesStatisticsInputBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsService; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap; +import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMapBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatisticsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; -import com.google.common.base.Preconditions; -import com.google.common.util.concurrent.ListenableFuture; - final class FlowTableStatsTracker extends AbstractStatsTracker { private final Set privateTables = new ConcurrentSkipListSet<>(); private final Set tables = Collections.unmodifiableSet(privateTables); private final OpendaylightFlowTableStatisticsService flowTableStatsService; - FlowTableStatsTracker(OpendaylightFlowTableStatisticsService flowTableStatsService, final FlowCapableContext context, long lifetimeNanos) { - super(context, lifetimeNanos); - this.flowTableStatsService = Preconditions.checkNotNull(flowTableStatsService); + FlowTableStatsTracker(OpendaylightFlowTableStatisticsService flowTableStatsService, final FlowCapableContext context) { + super(context); + this.flowTableStatsService = flowTableStatsService; } Set getTables() { @@ -65,10 +62,21 @@ final class FlowTableStatsTracker extends AbstractStatsTracker request() { - final GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder(); - input.setNode(getNodeRef()); + @Override + public void request() { + if (flowTableStatsService != null) { + final GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder(); + input.setNode(getNodeRef()); - return requestHelper(flowTableStatsService.getFlowTablesStatistics(input.build())); + requestHelper(flowTableStatsService.getFlowTablesStatistics(input.build())); + } + } + + @Override + protected FlowTableAndStatisticsMap createInvariantKey(FlowTableAndStatisticsMap item) { + FlowTableAndStatisticsMapBuilder flowTableAndStatisticsMapBuilder = new FlowTableAndStatisticsMapBuilder(); + flowTableAndStatisticsMapBuilder.setTableId(item.getTableId()); + flowTableAndStatisticsMapBuilder.setKey(item.getKey()); + return flowTableAndStatisticsMapBuilder.build(); } }