2 * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowplugin.impl.statistics.services.compatibility;
10 import com.google.common.util.concurrent.ListenableFuture;
11 import java.util.concurrent.atomic.AtomicLong;
12 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
13 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
14 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
15 import org.opendaylight.openflowplugin.impl.statistics.services.AggregateFlowsInTableService;
16 import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInAllTablesService;
17 import org.opendaylight.openflowplugin.impl.statistics.services.AllFlowsInTableService;
18 import org.opendaylight.openflowplugin.impl.statistics.services.FlowsInTableService;
19 import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableInput;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowStatisticsFromFlowTableOutput;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesInput;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetAllFlowsStatisticsFromAllFlowTablesOutput;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableInput;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.GetFlowStatisticsFromFlowTableOutput;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsService;
31 import org.opendaylight.yangtools.yang.common.RpcResult;
32 import org.slf4j.Logger;
33 import org.slf4j.LoggerFactory;
35 public class OpendaylightFlowStatisticsServiceDelegateImpl implements OpendaylightFlowStatisticsService {
37 private static final Logger LOG = LoggerFactory.getLogger(OpendaylightFlowStatisticsServiceDelegateImpl.class);
39 private final AggregateFlowsInTableService aggregateFlowsInTable;
40 private final AllFlowsInAllTablesService allFlowsInAllTables;
41 private final AllFlowsInTableService allFlowsInTable;
42 private final FlowsInTableService flowsInTable;
43 private final NotificationPublishService notificationService;
45 public OpendaylightFlowStatisticsServiceDelegateImpl(final RequestContextStack requestContextStack,
46 final DeviceContext deviceContext,
47 final NotificationPublishService notificationService,
48 final AtomicLong compatibilityXidSeed,
49 final ConvertorExecutor convertorExecutor) {
50 this.notificationService = notificationService;
51 aggregateFlowsInTable =
52 AggregateFlowsInTableService.createWithOook(requestContextStack, deviceContext, compatibilityXidSeed);
53 allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack,
58 new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
60 new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
64 * Get statistics for the given match.
66 * @deprecated this is the only method with real implementation provided, in delegate it makes no sense.
70 public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>>
71 getAggregateFlowStatisticsFromFlowTableForGivenMatch(
72 final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
73 throw new IllegalAccessError("unsupported by backward compatibility delegate service "
74 + "- this rpc is always provided by default service implementation");
78 public ListenableFuture<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>>
79 getAggregateFlowStatisticsFromFlowTableForAllFlows(
80 final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
81 return aggregateFlowsInTable.handleAndNotify(input, notificationService);
85 public ListenableFuture<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
86 final GetAllFlowStatisticsFromFlowTableInput input) {
87 return allFlowsInTable.handleAndNotify(input, notificationService);
91 public ListenableFuture<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>>
92 getAllFlowsStatisticsFromAllFlowTables(final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
93 return allFlowsInAllTables.handleAndNotify(input, notificationService);
97 public ListenableFuture<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
98 final GetFlowStatisticsFromFlowTableInput input) {
99 return flowsInTable.handleAndNotify(input, notificationService);