2 * Copyright (c) 2016 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
11 import java.math.BigInteger;
13 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
14 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
19 import io.netty.buffer.ByteBuf;
21 public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {
24 public Instruction deserialize(ByteBuf message) {
25 processHeader(message);
26 message.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
28 final byte[] meta = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
29 message.readBytes(meta);
30 final byte[] metaMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
31 message.readBytes(metaMask);
33 return new WriteMetadataCaseBuilder()
34 .setWriteMetadata(new WriteMetadataBuilder()
35 .setMetadata(new BigInteger(1, meta))
36 .setMetadataMask(new BigInteger(1, metaMask))
42 public Instruction deserializeHeader(ByteBuf message) {
43 processHeader(message);
44 return new WriteMetadataCaseBuilder().build();