use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder in project openflowplugin by opendaylight.
the class NodeConnectorStatNotificationSupplierImpl method createNotification.
@Override
public NodeConnectorStatisticsUpdate createNotification(final FlowCapableNodeConnectorStatistics flowCapableNodeConnectorStatistics, final InstanceIdentifier<FlowCapableNodeConnectorStatistics> path) {
Preconditions.checkArgument(flowCapableNodeConnectorStatistics != null);
Preconditions.checkArgument(path != null);
final NodeConnectorBuilder ncBuilder = new NodeConnectorBuilder();
final NodeConnectorKey ncKey = path.firstKeyOf(NodeConnector.class, NodeConnectorKey.class);
ncBuilder.setId(ncKey.getId());
ncBuilder.setKey(ncKey);
final NodeConnectorStatisticsUpdateBuilder builder = new NodeConnectorStatisticsUpdateBuilder();
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
builder.setNodeConnector(Collections.singletonList(ncBuilder.build()));
builder.setNodeConnectorStatisticsAndPortNumberMap(Collections.singletonList(new NodeConnectorStatisticsAndPortNumberMapBuilder(flowCapableNodeConnectorStatistics).build()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder in project openflowplugin by opendaylight.
the class NodeConnectorStatisticsToNotificationTransformer method transformToNotification.
/**
* Transform statistics to notification.
*
* @param mpReplyList raw multipart response from device
* @param deviceInfo device basic info
* @param ofVersion device version
* @param emulatedTxId emulated transaction Id
* @return notification containing flow stats
*/
public static NodeConnectorStatisticsUpdate transformToNotification(final List<MultipartReply> mpReplyList, final DeviceInfo deviceInfo, final OpenflowVersion ofVersion, final TransactionId emulatedTxId) {
NodeConnectorStatisticsUpdateBuilder notification = new NodeConnectorStatisticsUpdateBuilder();
notification.setId(deviceInfo.getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
notification.setNodeConnectorStatisticsAndPortNumberMap(new ArrayList<>());
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyPortStatsCase caseBody = (MultipartReplyPortStatsCase) mpReply.getMultipartReplyBody();
MultipartReplyPortStats replyBody = caseBody.getMultipartReplyPortStats();
for (PortStats portStats : replyBody.getPortStats()) {
NodeConnectorStatisticsAndPortNumberMapBuilder statsBuilder = processSingleNodeConnectorStats(deviceInfo, ofVersion, portStats);
notification.getNodeConnectorStatisticsAndPortNumberMap().add(statsBuilder.build());
}
}
return notification.build();
}
Aggregations