2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
\r
10 import io.netty.buffer.ByteBuf;
\r
12 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntry;
\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv4CodeMatchEntryBuilder;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv4Code;
\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
\r
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
\r
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
\r
23 * @author michal.polkorab
\r
26 public class OxmIcmpv4CodeDeserializer extends AbstractOxmMatchEntryDeserializer
\r
27 implements OFDeserializer<MatchEntries> {
\r
30 public MatchEntries deserialize(ByteBuf input) {
\r
31 MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
\r
32 addIcmpv4CodeAugmentation(input, builder);
\r
33 return builder.build();
\r
36 private static void addIcmpv4CodeAugmentation(ByteBuf input,
\r
37 MatchEntriesBuilder builder) {
\r
38 Icmpv4CodeMatchEntryBuilder icmpv4CodeBuilder = new Icmpv4CodeMatchEntryBuilder();
\r
39 icmpv4CodeBuilder.setIcmpv4Code(input.readUnsignedByte());
\r
40 builder.addAugmentation(Icmpv4CodeMatchEntry.class, icmpv4CodeBuilder.build());
\r
44 protected Class<? extends MatchField> getOxmField() {
\r
45 return Icmpv4Code.class;
\r
49 protected Class<? extends OxmClassBase> getOxmClass() {
\r
50 return OpenflowBasicClass.class;
\r