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;
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.openflow.md.core.sal.convertor.ConvertorExecutor;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsService;
25 import org.opendaylight.yangtools.yang.common.RpcResult;
27 public class OpendaylightGroupStatisticsServiceImpl implements OpendaylightGroupStatisticsService {
28 private final AllGroupsStatsService allGroups;
29 private final GroupDescriptionService groupDesc;
30 private final GroupFeaturesService groupFeat;
31 private final GroupStatsService groupStats;
32 private final NotificationPublishService notificationPublishService;
34 public OpendaylightGroupStatisticsServiceImpl(final RequestContextStack requestContextStack,
35 final DeviceContext deviceContext,
36 final AtomicLong compatibilityXidSeed,
37 final NotificationPublishService notificationPublishService,
38 final ConvertorExecutor convertorExecutor) {
39 this.notificationPublishService = notificationPublishService;
41 new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
42 groupDesc = new GroupDescriptionService(requestContextStack,
46 groupFeat = new GroupFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
47 groupStats = new GroupStatsService(requestContextStack, deviceContext, compatibilityXidSeed, convertorExecutor);
51 public ListenableFuture<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(
52 final GetAllGroupStatisticsInput input) {
53 return allGroups.handleAndNotify(input, notificationPublishService);
57 public ListenableFuture<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(
58 final GetGroupDescriptionInput input) {
59 return groupDesc.handleAndNotify(input, notificationPublishService);
63 public ListenableFuture<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
64 return groupFeat.handleAndNotify(input, notificationPublishService);
68 public ListenableFuture<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(
69 final GetGroupStatisticsInput input) {
70 return groupStats.handleAndNotify(input, notificationPublishService);