2 * Copyright (c) 2014 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
9 package org.opendaylight.openflowplugin.applications.statistics.manager;
11 import java.util.List;
12 import java.util.concurrent.Future;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionAware;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
19 import org.opendaylight.yangtools.yang.binding.DataObject;
20 import org.opendaylight.yangtools.yang.common.RpcResult;
22 import com.google.common.base.Optional;
23 import com.google.common.util.concurrent.SettableFuture;
27 * org.opendaylight.openflowplugin.applications.statistics.manager
30 * It represent access point for Device statistics RPC services which are
31 * filtered for needed methods only and they are wrapped in simply way.
32 * Many statistics responses are Multipart messages, so StatRpcMsgManager
33 * provide a functionality to add all multipart msg and provides back whole
34 * stack to listener when listener catch the last Multipart msg.
36 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
38 * Created: Aug 29, 2014
40 public interface StatRpcMsgManager {
42 * Transaction container is definition for Multipart transaction
43 * join container for all Multipart msg with same TransactionId
44 * Input {@link DataObject} is a possible light-weight DataObject
45 * which is used for identification (e.g. Flow -> Priority,Match,Cookie,FlowId)
49 interface TransactionCacheContainer<T extends TransactionAware> {
51 void addNotif(T notification);
53 TransactionId getId();
57 Optional<? extends DataObject> getConfInput();
59 List<T> getNotifications();
63 * Method is used for check a transaction registration
64 * for multipart cache holder
67 * @return true if the transaction has been correctly registered
69 Future<Boolean> isExpectedStatistics(TransactionId id, NodeId nodeId);
72 * Method converts {@link java.util.concurrent.Future} object to listenenable future which
73 * is registered for Multipart Notification Statistics Collecting processing.
75 * @param future - result every Device RPC call
77 <T extends TransactionAware, D extends DataObject> void registrationRpcFutureCallBack(
78 Future<RpcResult<T>> future, D inputObj, NodeRef ref, SettableFuture<TransactionId> resultTransId);
81 * Method adds Notification which is marked as Multipart to the transaction cash
82 * to wait for the last one.
86 <T extends TransactionAware> void addNotification(T notification, NodeId nodeId);
89 * The last Multipart should inform code about possibility to take all previous
90 * messages for next processing. The method take all msg and possible input object
91 * and build all to TransactionCacheContainer Object to return. This process clean
92 * all instances in Cache.
95 * @return TransactionCacheContainer
97 Future<Optional<TransactionCacheContainer<?>>> getTransactionCacheContainer(TransactionId id, NodeId nodeId);
100 * Method wraps OpendaylightGroupStatisticsService.getAllGroupStatistics
101 * and registers to Transaction Cache
105 Future<TransactionId> getAllGroupsStat(NodeRef nodeRef);
108 * Method wraps OpendaylightGroupStatisticsService.getGroupDescription
109 * and registers to Transaction Cache
113 Future<TransactionId> getAllGroupsConfStats(NodeRef nodeRef);
116 * Method wraps OpendaylightMeterStatisticsService.getGroupFeatures
117 * and registers to Transaction Cache
121 void getGroupFeaturesStat(NodeRef nodeRef);
124 * Method wraps OpendaylightMeterStatisticsService.getAllMeterStatistics
125 * and registers to Transaction Cache
129 Future<TransactionId> getAllMetersStat(NodeRef nodeRef);
132 * Method wraps OpendaylightMeterStatisticsService.getAllMeterConfigStatistics
133 * and registers to Transaction Cache
137 Future<TransactionId> getAllMeterConfigStat(NodeRef nodeRef);
140 * Method wraps OpendaylightMeterStatisticsService.getMeterFeatures
141 * and registers to Transaction Cache
145 void getMeterFeaturesStat(NodeRef nodeRef);
148 * Method wraps OpendaylightFlowStatisticsService.getAllFlowsStatisticsFromAllFlowTables
149 * and registers to Transaction Cache
153 Future<TransactionId> getAllFlowsStat(NodeRef nodeRef);
156 * Method wraps OpendaylightFlowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows
157 * and registers to Transaction Cache
162 void getAggregateFlowStat(NodeRef nodeRef, TableId tableId);
165 * Method wraps OpendaylightPortStatisticsService.getAllNodeConnectorsStatistics
166 * and registers to Transaction Cache
170 Future<TransactionId> getAllPortsStat(NodeRef nodeRef);
173 * Method wraps OpendaylightFlowTableStatisticsService.getFlowTablesStatistics
174 * and registers to Transaction Cache
178 Future<TransactionId> getAllTablesStat(NodeRef nodeRef);
181 * Method wraps OpendaylightQueueStatisticsService.getAllQueuesStatisticsFromAllPorts
182 * and registers to Transaction Cache
186 Future<TransactionId> getAllQueueStat(NodeRef nodeRef);