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.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetAllNodeConnectorsStatisticsOutput;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsInput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.GetNodeConnectorStatisticsOutput;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsService;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
22 public class OpendaylightPortStatisticsServiceImpl implements OpendaylightPortStatisticsService {
23 private final AllPortStatsService allPortStats;
24 private final PortStatsService portStats;
25 private final NotificationPublishService notificationPublishService;
27 public OpendaylightPortStatisticsServiceImpl(final RequestContextStack requestContextStack,
28 final DeviceContext deviceContext,
29 final AtomicLong compatibilityXidSeed,
30 final NotificationPublishService notificationPublishService) {
31 this.notificationPublishService = notificationPublishService;
32 allPortStats = new AllPortStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
33 portStats = new PortStatsService(requestContextStack, deviceContext, compatibilityXidSeed);
37 public ListenableFuture<RpcResult<GetAllNodeConnectorsStatisticsOutput>> getAllNodeConnectorsStatistics(
38 final GetAllNodeConnectorsStatisticsInput input) {
39 return allPortStats.handleAndNotify(input, notificationPublishService);
43 public ListenableFuture<RpcResult<GetNodeConnectorStatisticsOutput>> getNodeConnectorStatistics(
44 final GetNodeConnectorStatisticsInput input) {
45 return portStats.handleAndNotify(input, notificationPublishService);