use of org.openkilda.floodlight.api.request.factory.EgressMirrorFlowSegmentRequestFactory in project open-kilda by telstra.
the class InstallIngressRulesAction method perform.
@Override
protected void perform(State from, State to, Event event, FlowPathSwapContext context, FlowPathSwapFsm stateMachine) {
String flowId = stateMachine.getFlowId();
Flow flow = getFlow(flowId);
FlowCommandBuilder commandBuilder = commandBuilderFactory.getBuilder(flow.getEncapsulationType());
FlowPath newPrimaryForward = flow.getForwardPath();
FlowPath newPrimaryReverse = flow.getReversePath();
SpeakerRequestBuildContext speakerContext = buildBaseSpeakerContextForInstall(flow.getSrcSwitchId(), flow.getDestSwitchId());
Collection<FlowSegmentRequestFactory> commands = new ArrayList<>(commandBuilder.buildIngressOnly(stateMachine.getCommandContext(), flow, newPrimaryForward, newPrimaryReverse, speakerContext));
commands.addAll(commandBuilder.buildEgressOnly(stateMachine.getCommandContext(), flow, newPrimaryForward, newPrimaryReverse).stream().filter(f -> f instanceof TransitFlowLoopSegmentRequestFactory || f instanceof EgressMirrorFlowSegmentRequestFactory).collect(Collectors.toList()));
// Installation of ingress rules for protected paths is skipped. These paths are activated on swap.
stateMachine.clearPendingAndRetriedAndFailedCommands();
SpeakerInstallSegmentEmitter.INSTANCE.emitBatch(stateMachine.getCarrier(), commands, stateMachine.getIngressCommands());
stateMachine.getIngressCommands().forEach((key, value) -> stateMachine.addPendingCommand(key, value.getSwitchId()));
stateMachine.saveActionToHistory("Commands for installing ingress rules have been sent");
}
Aggregations