-
- // TODO: in case the result value is null then multipart data probably got processed on the fly -
- // TODO: this contract should by clearly stated and enforced - now simple true value is returned
- if (null != rpcResult.getResult()) {
- Iterable<? extends DataObject> allMultipartData = Collections.emptyList();
- DataObject multipartData = null;
-
-
- try {
- for (final MultipartReply singleReply : rpcResult.getResult()) {
- final List<? extends DataObject> multipartDataList = multipartReplyTranslator.translate(
- deviceInfo.getDatapathId(),
- deviceInfo.getVersion(), singleReply);
- multipartData = multipartDataList.get(0);
- allMultipartData = Iterables.concat(allMultipartData, multipartDataList);
- }
- } catch (final Exception e) {
- LOG.warn("stats processing of type {} for node {} failed during transfomation step",
- type, deviceInfo.getNodeId(), e);
- return Futures.immediateFailedFuture(e);
- }
-
-
- try {
- if (multipartData instanceof GroupStatisticsUpdated) {
- processGroupStatistics((Iterable<GroupStatisticsUpdated>) allMultipartData, deviceInfo, txFacade);
- } else if (multipartData instanceof MeterStatisticsUpdated) {
- processMetersStatistics((Iterable<MeterStatisticsUpdated>) allMultipartData, deviceInfo, txFacade);
- } else if (multipartData instanceof NodeConnectorStatisticsUpdate) {
- processNodeConnectorStatistics((Iterable<NodeConnectorStatisticsUpdate>) allMultipartData, deviceInfo, txFacade);
- } else if (multipartData instanceof FlowTableStatisticsUpdate) {
- processFlowTableStatistics((Iterable<FlowTableStatisticsUpdate>) allMultipartData, deviceInfo, txFacade);
- } else if (multipartData instanceof QueueStatisticsUpdate) {
- processQueueStatistics((Iterable<QueueStatisticsUpdate>) allMultipartData, deviceInfo, txFacade);
- } else if (multipartData instanceof FlowsStatisticsUpdate) {
- /* FlowStat Processing is realized by NettyThread only by initPhase, otherwise it is realized
- * by MD-SAL thread */
- return processFlowStatistics((Iterable<FlowsStatisticsUpdate>) allMultipartData, deviceInfo, txFacade, registry.getDeviceFlowRegistry(), initial, eventIdentifier);
-
- } else if (multipartData instanceof GroupDescStatsUpdated) {
- processGroupDescStats((Iterable<GroupDescStatsUpdated>) allMultipartData, deviceInfo, txFacade, registry.getDeviceGroupRegistry());
- } else if (multipartData instanceof MeterConfigStatsUpdated) {
- processMeterConfigStatsUpdated((Iterable<MeterConfigStatsUpdated>) allMultipartData, deviceInfo, txFacade, registry.getDeviceMeterRegistry());
- } else {
- isMultipartProcessed = Boolean.FALSE;
- }
- } catch (final Exception e) {
- LOG.warn("stats processing of type {} for node {} failed during write-to-tx step",
- type, deviceInfo.getNodeId(), e);
- return Futures.immediateFailedFuture(e);
- }
-
- LOG.debug("Stats reply added to transaction for node {} of type {}", deviceInfo.getNodeId(), type);
-
- //TODO : implement experimenter
+ // TODO: in case the result value is null then multipart data probably got processed
+ // TODO: on the fly. This contract should by clearly stated and enforced.
+ // TODO: Now simple true value is returned
+ if (Objects.nonNull(rpcResult.getResult()) && !rpcResult.getResult().isEmpty()) {
+ final List<DataContainer> allMultipartData = rpcResult.getResult().stream()
+ .map(reply -> MultipartReplyTranslatorUtil
+ .translate(reply, deviceInfo, convertorExecutor, null))
+ .filter(java.util.Optional::isPresent).map(java.util.Optional::get)
+ .collect(Collectors.toList());
+
+ return processStatistics(type, allMultipartData, txFacade, registry, deviceInfo,
+ statisticsWriterProvider);