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.openflowjava.protocol.api.util.EncodeConstants;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.PbbIsid;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.PbbIsidCaseBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.pbb.isid._case.PbbIsidBuilder;
24 * @author michal.polkorab
27 public class OxmPbbIsidDeserializer extends AbstractOxmMatchEntryDeserializer
28 implements OFDeserializer<MatchEntry> {
31 public MatchEntry deserialize(ByteBuf input) {
32 MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
33 addPbbIsidValue(input, builder);
34 return builder.build();
37 private static void addPbbIsidValue(ByteBuf input, MatchEntryBuilder builder) {
38 PbbIsidCaseBuilder caseBuilder = new PbbIsidCaseBuilder();
39 PbbIsidBuilder isidBuilder = new PbbIsidBuilder();
40 Integer isid = input.readUnsignedMedium();
41 isidBuilder.setIsid(isid.longValue());
42 if (builder.isHasMask()) {
43 isidBuilder.setMask(OxmDeserializerHelper
44 .convertMask(input, EncodeConstants.SIZE_OF_3_BYTES));
46 caseBuilder.setPbbIsid(isidBuilder.build());
47 builder.setMatchEntryValue(caseBuilder.build());
51 protected Class<? extends MatchField> getOxmField() {
56 protected Class<? extends OxmClassBase> getOxmClass() {
57 return OpenflowBasicClass.class;