2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
\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
9 package org.opendaylight.openflowjava.protocol.ext.deserialization;
\r
11 import io.netty.buffer.ByteBuf;
\r
13 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
\r
14 import org.opendaylight.openflowjava.protocol.ext.util.ExtConstants;
\r
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty;
\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder;
\r
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeatureProperties;
\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.table.features.properties.grouping.TableFeaturePropertiesBuilder;
\r
22 * @author michal.polkorab
\r
25 public class OF13TableFeaturesExperimenterDeserializer
\r
26 implements OFDeserializer<TableFeatureProperties>{
\r
29 public TableFeatureProperties deserialize(ByteBuf input) {
\r
30 TableFeaturePropertiesBuilder builder = new TableFeaturePropertiesBuilder();
\r
31 TableFeaturesPropType type = TableFeaturesPropType.forValue(input.readUnsignedShort());
\r
32 builder.setType(type);
\r
33 int length = input.readUnsignedShort();
\r
34 ExperimenterRelatedTableFeaturePropertyBuilder expBuilder =
\r
35 new ExperimenterRelatedTableFeaturePropertyBuilder();
\r
36 expBuilder.setExperimenter(input.readUnsignedInt());
\r
37 expBuilder.setExpType(input.readUnsignedInt());
\r
38 // extract experimenter_data length
\r
39 length = length - 2 * ExtConstants.SIZE_OF_SHORT_IN_BYTES - 2 * ExtConstants.SIZE_OF_INT_IN_BYTES;
\r
41 byte[] data = new byte[length];
\r
42 input.readBytes(data);
\r
43 expBuilder.setData(data);
\r
45 builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expBuilder.build());
\r
46 return builder.build();
\r