Merge "Quickfix - Vlan-vid match entry"
authorDaniel Bartos <daniel.bartos@pantheon.sk>
Tue, 10 Dec 2013 07:15:17 +0000 (07:15 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 10 Dec 2013 07:15:17 +0000 (07:15 +0000)
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

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
index d4729f6b2aafc637ebaff08b625788e60a0cd8f9..bde832c0206aae3ab089da9dd8e00c51cbd5e56e 100644 (file)
@@ -187,9 +187,10 @@ public class MatchSerializer {
             fieldValue = 6;\r
             fieldValue = fieldValue << 1;\r
             VlanVidMatchEntry vlanVid = entry.getAugmentation(VlanVidMatchEntry.class);\r
-            int vlanVidValue = vlanVid.getVlanVid() << 1;\r
+            int vlanVidValue = vlanVid.getVlanVid();\r
             if (vlanVid.isCfiBit()) {\r
-                vlanVidValue = vlanVidValue | 1;\r
+                short cfi = 1 << 12; // 13-th bit\r
+                vlanVidValue = vlanVidValue | cfi;\r
             }\r
             if (entry.isHasMask()) {\r
                 fieldValue = fieldValue | 1;\r