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;
12 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntry;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsLabelMatchEntryBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsLabel;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
23 * @author michal.polkorab
26 public class OxmMplsLabelDeserializer extends AbstractOxmMatchEntryDeserializer
27 implements OFDeserializer<MatchEntries> {
30 public MatchEntries deserialize(ByteBuf input) {
31 MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
32 addMplsLabelAugmentation(input, builder);
33 return builder.build();
36 private static void addMplsLabelAugmentation(ByteBuf input,
37 MatchEntriesBuilder builder) {
38 MplsLabelMatchEntryBuilder mplsLabelBuilder = new MplsLabelMatchEntryBuilder();
39 mplsLabelBuilder.setMplsLabel(input.readUnsignedInt());
40 builder.addAugmentation(MplsLabelMatchEntry.class, mplsLabelBuilder.build());
44 protected Class<? extends MatchField> getOxmField() {
45 return MplsLabel.class;
49 protected Class<? extends OxmClassBase> getOxmClass() {
50 return OpenflowBasicClass.class;