Search in sources :

Example 21 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyFlowTableStatsDeserializer method deserialize.

@Override
public MultipartReplyBody deserialize(ByteBuf message) {
    final MultipartReplyFlowTableStatsBuilder builder = new MultipartReplyFlowTableStatsBuilder();
    final List<FlowTableAndStatisticsMap> items = new ArrayList<>();
    while (message.readableBytes() > 0) {
        final FlowTableAndStatisticsMapBuilder itemBuilder = new FlowTableAndStatisticsMapBuilder().setTableId(new TableId(message.readUnsignedByte()));
        message.skipBytes(PADDING_IN_TABLE_HEADER);
        itemBuilder.setKey(new FlowTableAndStatisticsMapKey(itemBuilder.getTableId())).setActiveFlows(new Counter32(message.readUnsignedInt()));
        final byte[] packetsLooked = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(packetsLooked);
        final byte[] packetsMatched = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(packetsMatched);
        items.add(itemBuilder.setPacketsLookedUp(new Counter64(new BigInteger(1, packetsLooked))).setPacketsMatched(new Counter64(new BigInteger(1, packetsMatched))).build());
    }
    return builder.setFlowTableAndStatisticsMap(items).build();
}
Also used : MultipartReplyFlowTableStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.multipart.reply.multipart.reply.body.MultipartReplyFlowTableStatsBuilder) FlowTableAndStatisticsMap(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap) TableId(org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId) Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) Counter64(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64) FlowTableAndStatisticsMapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMapKey) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) FlowTableAndStatisticsMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMapBuilder)

Example 22 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyQueueStatsDeserializer method deserialize.

@Override
public MultipartReplyBody deserialize(ByteBuf message) {
    final MultipartReplyQueueStatsBuilder builder = new MultipartReplyQueueStatsBuilder();
    final List<QueueIdAndStatisticsMap> items = new ArrayList<>();
    while (message.readableBytes() > 0) {
        final long port = message.readUnsignedInt();
        final NodeConnectorId nodeConnectorId = new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port));
        final QueueId queueId = new QueueId(message.readUnsignedInt());
        final byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(txBytes);
        final byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(txPackets);
        final byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
        message.readBytes(txErrors);
        items.add(new QueueIdAndStatisticsMapBuilder().setKey(new QueueIdAndStatisticsMapKey(nodeConnectorId, queueId)).setNodeConnectorId(nodeConnectorId).setQueueId(queueId).setTransmittedBytes(new Counter64(new BigInteger(1, txBytes))).setTransmittedPackets(new Counter64(new BigInteger(1, txPackets))).setTransmissionErrors(new Counter64(new BigInteger(1, txErrors))).setDuration(new DurationBuilder().setSecond(new Counter32(message.readUnsignedInt())).setNanosecond(new Counter32(message.readUnsignedInt())).build()).build());
    }
    return builder.setQueueIdAndStatisticsMap(items).build();
}
Also used : QueueIdAndStatisticsMap(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) ArrayList(java.util.ArrayList) QueueId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId) Counter32(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32) Counter64(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64) QueueIdAndStatisticsMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder) QueueIdAndStatisticsMapKey(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapKey) BigInteger(java.math.BigInteger) MultipartReplyQueueStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.reply.multipart.reply.body.MultipartReplyQueueStatsBuilder) DurationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)

Example 23 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method prepareMultipartReplyGroupDesc.

private MultipartReplyBody prepareMultipartReplyGroupDesc() {
    GroupDescBuilder groupDescBuilder = new GroupDescBuilder();
    groupDescBuilder.setGroupId(DUMMY_GROUP_ID);
    groupDescBuilder.setBucketsList(Collections.<BucketsList>emptyList());
    groupDescBuilder.setType(DUMMY_GROUP_TYPE);
    MultipartReplyGroupDescBuilder multipartReplyGroupDescBuilder = new MultipartReplyGroupDescBuilder();
    multipartReplyGroupDescBuilder.setGroupDesc(Lists.newArrayList(groupDescBuilder.build()));
    MultipartReplyGroupDescCaseBuilder multipartReplyGroupDescCaseBuilder = new MultipartReplyGroupDescCaseBuilder();
    multipartReplyGroupDescCaseBuilder.setMultipartReplyGroupDesc(multipartReplyGroupDescBuilder.build());
    return multipartReplyGroupDescCaseBuilder.build();
}
Also used : MultipartReplyGroupDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDescBuilder) GroupDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.multipart.reply.group.desc.GroupDescBuilder) MultipartReplyGroupDescBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group.desc._case.MultipartReplyGroupDescBuilder) MultipartReplyGroupDescCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyGroupDescCaseBuilder)

Example 24 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method prepareMultipartReplyFlow.

private MultipartReplyBody prepareMultipartReplyFlow() {
    MultipartReplyFlowCaseBuilder multipartReplyFlowCaseBuilder = new MultipartReplyFlowCaseBuilder();
    MultipartReplyFlowBuilder multipartReplyFlowBuilder = new MultipartReplyFlowBuilder();
    multipartReplyFlowBuilder.setFlowStats(Collections.<FlowStats>emptyList());
    multipartReplyFlowCaseBuilder.setMultipartReplyFlow(multipartReplyFlowBuilder.build());
    return multipartReplyFlowCaseBuilder.build();
}
Also used : MultipartReplyFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlowBuilder) MultipartReplyFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCaseBuilder)

Example 25 with MultipartReplyBody

use of org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody in project openflowplugin by opendaylight.

the class MultipartReplyTranslatorTest method prepareMultipartReplyAggregate.

private MultipartReplyBody prepareMultipartReplyAggregate() {
    MultipartReplyAggregateBuilder multipartReplyAggregateBuilder = new MultipartReplyAggregateBuilder();
    multipartReplyAggregateBuilder.setByteCount(DUMMY_BYTE_COUNT);
    multipartReplyAggregateBuilder.setPacketCount(DUMMY_PACKET_COUNT);
    multipartReplyAggregateBuilder.setFlowCount(DUMMY_FLOW_COUNT);
    MultipartReplyAggregateCaseBuilder multipartReplyAggregateCaseBuilder = new MultipartReplyAggregateCaseBuilder();
    multipartReplyAggregateCaseBuilder.setMultipartReplyAggregate(multipartReplyAggregateBuilder.build());
    return multipartReplyAggregateCaseBuilder.build();
}
Also used : MultipartReplyAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregateBuilder) MultipartReplyAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCaseBuilder)

Aggregations

ArrayList (java.util.ArrayList)11 ByteBuf (io.netty.buffer.ByteBuf)9 BigInteger (java.math.BigInteger)8 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)7 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)6 BucketId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId)2 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 MeterId (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId)2 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)2 MultipartReplyAggregateCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyAggregateCase)2 MultipartReplyFlowCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyFlowCase)2 MultipartReplyTableCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyTableCase)2 MultipartReplyAggregate (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.aggregate._case.MultipartReplyAggregate)2 MultipartReplyFlow (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.MultipartReplyFlow)2 FlowStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.flow._case.multipart.reply.flow.FlowStats)2 MultipartReplyTable (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.MultipartReplyTable)2 TableStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.table._case.multipart.reply.table.TableStats)2 List (java.util.List)1 OFDeserializer (org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer)1