use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactoryTest method createQueueStats.
private static List<QueueStats> createQueueStats() {
QueueStatsBuilder builder = new QueueStatsBuilder();
builder.setQueueId(1L);
builder.setTxBytes(BigInteger.valueOf(1L));
builder.setTxPackets(BigInteger.valueOf(1L));
builder.setTxErrors(BigInteger.valueOf(1L));
List<QueueStats> list = new ArrayList<>();
list.add(builder.build());
return list;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats in project openflowplugin by opendaylight.
the class QueueDirectStatisticsServiceTest method testBuildReply.
@Override
public void testBuildReply() throws Exception {
final QueueIdAndStatisticsMap queueStats = new QueueIdAndStatisticsMapBuilder().setQueueId(new QueueId(QUEUE_NO)).setNodeConnectorId(new NodeConnectorId(PORT_NO.toString())).setTransmittedBytes(new Counter64(BigInteger.ONE)).setTransmissionErrors(new Counter64(BigInteger.ONE)).setTransmittedBytes(new Counter64(BigInteger.ONE)).build();
final MultipartReply reply = new MultipartReplyBuilder().setMultipartReplyBody(new MultipartReplyQueueStatsBuilder().setQueueIdAndStatisticsMap(Collections.singletonList(queueStats)).build()).build();
final List<MultipartReply> input = Collections.singletonList(reply);
final GetQueueStatisticsOutput output = service.buildReply(input, true);
assertTrue(output.getQueueIdAndStatisticsMap().size() > 0);
final QueueIdAndStatisticsMap map = output.getQueueIdAndStatisticsMap().get(0);
assertEquals(map.getQueueId().getValue(), QUEUE_NO);
assertEquals(map.getNodeConnectorId().getValue(), PORT_NO.toString());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method setQueue.
private static MultipartReplyQueueCase setQueue(final ByteBuf input) {
MultipartReplyQueueCaseBuilder caseBuilder = new MultipartReplyQueueCaseBuilder();
MultipartReplyQueueBuilder builder = new MultipartReplyQueueBuilder();
List<QueueStats> queueStatsList = new ArrayList<>();
while (input.readableBytes() > 0) {
QueueStatsBuilder queueStatsBuilder = new QueueStatsBuilder();
queueStatsBuilder.setPortNo(input.readUnsignedInt());
queueStatsBuilder.setQueueId(input.readUnsignedInt());
byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
queueStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
queueStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
queueStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
queueStatsBuilder.setDurationSec(input.readUnsignedInt());
queueStatsBuilder.setDurationNsec(input.readUnsignedInt());
queueStatsList.add(queueStatsBuilder.build());
}
builder.setQueueStats(queueStatsList);
caseBuilder.setMultipartReplyQueue(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactory method setQueue.
private static MultipartReplyQueueCase setQueue(ByteBuf input) {
MultipartReplyQueueCaseBuilder caseBuilder = new MultipartReplyQueueCaseBuilder();
MultipartReplyQueueBuilder builder = new MultipartReplyQueueBuilder();
List<QueueStats> queueStatsList = new ArrayList<>();
while (input.readableBytes() > 0) {
QueueStatsBuilder queueStatsBuilder = new QueueStatsBuilder();
queueStatsBuilder.setPortNo((long) input.readUnsignedShort());
input.skipBytes(PADDING_IN_QUEUE_HEADER);
queueStatsBuilder.setQueueId(input.readUnsignedInt());
byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
queueStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
queueStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
queueStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
queueStatsList.add(queueStatsBuilder.build());
}
builder.setQueueStats(queueStatsList);
caseBuilder.setMultipartReplyQueue(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method createQueueStats.
private static List<QueueStats> createQueueStats() {
QueueStatsBuilder builder = new QueueStatsBuilder();
builder.setPortNo(1L);
builder.setQueueId(1L);
builder.setTxBytes(BigInteger.valueOf(1L));
builder.setTxPackets(BigInteger.valueOf(1L));
builder.setTxErrors(BigInteger.valueOf(1L));
builder.setDurationSec(1L);
builder.setDurationNsec(1L);
List<QueueStats> list = new ArrayList<>();
list.add(builder.build());
return list;
}
Aggregations