Bug 2756 - Match model update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / match / OxmIpv6FlabelSerializer.java
index bb6c04509f9b23e088379717498f6847c41b415a..4f86b252604b617d19917c725c71a59dfc8a81a9 100644 (file)
@@ -11,8 +11,8 @@ import io.netty.buffer.ByteBuf;
 
 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6FlabelMatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6FlabelCase;
 
 /**
  * @author michal.polkorab
@@ -21,10 +21,13 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.
 public class OxmIpv6FlabelSerializer extends AbstractOxmMatchEntrySerializer {
 
     @Override
-    public void serialize(MatchEntries entry, ByteBuf outBuffer) {
+    public void serialize(MatchEntry entry, ByteBuf outBuffer) {
         super.serialize(entry, outBuffer);
-        outBuffer.writeInt(entry.getAugmentation(Ipv6FlabelMatchEntry.class).getIpv6Flabel().getValue().intValue());
-        writeMask(entry, outBuffer, getValueLength());
+        Ipv6FlabelCase entryValue = (Ipv6FlabelCase) entry.getMatchEntryValue();
+        outBuffer.writeInt(entryValue.getIpv6Flabel().getIpv6Flabel().getValue().intValue());
+        if (entry.isHasMask()) {
+            writeMask(entryValue.getIpv6Flabel().getMask(), outBuffer, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+        }
     }
 
     @Override