Bug-2957 : Fix class cast exception while translating PacketIn Message 69/18669/1
authorAnil Vishnoi <vishnoianil@gmail.com>
Mon, 20 Apr 2015 20:42:55 +0000 (02:12 +0530)
committerAnil Vishnoi <vishnoianil@gmail.com>
Mon, 20 Apr 2015 20:42:55 +0000 (02:12 +0530)
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/translator/PacketInTranslator.java

index be8056bfe41bc729ef8ca27a43405d5181c5a379..cca3ea91de02459009522477d47b10229ea21d82 100644 (file)
@@ -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;
                             }
                         }
                     }