use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method setPortStats.
private static MultipartReplyPortStatsCase setPortStats(final ByteBuf input) {
MultipartReplyPortStatsCaseBuilder caseBuilder = new MultipartReplyPortStatsCaseBuilder();
MultipartReplyPortStatsBuilder builder = new MultipartReplyPortStatsBuilder();
List<PortStats> portStatsList = new ArrayList<>();
while (input.readableBytes() > 0) {
PortStatsBuilder portStatsBuilder = new PortStatsBuilder();
portStatsBuilder.setPortNo(input.readUnsignedInt());
input.skipBytes(PADDING_IN_PORT_STATS_HEADER);
byte[] rxPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxPackets);
portStatsBuilder.setRxPackets(new BigInteger(1, rxPackets));
byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
portStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
byte[] rxBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxBytes);
portStatsBuilder.setRxBytes(new BigInteger(1, rxBytes));
byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
portStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
byte[] rxDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxDropped);
portStatsBuilder.setRxDropped(new BigInteger(1, rxDropped));
byte[] txDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txDropped);
portStatsBuilder.setTxDropped(new BigInteger(1, txDropped));
byte[] rxErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxErrors);
portStatsBuilder.setRxErrors(new BigInteger(1, rxErrors));
byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
portStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
byte[] rxFrameErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxFrameErr);
portStatsBuilder.setRxFrameErr(new BigInteger(1, rxFrameErr));
byte[] rxOverErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxOverErr);
portStatsBuilder.setRxOverErr(new BigInteger(1, rxOverErr));
byte[] rxCrcErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxCrcErr);
portStatsBuilder.setRxCrcErr(new BigInteger(1, rxCrcErr));
byte[] collisions = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(collisions);
portStatsBuilder.setCollisions(new BigInteger(1, collisions));
portStatsBuilder.setDurationSec(input.readUnsignedInt());
portStatsBuilder.setDurationNsec(input.readUnsignedInt());
portStatsList.add(portStatsBuilder.build());
}
builder.setPortStats(portStatsList);
caseBuilder.setMultipartReplyPortStats(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactory method setPortStats.
private static MultipartReplyPortStatsCase setPortStats(ByteBuf input) {
MultipartReplyPortStatsCaseBuilder caseBuilder = new MultipartReplyPortStatsCaseBuilder();
MultipartReplyPortStatsBuilder builder = new MultipartReplyPortStatsBuilder();
List<PortStats> portStatsList = new ArrayList<>();
while (input.readableBytes() > 0) {
PortStatsBuilder portStatsBuilder = new PortStatsBuilder();
portStatsBuilder.setPortNo((long) input.readUnsignedShort());
input.skipBytes(PADDING_IN_PORT_STATS_HEADER);
byte[] rxPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxPackets);
portStatsBuilder.setRxPackets(new BigInteger(1, rxPackets));
byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txPackets);
portStatsBuilder.setTxPackets(new BigInteger(1, txPackets));
byte[] rxBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxBytes);
portStatsBuilder.setRxBytes(new BigInteger(1, rxBytes));
byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txBytes);
portStatsBuilder.setTxBytes(new BigInteger(1, txBytes));
byte[] rxDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxDropped);
portStatsBuilder.setRxDropped(new BigInteger(1, rxDropped));
byte[] txDropped = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txDropped);
portStatsBuilder.setTxDropped(new BigInteger(1, txDropped));
byte[] rxErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxErrors);
portStatsBuilder.setRxErrors(new BigInteger(1, rxErrors));
byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(txErrors);
portStatsBuilder.setTxErrors(new BigInteger(1, txErrors));
byte[] rxFrameErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxFrameErr);
portStatsBuilder.setRxFrameErr(new BigInteger(1, rxFrameErr));
byte[] rxOverErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxOverErr);
portStatsBuilder.setRxOverErr(new BigInteger(1, rxOverErr));
byte[] rxCrcErr = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(rxCrcErr);
portStatsBuilder.setRxCrcErr(new BigInteger(1, rxCrcErr));
byte[] collisions = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
input.readBytes(collisions);
portStatsBuilder.setCollisions(new BigInteger(1, collisions));
portStatsList.add(portStatsBuilder.build());
}
builder.setPortStats(portStatsList);
caseBuilder.setMultipartReplyPortStats(builder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.port.stats._case.multipart.reply.port.stats.PortStatsBuilder in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactoryTest method createPortStats.
private static List<PortStats> createPortStats() {
PortStatsBuilder builder = new PortStatsBuilder();
builder.setPortNo(1L);
builder.setRxPackets(BigInteger.valueOf(1L));
builder.setTxPackets(BigInteger.valueOf(1L));
builder.setRxBytes(BigInteger.valueOf(1L));
builder.setTxBytes(BigInteger.valueOf(1L));
builder.setRxDropped(BigInteger.valueOf(1L));
builder.setTxDropped(BigInteger.valueOf(1L));
builder.setRxErrors(BigInteger.valueOf(1L));
builder.setTxErrors(BigInteger.valueOf(1L));
builder.setRxFrameErr(BigInteger.valueOf(1L));
builder.setRxOverErr(BigInteger.valueOf(1L));
builder.setRxCrcErr(BigInteger.valueOf(1L));
builder.setCollisions(BigInteger.valueOf(1L));
builder.setDurationSec(1L);
builder.setDurationNsec(1L);
List<PortStats> 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.port.stats._case.multipart.reply.port.stats.PortStatsBuilder in project openflowplugin by opendaylight.
the class OF10StatsReplyMessageFactoryTest method createPortStats.
private static List<PortStats> createPortStats() {
PortStatsBuilder builder = new PortStatsBuilder();
builder.setPortNo(1L);
builder.setRxPackets(BigInteger.valueOf(1L));
builder.setTxPackets(BigInteger.valueOf(1L));
builder.setRxBytes(BigInteger.valueOf(1L));
builder.setTxBytes(BigInteger.valueOf(1L));
builder.setRxDropped(BigInteger.valueOf(1L));
builder.setTxDropped(BigInteger.valueOf(1L));
builder.setRxErrors(BigInteger.valueOf(1L));
builder.setTxErrors(BigInteger.valueOf(1L));
builder.setRxFrameErr(BigInteger.valueOf(1L));
builder.setRxOverErr(BigInteger.valueOf(1L));
builder.setRxCrcErr(BigInteger.valueOf(1L));
builder.setCollisions(BigInteger.valueOf(1L));
List<PortStats> 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.port.stats._case.multipart.reply.port.stats.PortStatsBuilder in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorTest method prepareMultipartReplyPortStats.
private MultipartReplyBody prepareMultipartReplyPortStats() {
PortStatsBuilder dummyPortStatBuilder = new PortStatsBuilder();
dummyPortStatBuilder.setPortNo(DUMMY_PORT_NO);
dummyPortStatBuilder.setRxBytes(DUMMY_RX_BYTES);
dummyPortStatBuilder.setTxBytes(DUMMY_TX_BYTES);
dummyPortStatBuilder.setRxPackets(DUMMY_RX_PACKETS);
dummyPortStatBuilder.setTxPackets(DUMMY_TX_PACKETS);
dummyPortStatBuilder.setCollisions(DUMMY_COLLISIONS);
dummyPortStatBuilder.setRxCrcErr(DUMMY_RX_CRC_ERR);
dummyPortStatBuilder.setRxDropped(DUMMY_RX_DROPPED);
dummyPortStatBuilder.setRxErrors(DUMMY_RX_ERRORS);
dummyPortStatBuilder.setRxFrameErr(DUMMY_RX_FRAME_ERR);
dummyPortStatBuilder.setRxOverErr(DUMMY_OVER_ERR);
dummyPortStatBuilder.setTxDropped(DUMMY_TX_DROPPED);
dummyPortStatBuilder.setTxErrors(DUMMY_TX_ERRORS);
MultipartReplyPortStatsBuilder multipartReplyPortStatsBuilder = new MultipartReplyPortStatsBuilder();
multipartReplyPortStatsBuilder.setPortStats(Lists.newArrayList(dummyPortStatBuilder.build()));
MultipartReplyPortStatsCaseBuilder multipartReplyPortStatsCaseBuilder = new MultipartReplyPortStatsCaseBuilder();
multipartReplyPortStatsCaseBuilder.setMultipartReplyPortStats(multipartReplyPortStatsBuilder.build());
return multipartReplyPortStatsCaseBuilder.build();
}
Aggregations