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;
24 import com.google.common.util.concurrent.SettableFuture;
28 * org.opendaylight.controller.md.statistics.manager
31 * It represent access point for Device statistics RPC services which are
32 * filtered for needed methods only and they are wrapped in simply way.
33 * Many statistics responses are Multipart messages, so StatRpcMsgManager
34 * provide a functionality to add all multipart msg and provides back whole
35 * stack to listener when listener catch the last Multipart msg.
37 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
39 * Created: Aug 29, 2014
41 public interface StatRpcMsgManager extends Runnable, AutoCloseable {
43 interface RpcJobsQueue extends Callable<Void> {}
46 * Transaction container is definition for Multipart transaction
47 * join container for all Multipart msg with same TransactionId
48 * Input {@link DataObject} is a possible light-weight DataObject
49 * which is used for identification (e.g. Flow-> Priority,Match,Cookie,FlowId)
51 * @param <T> extends TransactionAware -
53 interface TransactionCacheContainer<T extends TransactionAware> {
55 void addNotif(T notification);
57 TransactionId getId();
61 Optional<? extends DataObject> getConfInput();
63 List<T> getNotifications();
67 * Method is used for check a transaction registration
68 * for multipart cache holder
70 * @param TransactionId id
71 * @return true if the transaction has been correctly registered
73 Future<Boolean> isExpectedStatistics(TransactionId id, NodeId nodeId);
76 * Method converts {@link java.util.concurrent.Future} object to listenenable future which
77 * is registered for Multipart Notification Statistics Collecting processing.
79 * @param future - result every Device RPC call
81 <T extends TransactionAware, D extends DataObject> void registrationRpcFutureCallBack(
82 Future<RpcResult<T>> future, D inputObj, NodeRef ref, SettableFuture<TransactionId> resultTransId);
85 * Method adds Notification which is marked as Multipart to the transaction cash
86 * to wait for the last one.
90 <T extends TransactionAware> void addNotification(T notification, NodeId nodeId);
93 * The last Multipart should inform code about possibility to take all previous
94 * messages for next processing. The method take all msg and possible input object
95 * and build all to TransactionCacheContainer Object to return. This process clean
96 * all instances in Cache.
98 * @param TransactionId id
99 * @return TransactionCacheContainer
101 Future<Optional<TransactionCacheContainer<?>>> getTransactionCacheContainer(TransactionId id, NodeId nodeId);
104 * Method wraps OpendaylightGroupStatisticsService.getAllGroupStatistics
105 * and registers to Transaction Cache
107 * @param NodeRef nodeRef
109 Future<TransactionId> getAllGroupsStat(NodeRef nodeRef);
112 * Method wraps OpendaylightGroupStatisticsService.getGroupDescription
113 * and registers to Transaction Cache
115 * @param NodeRef nodeRef
117 Future<TransactionId> getAllGroupsConfStats(NodeRef nodeRef);
120 * Method wraps OpendaylightMeterStatisticsService.getGroupFeatures
121 * and registers to Transaction Cache
123 * @param NodeRef nodeRef
125 void getGroupFeaturesStat(NodeRef nodeRef);
128 * Method wraps OpendaylightMeterStatisticsService.getAllMeterStatistics
129 * and registers to Transaction Cache
131 * @param NodeRef nodeRef
133 Future<TransactionId> getAllMetersStat(NodeRef nodeRef);
136 * Method wraps OpendaylightMeterStatisticsService.getAllMeterConfigStatistics
137 * and registers to Transaction Cache
139 * @param NodeRef nodeRef
141 Future<TransactionId> getAllMeterConfigStat(NodeRef nodeRef);
144 * Method wraps OpendaylightMeterStatisticsService.getMeterFeatures
145 * and registers to Transaction Cache
147 * @param NodeRef nodeRef
149 void getMeterFeaturesStat(NodeRef nodeRef);
152 * Method wraps OpendaylightFlowStatisticsService.getAllFlowsStatisticsFromAllFlowTables
153 * and registers to Transaction Cache
155 * @param NodeRef nodeRef
157 Future<TransactionId> getAllFlowsStat(NodeRef nodeRef);
160 * Method wraps OpendaylightFlowStatisticsService.getAggregateFlowStatisticsFromFlowTableForAllFlows
161 * and registers to Transaction Cache
163 * @param NodeRef nodeRef
164 * @param TableId tableId
166 void getAggregateFlowStat(NodeRef nodeRef, TableId tableId);
169 * Method wraps OpendaylightPortStatisticsService.getAllNodeConnectorsStatistics
170 * and registers to Transaction Cache
172 * @param NodeRef nodeRef
174 Future<TransactionId> getAllPortsStat(NodeRef nodeRef);
177 * Method wraps OpendaylightFlowTableStatisticsService.getFlowTablesStatistics
178 * and registers to Transaction Cache
180 * @param NodeRef nodeRef
182 Future<TransactionId> getAllTablesStat(NodeRef nodeRef);
185 * Method wraps OpendaylightQueueStatisticsService.getAllQueuesStatisticsFromAllPorts
186 * and registers to Transaction Cache
188 * @param NodeRef nodeRef
190 Future<TransactionId> getAllQueueStat(NodeRef nodeRef);