Merge "Bug 1577: Gates access to Shard actor until its initialized"
[controller.git] / opendaylight / md-sal / statistics-manager / src / main / java / org / opendaylight / controller / md / statistics / manager / StatisticsManager.java
1 /**
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.controller.md.statistics.manager;
10
11 import java.util.List;
12
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.sal.binding.api.NotificationProviderService;
17 import org.opendaylight.controller.sal.binding.api.RpcConsumerRegistry;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsListener;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsListener;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener;
28 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsListener;
29 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
30
31 /**
32  * statistics-manager
33  * org.opendaylight.controller.md.statistics.manager
34  *
35  * StatisticsManager
36  * It represent a central point for whole module. Implementation
37  * StatisticsManager registers all Operation/DS {@link StatNotifyCommiter} and
38  * Config/DS {@StatListeningCommiter}, as well as {@link StatPermCollector}
39  * for statistic collecting and {@link StatRpcMsgManager} as Device RPCs provider.
40  * In next, StatisticsManager provides all DS contact Transaction services.
41  *
42  * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
43  *
44  * Created: Aug 27, 2014
45  */
46 public interface StatisticsManager extends AutoCloseable, TransactionChainListener {
47
48     /**
49      * StatDataStoreOperation
50      * Interface represent functionality to submit changes to DataStore.
51      * Internal {@link TransactionChainListener} joining all DS commits
52      * to Set of chained changes for prevent often DataStore touches.
53      */
54     public interface StatDataStoreOperation {
55
56         /**
57          * Apply all read / write (put|merge) operation
58          * for DataStore
59          * @param {@link ReadWriteTransaction} tx
60          */
61         void applyOperation(ReadWriteTransaction tx);
62
63     }
64
65     /**
66      * Method starts whole StatisticManager functionality
67      *
68      * @param {@link NotificationProviderService} notifService
69      * @param {@link RpcConsumerRegistry} rpcRegistry
70      * @param minReqNetMonitInt
71      */
72     void start(final NotificationProviderService notifService,
73             final RpcConsumerRegistry rpcRegistry, final long minReqNetMonitInt);
74
75     /**
76      * Method provides read/write DataStore functionality cross applyOperation
77      * defined in {@link StatDataStoreOperation}
78      *
79      * @param inventoryOper - operation for DataStore
80      */
81     void enqueue(final StatDataStoreOperation inventoryOper);
82
83     /**
84      * Method wraps {@link StatisticCollector}.isProvidedFlowNodeActive method
85      * to provide parallel statCollection process for Set of Nodes. So it has to
86      * identify correct Node Set by NodeIdentifier
87      *
88      * @param nodeIdent
89      */
90      boolean isProvidedFlowNodeActive(InstanceIdentifier<Node> nodeIdent);
91
92      /**
93       * Method wraps {@link StatPermCollector}.collectNextStatistics to provide
94       * parallel statCollection process for Set of Nodes. So it has to
95       * identify correct Node Set by NodeIdentifier.
96       *
97       * @param nodeIdent
98       */
99      void collectNextStatistics(InstanceIdentifier<Node> nodeIdent);
100
101      /**
102       * Method wraps {@link StatPermCollector}.connectedNodeRegistration to provide
103       * parallel statCollection process for Set of Nodes. So it has to
104       * connect node to new or not full Node statCollector Set.
105       *
106       * @param nodeIdent
107       * @param statTypes
108       * @param nrOfSwitchTables
109       */
110      void connectedNodeRegistration(InstanceIdentifier<Node> nodeIdent,
111              List<StatCapabTypes> statTypes, Short nrOfSwitchTables);
112
113      /**
114       * Method wraps {@link StatPermCollector}.disconnectedNodeUnregistration to provide
115       * parallel statCollection process for Set of Nodes. So it has to identify
116       * correct collector for disconnect node.
117       *
118       * @param nodeIdent
119       */
120      void disconnectedNodeUnregistration(InstanceIdentifier<Node> nodeIdent);
121
122     /**
123      * Method provides access to Device RPC methods by wrapped
124      * internal method. In next {@link StatRpcMsgManager} is registered all
125      * Multipart device msg response and joining all to be able run all
126      * collected statistics in one time (easy identification Data for delete)
127      *
128      * @return {@link StatRpcMsgManager}
129      */
130     StatRpcMsgManager getRpcMsgManager();
131
132     /**
133      * Define Method : {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode}
134      * Operational/DS data change listener -> impl. target -> register FlowCapableNode to Statistic Collecting process
135      * @return {@link StatNodeRegistration}
136      */
137     StatNodeRegistration getNodeRegistrator();
138
139     /**
140      * Define Method : Flow Config/DS data change listener -> impl. target ->
141      * -> make pair between Config/DS FlowId and Device Flow response Hash
142      * @return
143      */
144     StatListeningCommiter<Flow, OpendaylightFlowStatisticsListener> getFlowListenComit();
145
146     /**
147      * Define Method : Meter Config/DS data change listener and Operation/DS notify commit
148      * functionality
149      * @return
150      */
151     StatListeningCommiter<Meter, OpendaylightMeterStatisticsListener> getMeterListenCommit();
152
153     /**
154      * Define Method : Group Config/DS data change listener and Operation/DS notify commit
155      * functionality
156      * @return
157      */
158     StatListeningCommiter<Group, OpendaylightGroupStatisticsListener> getGroupListenCommit();
159
160     /**
161      * Define Method : Queue Config/DS change listener and Operation/DS notify commit functionality
162      * @return
163      */
164     StatListeningCommiter<Queue, OpendaylightQueueStatisticsListener> getQueueNotifyCommit();
165
166     /**
167      * Define Method : Table Operation/DS notify commit functionality
168      * @return
169      */
170     StatNotifyCommiter<OpendaylightFlowTableStatisticsListener> getTableNotifCommit();
171
172     /**
173      * Define Method : Port Operation/DS notify commit functionality
174      * @return
175      */
176     StatNotifyCommiter<OpendaylightPortStatisticsListener> getPortNotifyCommit();
177
178 }
179