X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fstatistics-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fstatistics%2Fmanager%2FStatisticsUpdateCommiter.java;h=5f264abc2cb41cf68939ec323e54c7064707a515;hp=19f25944b45f0ce34a94c9224ce4b107da4f467b;hb=7eceb26f8f0680b3e3193c0633cc5d771a3bb946;hpb=f207c0c13689d0744c2ed2eb0395076fee82ffe6 diff --git a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java index 19f25944b4..5f264abc2c 100644 --- a/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java +++ b/opendaylight/md-sal/statistics-manager/src/main/java/org/opendaylight/controller/md/statistics/manager/StatisticsUpdateCommiter.java @@ -412,8 +412,6 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList cache.put(notification.getId(), new NodeStatisticsAger(statisticsManager,key)); } NodeStatisticsAger nsa = cache.get(notification.getId()); - FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flowRule); - cache.get(notification.getId()).updateFlowStats(flowStatsEntry); //Augment the data to the flow node @@ -466,6 +464,11 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build()); sucLogger.debug("Found matching flow in the datastore, augmenting statistics"); foundOriginalFlow = true; + // Update entry with timestamp of latest response + flow.setKey(existingFlow.getKey()); + FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flow.build()); + cache.get(notification.getId()).updateFlowStats(flowStatsEntry); + it.putOperationalData(flowRef, flowBuilder.build()); it.commit(); } @@ -490,6 +493,12 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build()); sucLogger.debug("Found matching unaccounted flow in the operational datastore, augmenting statistics"); foundOriginalFlow = true; + + // Update entry with timestamp of latest response + flow.setKey(existingFlow.getKey()); + FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flow.build()); + cache.get(notification.getId()).updateFlowStats(flowStatsEntry); + it.putOperationalData(flowRef, flowBuilder.build()); it.commit(); break; @@ -498,9 +507,9 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList } } if(!foundOriginalFlow){ - long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"0"+Integer.toString(this.unaccountedFlowsCounter))); + String flowKey = "#UF$TABLE*"+Short.toString(tableId)+"*"+Integer.toString(this.unaccountedFlowsCounter); this.unaccountedFlowsCounter++; - FlowKey newFlowKey = new FlowKey(new FlowId(Long.toString(flowKey))); + FlowKey newFlowKey = new FlowKey(new FlowId(flowKey)); InstanceIdentifier flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key) .augmentation(FlowCapableNode.class) .child(Table.class, new TableKey(tableId)) @@ -508,6 +517,12 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList flowBuilder.setKey(newFlowKey); flowBuilder.addAugmentation(FlowStatisticsData.class, flowStatisticsData.build()); sucLogger.debug("Flow {} is not present in config data store, augmenting statistics as an unaccounted flow",flowBuilder.build()); + + // Update entry with timestamp of latest response + flow.setKey(newFlowKey); + FlowEntry flowStatsEntry = nsa.new FlowEntry(tableId,flow.build()); + cache.get(notification.getId()).updateFlowStats(flowStatsEntry); + it.putOperationalData(flowRef, flowBuilder.build()); it.commit(); }