Bug 2756 - Action model update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / action / OF13PushVlanActionSerializer.java
index 1dedb85bc2a2330490f3dcd212e74df0d054d827..696aa59f3b4ff139200c5679433c9a832bacc818 100644 (file)
@@ -8,14 +8,31 @@
 
 package org.opendaylight.openflowjava.protocol.impl.serialization.action;
 
+import io.netty.buffer.ByteBuf;
+
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 
 
 /**
  * @author michal.polkorab
  *
  */
-public class OF13PushVlanActionSerializer extends AbstractEthertypeActionSerializer {
+public class OF13PushVlanActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        outBuffer.writeShort(((PushVlanCase) action.getActionChoice())
+                .getPushVlanAction().getEthertype().getValue());
+        outBuffer.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
 
     @Override
     protected int getType() {