java_gen: use LagId type for the bsn_lag_id OXM
diff --git a/java_gen/java_model.py b/java_gen/java_model.py
index e2e1cef..ac52de4 100644
--- a/java_gen/java_model.py
+++ b/java_gen/java_model.py
@@ -141,8 +141,8 @@
                 "OFOxmMplsTcMasked":        OxmMapEntry("U8", "MPLS_TC", True),
                 "OFOxmBsnInPorts128":       OxmMapEntry("OFBitMask128", "BSN_IN_PORTS_128", False),
                 "OFOxmBsnInPorts128Masked": OxmMapEntry("OFBitMask128", "BSN_IN_PORTS_128", True),
-                "OFOxmBsnLagId":            OxmMapEntry("U32", "BSN_LAG_ID", False),
-                "OFOxmBsnLagIdMasked":      OxmMapEntry("U32", "BSN_LAG_ID", True),
+                "OFOxmBsnLagId":            OxmMapEntry("LagId", "BSN_LAG_ID", False),
+                "OFOxmBsnLagIdMasked":      OxmMapEntry("LagId", "BSN_LAG_ID", True),
                 }
 
     # Registry of nullable properties:
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index adb80f6..0bae34a 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -462,6 +462,8 @@
          .op(version=ANY, read="OFGroup.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="OFGroup.ANY")
 buffer_id = JType("OFBufferId") \
          .op(read="OFBufferId.of(bb.readInt())", write="bb.writeInt($name.getInt())", default="OFBufferId.NO_BUFFER")
+lag_id = JType("LagId") \
+         .op(version=ANY, read="LagId.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="LagId.NONE")
 
 generic_t = JType("T")
 
@@ -552,8 +554,8 @@
         'of_oxm_bsn_in_ports_128' : { 'value': port_bitmap },
         'of_oxm_bsn_in_ports_128_masked' : { 'value': port_bitmap, 'value_mask': port_bitmap },
 
-        'of_oxm_bsn_lag_id' : { 'value' : u32obj },
-        'of_oxm_bsn_lag_id_masked' : { 'value' : u32obj, 'value_mask' : u32obj },
+        'of_oxm_bsn_lag_id' : { 'value' : lag_id },
+        'of_oxm_bsn_lag_id_masked' : { 'value' : lag_id, 'value_mask' : lag_id },
 
         'of_table_stats_entry': { 'wildcards': table_stats_wildcards },
         'of_match_v1': { 'vlan_vid' : vlan_vid, 'vlan_pcp': vlan_pcp,
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
index 774336b..574cb55 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/match/MatchField.java
@@ -10,6 +10,7 @@
 import org.projectfloodlight.openflow.types.IpDscp;
 import org.projectfloodlight.openflow.types.IpEcn;
 import org.projectfloodlight.openflow.types.IpProtocol;
+import org.projectfloodlight.openflow.types.LagId;
 import org.projectfloodlight.openflow.types.MacAddress;
 import org.projectfloodlight.openflow.types.OFBitMask128;
 import org.projectfloodlight.openflow.types.OFMetadata;
@@ -174,8 +175,8 @@
     public final static MatchField<OFBitMask128> BSN_IN_PORTS_128 =
             new MatchField<OFBitMask128>("bsn_in_port_masked_128", MatchFields.BSN_IN_PORTS_128);
 
-    public final static MatchField<U32> BSN_LAG_ID =
-            new MatchField<U32>("bsn_lag_id", MatchFields.BSN_LAG_ID);
+    public final static MatchField<LagId> BSN_LAG_ID =
+            new MatchField<LagId>("bsn_lag_id", MatchFields.BSN_LAG_ID);
 
     public String getName() {
         return name;
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
index 2046d71..6d9421a 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
@@ -12,6 +12,9 @@
     static final int LENGTH = 4;
     private final int rawValue;
 
+    private final static int NONE_VAL = 0;
+    public final static LagId NONE = new LagId(NONE_VAL);
+
     private LagId(final int rawValue) {
         this.rawValue = rawValue;
     }
diff --git a/test_data/of13/action_set_field__bsn_lag_id.data b/test_data/of13/action_set_field__bsn_lag_id.data
index eb57c05..f1a8aa1 100644
--- a/test_data/of13/action_set_field__bsn_lag_id.data
+++ b/test_data/of13/action_set_field__bsn_lag_id.data
@@ -8,4 +8,4 @@
 ofp.action.set_field(field=ofp.oxm.bsn_lag_id(0x12345678))
 -- java
 OFOxms oxms = OFFactories.getFactory(OFVersion.OF_13).oxms();
-builder.setField(oxms.bsnLagId(U32.of(0x12345678)))
+builder.setField(oxms.bsnLagId(LagId.of(0x12345678)))
diff --git a/test_data/of13/oxm_bsn_lag_id.data b/test_data/of13/oxm_bsn_lag_id.data
index 73cfcf2..e8b2fcd 100644
--- a/test_data/of13/oxm_bsn_lag_id.data
+++ b/test_data/of13/oxm_bsn_lag_id.data
@@ -9,4 +9,4 @@
 obj = of_oxm_bsn_lag_id_new(OF_VERSION_1_3);
 of_oxm_bsn_lag_id_value_set(obj, 0x12345678);
 -- java
-builder.setValue(U32.of(0x12345678))
+builder.setValue(LagId.of(0x12345678))