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 java.util.concurrent.Future;
11 import java.util.concurrent.atomic.AtomicLong;
12 import org.opendaylight.controller.md.sal.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;
38 public class OpendaylightFlowStatisticsServiceDelegateImpl implements OpendaylightFlowStatisticsService {
40 private static final Logger LOG = LoggerFactory.getLogger(OpendaylightFlowStatisticsServiceDelegateImpl.class);
42 private final AggregateFlowsInTableService aggregateFlowsInTable;
43 private final AllFlowsInAllTablesService allFlowsInAllTables;
44 private final AllFlowsInTableService allFlowsInTable;
45 private final FlowsInTableService flowsInTable;
46 private final NotificationPublishService notificationService;
48 public OpendaylightFlowStatisticsServiceDelegateImpl(final RequestContextStack requestContextStack,
49 final DeviceContext deviceContext,
50 final NotificationPublishService notificationService,
51 final AtomicLong compatibilityXidSeed,
52 final ConvertorExecutor convertorExecutor) {
53 this.notificationService = notificationService;
54 aggregateFlowsInTable = AggregateFlowsInTableService.createWithOook(requestContextStack, deviceContext, compatibilityXidSeed);
55 allFlowsInAllTables = new AllFlowsInAllTablesService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
56 allFlowsInTable = new AllFlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
57 flowsInTable = new FlowsInTableService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
61 * @deprecated this is the only method with real implementation provided, in delegate it makes no sense
65 public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForGivenMatchOutput>> getAggregateFlowStatisticsFromFlowTableForGivenMatch(
66 final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
67 throw new IllegalAccessError("unsupported by backward compatibility delegate service " +
68 "- this rpc is always provided by default service implementation");
72 public Future<RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput>> getAggregateFlowStatisticsFromFlowTableForAllFlows(
73 final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) {
74 return aggregateFlowsInTable.handleAndNotify(input, notificationService);
78 public Future<RpcResult<GetAllFlowStatisticsFromFlowTableOutput>> getAllFlowStatisticsFromFlowTable(
79 final GetAllFlowStatisticsFromFlowTableInput input) {
80 return allFlowsInTable.handleAndNotify(input, notificationService);
84 public Future<RpcResult<GetAllFlowsStatisticsFromAllFlowTablesOutput>> getAllFlowsStatisticsFromAllFlowTables(
85 final GetAllFlowsStatisticsFromAllFlowTablesInput input) {
86 return allFlowsInAllTables.handleAndNotify(input, notificationService);
90 public Future<RpcResult<GetFlowStatisticsFromFlowTableOutput>> getFlowStatisticsFromFlowTable(
91 final GetFlowStatisticsFromFlowTableInput input) {
92 return flowsInTable.handleAndNotify(input, notificationService);