Match (de)serialization fixed + tests added 62/3862/2
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Fri, 20 Dec 2013 09:59:20 +0000 (10:59 +0100)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Fri, 20 Dec 2013 15:54:22 +0000 (16:54 +0100)
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
Change-Id: Ic948380dc99725fd169b620403f5aa7bf7bd3273

openflow-protocol-api/src/main/yang/openflow-augments.yang
openflow-protocol-api/src/main/yang/openflow-types.yang
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchSerializer.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/MatchDeserializerTest.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/MatchSerializerTest2.java [new file with mode: 0644]

index 71718bc770b3ca1a037741fdc0f70063471d1535..a2ab6eaed45201023d0dcfce519fd0ab164c01bf 100644 (file)
@@ -161,44 +161,7 @@ module openflow-augments {
      augment "/oxm:oxm-container/oxm:match-entries" {\r
          ext:augment-identifier "pseudo-field-match-entry";\r
          leaf pseudo-field {\r
-             type bits {\r
-                 bit nonext {\r
-                     description "<No next header> encountered.";\r
-                     position 0;\r
-                 }\r
-                 bit esp {\r
-                     description "Encrypted Sec Payload header present.";\r
-                     position 1;\r
-                 }\r
-                 bit auth {\r
-                     description "Authentication header present.";\r
-                     position 2;\r
-                 }\r
-                 bit dest {\r
-                     description "1 or 2 dest headers present.";\r
-                     position 3;\r
-                 }\r
-                 bit frag {\r
-                     description "Fragment header present.";\r
-                     position 4;\r
-                 }\r
-                 bit router {\r
-                     description "Router header present.";\r
-                     position 5;\r
-                 }\r
-                 bit hop {\r
-                     description "Hop-by-hop header present.";\r
-                     position 6;\r
-                 }\r
-                 bit unrep {\r
-                     description "Unexpected repeats encountered.";\r
-                     position 7;\r
-                 }\r
-                 bit unseq {\r
-                     description "Unexpected sequencing encountered.";\r
-                     position 8;\r
-                 }\r
-             }\r
+             type oft:ipv6-exthdr-flags;\r
          }\r
      }\r
 \r
index 6d7bf2fb4c94cf48a73a3c339afc4ff1677810cf..d17f69a807b7290e886a52a7e7dbb40361ed7090 100644 (file)
@@ -1364,6 +1364,47 @@ module openflow-types {
         }
     }
     
+    typedef ipv6-exthdr-flags {
+        type bits {
+            bit nonext {
+                description "<No next header> encountered.";
+                position 0;
+            }
+            bit esp {
+                description "Encrypted Sec Payload header present.";
+                position 1;
+            }
+            bit auth {
+                description "Authentication header present.";
+                position 2;
+            }
+            bit dest {
+                description "1 or 2 dest headers present.";
+                position 3;
+            }
+            bit frag {
+                description "Fragment header present.";
+                position 4;
+            }
+            bit router {
+                description "Router header present.";
+                position 5;
+            }
+            bit hop {
+                description "Hop-by-hop header present.";
+                position 6;
+            }
+            bit unrep {
+                description "Unexpected repeats encountered.";
+                position 7;
+            }
+            bit unseq {
+                description "Unexpected sequencing encountered.";
+                position 8;
+            }
+        }
+    }
+    
 // OPENFLOW v1.0 STRUCTURES
     // Structures under this line are needed to support OpenFlow version 1.0 
     // wire protocol 0x01;
index 097046f35a102be2b794417858258a9d56e82b65..62cb6ccd49007a47e1f38a79bb4158c5a2a81d59 100644 (file)
@@ -59,7 +59,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry.PseudoField;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;
@@ -68,6 +67,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.StandardMatchType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
@@ -299,27 +299,27 @@ public abstract class MatchDeserializer {
                 break;
             case 13:
                 matchEntriesBuilder.setOxmMatchField(TcpSrc.class);
-                addPortAugmentation(null, in);
+                addPortAugmentation(matchEntriesBuilder, in);
                 break;
             case 14:
                 matchEntriesBuilder.setOxmMatchField(TcpDst.class);
-                addPortAugmentation(null, in);
+                addPortAugmentation(matchEntriesBuilder, in);
                 break;
             case 15:
                 matchEntriesBuilder.setOxmMatchField(UdpSrc.class);
-                addPortAugmentation(null, in);
+                addPortAugmentation(matchEntriesBuilder, in);
                 break;
             case 16:
                 matchEntriesBuilder.setOxmMatchField(UdpDst.class);
-                addPortAugmentation(null, in);
+                addPortAugmentation(matchEntriesBuilder, in);
                 break;
             case 17:
                 matchEntriesBuilder.setOxmMatchField(SctpSrc.class);
-                addPortAugmentation(null, in);
+                addPortAugmentation(matchEntriesBuilder, in);
                 break;
             case 18:
                 matchEntriesBuilder.setOxmMatchField(SctpDst.class);
-                addPortAugmentation(null, in);
+                addPortAugmentation(matchEntriesBuilder, in);
                 break;
             case 19:
                 matchEntriesBuilder.setOxmMatchField(Icmpv4Type.class);
@@ -466,7 +466,7 @@ public abstract class MatchDeserializer {
                 final Boolean HOP = ((bitmap) & (1<<6)) != 0;
                 final Boolean UNREP = ((bitmap) & (1<<7)) != 0;
                 final Boolean UNSEQ = ((bitmap) & (1<<8)) != 0;
-                pseudoBuilder.setPseudoField(new PseudoField(AUTH, DEST, ESP, FRAG, HOP, NONEXT, ROUTER, UNREP, UNSEQ));
+                pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(AUTH, DEST, ESP, FRAG, HOP, NONEXT, ROUTER, UNREP, UNSEQ));
                 matchEntriesBuilder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());
                 if (hasMask) {
                     addMaskAugmentation(matchEntriesBuilder, in, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
index 3a26f4c5a9e2d79c6768e3d3f69f1de6e6504029..96bc7a657ca249aee74395c0a6395f4f681dfc16 100644 (file)
@@ -36,10 +36,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry.PseudoField;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.StandardMatchType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;
@@ -324,8 +324,7 @@ public class MatchSerializer {
             writeMetadataRelatedEntry(entry, out, fieldValue);
         } else if (field.isAssignableFrom(Ipv6Exthdr.class)) {
             fieldValue = 39;
-            fieldValue = fieldValue << 1;
-            PseudoField pseudoField = entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField();
+            Ipv6ExthdrFlags pseudoField = entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField();
             Map<Integer, Boolean> map = new HashMap<>();
             map.put(0, pseudoField.isNonext());
             map.put(1, pseudoField.isEsp());
index 018feb1d3e0e5aff95b718235a67c4ecc4ffbd6b..e8cd38b9be5df2b2e1f52fd82a4277ec2da7070d 100644 (file)
@@ -15,9 +15,79 @@ import org.junit.Assert;
 import org.junit.Test;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.Match;\r
 \r
 /**\r
  * @author michal.polkorab\r
@@ -26,7 +96,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.
 public class MatchDeserializerTest {\r
     \r
     /**\r
-     * Testing match deserialization\r
+     * Testing Ipv4 address deserialization\r
      */\r
     @Test\r
     public void testIpv4Address() {\r
@@ -39,7 +109,7 @@ public class MatchDeserializerTest {
     }\r
     \r
     /**\r
-     * Testing match deserialization\r
+     * Testing Ipv6 address deserialization\r
      */\r
     @Test\r
     public void testIpv6Address() {\r
@@ -50,5 +120,339 @@ public class MatchDeserializerTest {
         Assert.assertEquals("Wrong Ipv6 address format", new Ipv6Address("0000:0001:0002:0003:0004:0005:0006:0F07"),\r
                 entry.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
     }\r
+    \r
+    /**\r
+     * Testing match deserialization\r
+     */\r
+    @Test\r
+    public void testMatch() {\r
+        ByteBuf buffer = ByteBufUtils.hexStringToByteBuf("00 01 01 AC "\r
+                + "80 00 00 04 00 00 00 01 "\r
+                + "00 00 02 04 00 00 00 02 "\r
+                + "00 01 05 10 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 04 "\r
+                + "FF FF 07 0C 00 00 00 00 00 05 00 00 00 00 00 06 "\r
+                + "80 00 09 0C 00 00 00 00 00 07 00 00 00 00 00 08 "\r
+                + "80 00 0A 02 00 09 "\r
+                + "80 00 0D 04 00 0A 00 0B "\r
+                + "80 00 0E 01 0C "\r
+                + "80 00 10 01 0D "\r
+                + "80 00 12 01 0E "\r
+                + "80 00 14 01 0F "\r
+                + "80 00 17 08 0A 00 00 01 00 00 FF 00 "\r
+                + "80 00 19 08 0A 00 00 02 00 00 00 FF "\r
+                + "80 00 1A 02 00 03 "\r
+                + "80 00 1C 02 00 04 "\r
+                + "80 00 1E 02 00 05 "\r
+                + "80 00 20 02 00 06 "\r
+                + "80 00 22 02 00 07 "\r
+                + "80 00 24 02 00 08 "\r
+                + "80 00 26 01 05 "\r
+                + "80 00 28 01 07 "\r
+                + "80 00 2A 02 00 10 "\r
+                + "80 00 2D 08 0A 00 00 09 00 00 FF 00 "\r
+                + "80 00 2F 08 0A 00 00 0A 00 00 00 FF "\r
+                + "80 00 31 0C 00 00 00 00 00 01 00 00 00 00 00 03 "\r
+                + "80 00 33 0C 00 00 00 00 00 02 00 00 00 00 00 04 "\r
+                + "80 00 35 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 15 "\r
+                +             "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16 "\r
+                + "80 00 37 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 17 "\r
+                +             "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18 "\r
+                + "80 00 39 08 00 00 00 02 00 00 00 03 "\r
+                + "80 00 3A 01 15 "\r
+                + "80 00 3C 01 17 "\r
+                + "80 00 3E 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 " //ipv6ndtarget\r
+                + "80 00 40 06 00 05 00 00 00 01 "\r
+                + "80 00 42 06 00 05 00 00 00 02 "\r
+                + "80 00 44 04 00 00 02 03 "\r
+                + "80 00 46 01 03 "\r
+                + "80 00 48 01 01 "\r
+                + "80 00 4B 06 00 00 02 00 00 01 "\r
+                + "80 00 4D 10 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 FF "\r
+                + "80 00 4F 04 01 66 03 04 "\r
+                + "00 00 00 00");\r
+\r
+        Match match = MatchDeserializer.createMatch(buffer);\r
+        Assert.assertEquals("Wrong match type", OxmMatchType.class, match.getType());\r
+        Assert.assertEquals("Wrong match entries size", 40, match.getMatchEntries().size());\r
+        List<MatchEntries> entries = match.getMatchEntries();\r
+        MatchEntries entry0 = entries.get(0);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry0.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", InPort.class, entry0.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry0.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 1,\r
+                entry0.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
+        MatchEntries entry1 = entries.get(1);\r
+        Assert.assertEquals("Wrong entry class", Nxm0Class.class, entry1.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", InPhyPort.class, entry1.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry1.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 2,\r
+                entry1.getAugmentation(PortNumberMatchEntry.class).getPortNumber().getValue().intValue());\r
+        MatchEntries entry2 = entries.get(2);\r
+        Assert.assertEquals("Wrong entry class", Nxm1Class.class, entry2.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Metadata.class, entry2.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry2.isHasMask());\r
+        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 03"), \r
+                entry2.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 04"), \r
+                entry2.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry3 = entries.get(3);\r
+        Assert.assertEquals("Wrong entry class", ExperimenterClass.class, entry3.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", EthDst.class, entry3.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry3.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:05"), \r
+                entry3.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 06"), \r
+                entry3.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry4 = entries.get(4);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry4.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", EthSrc.class, entry4.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry4.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:07"), \r
+                entry4.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 08"), \r
+                entry4.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry5 = entries.get(5);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry5.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", EthType.class, entry5.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry5.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 9,\r
+                entry5.getAugmentation(EthTypeMatchEntry.class).getEthType().getValue().intValue());\r
+        MatchEntries entry6 = entries.get(6);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry6.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", VlanVid.class, entry6.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry6.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 10,\r
+                entry6.getAugmentation(VlanVidMatchEntry.class).getVlanVid().intValue());\r
+        Assert.assertEquals("Wrong entry value", false, \r
+                entry6.getAugmentation(VlanVidMatchEntry.class).isCfiBit());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 0B"), \r
+                entry6.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry7 = entries.get(7);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry7.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", VlanPcp.class, entry7.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry7.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 12,\r
+                entry7.getAugmentation(VlanPcpMatchEntry.class).getVlanPcp().intValue());\r
+        MatchEntries entry8 = entries.get(8);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry8.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", IpDscp.class, entry8.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry8.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 13,\r
+                entry8.getAugmentation(DscpMatchEntry.class).getDscp().getValue().intValue());\r
+        MatchEntries entry9 = entries.get(9);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry9.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", IpEcn.class, entry9.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry9.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 14,\r
+                entry9.getAugmentation(EcnMatchEntry.class).getEcn().intValue());\r
+        MatchEntries entry10 = entries.get(10);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry10.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", IpProto.class, entry10.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry10.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 15,\r
+                entry10.getAugmentation(ProtocolNumberMatchEntry.class).getProtocolNumber().intValue());\r
+        MatchEntries entry11 = entries.get(11);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry11.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv4Src.class, entry11.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry11.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.1"),\r
+                entry11.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), \r
+                entry11.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry12 = entries.get(12);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry12.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv4Dst.class, entry12.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry12.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.2"),\r
+                entry12.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), \r
+                entry12.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry13 = entries.get(13);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry13.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", TcpSrc.class, entry13.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry13.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 3,\r
+                entry13.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
+        MatchEntries entry14 = entries.get(14);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry14.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", TcpDst.class, entry14.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry14.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 4,\r
+                entry14.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
+        MatchEntries entry15 = entries.get(15);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry15.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", UdpSrc.class, entry15.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry15.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 5,\r
+                entry15.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
+        MatchEntries entry16 = entries.get(16);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry16.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", UdpDst.class, entry16.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry16.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 6,\r
+                entry16.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
+        MatchEntries entry17 = entries.get(17);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry17.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", SctpSrc.class, entry17.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry17.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 7,\r
+                entry17.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
+        MatchEntries entry18 = entries.get(18);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry18.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", SctpDst.class, entry18.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry18.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 8,\r
+                entry18.getAugmentation(PortMatchEntry.class).getPort().getValue().intValue());\r
+        MatchEntries entry19 = entries.get(19);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry19.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Icmpv4Type.class, entry19.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry19.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 5,\r
+                entry19.getAugmentation(Icmpv4TypeMatchEntry.class).getIcmpv4Type().intValue());\r
+        MatchEntries entry20 = entries.get(20);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry20.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Icmpv4Code.class, entry20.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry20.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 7,\r
+                entry20.getAugmentation(Icmpv4CodeMatchEntry.class).getIcmpv4Code().intValue());\r
+        MatchEntries entry21 = entries.get(21);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry21.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", ArpOp.class, entry21.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry21.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 16,\r
+                entry21.getAugmentation(OpCodeMatchEntry.class).getOpCode().intValue());\r
+        MatchEntries entry22 = entries.get(22);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry22.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", ArpSpa.class, entry22.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry22.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.9"),\r
+                entry22.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 FF 00"), \r
+                entry22.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry23 = entries.get(23);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry23.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", ArpTpa.class, entry23.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry23.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new Ipv4Address("10.0.0.10"),\r
+                entry23.getAugmentation(Ipv4AddressMatchEntry.class).getIpv4Address());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 FF"), \r
+                entry23.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry24 = entries.get(24);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry24.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", ArpSha.class, entry24.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry24.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:01"), \r
+                entry24.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 03"), \r
+                entry24.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry25 = entries.get(25);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry25.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", ArpTha.class, entry25.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry25.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:00:00:00:00:02"), \r
+                entry25.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 04"), \r
+                entry25.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry26 = entries.get(26);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry26.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv6Src.class, entry26.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry26.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0015"), \r
+                entry26.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
+        Assert.assertArrayEquals("Wrong entry mask",\r
+                ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 16"), \r
+                entry26.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry27 = entries.get(27);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry27.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv6Dst.class, entry27.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry27.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0017"), \r
+                entry27.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
+        Assert.assertArrayEquals("Wrong entry mask",\r
+                ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 18"), \r
+                entry27.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry28 = entries.get(28);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry28.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv6Flabel.class, entry28.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry28.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 2, \r
+                entry28.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 03"),\r
+                entry28.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry29 = entries.get(29);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry29.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Icmpv6Type.class, entry29.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry29.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 21, \r
+                entry29.getAugmentation(Icmpv6TypeMatchEntry.class).getIcmpv6Type().intValue());\r
+        MatchEntries entry30 = entries.get(30);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry30.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Icmpv6Code.class, entry30.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry30.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 23, \r
+                entry30.getAugmentation(Icmpv6CodeMatchEntry.class).getIcmpv6Code().intValue());\r
+        MatchEntries entry31 = entries.get(31);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry31.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv6NdTarget.class, entry31.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry31.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new Ipv6Address("0000:0000:0000:0000:0000:0000:0000:0020"), \r
+                entry31.getAugmentation(Ipv6AddressMatchEntry.class).getIpv6Address());\r
+        MatchEntries entry32 = entries.get(32);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry32.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv6NdSll.class, entry32.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry32.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:01"), \r
+                entry32.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
+        MatchEntries entry33 = entries.get(33);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry33.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv6NdTll.class, entry33.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry33.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", new MacAddress("00:05:00:00:00:02"),\r
+                entry33.getAugmentation(MacAddressMatchEntry.class).getMacAddress());\r
+        MatchEntries entry34 = entries.get(34);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry34.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", MplsLabel.class, entry34.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry34.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 515,\r
+                entry34.getAugmentation(MplsLabelMatchEntry.class).getMplsLabel().intValue());\r
+        MatchEntries entry35 = entries.get(35);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry35.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", MplsTc.class, entry35.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry35.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 3,\r
+                entry35.getAugmentation(TcMatchEntry.class).getTc().intValue());\r
+        MatchEntries entry36 = entries.get(36);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry36.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", MplsBos.class, entry36.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", false, entry36.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", true,\r
+                entry36.getAugmentation(BosMatchEntry.class).isBos());\r
+        MatchEntries entry37 = entries.get(37);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry37.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", PbbIsid.class, entry37.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry37.isHasMask());\r
+        Assert.assertEquals("Wrong entry value", 2,\r
+                entry37.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 01"),\r
+                entry37.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry38 = entries.get(38);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry38.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", TunnelId.class, entry38.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry38.isHasMask());\r
+        Assert.assertArrayEquals("Wrong entry value", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 07"),\r
+                entry38.getAugmentation(MetadataMatchEntry.class).getMetadata());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("00 00 00 00 00 00 00 FF"),\r
+                entry38.getAugmentation(MaskMatchEntry.class).getMask());\r
+        MatchEntries entry39 = entries.get(39);\r
+        Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry39.getOxmClass());\r
+        Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry39.getOxmMatchField());\r
+        Assert.assertEquals("Wrong entry hasMask", true, entry39.isHasMask());\r
+        Assert.assertEquals("Wrong entry value",\r
+                new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true),\r
+                entry39.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());\r
+        Assert.assertArrayEquals("Wrong entry mask", ByteBufUtils.hexStringToBytes("03 04"),\r
+                entry39.getAugmentation(MaskMatchEntry.class).getMask());\r
+        Assert.assertTrue("Unread data", buffer.readableBytes() == 0);\r
+    }\r
 \r
 }\r
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/MatchSerializerTest2.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/MatchSerializerTest2.java
new file mode 100644 (file)
index 0000000..323a901
--- /dev/null
@@ -0,0 +1,776 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.openflowjava.protocol.impl.util;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6FlowLabel;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.BosMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DscpMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EcnMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthTypeMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4TypeMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6TypeMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv4AddressMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MacAddressMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OpCodeMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ProtocolNumberMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntry;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidMatchEntryBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpOp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSha;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpSpa;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTha;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ArpTpa;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.EthType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.ExperimenterClass;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Type;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Type;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPhyPort;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpDscp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpEcn;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.IpProto;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Dst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv4Src;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Dst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Flabel;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdSll;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTarget;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6NdTll;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Src;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Metadata;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsBos;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm0Class;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmMatchType;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.PbbIsid;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.SctpSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanVid;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntries;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.MatchEntriesBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.Match;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.match.grouping.MatchBuilder;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class MatchSerializerTest2 {\r
+\r
+    /**\r
+     * Testing serialization of match\r
+     */\r
+    @Test\r
+    public void testEmptyMatch() {\r
+        MatchBuilder builder = new MatchBuilder();\r
+        builder.setType(OxmMatchType.class);\r
+        Match match = builder.build();\r
+        \r
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        MatchSerializer.encodeMatch(match, out);\r
+        \r
+        Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match length", 4, out.readUnsignedShort());\r
+        Assert.assertTrue("Wrong padding", out.readableBytes() == 4);\r
+    }\r
+    \r
+    /**\r
+     * Testing serialization of match\r
+     */\r
+    @Test\r
+    public void test() {\r
+        MatchBuilder builder = new MatchBuilder();\r
+        builder.setType(OxmMatchType.class);\r
+        List<MatchEntries> entries = new ArrayList<>();\r
+        MatchEntriesBuilder entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(Nxm0Class.class);\r
+        entryBuilder.setOxmMatchField(InPort.class);\r
+        entryBuilder.setHasMask(false);\r
+        PortNumberMatchEntryBuilder portNumberBuilder = new PortNumberMatchEntryBuilder();\r
+        portNumberBuilder.setPortNumber(new PortNumber(42L));\r
+        entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(Nxm1Class.class);\r
+        entryBuilder.setOxmMatchField(InPhyPort.class);\r
+        entryBuilder.setHasMask(false);\r
+        portNumberBuilder = new PortNumberMatchEntryBuilder();\r
+        portNumberBuilder.setPortNumber(new PortNumber(43L));\r
+        entryBuilder.addAugmentation(PortNumberMatchEntry.class, portNumberBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Metadata.class);\r
+        entryBuilder.setHasMask(true);\r
+        MetadataMatchEntryBuilder metadataBuilder = new MetadataMatchEntryBuilder();\r
+        metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});\r
+        entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
+        MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(ExperimenterClass.class);\r
+        entryBuilder.setOxmMatchField(EthDst.class);\r
+        entryBuilder.setHasMask(true);\r
+        MacAddressMatchEntryBuilder macBuilder = new MacAddressMatchEntryBuilder();\r
+        macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));\r
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,5});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(EthSrc.class);\r
+        entryBuilder.setHasMask(true);\r
+        macBuilder = new MacAddressMatchEntryBuilder();\r
+        macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));\r
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,2});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(EthType.class);\r
+        entryBuilder.setHasMask(false);\r
+        EthTypeMatchEntryBuilder ethBuilder = new EthTypeMatchEntryBuilder();\r
+        ethBuilder.setEthType(new EtherType(46));\r
+        entryBuilder.addAugmentation(EthTypeMatchEntry.class, ethBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(VlanVid.class);\r
+        entryBuilder.setHasMask(true);\r
+        VlanVidMatchEntryBuilder vidBuilder = new VlanVidMatchEntryBuilder();\r
+        vidBuilder.setCfiBit(true);\r
+        vidBuilder.setVlanVid(45);\r
+        entryBuilder.addAugmentation(VlanVidMatchEntry.class, vidBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,9});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(VlanPcp.class);\r
+        entryBuilder.setHasMask(true);\r
+        VlanPcpMatchEntryBuilder pcpBuilder = new VlanPcpMatchEntryBuilder();\r
+        pcpBuilder.setVlanPcp((short) 14);\r
+        entryBuilder.addAugmentation(VlanPcpMatchEntry.class, pcpBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(IpDscp.class);\r
+        entryBuilder.setHasMask(false);\r
+        DscpMatchEntryBuilder dscpBuilder = new DscpMatchEntryBuilder();\r
+        dscpBuilder.setDscp(new Dscp((short) 48));\r
+        entryBuilder.addAugmentation(DscpMatchEntry.class, dscpBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(IpEcn.class);\r
+        entryBuilder.setHasMask(false);\r
+        EcnMatchEntryBuilder ecnBuilder = new EcnMatchEntryBuilder();\r
+        ecnBuilder.setEcn((short) 49);\r
+        entryBuilder.addAugmentation(EcnMatchEntry.class, ecnBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(IpProto.class);\r
+        entryBuilder.setHasMask(false);\r
+        ProtocolNumberMatchEntryBuilder protoBuilder = new ProtocolNumberMatchEntryBuilder();\r
+        protoBuilder.setProtocolNumber((short) 50);\r
+        entryBuilder.addAugmentation(ProtocolNumberMatchEntry.class, protoBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv4Src.class);\r
+        entryBuilder.setHasMask(true);\r
+        Ipv4AddressMatchEntryBuilder ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.1"));\r
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,14});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv4Dst.class);\r
+        entryBuilder.setHasMask(true);\r
+        ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.2"));\r
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,15});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(TcpSrc.class);\r
+        entryBuilder.setHasMask(false);\r
+        PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();\r
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6653));\r
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(TcpDst.class);\r
+        entryBuilder.setHasMask(false);\r
+        portBuilder = new PortMatchEntryBuilder();\r
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6654));\r
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(UdpSrc.class);\r
+        entryBuilder.setHasMask(false);\r
+        portBuilder = new PortMatchEntryBuilder();\r
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6655));\r
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(UdpDst.class);\r
+        entryBuilder.setHasMask(false);\r
+        portBuilder = new PortMatchEntryBuilder();\r
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6656));\r
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(SctpSrc.class);\r
+        entryBuilder.setHasMask(false);\r
+        portBuilder = new PortMatchEntryBuilder();\r
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6657));\r
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(SctpDst.class);\r
+        entryBuilder.setHasMask(false);\r
+        portBuilder = new PortMatchEntryBuilder();\r
+        portBuilder.setPort(new org.opendaylight.yang.gen.v1.urn.ietf.params\r
+                .xml.ns.yang.ietf.inet.types.rev100924.PortNumber(6658));\r
+        entryBuilder.addAugmentation(PortMatchEntry.class, portBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Icmpv4Type.class);\r
+        entryBuilder.setHasMask(false);\r
+        Icmpv4TypeMatchEntryBuilder icmpv4typeBuilder = new Icmpv4TypeMatchEntryBuilder();\r
+        icmpv4typeBuilder.setIcmpv4Type((short) 51);\r
+        entryBuilder.addAugmentation(Icmpv4TypeMatchEntry.class, icmpv4typeBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Icmpv4Code.class);\r
+        entryBuilder.setHasMask(false);\r
+        Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();\r
+        icmpv4CodeBuilder.setIcmpv4Code((short) 52);\r
+        entryBuilder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(ArpOp.class);\r
+        entryBuilder.setHasMask(false);\r
+        OpCodeMatchEntryBuilder opBuilder = new OpCodeMatchEntryBuilder();\r
+        opBuilder.setOpCode(53);\r
+        entryBuilder.addAugmentation(OpCodeMatchEntry.class, opBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(ArpSpa.class);\r
+        entryBuilder.setHasMask(true);\r
+        ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.4"));\r
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,16});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(ArpTpa.class);\r
+        entryBuilder.setHasMask(true);\r
+        ipv4Builder = new Ipv4AddressMatchEntryBuilder();\r
+        ipv4Builder.setIpv4Address(new Ipv4Address("10.0.0.5"));\r
+        entryBuilder.addAugmentation(Ipv4AddressMatchEntry.class, ipv4Builder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,17});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(ArpSha.class);\r
+        entryBuilder.setHasMask(true);\r
+        macBuilder = new MacAddressMatchEntryBuilder();\r
+        macBuilder.setMacAddress(new MacAddress("00:01:02:03:04:05"));\r
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,4,0,0,6});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(ArpTha.class);\r
+        entryBuilder.setHasMask(true);\r
+        macBuilder = new MacAddressMatchEntryBuilder();\r
+        macBuilder.setMacAddress(new MacAddress("00:00:00:00:00:03"));\r
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,6,0,0,4});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv6Src.class);\r
+        entryBuilder.setHasMask(true);\r
+        Ipv6AddressMatchEntryBuilder ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
+        ipv6Builder.setIpv6Address(new Ipv6Address("0:0:0:0:0:0:0:1"));\r
+        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv6Dst.class);\r
+        entryBuilder.setHasMask(true);\r
+        ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
+        ipv6Builder.setIpv6Address(new Ipv6Address("0:0:1:0:1:0:0:1"));\r
+        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv6Flabel.class);\r
+        entryBuilder.setHasMask(true);\r
+        Ipv6FlabelMatchEntryBuilder flabelBuilder = new Ipv6FlabelMatchEntryBuilder();\r
+        flabelBuilder.setIpv6Flabel(new Ipv6FlowLabel(58L));\r
+        entryBuilder.addAugmentation(Ipv6FlabelMatchEntry.class, flabelBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,1,0,2});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Icmpv6Type.class);\r
+        entryBuilder.setHasMask(false);\r
+        Icmpv6TypeMatchEntryBuilder icmpv6TypeBuilder = new Icmpv6TypeMatchEntryBuilder();\r
+        icmpv6TypeBuilder.setIcmpv6Type((short) 59);\r
+        entryBuilder.addAugmentation(Icmpv6TypeMatchEntry.class, icmpv6TypeBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Icmpv6Code.class);\r
+        entryBuilder.setHasMask(false);\r
+        Icmpv6CodeMatchEntryBuilder icmpv6CodeBuilder = new Icmpv6CodeMatchEntryBuilder();\r
+        icmpv6CodeBuilder.setIcmpv6Code((short) 60);\r
+        entryBuilder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6CodeBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv6NdTarget.class);\r
+        entryBuilder.setHasMask(false);\r
+        ipv6Builder = new Ipv6AddressMatchEntryBuilder();\r
+        ipv6Builder.setIpv6Address(new Ipv6Address("F:0:0::0:0:0:1"));\r
+        entryBuilder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6Builder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(ExperimenterClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv6NdSll.class);\r
+        entryBuilder.setHasMask(false);\r
+        macBuilder = new MacAddressMatchEntryBuilder();\r
+        macBuilder.setMacAddress(new MacAddress("01:00:03:00:00:06"));\r
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv6NdTll.class);\r
+        entryBuilder.setHasMask(false);\r
+        macBuilder = new MacAddressMatchEntryBuilder();\r
+        macBuilder.setMacAddress(new MacAddress("04:00:02:00:00:08"));\r
+        entryBuilder.addAugmentation(MacAddressMatchEntry.class, macBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(MplsLabel.class);\r
+        entryBuilder.setHasMask(false);\r
+        MplsLabelMatchEntryBuilder labelBuilder = new MplsLabelMatchEntryBuilder();\r
+        labelBuilder.setMplsLabel(61L);\r
+        entryBuilder.addAugmentation(MplsLabelMatchEntry.class, labelBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(MplsTc.class);\r
+        entryBuilder.setHasMask(false);\r
+        TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder();\r
+        tcBuilder.setTc((short) 62);\r
+        entryBuilder.addAugmentation(TcMatchEntry.class, tcBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(MplsBos.class);\r
+        entryBuilder.setHasMask(false);\r
+        BosMatchEntryBuilder bosBuilder = new BosMatchEntryBuilder();\r
+        bosBuilder.setBos(true);\r
+        entryBuilder.addAugmentation(BosMatchEntry.class, bosBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        \r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(PbbIsid.class);\r
+        entryBuilder.setHasMask(true);\r
+        IsidMatchEntryBuilder isidBuilder = new IsidMatchEntryBuilder();\r
+        isidBuilder.setIsid(64L);\r
+        entryBuilder.addAugmentation(IsidMatchEntry.class, isidBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,1,2});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        \r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(TunnelId.class);\r
+        entryBuilder.setHasMask(true);\r
+        metadataBuilder = new MetadataMatchEntryBuilder();\r
+        metadataBuilder.setMetadata(new byte[]{0,0,0,0,0,0,0,1});\r
+        entryBuilder.addAugmentation(MetadataMatchEntry.class, metadataBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        \r
+        entryBuilder = new MatchEntriesBuilder();\r
+        entryBuilder.setOxmClass(OpenflowBasicClass.class);\r
+        entryBuilder.setOxmMatchField(Ipv6Exthdr.class);\r
+        entryBuilder.setHasMask(true);\r
+        PseudoFieldMatchEntryBuilder pseudoBuilder = new PseudoFieldMatchEntryBuilder();\r
+        pseudoBuilder.setPseudoField(new Ipv6ExthdrFlags(true, false, true, false, true, false, true, false, true));\r
+        entryBuilder.addAugmentation(PseudoFieldMatchEntry.class, pseudoBuilder.build());\r
+        maskBuilder = new MaskMatchEntryBuilder();\r
+        maskBuilder.setMask(new byte[]{0,2});\r
+        entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());\r
+        entries.add(entryBuilder.build());\r
+        \r
+        \r
+        \r
+        builder.setMatchEntries(entries);\r
+        Match match = builder.build();\r
+        \r
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        MatchSerializer.encodeMatch(match, out);\r
+        \r
+        Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match length", 428, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 0, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 42, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong match entry class", 1, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 43, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 5, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 1L, out.readLong());\r
+        Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());\r
+        Assert.assertEquals("Wrong match entry class", 0xFFFF, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 7, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
+        byte[] array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,5}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 9, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,2}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 10, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 46, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 13, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 4141, out.readUnsignedShort());\r
+        array = new byte[2];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,9}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 14, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 14, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 16, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 48, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 18, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 49, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 20, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 50, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 23, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,1}, array);\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,14}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 25, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,2}, array);\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,15}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 26, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 6653, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 28, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 6654, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 30, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 6655, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 32, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 6656, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 34, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 6657, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 36, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 6658, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 38, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 51, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 40, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 52, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 42, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 2, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 53, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 45, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,4}, array);\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,16}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 47, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{10,0,0,5}, array);\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,17}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 49, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,1,2,3,4,5}, array);\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,4,0,0,6}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 51, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 12, out.readUnsignedByte());\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,3}, array);\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,6,0,0,4}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 53, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());\r
+        array = new byte[16];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
+        array = new byte[16];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 55, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 32, out.readUnsignedByte());\r
+        array = new byte[16];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1}, array);\r
+        array = new byte[16];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 57, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 8, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 58, out.readUnsignedInt());\r
+        array = new byte[4];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,0,2}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 58, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 59, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 60, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 60, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 62, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
+        array = new byte[16];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,15,0,0,0,0,0,0,0,0,0,0,0,0,0,1}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0xFFFF, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 64, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{1,0,3,0,0,6}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 66, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
+        array = new byte[6];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{4,0,2,0,0,8}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 68, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 61, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 70, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 62, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 72, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 75, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 6, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 64, out.readUnsignedMedium());\r
+        array = new byte[3];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry mask", new byte[]{0,1,2}, array);\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 77, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 16, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 1L, out.readLong());\r
+        Assert.assertEquals("Wrong match entry mask", 2L, out.readLong());\r
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong match entry field & hasMask", 79, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong match entry value", 358, out.readUnsignedShort());\r
+        array = new byte[2];\r
+        out.readBytes(array);\r
+        Assert.assertArrayEquals("Wrong match entry value", new byte[]{0,2}, array);\r
+        Assert.assertTrue("Wrong padding", out.readableBytes() == 4);\r
+    }\r
+\r
+}\r