use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStatsBuilder in project openflowplugin by opendaylight.
the class StatisticsGatheringUtilsTest method testGatherStatistics_queue.
@Test
public void testGatherStatistics_queue() throws Exception {
final MultipartType type = MultipartType.OFPMPQUEUE;
final long queueIdValue = 4L;
final QueueStatsBuilder queueStatsBld = new QueueStatsBuilder().setPortNo(11L).setTxBytes(BigInteger.valueOf(44L)).setTxErrors(BigInteger.valueOf(45L)).setTxPackets(BigInteger.valueOf(46L)).setDurationSec(47L).setDurationNsec(48L).setQueueId(queueIdValue);
final MultipartReplyQueueBuilder mpReplyQueueBld = new MultipartReplyQueueBuilder();
mpReplyQueueBld.setQueueStats(Lists.newArrayList(queueStatsBld.build()));
final MultipartReplyQueueCaseBuilder mpReplyQueueCaseBld = new MultipartReplyQueueCaseBuilder();
mpReplyQueueCaseBld.setMultipartReplyQueue(mpReplyQueueBld.build());
final MultipartReply meterStatsUpdated = assembleMPReplyMessage(type, mpReplyQueueCaseBld.build());
final List<MultipartReply> statsData = Collections.singletonList(meterStatsUpdated);
fireAndCheck(type, statsData);
final KeyedInstanceIdentifier<Queue, QueueKey> queuePath = dummyNodePath.child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId("openflow:" + DUMMY_NODE_ID_VALUE + ":11"))).augmentation(FlowCapableNodeConnector.class).child(Queue.class, new QueueKey(new QueueId(queueIdValue)));
verify(deviceContext).writeToTransaction(Matchers.eq(LogicalDatastoreType.OPERATIONAL), Matchers.eq(queuePath), Matchers.any(Queue.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStatsBuilder 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.QueueStatsBuilder 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.QueueStatsBuilder 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.QueueStatsBuilder 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