2 * Copyright (c) 2017 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
8 package org.opendaylight.openflowplugin.impl.protocol.deserialization.multipart;
10 import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
11 import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint64;
13 import io.netty.buffer.ByteBuf;
14 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStatsBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
20 public class MultipartReplyFlowAggregateStatsDeserializer implements OFDeserializer<MultipartReplyBody> {
21 private static final byte PADDING_IN_AGGREGATE_HEADER = 4;
24 public MultipartReplyBody deserialize(final ByteBuf message) {
25 final MultipartReplyFlowAggregateStatsBuilder builder = new MultipartReplyFlowAggregateStatsBuilder()
26 .setPacketCount(new Counter64(readUint64(message)))
27 .setByteCount(new Counter64(readUint64(message)))
28 .setFlowCount(new Counter32(readUint32(message)));
29 message.skipBytes(PADDING_IN_AGGREGATE_HEADER);
31 return builder.build();