91a9f44ff82d3a2a3749dc4812bb2a551b1c4bd9
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightQueueStatisticsServiceImpl.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 com.google.common.util.concurrent.ListenableFuture;
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.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromAllPortsOutput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetAllQueuesStatisticsFromGivenPortOutput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortInput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.GetQueueStatisticsFromGivenPortOutput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsService;
22 import org.opendaylight.yangtools.yang.common.RpcResult;
23
24 public class OpendaylightQueueStatisticsServiceImpl implements OpendaylightQueueStatisticsService {
25     private final AllQueuesAllPortsService allQueuesAllPorts;
26     private final AllQueuesOnePortService allQueuesOnePort;
27     private final OneQueueOnePortService oneQueueOnePort;
28     private final NotificationPublishService notificationPublishService;
29
30     public OpendaylightQueueStatisticsServiceImpl(final RequestContextStack requestContextStack,
31                                                   final DeviceContext deviceContext,
32                                                   final AtomicLong compatibilityXidSeed,
33                                                   final NotificationPublishService notificationPublishService) {
34         this.notificationPublishService = notificationPublishService;
35         allQueuesAllPorts = new AllQueuesAllPortsService(requestContextStack, deviceContext, compatibilityXidSeed);
36         allQueuesOnePort = new AllQueuesOnePortService(requestContextStack, deviceContext, compatibilityXidSeed);
37         oneQueueOnePort = new OneQueueOnePortService(requestContextStack, deviceContext, compatibilityXidSeed);
38     }
39
40     @Override
41     public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromAllPortsOutput>> getAllQueuesStatisticsFromAllPorts(
42             final GetAllQueuesStatisticsFromAllPortsInput input) {
43         return allQueuesAllPorts.handleAndNotify(input, notificationPublishService);
44     }
45
46     @Override
47     public ListenableFuture<RpcResult<GetAllQueuesStatisticsFromGivenPortOutput>> getAllQueuesStatisticsFromGivenPort(
48             final GetAllQueuesStatisticsFromGivenPortInput input) {
49         return allQueuesOnePort.handleAndNotify(input, notificationPublishService);
50     }
51
52     @Override
53     public ListenableFuture<RpcResult<GetQueueStatisticsFromGivenPortOutput>> getQueueStatisticsFromGivenPort(
54             final GetQueueStatisticsFromGivenPortInput input) {
55         return oneQueueOnePort.handleAndNotify(input, notificationPublishService);
56     }
57 }