Merge "Bug 5914 - Flow statistics don't show up on the same flow id, if flow uses...
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightGroupStatisticsServiceImpl.java
1 /**
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.openflowplugin.impl.statistics.services;
9
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.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetAllGroupStatisticsOutput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupDescriptionOutput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesInput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupFeaturesOutput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsInput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GetGroupStatisticsOutput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsService;
24 import org.opendaylight.yangtools.yang.common.RpcResult;
25
26 /**
27  * @author joe
28  */
29 public class OpendaylightGroupStatisticsServiceImpl implements OpendaylightGroupStatisticsService {
30     private final AllGroupsStatsService allGroups;
31     private final GroupDescriptionService groupDesc;
32     private final GroupFeaturesService groupFeat;
33     private final GroupStatsService groupStats;
34     private final NotificationPublishService notificationPublishService;
35
36     public OpendaylightGroupStatisticsServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext,
37                                                   final AtomicLong compatibilityXidSeed,
38                                                   final NotificationPublishService notificationPublishService) {
39         this.notificationPublishService = notificationPublishService;
40         allGroups = new AllGroupsStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
41         groupDesc = new GroupDescriptionService(requestContextStack, deviceContext, compatibilityXidSeed);
42         groupFeat = new GroupFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
43         groupStats = new GroupStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
44     }
45
46     @Override
47     public Future<RpcResult<GetAllGroupStatisticsOutput>> getAllGroupStatistics(final GetAllGroupStatisticsInput input) {
48         return allGroups.handleAndNotify(input, notificationPublishService);
49     }
50
51     @Override
52     public Future<RpcResult<GetGroupDescriptionOutput>> getGroupDescription(final GetGroupDescriptionInput input) {
53         return groupDesc.handleAndNotify(input, notificationPublishService);
54     }
55
56     @Override
57     public Future<RpcResult<GetGroupFeaturesOutput>> getGroupFeatures(final GetGroupFeaturesInput input) {
58         return groupFeat.handleAndNotify(input, notificationPublishService);
59     }
60
61     @Override
62     public Future<RpcResult<GetGroupStatisticsOutput>> getGroupStatistics(final GetGroupStatisticsInput input) {
63         return groupStats.handleAndNotify(input, notificationPublishService);
64     }
65 }