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