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=62ba04687e67eb368f47e61f07d64d4ee3de0618;hp=aa6e99a03f978a4604fe72ea4ba36307a6bdaa80;hb=5913578c89e52af7a7b755d69b2bb5db0939cd27;hpb=67a2d25f63cc03d6291f9b3110e70fac812c3793 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 aa6e99a03f..62ba04687e 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 @@ -7,10 +7,6 @@ */ package org.opendaylight.controller.md.statistics.manager; -import java.util.HashMap; -import java.util.List; -import java.util.concurrent.ConcurrentMap; - import org.opendaylight.controller.sal.binding.api.data.DataModificationTransaction; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector; @@ -111,6 +107,10 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdenti import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ConcurrentMap; + /** * Class implement statistics manager related listener interface and augment all the * received statistics data to data stores. @@ -500,7 +500,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList sucLogger.debug("Associated original flow is not found in data store. Augmenting flow in operational data store"); //TODO: Temporary fix: format [ 1+tableid+1+unaccounted flow counter] long flowKey = Long.parseLong(new String("1"+Short.toString(tableId)+"1"+Integer.toString(this.unaccountedFlowsCounter))); - FlowKey newFlowKey = new FlowKey(new FlowId(flowKey)); + FlowKey newFlowKey = new FlowKey(new FlowId(Long.toString(flowKey))); InstanceIdentifier flowRef = InstanceIdentifier.builder(Nodes.class).child(Node.class, key) .augmentation(FlowCapableNode.class) .child(Table.class, new TableKey(tableId)) @@ -799,7 +799,11 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList * _ethernetSource=EthernetSource [_address=MacAddress [_value=00:00:00:00:00:00], _mask=null, augmentation=[]], * _ethernetType=EthernetType [_type=EtherType [_value=2048], _mask=null, augmentation=[]] * - * So this custom equals method add additional check, in case any match element is null in data-store-flow, but not + * Similarly for inPort, if user/application don't set any value for it, FRM will store null value for it in data store. + * When we fetch the same flow (with its statistics) from switch, plugin converts its value to openflow:X:0. + * e.g _inPort=Uri [_value=openflow:1:0] + * + * So this custom equals method add additional check to take care of these scenario, in case any match element is null in data-store-flow, but not * in the flow fetched from switch. * * @param statsFlow @@ -820,8 +824,7 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList return false; } } - } //else if(!storedFlow.getEthernetMatch().equals(statsFlow.getEthernetMatch())) { - else if(!EthernetMatchEquals(statsFlow.getEthernetMatch(),storedFlow.getEthernetMatch())) { + } else if(!EthernetMatchEquals(statsFlow.getEthernetMatch(),storedFlow.getEthernetMatch())) { return false; } if (storedFlow.getIcmpv4Match()== null) { @@ -847,7 +850,12 @@ public class StatisticsUpdateCommiter implements OpendaylightGroupStatisticsList } if (storedFlow.getInPort()== null) { if (statsFlow.getInPort() != null) { - return false; + String[] portArr = statsFlow.getInPort().getValue().split(":"); + if(portArr.length >= 3){ + if(Integer.parseInt(portArr[2]) != 0){ + return false; + } + } } } else if(!storedFlow.getInPort().equals(statsFlow.getInPort())) { return false;