2 * Copyright (c) 2013 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.openflowjava.protocol.impl.deserialization.match;
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MetadataCaseBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.metadata._case.MetadataBuilder;
17 * Translates OxmMetadata messages.
19 * @author michal.polkorab
21 public class OxmMetadataDeserializer extends AbstractOxmMatchEntryDeserializer {
22 public OxmMetadataDeserializer() {
23 super(Metadata.class);
27 protected void deserialize(final ByteBuf input, final MatchEntryBuilder builder) {
28 final byte[] metadataBytes = new byte[Long.BYTES];
29 input.readBytes(metadataBytes);
31 final MetadataBuilder metadataBuilder = new MetadataBuilder().setMetadata(metadataBytes);
32 if (builder.isHasMask()) {
33 metadataBuilder.setMask(OxmDeserializerHelper.convertMask(input, Long.BYTES));
35 builder.setMatchEntryValue(new MetadataCaseBuilder().setMetadata(metadataBuilder.build()).build());