Bug 2756 - Action model update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / action / OF13PopMplsActionSerializer.java
index 2857b4a00c9e0e6a874e9487e773fbde545ed978..4cfebf7b2937399c62dbf20d8dbc7f33ccd5cc4e 100644 (file)
@@ -8,13 +8,30 @@
 
 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.PopMplsCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 
 /**
  * @author michal.polkorab
  *
  */
-public class OF13PopMplsActionSerializer extends AbstractEthertypeActionSerializer {
+public class OF13PopMplsActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(Action action, ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        outBuffer.writeShort(((PopMplsCase) action.getActionChoice())
+                .getPopMplsAction().getEthertype().getValue());
+        outBuffer.writeZero(ActionConstants.ETHERTYPE_ACTION_PADDING);
+    }
+
+    @Override
+    protected int getLength() {
+        return ActionConstants.GENERAL_ACTION_LENGTH;
+    }
 
     @Override
     protected int getType() {