use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.
the class InstallNonIngressRulesAction method perform.
@Override
protected void perform(State from, State to, Event event, FlowUpdateContext context, FlowUpdateFsm stateMachine) {
String flowId = stateMachine.getFlowId();
RequestedFlow requestedFlow = stateMachine.getTargetFlow();
Flow flow = getFlow(flowId);
FlowCommandBuilder commandBuilder = commandBuilderFactory.getBuilder(requestedFlow.getFlowEncapsulationType());
// primary path
FlowPath newPrimaryForward = getFlowPath(flow, stateMachine.getNewPrimaryForwardPath());
FlowPath newPrimaryReverse = getFlowPath(flow, stateMachine.getNewPrimaryReversePath());
Collection<FlowSegmentRequestFactory> commands = buildCommands(commandBuilder, stateMachine, flow, newPrimaryForward, newPrimaryReverse);
// protected path
if (stateMachine.getNewProtectedForwardPath() != null && stateMachine.getNewProtectedReversePath() != null) {
FlowPath newProtectedForward = getFlowPath(flow, stateMachine.getNewProtectedForwardPath());
FlowPath newProtectedReverse = getFlowPath(flow, stateMachine.getNewProtectedReversePath());
commands.addAll(buildCommands(commandBuilder, stateMachine, flow, newProtectedForward, newProtectedReverse));
}
stateMachine.clearPendingAndRetriedAndFailedCommands();
if (commands.isEmpty()) {
stateMachine.saveActionToHistory("No need to install non ingress rules");
stateMachine.fire(Event.RULES_INSTALLED);
} else {
// emitting
SpeakerInstallSegmentEmitter.INSTANCE.emitBatch(stateMachine.getCarrier(), commands, stateMachine.getNonIngressCommands());
stateMachine.getNonIngressCommands().forEach((key, value) -> stateMachine.addPendingCommand(key, value.getSwitchId()));
stateMachine.saveActionToHistory("Commands for installing non ingress rules have been sent");
}
}
use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.
the class FlowValidatorTest method shouldNotFailOnSwapWhenDifferentEndpointsOnFirstAndSecondFlow.
@Test
public void shouldNotFailOnSwapWhenDifferentEndpointsOnFirstAndSecondFlow() throws InvalidFlowException {
RequestedFlow firstFlow = RequestedFlow.builder().flowId("firstFlow").srcSwitch(SWITCH_ID_1).srcPort(10).srcVlan(11).destSwitch(SWITCH_ID_2).destPort(12).destVlan(13).detectConnectedDevices(new DetectConnectedDevices()).build();
RequestedFlow secondFlow = RequestedFlow.builder().flowId("secondFlow").srcSwitch(SWITCH_ID_1).srcPort(14).srcVlan(15).destSwitch(SWITCH_ID_2).destPort(16).destVlan(17).detectConnectedDevices(new DetectConnectedDevices()).build();
flowValidator.checkForEqualsEndpoints(firstFlow, secondFlow);
}
use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.
the class FlowValidatorTest method shouldFailOnSwapWhenEqualsEndpointsOnFirstAndSecondFlow.
@Test(expected = InvalidFlowException.class)
public void shouldFailOnSwapWhenEqualsEndpointsOnFirstAndSecondFlow() throws InvalidFlowException {
RequestedFlow firstFlow = RequestedFlow.builder().flowId("firstFlow").srcSwitch(SWITCH_ID_1).srcPort(10).srcVlan(11).destSwitch(SWITCH_ID_2).destPort(12).destVlan(13).detectConnectedDevices(new DetectConnectedDevices()).build();
RequestedFlow secondFlow = RequestedFlow.builder().flowId("secondFlow").srcSwitch(SWITCH_ID_1).srcPort(10).srcVlan(11).destSwitch(SWITCH_ID_2).destPort(12).destVlan(13).detectConnectedDevices(new DetectConnectedDevices()).build();
flowValidator.checkForEqualsEndpoints(firstFlow, secondFlow);
}
use of org.openkilda.wfm.topology.flowhs.model.RequestedFlow in project open-kilda by telstra.
the class FlowValidatorTest method shouldNotFailOnCreateSingleTaggedFlowOnWbSeries.
@Test
public void shouldNotFailOnCreateSingleTaggedFlowOnWbSeries() throws InvalidFlowException, UnavailableFlowEndpointException {
RequestedFlow flow = RequestedFlow.builder().flowId("firstFlow").srcSwitch(SWITCH_ID_1).srcPort(10).srcInnerVlan(11).destSwitch(SWITCH_ID_2).destPort(12).destInnerVlan(13).detectConnectedDevices(new DetectConnectedDevices()).build();
flowValidator.validateQinQonWB(flow);
}
Aggregations