Search in sources :

Example 1 with MirrorDirection

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;
}
Also used : MirrorGroup(org.openkilda.model.MirrorGroup) Switch(org.openkilda.model.Switch) FlowProcessingException(org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException) FlowMirrorPoints(org.openkilda.model.FlowMirrorPoints) MirrorDirection(org.openkilda.model.MirrorDirection)

Aggregations

FlowMirrorPoints (org.openkilda.model.FlowMirrorPoints)1 MirrorDirection (org.openkilda.model.MirrorDirection)1 MirrorGroup (org.openkilda.model.MirrorGroup)1 Switch (org.openkilda.model.Switch)1 FlowProcessingException (org.openkilda.wfm.topology.flowhs.exception.FlowProcessingException)1