use of org.openkilda.model.MirrorDirection in project open-kilda by telstra.
the class ResourceAllocationAction method createFlowMirrorPoints.
private FlowMirrorPoints createFlowMirrorPoints(RequestedFlowMirrorPoint mirrorPoint, FlowPath flowPath) throws ResourceAllocationException {
Switch mirrorSwitch = switchRepository.findById(mirrorPoint.getMirrorPointSwitchId()).orElseThrow(() -> new FlowProcessingException(ErrorType.NOT_FOUND, format("Switch %s not found", mirrorPoint.getMirrorPointSwitchId())));
MirrorDirection direction = mirrorPoint.getMirrorPointSwitchId().equals(flowPath.getSrcSwitchId()) ? MirrorDirection.INGRESS : MirrorDirection.EGRESS;
MirrorGroup mirrorGroup = resourcesManager.getAllocatedMirrorGroup(mirrorPoint.getMirrorPointSwitchId(), mirrorPoint.getFlowId(), flowPath.getPathId(), MirrorGroupType.TRAFFIC_INTEGRITY, direction);
FlowMirrorPoints flowMirrorPoints = FlowMirrorPoints.builder().mirrorSwitch(mirrorSwitch).mirrorGroup(mirrorGroup).build();
flowMirrorPointsRepository.add(flowMirrorPoints);
flowPath.addFlowMirrorPoints(flowMirrorPoints);
return flowMirrorPoints;
}
Aggregations