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.oxm.rev150225.MatchField;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCaseBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.vlan.pcp._case.VlanPcpBuilder;
23 * @author michal.polkorab
26 public class OxmVlanPcpDeserializer extends AbstractOxmMatchEntryDeserializer
27 implements OFDeserializer<MatchEntry> {
30 public MatchEntry deserialize(ByteBuf input) {
31 MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
32 addVlanPcpValue(input, builder);
33 return builder.build();
36 private static void addVlanPcpValue(ByteBuf input, MatchEntryBuilder builder) {
37 VlanPcpCaseBuilder caseBuilder = new VlanPcpCaseBuilder();
38 VlanPcpBuilder vlanBuilder = new VlanPcpBuilder();
39 vlanBuilder.setVlanPcp(input.readUnsignedByte());
40 caseBuilder.setVlanPcp(vlanBuilder.build());
41 builder.setMatchEntryValue(caseBuilder.build());
45 protected Class<? extends MatchField> getOxmField() {
50 protected Class<? extends OxmClassBase> getOxmClass() {
51 return OpenflowBasicClass.class;