use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message 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.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorUtil method translateTable.
private static MultipartReplyFlowTableStats translateTable(final MultipartReply msg) {
MultipartReplyFlowTableStatsBuilder message = new MultipartReplyFlowTableStatsBuilder();
MultipartReplyTableCase caseBody = (MultipartReplyTableCase) msg.getMultipartReplyBody();
MultipartReplyTable replyBody = caseBody.getMultipartReplyTable();
List<TableStats> swTablesStats = replyBody.getTableStats();
List<FlowTableAndStatisticsMap> salFlowStats = new ArrayList<>();
// TODO: Duplicate code: look at OpendaylightFlowTableStatisticsServiceImpl method transformToNotification
for (TableStats swTableStats : swTablesStats) {
FlowTableAndStatisticsMapBuilder statisticsBuilder = new FlowTableAndStatisticsMapBuilder();
statisticsBuilder.setActiveFlows(new Counter32(swTableStats.getActiveCount()));
statisticsBuilder.setPacketsLookedUp(new Counter64(swTableStats.getLookupCount()));
statisticsBuilder.setPacketsMatched(new Counter64(swTableStats.getMatchedCount()));
statisticsBuilder.setTableId(new TableId(swTableStats.getTableId()));
salFlowStats.add(statisticsBuilder.build());
}
message.setFlowTableAndStatisticsMap(salFlowStats);
return message.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorUtil method translateFlow.
private static MultipartReplyFlowStats translateFlow(final MultipartReply msg, final VersionDatapathIdConvertorData data, final ConvertorExecutor convertorExecutor) {
FlowStatsResponseConvertorData flowData = new FlowStatsResponseConvertorData(data.getVersion());
flowData.setDatapathId(data.getDatapathId());
flowData.setMatchPath(MatchPath.FLOWS_STATISTICS_UPDATE_MATCH);
MultipartReplyFlowStatsBuilder message = new MultipartReplyFlowStatsBuilder();
MultipartReplyFlowCase caseBody = (MultipartReplyFlowCase) msg.getMultipartReplyBody();
MultipartReplyFlow replyBody = caseBody.getMultipartReplyFlow();
final Optional<List<FlowAndStatisticsMapList>> flowAndStatisticsMapLists = convertorExecutor.convert(replyBody.getFlowStats(), flowData);
message.setFlowAndStatisticsMapList(flowAndStatisticsMapLists.orElse(Collections.emptyList()));
return message.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorUtil method translateGroupDesc.
private static org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupDesc translateGroupDesc(final MultipartReply msg, final VersionDatapathIdConvertorData data, final ConvertorExecutor convertorExecutor) {
MultipartReplyGroupDescBuilder message = new MultipartReplyGroupDescBuilder();
MultipartReplyGroupDescCase caseBody = (MultipartReplyGroupDescCase) msg.getMultipartReplyBody();
MultipartReplyGroupDesc replyBody = caseBody.getMultipartReplyGroupDesc();
final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(replyBody.getGroupDesc(), data);
message.setGroupDescStats(groupDescStatsList.orElse(Collections.emptyList()));
return message.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.Message in project openflowplugin by opendaylight.
the class MultipartReplyTranslatorUtil method translateGroupFeatures.
private static org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupFeatures translateGroupFeatures(final MultipartReply msg) {
final MultipartReplyGroupFeaturesBuilder message = new MultipartReplyGroupFeaturesBuilder();
final MultipartReplyGroupFeaturesCase caseBody = (MultipartReplyGroupFeaturesCase) msg.getMultipartReplyBody();
final MultipartReplyGroupFeatures replyBody = caseBody.getMultipartReplyGroupFeatures();
List<Class<? extends GroupType>> supportedGroups = new ArrayList<>();
if (replyBody.getTypes().isOFPGTALL()) {
supportedGroups.add(GroupAll.class);
}
if (replyBody.getTypes().isOFPGTSELECT()) {
supportedGroups.add(GroupSelect.class);
}
if (replyBody.getTypes().isOFPGTINDIRECT()) {
supportedGroups.add(GroupIndirect.class);
}
if (replyBody.getTypes().isOFPGTFF()) {
supportedGroups.add(GroupFf.class);
}
message.setGroupTypesSupported(supportedGroups);
message.setMaxGroups(replyBody.getMaxGroups());
List<Class<? extends GroupCapability>> supportedCapabilities = new ArrayList<>();
if (replyBody.getCapabilities().isOFPGFCCHAINING()) {
supportedCapabilities.add(Chaining.class);
}
if (replyBody.getCapabilities().isOFPGFCCHAININGCHECKS()) {
supportedCapabilities.add(ChainingChecks.class);
}
if (replyBody.getCapabilities().isOFPGFCSELECTLIVENESS()) {
supportedCapabilities.add(SelectLiveness.class);
}
if (replyBody.getCapabilities().isOFPGFCSELECTWEIGHT()) {
supportedCapabilities.add(SelectWeight.class);
}
message.setGroupCapabilitiesSupported(supportedCapabilities);
message.setActions(GroupUtil.extractGroupActionsSupportBitmap(replyBody.getActionsBitmap()));
return message.build();
}
Aggregations