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.controller.md.statistics.manager;
11 import java.util.List;
12 import java.util.concurrent.Callable;
13 import java.util.concurrent.Future;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionAware;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
20 import org.opendaylight.yangtools.yang.binding.DataObject;
21 import org.opendaylight.yangtools.yang.common.RpcResult;
23 import com.google.common.base.Optional;
27 * org.opendaylight.controller.md.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 extends Runnable, AutoCloseable {
42 interface RpcJobsQueue extends Callable<Void> {}
45 * Transaction container is definition for Multipart transaction
46 * join container for all Multipart msg with same TransactionId
47 * Input {@link DataObject} is a possible light-weight DataObject
48 * which is used for identification (e.g. Flow-> Priority,Match,Cookie,FlowId)
50 * @param <T> extends TransactionAware -
52 interface TransactionCacheContainer<T extends TransactionAware> {
54 void addNotif(T notification);
56 TransactionId getId();
60 Optional<? extends DataObject> getConfInput();
62 List<T> getNotifications();
66 * Method is used for check a transaction registration
67 * for multipart cache holder
69 * @param TransactionId id
70 * @return true if the transaction has been correctly registered
72 Future<Boolean> isExpectedStatistics(TransactionId id, NodeId nodeId);
75 * Method converts {@link java.util.concurrent.Future} object to listenenable future which
76 * is registered for Multipart Notification Statistics Collecting processing.
78 * @param future - result every Device RPC call
80 <T extends TransactionAware, D extends DataObject> void registrationRpcFutureCallBack(Future<RpcResult<T>> future, D inputObj, NodeRef ref);
83 * Method adds Notification which is marked as Multipart to the transaction cash
84 * to wait for the last one.
88 <T extends TransactionAware> void addNotification(T notification, NodeId nodeId);
91 * The last Multipart should inform code about possibility to take all previous
92 * messages for next processing. The method take all msg and possible input object
93 * and build all to TransactionCacheContainer Object to return. This process clean
94 * all instances in Cache.
96 * @param TransactionId id
97 * @return TransactionCacheContainer
99 Future<Optional<TransactionCacheContainer<?>>> getTransactionCacheContainer(TransactionId id, NodeId nodeId);
102 * Method wraps OpendaylightGroupStatisticsService.getAllGroupStatistics
103 * and registers to Transaction Cache
105 * @param NodeRef nodeRef
107 void getAllGroupsStat(NodeRef nodeRef);
110 * Method wraps OpendaylightGroupStatisticsService.getGroupDescription
111 * and registers to Transaction Cache
113 * @param NodeRef nodeRef
115 void getAllGroupsConfStats(NodeRef nodeRef);
118 * Method wraps OpendaylightMeterStatisticsService.getGroupFeatures
119 * and registers to Transaction Cache
121 * @param NodeRef nodeRef
123 void getGroupFeaturesStat(NodeRef nodeRef);
126 * Method wraps OpendaylightMeterStatisticsService.getAllMeterStatistics
127 * and registers to Transaction Cache
129 * @param NodeRef nodeRef
131 void getAllMetersStat(NodeRef nodeRef);
134 * Method wraps OpendaylightMeterStatisticsService.getAllMeterConfigStatistics
135 * and registers to Transaction Cache
137 * @param NodeRef nodeRef
139 void getAllMeterConfigStat(NodeRef nodeRef);
142 * Method wraps OpendaylightMeterStatisticsService.getMeterFeatures
143 * and registers to Transaction Cache
145 * @param NodeRef nodeRef
147 void getMeterFeaturesStat(NodeRef nodeRef);
150 * Method wraps OpendaylightFlowStatisticsService.getAllFlowsStatisticsFromAllFlowTables
151 * and registers to Transaction Cache
153 * @param NodeRef nodeRef
155 void getAllFlowsStat(NodeRef nodeRef);
158 * Method wraps OpendaylightFlowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows
159 * and registers to Transaction Cache
161 * @param NodeRef nodeRef
162 * @param TableId tableId
164 void getAggregateFlowStat(NodeRef nodeRef, TableId tableId);
167 * Method wraps OpendaylightPortStatisticsService.getAllNodeConnectorsStatistics
168 * and registers to Transaction Cache
170 * @param NodeRef nodeRef
172 void getAllPortsStat(NodeRef nodeRef);
175 * Method wraps OpendaylightFlowTableStatisticsService.getFlowTablesStatistics
176 * and registers to Transaction Cache
178 * @param NodeRef nodeRef
180 void getAllTablesStat(NodeRef nodeRef);
183 * Method wraps OpendaylightQueueStatisticsService.getAllQueuesStatisticsFromAllPorts
184 * and registers to Transaction Cache
186 * @param NodeRef nodeRef
188 void getAllQueueStat(NodeRef nodeRef);