Merge "Added support for TCP and UDP port mask in Nicira extention"
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / statistics / services / OpendaylightMeterStatisticsServiceImpl.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.meter.statistics.rev131111.GetAllMeterConfigStatisticsInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterConfigStatisticsOutput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetAllMeterStatisticsOutput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesInput;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterFeaturesOutput;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsInput;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.GetMeterStatisticsOutput;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsService;
24 import org.opendaylight.yangtools.yang.common.RpcResult;
25
26 public class OpendaylightMeterStatisticsServiceImpl implements OpendaylightMeterStatisticsService {
27     private final AllMeterConfigStatsService allMeterConfig;
28     private final AllMeterStatsService allMeterStats;
29     private final MeterFeaturesService meterFeatures;
30     private final MeterStatsService meterStats;
31     private final NotificationPublishService notificationPublishService;
32
33     public OpendaylightMeterStatisticsServiceImpl(final RequestContextStack requestContextStack,
34                                                   final DeviceContext deviceContext,
35                                                   final AtomicLong compatibilityXidSeed,
36                                                   final NotificationPublishService notificationPublishService) {
37         this.notificationPublishService = notificationPublishService;
38
39         allMeterConfig = new AllMeterConfigStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
40         allMeterStats = new AllMeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
41         meterFeatures = new MeterFeaturesService(requestContextStack, deviceContext, compatibilityXidSeed);
42         meterStats = new MeterStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
43     }
44
45     @Override
46     public Future<RpcResult<GetAllMeterConfigStatisticsOutput>> getAllMeterConfigStatistics(
47             final GetAllMeterConfigStatisticsInput input) {
48         return allMeterConfig.handleAndNotify(input, notificationPublishService);
49     }
50
51     @Override
52     public Future<RpcResult<GetAllMeterStatisticsOutput>> getAllMeterStatistics(final GetAllMeterStatisticsInput input) {
53         return allMeterStats.handleAndNotify(input, notificationPublishService);
54     }
55
56     @Override
57     public Future<RpcResult<GetMeterFeaturesOutput>> getMeterFeatures(final GetMeterFeaturesInput input) {
58         return meterFeatures.handleAndNotify(input, notificationPublishService);
59     }
60
61     @Override
62     public Future<RpcResult<GetMeterStatisticsOutput>> getMeterStatistics(final GetMeterStatisticsInput input) {
63         return meterStats.handleAndNotify(input, notificationPublishService);
64     }
65 }