2 * Copyright (c) 2016 Brocade Communications Systems, Inc. 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.serialization.match.ext;
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
12 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainer;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
19 * Created by Anil Vishnoi (avishnoi@Brocade.com) on 7/25/16.
21 public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntrySerializer {
24 public void serialize(MatchEntry entry, ByteBuf outBuffer) {
25 super.serialize(entry, outBuffer);
26 ExperimenterIdCase expCase = serializeExperimenterId(entry, outBuffer);
27 TcpFlags tcpFlags = expCase.getAugmentation(TcpFlagsContainer.class).getTcpFlags();
28 outBuffer.writeShort(tcpFlags.getFlags());
29 if (entry.isHasMask()) {
30 outBuffer.writeBytes(tcpFlags.getMask());
35 * @return Experimenter match entry ID
38 protected long getExperimenterId() {
39 return EncodeConstants.ONF_EXPERIMENTER_ID;
43 * @return numeric representation of oxm_field
46 protected int getOxmFieldCode() {
47 return EncodeConstants.ONFOXM_ET_TCP_FLAGS;
51 * @return numeric representation of oxm_class
54 protected int getOxmClassCode() {
55 return OxmMatchConstants.EXPERIMENTER_CLASS;
59 * @return match entry value length (without mask length)
62 protected int getValueLength() {
63 return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;