Search in sources :

Example 6 with QueueStats

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;
}
Also used : QueueStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStatsBuilder) ArrayList(java.util.ArrayList) QueueStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats)

Example 7 with QueueStats

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());
}
Also used : Counter64(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64) QueueIdAndStatisticsMap(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap) MultipartReply(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReply) QueueIdAndStatisticsMapBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder) NodeConnectorId(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId) GetQueueStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetQueueStatisticsOutput) QueueId(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId) MultipartReplyBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartReplyBuilder) MultipartReplyQueueStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.reply.multipart.reply.body.MultipartReplyQueueStatsBuilder)

Example 8 with QueueStats

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();
}
Also used : MultipartReplyQueueCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCaseBuilder) QueueStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStatsBuilder) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) QueueStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats) MultipartReplyQueueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueueBuilder)

Example 9 with QueueStats

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();
}
Also used : MultipartReplyQueueCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCaseBuilder) QueueStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStatsBuilder) ArrayList(java.util.ArrayList) BigInteger(java.math.BigInteger) QueueStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats) MultipartReplyQueueBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueueBuilder)

Example 10 with QueueStats

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;
}
Also used : QueueStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStatsBuilder) ArrayList(java.util.ArrayList) QueueStats(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats)

Aggregations

QueueStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStats)12 MultipartReplyQueueCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCase)8 MultipartReplyQueue (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueue)8 ArrayList (java.util.ArrayList)6 QueueIdAndStatisticsMap (org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap)5 ByteBuf (io.netty.buffer.ByteBuf)4 Counter64 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64)4 QueueId (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId)4 MultipartReplyQueueCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.MultipartReplyQueueCaseBuilder)4 MultipartReplyQueueBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.MultipartReplyQueueBuilder)4 QueueStatsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.queue._case.multipart.reply.queue.QueueStatsBuilder)4 QueueIdAndStatisticsMapBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder)4 Test (org.junit.Test)3 Counter32 (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32)3 DurationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder)3 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)3 BigInteger (java.math.BigInteger)2 GetQueueStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetQueueStatisticsOutput)2 NodeConnectorId (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId)2 MultipartRequestFlags (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags)2