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%2FOF10AbstractMacAddressActionDeserializer.java;h=46022f0c9c654b6fb6ed02ab516170b37c2e35dc;hb=29a2a074c78708f6d18583779ece96bb6573f0c6;hp=3013c880fe9b6ead9ca7ff710a8584675ed250ca;hpb=26aeaa7e2754b2cf4f6ad63055ab3ce34f68c961;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10AbstractMacAddressActionDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10AbstractMacAddressActionDeserializer.java index 3013c880..46022f0c 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10AbstractMacAddressActionDeserializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/action/OF10AbstractMacAddressActionDeserializer.java @@ -1,46 +1,46 @@ -/* - * 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.impl.util.ActionConstants; -import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils; -import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; -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.augments.rev131002.DlAddressAction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder; - -/** - * @author michal.polkorab - * - */ -public abstract class OF10AbstractMacAddressActionDeserializer extends AbstractActionDeserializer { - - @Override - public Action deserialize(ByteBuf input) { - ActionBuilder builder = new ActionBuilder(); - input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); - builder.setType(getType()); - input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); - builder.addAugmentation(DlAddressAction.class, createDlAugmentationAndPad(input)); - return builder.build(); - } - - private static DlAddressAction createDlAugmentationAndPad(ByteBuf input) { - DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder(); - byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH]; - input.readBytes(address); - dlBuilder.setDlAddress(new MacAddress(ByteBufUtils.macAddressToString(address))); - input.skipBytes(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION); - return dlBuilder.build(); - } -} +/* + * 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.augments.rev150225.DlAddressAction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.DlAddressActionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder; + +/** + * @author michal.polkorab + * + */ +public abstract class OF10AbstractMacAddressActionDeserializer extends AbstractActionDeserializer { + + @Override + public Action deserialize(ByteBuf input) { + ActionBuilder builder = new ActionBuilder(); + input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); + builder.setType(getType()); + input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); + builder.addAugmentation(DlAddressAction.class, createDlAugmentationAndPad(input)); + return builder.build(); + } + + private static DlAddressAction createDlAugmentationAndPad(ByteBuf input) { + DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder(); + byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH]; + input.readBytes(address); + dlBuilder.setDlAddress(new MacAddress(ByteBufUtils.macAddressToString(address))); + input.skipBytes(ActionConstants.PADDING_IN_DL_ADDRESS_ACTION); + return dlBuilder.build(); + } +}