package org.opendaylight.openflowplugin.applications.statistics.manager;
import java.util.List;
-
+import java.util.UUID;
+import org.opendaylight.controller.md.sal.common.api.clustering.EntityOwnershipService;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.OpendaylightFlowStatisticsListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.OpendaylightFlowTableStatisticsListener;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev131103.TransactionId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.TransactionId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.OpendaylightGroupStatisticsListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.OpendaylightMeterStatisticsListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.OpendaylightPortStatisticsListener;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.OpendaylightQueueStatisticsListener;
* StatisticsManager
* It represent a central point for whole module. Implementation
* StatisticsManager registers all Operation/DS {@link StatNotifyCommiter} and
- * Config/DS {@StatListeningCommiter}, as well as {@link StatPermCollector}
+ * Config/DS {@link StatListeningCommiter}, as well as {@link StatPermCollector}
* for statistic collecting and {@link StatRpcMsgManager} as Device RPCs provider.
* In next, StatisticsManager provides all DS contact Transaction services.
*
private NodeId nodeId;
private StatsManagerOperationType operationType = StatsManagerOperationType.DATA_COMMIT_OPER_DS;
+ private UUID nodeUUID;
public StatDataStoreOperation(final StatsManagerOperationType operType, final NodeId id){
if(operType != null){
operationType = operType;
}
nodeId = id;
+ nodeUUID = generatedUUIDForNode();
}
public final StatsManagerOperationType getType() {
return nodeId;
}
+ public UUID getNodeUUID() {
+ return nodeUUID;
+ }
+
/**
* Apply all read / write (put|merge) operation for DataStore
*
- * @param {@link ReadWriteTransaction} tx
+ * @param tx {@link ReadWriteTransaction}
*/
public abstract void applyOperation(ReadWriteTransaction tx);
+ protected abstract UUID generatedUUIDForNode();
+
+ public InstanceIdentifier<Node> getNodeIdentifier() {
+ final InstanceIdentifier<Node> nodeIdent = InstanceIdentifier.create(Nodes.class)
+ .child(Node.class, new NodeKey(nodeId));
+ return nodeIdent;
+ }
+
+ }
+
+
+ class Pair<L,R> {
+
+ private final L left;
+ private final R right;
+
+ public Pair(L left, R right) {
+ this.left = left;
+ this.right = right;
+ }
+
+ public L getLeft() { return left; }
+ public R getRight() { return right; }
+
+ @Override
+ public int hashCode() { return left.hashCode() ^ right.hashCode(); }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof Pair)) return false;
+ Pair pairo = (Pair) o;
+ return this.left.equals(pairo.getLeft()) &&
+ this.right.equals(pairo.getRight());
+ }
+
}
/**
* Method starts whole StatisticManager functionality
*
- * @param {@link NotificationProviderService} notifService
- * @param {@link RpcConsumerRegistry} rpcRegistry
- * @param minReqNetMonitInt
+ * @param notifService
+ * @param rpcRegistry
*/
void start(final NotificationProviderService notifService,
final RpcConsumerRegistry rpcRegistry);
void enqueue(final StatDataStoreOperation inventoryOper);
/**
- * Method wraps {@link StatisticCollector}.isProvidedFlowNodeActive method
+ * Method wraps {@link StatisticsManager#isProvidedFlowNodeActive(InstanceIdentifier)} method
* to provide parallel statCollection process for Set of Nodes. So it has to
* identify correct Node Set by NodeIdentifier
*
/**
* Define Method : {@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode}
- * Operational/DS data change listener -> impl. target -> register FlowCapableNode to Statistic Collecting process
+ * Operational/DS data change listener -> impl. target -> register FlowCapableNode to Statistic Collecting process
* @return {@link StatNodeRegistration}
*/
StatNodeRegistration getNodeRegistrator();
/**
- * Define Method : Flow Config/DS data change listener -> impl. target ->
- * -> make pair between Config/DS FlowId and Device Flow response Hash
+ * Define Method : Flow Config/DS data change listener -> impl. target ->
+ * -> make pair between Config/DS FlowId and Device Flow response Hash
* @return
*/
StatListeningCommiter<Flow, OpendaylightFlowStatisticsListener> getFlowListenComit();
StatisticsManagerConfig getConfiguration();
+ /**
+ * A unique UUID is generated with each node added by the statistics manager implementation in order to uniquely
+ * identify a session.
+ * @param nodeInstanceIdentifier
+ */
+ UUID getGeneratedUUIDForNode(InstanceIdentifier<Node> nodeInstanceIdentifier);
+
+ /*
+ * Setting entity-ownership-service
+ */
+ void setOwnershipService(EntityOwnershipService ownershipService);
+
+ /**
+ * Getting entity-ownership-service
+ */
+ EntityOwnershipService getOwnershipService();
+
}