use of org.openkilda.messaging.model.FlowPathDto.FlowProtectedPathDto in project open-kilda by telstra.
the class FlowServiceImpl method buildFlowPathPayload.
private FlowPathPayload buildFlowPathPayload(List<FlowPathDto> paths, String flowId) {
FlowPathDto askedPathDto = paths.stream().filter(e -> e.getId().equals(flowId)).findAny().orElseThrow(() -> new IllegalStateException(format("Path for flow %s is not found.", flowId)));
// fill primary flow path
FlowPathPayload payload = new FlowPathPayload();
payload.setId(askedPathDto.getId());
payload.setForwardPath(askedPathDto.getForwardPath());
payload.setReversePath(askedPathDto.getReversePath());
if (askedPathDto.getProtectedPath() != null) {
FlowProtectedPathDto protectedPath = askedPathDto.getProtectedPath();
payload.setProtectedPath(FlowProtectedPath.builder().forwardPath(protectedPath.getForwardPath()).reversePath(protectedPath.getReversePath()).build());
}
// fill group paths
if (paths.size() > 1) {
payload.setDiverseGroupPayload(DiverseGroupPayload.builder().overlappingSegments(askedPathDto.getSegmentsStats()).otherFlows(mapGroupPaths(paths, flowId, FlowPathDto::isPrimaryPathCorrespondStat)).build());
if (askedPathDto.getProtectedPath() != null) {
payload.setDiverseGroupProtectedPayload(DiverseGroupPayload.builder().overlappingSegments(askedPathDto.getProtectedPath().getSegmentsStats()).otherFlows(mapGroupPaths(paths, flowId, e -> !e.isPrimaryPathCorrespondStat())).build());
}
}
return payload;
}
Aggregations