BUG-2637: migration consequence - fix unit test
[controller.git] / opendaylight / md-sal / statistics-manager / src / main / java / org / opendaylight / controller / md / statistics / manager / StatPermCollector.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.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
15 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
16
17 /**
18  * statistics-manager
19  * org.opendaylight.controller.md.statistics.manager
20  *
21  * StatPermCollector
22  * Class implement {@link Runnable} and inside is running statistic collecting
23  * process DataObject statistics by DataObject statistics for every {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode}.
24  * Every statistics wait to finish previous statistics. Only if all statistics finish,
25  * next {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode}
26  * Statistics should be collecting. We are able to set minimal time for start next round cross all Network,
27  * but all depends on network possibility.
28  *
29  * @author <a href="mailto:vdemcak@cisco.com">Vaclav Demcak</a>
30  *
31  * Created: Aug 28, 2014
32  */
33 public interface StatPermCollector extends Runnable, AutoCloseable {
34
35     /**
36      * StatCapType
37      * Enum class refers ofp_statistics capabilities fields from OF Switch
38      * capabilities specification which have to come as a post HandShake
39      * information from OF Switch and Inventory Manager adds all to the
40      * Operational/DS.
41      * If the capabilities are not add (for any reason) NodeRegistrator
42      * adds all StatCapTypes for the {@link Node}.
43      */
44     public enum StatCapabTypes {
45         /**
46          * OFPC_FLOW_STATS
47          */
48         FLOW_STATS,
49         /**
50          * OFPC_TABLE_STATS
51          */
52         TABLE_STATS,
53         /**
54          * OFPC_PORT_STATS
55          */
56         PORT_STATS,
57         /**
58          * OFPC_GROUP_STATS
59          */
60         GROUP_STATS,
61         /**
62          * OFPC_QUEUE_STATS
63          */
64         QUEUE_STATS,
65         /**
66          * Meter statistics has no support from OF Switch capabilities
67          * so we have to try get statistics for it and wait for response
68          * Error or response package with results.
69          */
70         METER_STATS
71     }
72
73     /**
74      * Add new connected node for permanent statistics collecting process
75      *
76      * @param flowNode
77      * @param statTypes
78      * @param nrOfSwitchTables
79      * @return true/false if the {@link Node} added successful
80      */
81     boolean connectedNodeRegistration(InstanceIdentifier<Node> nodeIdent,
82             List<StatCapabTypes> statTypes, Short nrOfSwitchTables);
83
84     /**
85      * All disconnected Nodes need be removed from stat list Nodes
86      *
87      * @param flowNode
88      * @return true/false if the {@link Node} removed successful
89      */
90     boolean disconnectedNodeUnregistration(InstanceIdentifier<Node> nodeIdent);
91
92     /**
93      * Method add new feature {@link StatCapabTypes} to Node identified by
94      * nodeIdent -> InstanceIdentifier<Node>
95      *
96      * @param flowNode
97      * @return true/false if the {@link StatCapabTypes} add successful
98      */
99     boolean registerAdditionalNodeFeature(InstanceIdentifier<Node> nodeIdent, StatCapabTypes statCapab);
100
101     /**
102      * Method return true only and only if {@link StatPermCollector} contain
103      * valid node registration in its internal {@link Node} map.
104      * Otherwise return false.
105      *
106      * @param flowNode
107      * @return
108      */
109     boolean isProvidedFlowNodeActive(InstanceIdentifier<Node> nodeIdent);
110
111     /**
112      * Object notification for continue statistics collecting process.
113      * It is call from collecting allStatistics methods as a future result for
114      * Operational/DS statistic store call (does not matter in the outcome).
115      */
116     void collectNextStatistics(TransactionId xid);
117
118     /**
119      * Method returns true if collector has registered some active nodes
120      * otherwise return false.
121      *
122      * @return
123      */
124     boolean hasActiveNodes();
125 }
126