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;
13 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
14 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
15 import org.opendaylight.controller.md.statistics.manager.StatPermCollector.StatCapabTypes;
16 import org.opendaylight.controller.md.statistics.manager.impl.StatisticsManagerConfig;
17 import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
18 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsListener;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
29 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsListener;
30 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener;
31 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsListener;
32 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
36 * org.opendaylight.controller.md.statistics.manager
39 * It represent a central point for whole module. Implementation
40 * StatisticsManager registers all Operation/DS {@link StatNotifyCommiter} and
41 * Config/DS {@StatListeningCommiter}, as well as {@link StatPermCollector}
42 * for statistic collecting and {@link StatRpcMsgManager} as Device RPCs provider.
43 * In next, StatisticsManager provides all DS contact Transaction services.
45 * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
47 * Created: Aug 27, 2014
49 public interface StatisticsManager extends AutoCloseable, TransactionChainListener {
52 * StatDataStoreOperation
53 * Interface represent functionality to submit changes to DataStore.
54 * Internal {@link TransactionChainListener} joining all DS commits
55 * to Set of chained changes for prevent often DataStore touches.
57 public abstract class StatDataStoreOperation {
58 public enum StatsManagerOperationType {
60 * Operation will carry out work related to new node addition /
65 * Operation will carry out work related to node removal
69 * Operation will commit data to the operational data store
74 private NodeId nodeId;
75 private StatsManagerOperationType operationType = StatsManagerOperationType.DATA_COMMIT_OPER_DS;
77 public StatDataStoreOperation(final StatsManagerOperationType operType, final NodeId id){
79 operationType = operType;
84 public final StatsManagerOperationType getType() {
88 public final NodeId getNodeId(){
93 * Apply all read / write (put|merge) operation for DataStore
95 * @param {@link ReadWriteTransaction} tx
97 public abstract void applyOperation(ReadWriteTransaction tx);
102 * Method starts whole StatisticManager functionality
104 * @param {@link NotificationProviderService} notifService
105 * @param {@link RpcConsumerRegistry} rpcRegistry
106 * @param minReqNetMonitInt
108 void start(final NotificationProviderService notifService,
109 final RpcConsumerRegistry rpcRegistry);
112 * Method provides read/write DataStore functionality cross applyOperation
113 * defined in {@link StatDataStoreOperation}
115 * @param inventoryOper - operation for DataStore
117 void enqueue(final StatDataStoreOperation inventoryOper);
120 * Method wraps {@link StatisticCollector}.isProvidedFlowNodeActive method
121 * to provide parallel statCollection process for Set of Nodes. So it has to
122 * identify correct Node Set by NodeIdentifier
126 boolean isProvidedFlowNodeActive(InstanceIdentifier<Node> nodeIdent);
129 * Method wraps {@link StatPermCollector}.collectNextStatistics to provide
130 * parallel statCollection process for Set of Nodes. So it has to
131 * identify correct Node Set by NodeIdentifier.
135 void collectNextStatistics(InstanceIdentifier<Node> nodeIdent, TransactionId xid);
138 * Method wraps {@link StatPermCollector}.connectedNodeRegistration to provide
139 * parallel statCollection process for Set of Nodes. So it has to
140 * connect node to new or not full Node statCollector Set.
144 * @param nrOfSwitchTables
146 void connectedNodeRegistration(InstanceIdentifier<Node> nodeIdent,
147 List<StatCapabTypes> statTypes, Short nrOfSwitchTables);
150 * Method wraps {@link StatPermCollector}.disconnectedNodeUnregistration to provide
151 * parallel statCollection process for Set of Nodes. So it has to identify
152 * correct collector for disconnect node.
156 void disconnectedNodeUnregistration(InstanceIdentifier<Node> nodeIdent);
159 * Method wraps {@link StatPermCollector}.registerAdditionalNodeFeature to provide
160 * possibility to register additional Node Feature {@link StatCapabTypes} for
161 * statistics collecting.
166 void registerAdditionalNodeFeature(InstanceIdentifier<Node> nodeIdent, StatCapabTypes statCapab);
169 * Method provides access to Device RPC methods by wrapped
170 * internal method. In next {@link StatRpcMsgManager} is registered all
171 * Multipart device msg response and joining all to be able run all
172 * collected statistics in one time (easy identification Data for delete)
174 * @return {@link StatRpcMsgManager}
176 StatRpcMsgManager getRpcMsgManager();
179 * Define Method : {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode}
180 * Operational/DS data change listener -> impl. target -> register FlowCapableNode to Statistic Collecting process
181 * @return {@link StatNodeRegistration}
183 StatNodeRegistration getNodeRegistrator();
186 * Define Method : Flow Config/DS data change listener -> impl. target ->
187 * -> make pair between Config/DS FlowId and Device Flow response Hash
190 StatListeningCommiter<Flow, OpendaylightFlowStatisticsListener> getFlowListenComit();
193 * Define Method : Meter Config/DS data change listener and Operation/DS notify commit
197 StatListeningCommiter<Meter, OpendaylightMeterStatisticsListener> getMeterListenCommit();
200 * Define Method : Group Config/DS data change listener and Operation/DS notify commit
204 StatListeningCommiter<Group, OpendaylightGroupStatisticsListener> getGroupListenCommit();
207 * Define Method : Queue Config/DS change listener and Operation/DS notify commit functionality
210 StatListeningCommiter<Queue, OpendaylightQueueStatisticsListener> getQueueNotifyCommit();
213 * Define Method : Table Operation/DS notify commit functionality
216 StatNotifyCommiter<OpendaylightFlowTableStatisticsListener> getTableNotifCommit();
219 * Define Method : Port Operation/DS notify commit functionality
222 StatNotifyCommiter<OpendaylightPortStatisticsListener> getPortNotifyCommit();
224 StatisticsManagerConfig getConfiguration();