use of org.openkilda.model.FlowStatus in project open-kilda by telstra.
the class YFlowUpdateServiceTest method verifyYFlowStatus.
protected YFlow verifyYFlowStatus(String yFlowId, FlowStatus expectedStatus, FlowStatus expectedFirstSubFlowStatus, FlowStatus expectedSecondSubFlowStatus) {
YFlow flow = getYFlow(yFlowId);
assertEquals(expectedStatus, flow.getStatus());
Set<FlowStatus> expectedSubFlowStatuses = Stream.of(expectedFirstSubFlowStatus, expectedSecondSubFlowStatus).collect(Collectors.toSet());
Set<FlowStatus> actualSubFlowStatuses = flow.getSubFlows().stream().map(YSubFlow::getFlow).map(Flow::getStatus).collect(Collectors.toSet());
assertEquals(expectedSubFlowStatuses, actualSubFlowStatuses);
return flow;
}
use of org.openkilda.model.FlowStatus in project open-kilda by telstra.
the class UpdateFlowStatusAction method perform.
@Override
protected void perform(State from, State to, Event event, FlowPathSwapContext context, FlowPathSwapFsm stateMachine) {
String flowId = stateMachine.getFlowId();
FlowStatus resultStatus = transactionManager.doInTransaction(() -> {
Flow flow = getFlow(flowId);
for (FlowPath fp : flow.getPaths()) {
fp.setStatus(FlowPathStatus.ACTIVE);
}
FlowStatus flowStatus = flow.computeFlowStatus();
if (flowStatus != flow.getStatus()) {
dashboardLogger.onFlowStatusUpdate(flowId, flowStatus);
flow.setStatus(flowStatus);
}
return flowStatus;
});
stateMachine.saveActionToHistory(format("The flow status was set to %s", resultStatus));
}
Aggregations