2 * Copyright (c) 2016 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
9 package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
11 import io.netty.buffer.ByteBuf;
12 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
15 public abstract class AbstractExperimenterMatchEntrySerializer extends AbstractMatchEntrySerializer {
18 public void serialize(Match match, ByteBuf outBuffer) {
19 super.serialize(match, outBuffer);
20 outBuffer.writeInt(Long.valueOf(getExperimenterId()).intValue());
24 public void serializeHeader(Match match, ByteBuf outBuffer) {
25 outBuffer.writeShort(getOxmClassCode());
27 int fieldAndMask = getOxmFieldCode() << 1;
28 int length = getValueLength();
30 if (getHasMask(match)) {
35 outBuffer.writeByte(fieldAndMask);
37 // Add length of experimenter ID to total length
38 outBuffer.writeByte(length + EncodeConstants.SIZE_OF_INT_IN_BYTES);
42 * @return experimenter match entry id
44 protected abstract long getExperimenterId();