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
8 package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
10 import io.netty.buffer.ByteBuf;
11 import java.math.BigInteger;
12 import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
17 public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {
19 public Instruction deserialize(ByteBuf message) {
20 processHeader(message);
21 message.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
23 final byte[] meta = new byte[Long.BYTES];
24 message.readBytes(meta);
25 final byte[] metaMask = new byte[Long.BYTES];
26 message.readBytes(metaMask);
28 return new WriteMetadataCaseBuilder()
29 .setWriteMetadata(new WriteMetadataBuilder()
30 .setMetadata(new BigInteger(1, meta))
31 .setMetadataMask(new BigInteger(1, metaMask))
37 public Instruction deserializeHeader(ByteBuf message) {
38 processHeader(message);
39 return new WriteMetadataCaseBuilder().build();