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();
}
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();
}
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();
}
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();
}
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();
}
Aggregations