Created experimenter subtype for vendor's actions
[openflowjava.git] / openflow-extension-nicira / src / main / java / org / opendaylight / openflowjava / nx / codec / action / AbstractActionSerializer.java
1 /**
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  * 
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
7  */
8 package org.opendaylight.openflowjava.nx.codec.action;
9
10 import io.netty.buffer.ByteBuf;
11
12 import org.opendaylight.openflowjava.nx.NiciraConstants;
13 import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
14 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
16
17 /**
18  * @author msunal
19  *
20  */
21 public abstract class AbstractActionSerializer implements OFSerializer<Action> {
22
23     protected final static void serializeHeader(int msgLength, int subtype, ByteBuf outBuffer) {
24         outBuffer.writeShort(EncodeConstants.EXPERIMENTER_VALUE);
25         writeMsgLengthVendorIdSubtypeToBuffer(msgLength, subtype, outBuffer);
26     }
27
28     private final static void writeMsgLengthVendorIdSubtypeToBuffer(int msgLength, int subtype, ByteBuf outBuffer) {
29         outBuffer.writeShort(msgLength);
30         outBuffer.writeInt(NiciraConstants.NX_VENDOR_ID.intValue());
31         outBuffer.writeShort(subtype);
32     }
33
34 }