Action experimenterId fix
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / util / TypeKeyMakerFactory.java
index 63563de3f265cab0a3247f9c9d1490fdd3270914..e954a4366f957d630a7b8b2a790fa5e9acce88b6 100644 (file)
@@ -9,16 +9,14 @@
 package org.opendaylight.openflowjava.protocol.impl.util;
 
 import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
-import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterActionSerializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.ExperimenterInstructionSerializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.InstructionSerializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
 import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdAction;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdInstruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.InstructionChoice;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ExperimenterClass;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
@@ -65,11 +63,13 @@ public abstract class TypeKeyMakerFactory {
         return new AbstractTypeKeyMaker<Action>(version) {
             @Override
             public MessageTypeKey<?> make(Action entry) {
-                if (entry.getType().equals(Experimenter.class)) {
-                    return new ExperimenterActionSerializerKey(getVersion(),
-                            entry.getAugmentation(ExperimenterIdAction.class).getExperimenter().getValue(), entry.getAugmentation(ExperimenterIdAction.class).getSubType());
+                if (entry.getExperimenterId() != null) {
+                    return new ActionSerializerKey<>(getVersion(),
+                            (Class<ActionChoice>) entry.getActionChoice().getImplementedInterface(),
+                            entry.getExperimenterId().getValue());
                 }
-                return new ActionSerializerKey<>(getVersion(), entry.getType(), null);
+                return new ActionSerializerKey<>(getVersion(),
+                        (Class<ActionChoice>) entry.getActionChoice().getImplementedInterface(), null);
             }
         };
     }
@@ -83,13 +83,15 @@ public abstract class TypeKeyMakerFactory {
         return new AbstractTypeKeyMaker<Instruction>(version) {
             @Override
             public MessageTypeKey<?> make(Instruction entry) {
-                if (entry.getType().equals(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
-                        .instruction.rev130731.Experimenter.class)) {
+                if (entry.getInstructionChoice() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+                        .augments.rev150225.instruction.container.instruction.choice.ExperimenterIdCase) {
                     return new ExperimenterInstructionSerializerKey(getVersion(),
-                            entry.getAugmentation(ExperimenterIdInstruction.class)
-                            .getExperimenter().getValue());
+                            ((org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.instruction
+                                    .container.instruction.choice.ExperimenterIdCase) entry.getInstructionChoice())
+                                    .getExperimenter().getExperimenterId().getValue());
                 }
-                return new InstructionSerializerKey<>(getVersion(), entry.getType(), null);
+                return new InstructionSerializerKey<>(getVersion(),
+                        (Class<InstructionChoice>) entry.getInstructionChoice().getImplementedInterface(), null);
             }
         };
     }