Quickfix - Vlan-vid match entry
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / util / MatchDeserializer.java
index 989af29398137eb97a6c4850a1dd353af1e6afa9..9df9d17d4e2ee67062a7e298505c0d7c556e0f1e 100644 (file)
@@ -248,9 +248,9 @@ public abstract class MatchDeserializer {
             case 6:\r
                 matchEntriesBuilder.setOxmMatchField(VlanVid.class);\r
                 VlanVidMatchEntryBuilder vlanVidBuilder = new VlanVidMatchEntryBuilder();\r
-                int vidEntryValue = in.readUnsignedShort(); \r
-                vlanVidBuilder.setCfiBit((vidEntryValue & 1) != 0);\r
-                vlanVidBuilder.setVlanVid(vidEntryValue >> 1);\r
+                int vidEntryValue = in.readUnsignedShort();\r
+                vlanVidBuilder.setCfiBit((vidEntryValue & (1 << 12)) != 0); // cfi is 13-th bit\r
+                vlanVidBuilder.setVlanVid(vidEntryValue & ((1 << 12) - 1)); // value without 13-th bit\r
                 matchEntriesBuilder.addAugmentation(VlanVidMatchEntry.class, vlanVidBuilder.build());\r
                 if (hasMask) {\r
                     addMaskAugmentation(matchEntriesBuilder, in, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);\r