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