Bug 3792 - Change default flow timeout values to 0
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / translator / PacketInTranslator.java
index be8056bfe41bc729ef8ca27a43405d5181c5a379..b5ff55f4f38ddc52d07d91a737e97259afbca047 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.openflowplugin.openflow.md.core.translator;
 
+import java.math.BigInteger;
+import java.util.Collections;
+import java.util.List;
 import org.opendaylight.openflowplugin.api.openflow.md.core.IMDMessageTranslator;
 import org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher;
 import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext;
@@ -31,16 +34,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709.pa
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import java.math.BigInteger;
-import java.util.Collections;
-import java.util.List;
 
 /**
  * translates packetIn from OF-API model to MD-SAL model, supports OF-1.3
  */
 public class PacketInTranslator implements IMDMessageTranslator<OfHeader, List<DataObject>> {
 
-    protected static final Logger LOG = LoggerFactory
+    private static final Logger LOG = LoggerFactory
             .getLogger(PacketInTranslator.class);
 
     @Override
@@ -80,14 +80,12 @@ public class PacketInTranslator implements IMDMessageTranslator<OfHeader, List<D
                 if (message.getMatch() != null && message.getMatch().getMatchEntry() != null) {
                     List<MatchEntry> entries = message.getMatch().getMatchEntry();
                     for (MatchEntry entry : entries) {
-                        InPortCase inPortCase = ((InPortCase) entry.getMatchEntryValue());
-                        org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPort inPort = inPortCase.getInPort();
-                        if (inPort != null) {
-                            if (port == null) {
+                        if(InPortCase.class.equals(entry.getMatchEntryValue().getImplementedInterface())) {
+                            InPortCase inPortCase = ((InPortCase) entry.getMatchEntryValue());
+                            org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPort inPort = inPortCase.getInPort();
+                            if (inPort != null) {
                                 port = inPort.getPortNumber().getValue();
-                            } else {
-                                LOG.warn("Multiple input ports discovered when walking through match entries (at least {} and {})",
-                                        port, inPort.getPortNumber().getValue());
+                                break;
                             }
                         }
                     }