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%2Finstruction%2FWriteMetadataInstructionDeserializer.java;h=9412413bd450f5b3b4b0e11be3c5cec453794651;hb=519a86d1ddcfb8f0fe264174e62e5424e1efba1f;hp=2dce4110e307537314e0691a16fed7aea51f7b1f;hpb=1f371ed220f3e70445ed305d45a722dd6a32ded0;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/WriteMetadataInstructionDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/WriteMetadataInstructionDeserializer.java index 2dce4110..9412413b 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/WriteMetadataInstructionDeserializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/instruction/WriteMetadataInstructionDeserializer.java @@ -1,44 +1,44 @@ -/* - * 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.instruction; - -import io.netty.buffer.ByteBuf; - -import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants; -import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder; - -/** - * @author michal.polkorab - * - */ -public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer { - - @Override - public Instruction deserialize(ByteBuf input) { - InstructionBuilder builder = new InstructionBuilder(); - input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); - builder.setType(WriteMetadata.class); - input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); - input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA); - MetadataInstructionBuilder metadataBuilder = new MetadataInstructionBuilder(); - byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES]; - input.readBytes(metadata); - metadataBuilder.setMetadata(metadata); - byte[] metadata_mask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES]; - input.readBytes(metadata_mask); - metadataBuilder.setMetadataMask(metadata_mask); - builder.addAugmentation(MetadataInstruction.class, metadataBuilder.build()); - return builder.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.instruction; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder; + +/** + * @author michal.polkorab + * + */ +public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer { + + @Override + public Instruction deserialize(ByteBuf input) { + InstructionBuilder builder = new InstructionBuilder(); + input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); + builder.setType(WriteMetadata.class); + input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); + input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA); + MetadataInstructionBuilder metadataBuilder = new MetadataInstructionBuilder(); + byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES]; + input.readBytes(metadata); + metadataBuilder.setMetadata(metadata); + byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES]; + input.readBytes(metadataMask); + metadataBuilder.setMetadataMask(metadataMask); + builder.addAugmentation(MetadataInstruction.class, metadataBuilder.build()); + return builder.build(); + } +}