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;
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.sal.binding.api.NotificationProviderService;
16 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
17 import org.opendaylight.openflowplugin.applications.statistics.manager.StatPermCollector.StatCapabTypes;
18 import org.opendaylight.openflowplugin.applications.statistics.manager.impl.StatisticsManagerConfig;
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.rev150304.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.openflowplugin.applications.statistics.manager
39 * It represent a central point for whole module. Implementation
40 * StatisticsManager registers all Operation/DS {@link StatNotifyCommiter} and
41 * Config/DS {@link 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 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 tx {@link ReadWriteTransaction}
97 public abstract void applyOperation(ReadWriteTransaction tx);
102 * Method starts whole StatisticManager functionality
104 * @param notifService
107 void start(final NotificationProviderService notifService,
108 final RpcConsumerRegistry rpcRegistry);
111 * Method provides read/write DataStore functionality cross applyOperation
112 * defined in {@link StatDataStoreOperation}
114 * @param inventoryOper - operation for DataStore
116 void enqueue(final StatDataStoreOperation inventoryOper);
119 * Method wraps {@link StatisticsManager#isProvidedFlowNodeActive(InstanceIdentifier)} method
120 * to provide parallel statCollection process for Set of Nodes. So it has to
121 * identify correct Node Set by NodeIdentifier
125 boolean isProvidedFlowNodeActive(InstanceIdentifier<Node> nodeIdent);
128 * Method wraps {@link StatPermCollector}.collectNextStatistics to provide
129 * parallel statCollection process for Set of Nodes. So it has to
130 * identify correct Node Set by NodeIdentifier.
134 void collectNextStatistics(InstanceIdentifier<Node> nodeIdent, TransactionId xid);
137 * Method wraps {@link StatPermCollector}.connectedNodeRegistration to provide
138 * parallel statCollection process for Set of Nodes. So it has to
139 * connect node to new or not full Node statCollector Set.
143 * @param nrOfSwitchTables
145 void connectedNodeRegistration(InstanceIdentifier<Node> nodeIdent,
146 List<StatCapabTypes> statTypes, Short nrOfSwitchTables);
149 * Method wraps {@link StatPermCollector}.disconnectedNodeUnregistration to provide
150 * parallel statCollection process for Set of Nodes. So it has to identify
151 * correct collector for disconnect node.
155 void disconnectedNodeUnregistration(InstanceIdentifier<Node> nodeIdent);
158 * Method wraps {@link StatPermCollector}.registerAdditionalNodeFeature to provide
159 * possibility to register additional Node Feature {@link StatCapabTypes} for
160 * statistics collecting.
165 void registerAdditionalNodeFeature(InstanceIdentifier<Node> nodeIdent, StatCapabTypes statCapab);
168 * Method provides access to Device RPC methods by wrapped
169 * internal method. In next {@link StatRpcMsgManager} is registered all
170 * Multipart device msg response and joining all to be able run all
171 * collected statistics in one time (easy identification Data for delete)
173 * @return {@link StatRpcMsgManager}
175 StatRpcMsgManager getRpcMsgManager();
178 * Define Method : {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode}
179 * Operational/DS data change listener -> impl. target -> register FlowCapableNode to Statistic Collecting process
180 * @return {@link StatNodeRegistration}
182 StatNodeRegistration getNodeRegistrator();
185 * Define Method : Flow Config/DS data change listener -> impl. target ->
186 * -> make pair between Config/DS FlowId and Device Flow response Hash
189 StatListeningCommiter<Flow, OpendaylightFlowStatisticsListener> getFlowListenComit();
192 * Define Method : Meter Config/DS data change listener and Operation/DS notify commit
196 StatListeningCommiter<Meter, OpendaylightMeterStatisticsListener> getMeterListenCommit();
199 * Define Method : Group Config/DS data change listener and Operation/DS notify commit
203 StatListeningCommiter<Group, OpendaylightGroupStatisticsListener> getGroupListenCommit();
206 * Define Method : Queue Config/DS change listener and Operation/DS notify commit functionality
209 StatListeningCommiter<Queue, OpendaylightQueueStatisticsListener> getQueueNotifyCommit();
212 * Define Method : Table Operation/DS notify commit functionality
215 StatNotifyCommiter<OpendaylightFlowTableStatisticsListener> getTableNotifCommit();
218 * Define Method : Port Operation/DS notify commit functionality
221 StatNotifyCommiter<OpendaylightPortStatisticsListener> getPortNotifyCommit();
223 StatisticsManagerConfig getConfiguration();