Add missing augmentations for extensions
[openflowplugin.git] / extension / openflowplugin-extension-nicira / src / main / java / org / opendaylight / openflowplugin / extension / vendor / nicira / convertor / match / RegConvertor.java
index 4456db9085960b6f114643be8c57c90cc7936934..92f2f5a55db7ca214f66bd7bb63f02d6dd2af849 100644 (file)
@@ -8,7 +8,8 @@
 package org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match;
 
 import com.google.common.base.Optional;
-import org.opendaylight.openflowjava.nx.NiciraMatchCodecs;
+import java.util.Objects;
+import org.opendaylight.openflowjava.nx.codec.match.NiciraMatchCodecs;
 import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
 import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
 import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
@@ -28,6 +29,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.ni
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemovedBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchPacketInMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchPacketInMessageBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchRpcGetFlowStatsBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg0Key;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg1Key;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmNxReg2Key;
@@ -52,7 +57,7 @@ public class RegConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
      * (org.opendaylight.yangtools.yang.binding.DataContainer,
@@ -75,6 +80,11 @@ public class RegConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
                         .getOxmMatchField());
         RegCaseValue regCaseValue = ((RegCaseValue) input.getMatchEntryValue());
         nxRegBuilder.setValue(regCaseValue.getRegValues().getValue());
+
+        if (input.isHasMask()) {
+            nxRegBuilder.setMask(regCaseValue.getRegValues().getMask());
+        }
+
         return resolveAugmentation(nxRegBuilder.build(), path, resolveRegKey(input.getOxmMatchField()));
     }
 
@@ -112,12 +122,18 @@ public class RegConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
             case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
                 return new ExtensionAugment<>(NxAugMatchNotifUpdateFlowStats.class,
                         new NxAugMatchNotifUpdateFlowStatsBuilder().setNxmNxReg(nxmNxReg).build(), key);
+            case RPCFLOWSSTATISTICS_FLOWANDSTATISTICSMAPLIST_MATCH:
+                return new ExtensionAugment<>(NxAugMatchRpcGetFlowStats.class,
+                        new NxAugMatchRpcGetFlowStatsBuilder().setNxmNxReg(nxmNxReg).build(), key);
             case PACKETRECEIVED_MATCH:
                 return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
                         .setNxmNxReg(nxmNxReg).build(), key);
             case SWITCHFLOWREMOVED_MATCH:
                 return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
                         new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmNxReg(nxmNxReg).build(), key);
+            case PACKETINMESSAGE_MATCH:
+                return new ExtensionAugment<>(NxAugMatchPacketInMessage.class,
+                        new NxAugMatchPacketInMessageBuilder().setNxmNxReg(nxmNxReg).build(), key);
             default:
                 throw new CodecPreconditionException(path);
         }
@@ -125,7 +141,7 @@ public class RegConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
 
     /*
      * (non-Javadoc)
-     * 
+     *
      * @see
      * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
      * (org
@@ -139,12 +155,17 @@ public class RegConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFro
             throw new CodecPreconditionException(extension);
         }
         NxmNxReg nxmNxReg = matchGrouping.get().getNxmNxReg();
-        RegValuesBuilder regValuesBuilder = new RegValuesBuilder().setValue(nxmNxReg.getValue());
+        RegValuesBuilder regValuesBuilder = new RegValuesBuilder()
+            .setValue(nxmNxReg.getValue())
+            .setMask(nxmNxReg.getMask());
+
         RegCaseValueBuilder regCaseValueBuilder = new RegCaseValueBuilder();
         regCaseValueBuilder.setRegValues(regValuesBuilder.build());
         return MatchUtil.createDefaultMatchEntryBuilder(nxmNxReg.getReg(),
                 Nxm1Class.class,
-                regCaseValueBuilder.build()).build();
+                regCaseValueBuilder.build())
+            .setHasMask(Objects.nonNull(nxmNxReg.getMask()))
+            .build();
     }
 
 }