ca740dd52ef2d448a80c3db75d12f49ee4fd6523
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / serialization / match / OxmPbbIsidSerializer.java
1 /*\r
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
3  *\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
7  */\r
8 package org.opendaylight.openflowjava.protocol.impl.serialization.match;\r
9 \r
10 import io.netty.buffer.ByteBuf;\r
11 \r
12 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
13 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IsidMatchEntry;\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
16 \r
17 /**\r
18  * @author michal.polkorab\r
19  *\r
20  */\r
21 public class OxmPbbIsidSerializer extends AbstractOxmMatchEntrySerializer {\r
22 \r
23     @Override\r
24     public void serialize(MatchEntries entry, ByteBuf outBuffer) {\r
25         super.serialize(entry, outBuffer);\r
26         outBuffer.writeMedium(entry.getAugmentation(IsidMatchEntry.class).getIsid().intValue());\r
27         writeMask(entry, outBuffer, getValueLength());\r
28     }\r
29 \r
30     @Override\r
31     protected int getOxmClassCode() {\r
32         return OxmMatchConstants.OPENFLOW_BASIC_CLASS;\r
33     }\r
34 \r
35     @Override\r
36     protected int getOxmFieldCode() {\r
37         return OxmMatchConstants.PBB_ISID;\r
38     }\r
39 \r
40     @Override\r
41     protected int getValueLength() {\r
42         return EncodeConstants.SIZE_OF_3_BYTES;\r
43     }\r
44 }\r