X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fdeserialization%2Faction%2FOF10SetDlDstActionDeserializer.java;h=29f640f3be0ada0d3104f4504b8f950385d02b63;hb=5f5622e79402f70a944fa93fd7ee2d84d1776b08;hp=2cdc5d0d541e46714eb1e7e7c7813f7bfd8546d1;hpb=7424f6fec6016081265f98bdd9c5b17f671c0d88;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetDlDstActionDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetDlDstActionDeserializer.java index 2cdc5d0d..29f640f3 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetDlDstActionDeserializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10SetDlDstActionDeserializer.java @@ -1,25 +1,49 @@ -/* - * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ - -package org.opendaylight.openflowjava.protocol.impl.deserialization.action; - -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase; - -/** - * @author michal.polkorab - * - */ -public class OF10SetDlDstActionDeserializer extends OF10AbstractMacAddressActionDeserializer { - - @Override - protected Class getType() { - return SetDlDst.class; - } - -} +/* + * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ + +package org.opendaylight.openflowjava.protocol.impl.deserialization.action; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants; +import org.opendaylight.openflowjava.util.ByteBufUtils; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetDlDstCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.dl.dst._case.SetDlDstActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder; + +/** + * @author michal.polkorab + * + */ +public class OF10SetDlDstActionDeserializer extends AbstractActionDeserializer { + + @Override + public Action deserialize(ByteBuf input) { + ActionBuilder builder = new ActionBuilder(); + input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES); + SetDlDstCaseBuilder caseBuilder = new SetDlDstCaseBuilder(); + SetDlDstActionBuilder actionBuilder = new SetDlDstActionBuilder(); + byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH]; + input.readBytes(address); + actionBuilder.setDlDstAddress(new MacAddress(ByteBufUtils.macAddressToString(address))); + caseBuilder.setSetDlDstAction(actionBuilder.build()); + builder.setActionChoice(caseBuilder.build()); + input.skipBytes(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION); + return builder.build(); + } + + @Override + protected ActionChoice getType() { + return new SetDlDstCaseBuilder().build(); + } + +}