use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder in project openflowplugin by opendaylight.
the class GroupStatNotificationSupplierImpl method createNotification.
@Override
public GroupStatisticsUpdated createNotification(final GroupStatistics groupStatistics, final InstanceIdentifier<GroupStatistics> path) {
Preconditions.checkArgument(groupStatistics != null);
Preconditions.checkArgument(path != null);
final GroupStatisticsUpdatedBuilder builder = new GroupStatisticsUpdatedBuilder();
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
// TODO : fix if it needs, but we have to ask DataStore for the NodeConnector list
builder.setNodeConnector(Collections.<NodeConnector>emptyList());
builder.setGroupStats(Collections.singletonList(new GroupStatsBuilder(groupStatistics).build()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.GroupStatisticsUpdatedBuilder in project openflowplugin by opendaylight.
the class GroupStatisticsToNotificationTransformer method transformToNotification.
/**
* Transform statistics to notification.
* @param mpReplyList raw multipart response from device
* @param deviceInfo device state
* @param emulatedTxId emulated transaction id
* @param convertorExecutor convertor executor
* @return notification containing flow stats
*/
public static GroupStatisticsUpdated transformToNotification(final List<MultipartReply> mpReplyList, final DeviceInfo deviceInfo, final TransactionId emulatedTxId, final ConvertorExecutor convertorExecutor) {
VersionConvertorData data = new VersionConvertorData(deviceInfo.getVersion());
GroupStatisticsUpdatedBuilder notification = new GroupStatisticsUpdatedBuilder();
notification.setId(deviceInfo.getNodeId());
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
notification.setGroupStats(new ArrayList<>());
for (MultipartReply mpReply : mpReplyList) {
MultipartReplyGroupCase caseBody = (MultipartReplyGroupCase) mpReply.getMultipartReplyBody();
MultipartReplyGroup replyBody = caseBody.getMultipartReplyGroup();
final Optional<List<GroupStats>> groupStatsList = convertorExecutor.convert(replyBody.getGroupStats(), data);
groupStatsList.ifPresent(groupStats -> notification.getGroupStats().addAll(groupStats));
}
return notification.build();
}
Aggregations