Output reg support for nicira experimenter fields
[openflowplugin.git] / extension / openflowplugin-extension-nicira / src / main / java / org / opendaylight / openflowplugin / extension / vendor / nicira / convertor / action / FieldChoiceResolver.java
index 5acfd3bf0d97311ad81796655a9209ed497de190..476a26150a5c2d5ae7e314404365a0172506dd52 100644 (file)
@@ -411,4 +411,28 @@ public final class FieldChoiceResolver {
                 ? REG_SRC_CHOICE_TO_NXMHEADER.get(srcChoice).toBigInteger()
                 : SRC_CHOICE_TYPE_TO_NXMHEADER.get(srcChoice.getImplementedInterface()).toBigInteger();
     }
+
+    /**
+     * Check if the source choice field is experimenter.
+     *
+     * @param srcChoice the source choice field.
+     * @return true if experimenter.
+     */
+    static boolean isExperimenter(SrcChoice srcChoice) {
+        return srcChoice instanceof SrcNxRegCase
+                ? REG_SRC_CHOICE_TO_NXMHEADER.get(srcChoice).isExperimenter()
+                : SRC_CHOICE_TYPE_TO_NXMHEADER.get(srcChoice.getImplementedInterface()).isExperimenter();
+    }
+
+    /**
+     * Check if the destination choice field is experimenter.
+     *
+     * @param dstChoice the destination choice field.
+     * @return true if experimenter.
+     */
+    static boolean isExperimenter(DstChoice dstChoice) {
+        return dstChoice instanceof DstNxRegCase
+                ? REG_DST_CHOICE_TO_NXMHEADER.get(dstChoice).isExperimenter()
+                : DST_CHOICE_TYPE_TO_NXMHEADER.get(dstChoice.getImplementedInterface()).isExperimenter();
+    }
 }