StatisticsGatheringUtils : fix classes to which responses are casted to 63/17763/1
authorMartin Bobak <mbobak@cisco.com>
Sat, 4 Apr 2015 15:49:13 +0000 (17:49 +0200)
committerMartin Bobak <mbobak@cisco.com>
Sat, 4 Apr 2015 16:37:58 +0000 (18:37 +0200)
Change-Id: Ia7e110903795ef201b8c9444f53dd9d224ba36af
Signed-off-by: Martin Bobak <mbobak@cisco.com>
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/StatisticsGatheringUtils.java

index bd0f614ac645e966ca0e1684834c3d2d1d750a9c..3e3c79208a475d0654c6b2dc6126753dde7ba44c 100644 (file)
@@ -17,42 +17,59 @@ import javax.annotation.Nullable;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.impl.statistics.services.dedicated.StatisticsGatheringService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdateBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.FlowTableStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.statistics.FlowTableStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatistics;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.statistics.GroupStatisticsBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupDescStatsUpdatedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.NodeGroupDescStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.group.desc.GroupDescBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
 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.MeterStatisticsUpdated;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.MeterStatisticsUpdatedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.FlowCapableNodeConnectorStatisticsData;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.NodeConnectorStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMap;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsData;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.FlowCapableNodeConnectorQueueStatisticsDataBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdate;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdateBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.flow.capable.node.connector.queue.statistics.FlowCapableNodeConnectorQueueStatistics;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.flow.capable.node.connector.queue.statistics.FlowCapableNodeConnectorQueueStatisticsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap;
@@ -60,12 +77,15 @@ import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Created by Martin Bobak &lt;mbobak@cisco.com&gt; on 2.4.2015.
  */
 public final class StatisticsGatheringUtils {
 
+    private static final Logger LOG = LoggerFactory.getLogger(StatisticsGatheringUtils.class);
     private static final SinglePurposeMultipartReplyTranslator MULTIPART_REPLY_TRANSLATOR = new SinglePurposeMultipartReplyTranslator();
 
     private StatisticsGatheringUtils() {
@@ -79,6 +99,7 @@ public final class StatisticsGatheringUtils {
     public static ListenableFuture<Boolean> gatherStatistics(final StatisticsGatheringService statisticsGatheringService,
                                                              final DeviceContext deviceContext,
                                                              MultipartType type) {
+        //FIXME : anytype listener must not be send as parameter, it has to be extracted from device context inside service
         ListenableFuture<RpcResult<List<MultipartReply>>> statisticsDataInFuture =
                 JdkFutureAdapters.listenInPoolThread(statisticsGatheringService.getStatisticsOfType(type, deviceContext.getAnyMessageTypeListener()));
         return transformAndStoreStatisticsData(statisticsDataInFuture, deviceContext);
@@ -94,70 +115,115 @@ public final class StatisticsGatheringUtils {
                     for (MultipartReply singleReply : rpcResult.getResult()) {
                         List<? extends DataObject> multipartDataList = MULTIPART_REPLY_TRANSLATOR.translate(deviceContext, singleReply);
                         for (DataObject singleMultipartData : multipartDataList) {
-                            MultipartReplyMessage mpReply = (MultipartReplyMessage) singleMultipartData;
-                            switch (mpReply.getType()) {
-                                case OFPMPGROUPDESC:
-                                    final GroupStatistics groupStatistics = new GroupStatisticsBuilder((GroupStats) singleMultipartData).build();
-                                    final InstanceIdentifier<Group> groupIdent = basicIId.child(Group.class, new GroupKey(groupStatistics.getGroupId()));
-                                    final InstanceIdentifier<NodeGroupStatistics> nGroupStatIdent = groupIdent
-                                            .augmentation(NodeGroupStatistics.class);
-                                    final InstanceIdentifier<GroupStatistics> gsIdent = nGroupStatIdent.child(GroupStatistics.class);
-                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, gsIdent, groupStatistics);
-                                    break;
-                                case OFPMPMETERCONFIG:
-                                    final MeterStatistics stats = new MeterStatisticsBuilder((MeterStats) singleMultipartData).build();
-                                    final InstanceIdentifier<Meter> meterIdent = basicIId.child(Meter.class, new MeterKey(stats.getMeterId()));
+                            if (singleMultipartData instanceof GroupDescStatsUpdatedBuilder) {
+                                GroupDescStatsUpdatedBuilder groupDescStatsUpdatedBuilder = (GroupDescStatsUpdatedBuilder) singleMultipartData;
+                                GroupDescStatsUpdated groupDescStatsUpdated = groupDescStatsUpdatedBuilder.build();
+                                for (GroupDescStats groupDescStats : groupDescStatsUpdated.getGroupDescStats()) {
+                                    final InstanceIdentifier<Node> nodeIdent = InstanceIdentifier
+                                            .create(Nodes.class).child(Node.class, new NodeKey(groupDescStatsUpdated.getId()));
+                                    final InstanceIdentifier<FlowCapableNode> fNodeIdent = nodeIdent.augmentation(FlowCapableNode.class);
+                                    final GroupKey groupKey = new GroupKey(groupDescStats.getGroupId());
+                                    final InstanceIdentifier<Group> groupRef = fNodeIdent.child(Group.class, groupKey);
+                                    final GroupBuilder groupBuilder = new GroupBuilder(groupDescStats);
+                                    final NodeGroupDescStatsBuilder groupDesc = new NodeGroupDescStatsBuilder();
+                                    groupDesc.setGroupDesc(new GroupDescBuilder(groupDescStats).build());
+                                    groupBuilder.addAugmentation(NodeGroupDescStats.class, groupDesc.build());
+                                    LOG.info("Writing group statistics to operational DS.");
+                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, groupRef, groupBuilder.build());
+                                }
+                            }
+
+                            if (singleMultipartData instanceof MeterStatisticsUpdatedBuilder) {
+                                MeterStatisticsUpdated meterStatisticsUpdated = ((MeterStatisticsUpdatedBuilder) singleMultipartData).build();
+                                final InstanceIdentifier<Node> nodeIdent = InstanceIdentifier
+                                        .create(Nodes.class).child(Node.class, new NodeKey(meterStatisticsUpdated.getId()));
+                                final InstanceIdentifier<FlowCapableNode> fNodeIdent = nodeIdent.augmentation(FlowCapableNode.class);
+
+                                for (final MeterStats mStat : meterStatisticsUpdated.getMeterStats()) {
+                                    final MeterStatistics stats = new MeterStatisticsBuilder(mStat).build();
+
+                                    final InstanceIdentifier<Meter> meterIdent = fNodeIdent.child(Meter.class, new MeterKey(mStat.getMeterId()));
                                     final InstanceIdentifier<NodeMeterStatistics> nodeMeterStatIdent = meterIdent
                                             .augmentation(NodeMeterStatistics.class);
                                     final InstanceIdentifier<MeterStatistics> msIdent = nodeMeterStatIdent.child(MeterStatistics.class);
+                                    LOG.info("Writing meter statistics to operational DS.");
                                     deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, msIdent, stats);
-                                    break;
-                                case OFPMPPORTDESC:
-                                    NodeConnectorStatisticsAndPortNumberMap nodeConnectorStatisticsAndPortNumberMap = (NodeConnectorStatisticsAndPortNumberMap) singleMultipartData;
-                                    final FlowCapableNodeConnectorStatistics nodeConnectorStatistics = new FlowCapableNodeConnectorStatisticsBuilder(nodeConnectorStatisticsAndPortNumberMap).build();
-                                    final NodeConnectorKey key = new NodeConnectorKey(nodeConnectorStatisticsAndPortNumberMap.getNodeConnectorId());
-                                    final InstanceIdentifier<NodeConnector> nodeConnectorIdent = basicIId.child(NodeConnector.class, key);
+                                }
+                            }
+                            if (singleMultipartData instanceof NodeConnectorStatisticsUpdateBuilder) {
+                                NodeConnectorStatisticsUpdate nodeConnectorStatisticsUpdate = ((NodeConnectorStatisticsUpdateBuilder) singleMultipartData).build();
+                                final InstanceIdentifier<Node> nodeIdent = InstanceIdentifier.create(Nodes.class)
+                                        .child(Node.class, new NodeKey(nodeConnectorStatisticsUpdate.getId()));
+                                for (final NodeConnectorStatisticsAndPortNumberMap nConnectPort : nodeConnectorStatisticsUpdate.getNodeConnectorStatisticsAndPortNumberMap()) {
+                                    final FlowCapableNodeConnectorStatistics stats = new FlowCapableNodeConnectorStatisticsBuilder(nConnectPort).build();
+                                    final NodeConnectorKey key = new NodeConnectorKey(nConnectPort.getNodeConnectorId());
+                                    final InstanceIdentifier<NodeConnector> nodeConnectorIdent = nodeIdent.child(NodeConnector.class, key);
                                     final InstanceIdentifier<FlowCapableNodeConnectorStatisticsData> nodeConnStatIdent = nodeConnectorIdent
                                             .augmentation(FlowCapableNodeConnectorStatisticsData.class);
                                     final InstanceIdentifier<FlowCapableNodeConnectorStatistics> flowCapNodeConnStatIdent =
                                             nodeConnStatIdent.child(FlowCapableNodeConnectorStatistics.class);
-                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, flowCapNodeConnStatIdent, nodeConnectorStatistics);
-                                    break;
-                                case OFPMPTABLE:
-                                    FlowTableAndStatisticsMap flowTableAndStatisticsMap = (FlowTableAndStatisticsMap) singleMultipartData;
-                                    final InstanceIdentifier<Table> tableIdent = basicIId
-                                            .child(Table.class, new TableKey(flowTableAndStatisticsMap.getTableId().getValue()));
-                                    final FlowTableStatistics flowTableStatistics = new FlowTableStatisticsBuilder(flowTableAndStatisticsMap).build();
-                                    final InstanceIdentifier<FlowTableStatisticsData> tableStatIdent = tableIdent
-                                            .augmentation(FlowTableStatisticsData.class);
+                                    LOG.info("Writing port statistics to operational DS.");
+                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, flowCapNodeConnStatIdent, stats);
+                                }
+                            }
+                            if (singleMultipartData instanceof FlowTableStatisticsUpdateBuilder) {
+
+                                FlowTableStatisticsUpdate flowTableStatisticsUpdate = ((FlowTableStatisticsUpdateBuilder) singleMultipartData).build();
+                                final InstanceIdentifier<Node> nodeIdent = InstanceIdentifier.create(Nodes.class)
+                                        .child(Node.class, new NodeKey(flowTableStatisticsUpdate.getId()));
+                                final InstanceIdentifier<FlowCapableNode> fNodeIdent = nodeIdent.augmentation(FlowCapableNode.class);
 
+                                for (final FlowTableAndStatisticsMap tableStat : flowTableStatisticsUpdate.getFlowTableAndStatisticsMap()) {
+                                    final InstanceIdentifier<Table> tableIdent = fNodeIdent
+                                            .child(Table.class, new TableKey(tableStat.getTableId().getValue()));
+                                    final InstanceIdentifier<FlowTableStatisticsData> tableStatIdent = tableIdent.augmentation(FlowTableStatisticsData.class);
+                                    final FlowTableStatistics stats = new FlowTableStatisticsBuilder(tableStat).build();
                                     final InstanceIdentifier<FlowTableStatistics> tStatIdent = tableStatIdent.child(FlowTableStatistics.class);
-                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, tStatIdent, flowTableStatistics);
-                                    break;
-                                case OFPMPQUEUE:
-                                    QueueIdAndStatisticsMap queueIdAndStatisticsMap = (QueueIdAndStatisticsMap) singleMultipartData;
-                                    final FlowCapableNodeConnectorQueueStatistics statChild =
-                                            new FlowCapableNodeConnectorQueueStatisticsBuilder(queueIdAndStatisticsMap).build();
-                                    final FlowCapableNodeConnectorQueueStatisticsDataBuilder statBuild =
-                                            new FlowCapableNodeConnectorQueueStatisticsDataBuilder();
-                                    statBuild.setFlowCapableNodeConnectorQueueStatistics(statChild);
-                                    final QueueKey qKey = new QueueKey(queueIdAndStatisticsMap.getQueueId());
-                                    final InstanceIdentifier<Queue> queueIdent = basicIId
-                                            .child(NodeConnector.class, new NodeConnectorKey(queueIdAndStatisticsMap.getNodeConnectorId()))
-                                            .augmentation(FlowCapableNodeConnector.class)
-                                            .child(Queue.class, qKey);
-                                    final InstanceIdentifier<FlowCapableNodeConnectorQueueStatisticsData> queueStatIdent = queueIdent.augmentation(FlowCapableNodeConnectorQueueStatisticsData.class);
-                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, queueStatIdent, statBuild.build());
-                                    break;
-                                case OFPMPFLOW:
-                                    FlowsStatisticsUpdate flowsStatisticsUpdate = (FlowsStatisticsUpdate) singleMultipartData;
-                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, basicIId, flowsStatisticsUpdate);
-                                    break;
-                                case OFPMPEXPERIMENTER:
-                                    //TODO : implement this
-                                    break;
+                                    LOG.info("Writing table statistics to operational DS.");
+                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, tStatIdent, stats);
+                                }
+                            }
+                            if (singleMultipartData instanceof QueueStatisticsUpdateBuilder) {
+                                QueueStatisticsUpdate queueStatisticsUpdate = ((QueueStatisticsUpdateBuilder) singleMultipartData).build();
+                                final InstanceIdentifier<Node> nodeIdent = InstanceIdentifier.create(Nodes.class)
+                                        .child(Node.class, new NodeKey(queueStatisticsUpdate.getId()));
+                                for (final QueueIdAndStatisticsMap queueStat : queueStatisticsUpdate.getQueueIdAndStatisticsMap()) {
+                                    if (queueStat.getQueueId() != null) {
+                                        final FlowCapableNodeConnectorQueueStatistics statChild =
+                                                new FlowCapableNodeConnectorQueueStatisticsBuilder(queueStat).build();
+                                        final FlowCapableNodeConnectorQueueStatisticsDataBuilder statBuild =
+                                                new FlowCapableNodeConnectorQueueStatisticsDataBuilder();
+                                        statBuild.setFlowCapableNodeConnectorQueueStatistics(statChild);
+                                        final QueueKey qKey = new QueueKey(queueStat.getQueueId());
+                                        final InstanceIdentifier<Queue> queueIdent = nodeIdent
+                                                .child(NodeConnector.class, new NodeConnectorKey(queueStat.getNodeConnectorId()))
+                                                .augmentation(FlowCapableNodeConnector.class)
+                                                .child(Queue.class, qKey);
+                                        final InstanceIdentifier<FlowCapableNodeConnectorQueueStatisticsData> queueStatIdent = queueIdent.augmentation(FlowCapableNodeConnectorQueueStatisticsData.class);
+                                        LOG.info("Writing queue statistics to operational DS.");
+                                        deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, queueStatIdent, statBuild.build());
+                                    }
+                                }
+                            }
+                            if (singleMultipartData instanceof FlowsStatisticsUpdateBuilder) {
+                                FlowsStatisticsUpdate flowsStatistics = ((FlowsStatisticsUpdateBuilder) singleMultipartData).build();
+                                final InstanceIdentifier<Node> nodeIdent = InstanceIdentifier.create(Nodes.class)
+                                        .child(Node.class, new NodeKey(flowsStatistics.getId()));
 
+                                for (final FlowAndStatisticsMapList flowStat : flowsStatistics.getFlowAndStatisticsMapList()) {
+                                    final FlowBuilder flowBuilder = new FlowBuilder(flowStat);
+                                    FlowId flowId = new FlowId(flowStat.getFlowId());
+                                    FlowKey flowKey = new FlowKey(flowId);
+                                    flowBuilder.setKey(flowKey);
+                                    TableKey tableKey = new TableKey(flowStat.getTableId());
+                                    final InstanceIdentifier<FlowCapableNode> fNodeIdent = nodeIdent.augmentation(FlowCapableNode.class);
+                                    final InstanceIdentifier<Flow> flowIdent = fNodeIdent.child(Table.class, tableKey).child(Flow.class, flowKey);
+                                    LOG.info("Writing queue statistics to operational DS.");
+                                    deviceContext.writeToTransaction(LogicalDatastoreType.OPERATIONAL, flowIdent, flowBuilder.build());
+                                }
                             }
+
+                            //TODO : implement experimenter
                         }
                     }
                     return Boolean.TRUE;