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.PortStats in project openflowplugin by opendaylight.
the class MultipartRequestInputFactory method serializePortStatsBody.
private static void serializePortStatsBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
MultipartRequestPortStatsCase portstatsCase = (MultipartRequestPortStatsCase) multipartRequestBody;
MultipartRequestPortStats portstats = portstatsCase.getMultipartRequestPortStats();
output.writeInt(portstats.getPortNo().intValue());
output.writeZero(PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY);
}
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.PortStats in project openflowplugin by opendaylight.
the class OF10StatsRequestInputFactory method serializePortBody.
private static void serializePortBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
MultipartRequestPortStatsCase portstatsCase = (MultipartRequestPortStatsCase) multipartRequestBody;
MultipartRequestPortStats portstats = portstatsCase.getMultipartRequestPortStats();
output.writeShort(portstats.getPortNo().intValue());
output.writeZero(PADDING_IN_MULTIPART_REQUEST_PORT_BODY);
}
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.PortStats in project openflowplugin by opendaylight.
the class NodeConnectorStatisticsToNotificationTransformer method processSingleNodeConnectorStats.
@VisibleForTesting
static NodeConnectorStatisticsAndPortNumberMapBuilder processSingleNodeConnectorStats(DeviceInfo deviceInfo, OpenflowVersion ofVersion, PortStats portStats) {
NodeConnectorStatisticsAndPortNumberMapBuilder statsBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
statsBuilder.setNodeConnectorId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(deviceInfo.getDatapathId(), portStats.getPortNo(), ofVersion));
BytesBuilder bytesBuilder = new BytesBuilder();
bytesBuilder.setReceived(portStats.getRxBytes());
bytesBuilder.setTransmitted(portStats.getTxBytes());
statsBuilder.setBytes(bytesBuilder.build());
PacketsBuilder packetsBuilder = new PacketsBuilder();
packetsBuilder.setReceived(portStats.getRxPackets());
packetsBuilder.setTransmitted(portStats.getTxPackets());
statsBuilder.setPackets(packetsBuilder.build());
DurationBuilder durationBuilder = new DurationBuilder();
if (portStats.getDurationSec() != null) {
durationBuilder.setSecond(new Counter32(portStats.getDurationSec()));
}
if (portStats.getDurationNsec() != null) {
durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
}
statsBuilder.setDuration(durationBuilder.build());
statsBuilder.setCollisionCount(portStats.getCollisions());
statsBuilder.setKey(new NodeConnectorStatisticsAndPortNumberMapKey(statsBuilder.getNodeConnectorId()));
statsBuilder.setReceiveCrcError(portStats.getRxCrcErr());
statsBuilder.setReceiveDrops(portStats.getRxDropped());
statsBuilder.setReceiveErrors(portStats.getRxErrors());
statsBuilder.setReceiveFrameError(portStats.getRxFrameErr());
statsBuilder.setReceiveOverRunError(portStats.getRxOverErr());
statsBuilder.setTransmitDrops(portStats.getTxDropped());
statsBuilder.setTransmitErrors(portStats.getTxErrors());
return statsBuilder;
}
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.PortStats in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorUtil method translatePortStats.
private static org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.reply.multipart.reply.body.MultipartReplyPortStats translatePortStats(final MultipartReply msg, final OpenflowVersion ofVersion, final BigInteger datapathId) {
MultipartReplyPortStatsBuilder message = new MultipartReplyPortStatsBuilder();
MultipartReplyPortStatsCase caseBody = (MultipartReplyPortStatsCase) msg.getMultipartReplyBody();
MultipartReplyPortStats replyBody = caseBody.getMultipartReplyPortStats();
List<NodeConnectorStatisticsAndPortNumberMap> statsMap = new ArrayList<>();
for (PortStats portStats : replyBody.getPortStats()) {
NodeConnectorStatisticsAndPortNumberMapBuilder statsBuilder = new NodeConnectorStatisticsAndPortNumberMapBuilder();
statsBuilder.setNodeConnectorId(InventoryDataServiceUtil.nodeConnectorIdfromDatapathPortNo(datapathId, portStats.getPortNo(), ofVersion));
BytesBuilder bytesBuilder = new BytesBuilder();
bytesBuilder.setReceived(portStats.getRxBytes());
bytesBuilder.setTransmitted(portStats.getTxBytes());
statsBuilder.setBytes(bytesBuilder.build());
PacketsBuilder packetsBuilder = new PacketsBuilder();
packetsBuilder.setReceived(portStats.getRxPackets());
packetsBuilder.setTransmitted(portStats.getTxPackets());
statsBuilder.setPackets(packetsBuilder.build());
DurationBuilder durationBuilder = new DurationBuilder();
if (portStats.getDurationSec() != null) {
durationBuilder.setSecond(new Counter32(portStats.getDurationSec()));
}
if (portStats.getDurationNsec() != null) {
durationBuilder.setNanosecond(new Counter32(portStats.getDurationNsec()));
}
statsBuilder.setDuration(durationBuilder.build());
statsBuilder.setCollisionCount(portStats.getCollisions());
statsBuilder.setKey(new NodeConnectorStatisticsAndPortNumberMapKey(statsBuilder.getNodeConnectorId()));
statsBuilder.setReceiveCrcError(portStats.getRxCrcErr());
statsBuilder.setReceiveDrops(portStats.getRxDropped());
statsBuilder.setReceiveErrors(portStats.getRxErrors());
statsBuilder.setReceiveFrameError(portStats.getRxFrameErr());
statsBuilder.setReceiveOverRunError(portStats.getRxOverErr());
statsBuilder.setTransmitDrops(portStats.getTxDropped());
statsBuilder.setTransmitErrors(portStats.getTxErrors());
statsMap.add(statsBuilder.build());
}
message.setNodeConnectorStatisticsAndPortNumberMap(statsMap);
return message.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.PortStats in project openflowplugin by opendaylight.
the class MultipartReplyMessageFactory method serializePortStatsBody.
private void serializePortStatsBody(final MultipartReplyBody body, final ByteBuf outBuffer) {
MultipartReplyPortStatsCase portStatsCase = (MultipartReplyPortStatsCase) body;
MultipartReplyPortStats portStats = portStatsCase.getMultipartReplyPortStats();
for (PortStats portStat : portStats.getPortStats()) {
outBuffer.writeInt(portStat.getPortNo().intValue());
outBuffer.writeZero(PORT_STATS_PADDING);
outBuffer.writeLong(portStat.getRxPackets().longValue());
outBuffer.writeLong(portStat.getTxPackets().longValue());
outBuffer.writeLong(portStat.getRxBytes().longValue());
outBuffer.writeLong(portStat.getTxBytes().longValue());
outBuffer.writeLong(portStat.getRxDropped().longValue());
outBuffer.writeLong(portStat.getTxDropped().longValue());
outBuffer.writeLong(portStat.getRxErrors().longValue());
outBuffer.writeLong(portStat.getTxErrors().longValue());
outBuffer.writeLong(portStat.getRxFrameErr().longValue());
outBuffer.writeLong(portStat.getRxOverErr().longValue());
outBuffer.writeLong(portStat.getRxCrcErr().longValue());
outBuffer.writeLong(portStat.getCollisions().longValue());
outBuffer.writeInt(portStat.getDurationSec().intValue());
outBuffer.writeInt(portStat.getDurationNsec().intValue());
}
}
Aggregations