Bug 2756 - Action model update
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / action / OF10SetNwDstActionSerializer.java
index 2494ced3fcfdd3a32acbcfd0da94627f82e9fc11..73ecd595df158da31c78111283807310e3428686 100644 (file)
@@ -8,13 +8,29 @@
 
 package org.opendaylight.openflowjava.protocol.impl.serialization.action;
 
+import io.netty.buffer.ByteBuf;
+
 import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
 
 /**
  * @author michal.polkorab
  *
  */
-public class OF10SetNwDstActionSerializer extends OF10AbstractIpAddressActionSerializer {
+public class OF10SetNwDstActionSerializer extends AbstractActionSerializer {
+
+    @Override
+    public void serialize(final Action action, final ByteBuf outBuffer) {
+        super.serialize(action, outBuffer);
+        Iterable<String> addressGroups = ByteBufUtils.DOT_SPLITTER
+                .split(((SetNwDstCase) action.getActionChoice()).getSetNwDstAction()
+                        .getIpAddress().getValue());
+        for (String group : addressGroups) {
+            outBuffer.writeByte(Short.parseShort(group));
+        }
+    }
 
     @Override
     protected int getType() {