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.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntry;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortMatchEntryBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
20 * @author michal.polkorab
23 public abstract class AbstractOxmPortDeserializer extends AbstractOxmMatchEntryDeserializer
24 implements OFDeserializer<MatchEntries> {
27 public MatchEntries deserialize(ByteBuf input) {
28 MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
29 addPortAugmentation(builder, input);
30 return builder.build();
33 private static void addPortAugmentation(MatchEntriesBuilder builder, ByteBuf input) {
34 PortMatchEntryBuilder portBuilder = new PortMatchEntryBuilder();
35 portBuilder.setPort(new PortNumber(input.readUnsignedShort()));
36 builder.addAugmentation(PortMatchEntry.class, portBuilder.build());