Bug 1088 :flow id in operational not matched; after removal not removed completely 36/10136/2
authorAnilkumar Vishnoi <avishnoi@in.ibm.com>
Tue, 19 Aug 2014 14:51:36 +0000 (20:21 +0530)
committerAnilkumar Vishnoi <avishnoi@in.ibm.com>
Thu, 21 Aug 2014 15:13:21 +0000 (20:43 +0530)
Statistics manager uses custom comparators to compare the flows it receive from
switch against the flows available in the config data store. Comparator was failing
to match flow against the config flow because of two issues
1) Port number convertion at openflow plugin includes prefix openflow:1: to the port
number. Prefix is not required,so removed it.
2) Mac address in the flow match, received from openflow plugin has different case
(e.g XX:XX:XX:XX:XX:XX) then the one in config data store (e.g xx:xx:xx:xx:xx:xx).
Default MacAddress class equals fails because of different case of mac address string.
This need to be fixed in statistics manager module in controller.

Change-Id: I8d10baa64af92dc9be4dd62c1c59c33344ac843d
Signed-off-by: Anilkumar Vishnoi <avishnoi@in.ibm.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/match/MatchConvertorImpl.java

index 6fe518e618bec719aadce41fb1b55467ae0d6948..1ad95b3285cb6bb4ed097ddaa04abc3b3fd5e4e2 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.openflowplugin.openflow.md.core.extension.ExtensionResol
 import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
+import org.opendaylight.openflowplugin.openflow.md.util.OpenflowPortsUtil;
 import org.opendaylight.openflowplugin.openflow.md.util.OpenflowVersion;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
@@ -34,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpSourceHardwareAddressBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.arp.match.fields.ArpTargetHardwareAddress;
@@ -626,8 +628,11 @@ public class MatchConvertorImpl implements MatchConvertor<List<MatchEntries>> {
 
             if (ofMatch.getOxmMatchField().equals(InPort.class)) {
                 PortNumberMatchEntry portNumber = ofMatch.getAugmentation(PortNumberMatchEntry.class);
-                matchBuilder.setInPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathid,
-                        portNumber.getPortNumber().getValue(), ofVersion));
+                if(portNumber != null){
+                    Long portNo = portNumber.getPortNumber().getValue();
+                    String logicalName = OpenflowPortsUtil.getPortLogicalName(ofVersion, portNo);
+                    matchBuilder.setInPort(new NodeConnectorId(logicalName == null? portNo.toString() : logicalName));
+                }
             } else if (ofMatch.getOxmMatchField().equals(InPhyPort.class)) {
                 PortNumberMatchEntry portNumber = ofMatch.getAugmentation(PortNumberMatchEntry.class);
                 matchBuilder.setInPhyPort(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathid,