Search in sources :

Example 21 with FlowStatus

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;
}
Also used : YFlow(org.openkilda.model.YFlow) FlowStatus(org.openkilda.model.FlowStatus) YSubFlow(org.openkilda.model.YSubFlow)

Example 22 with FlowStatus

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));
}
Also used : FlowPath(org.openkilda.model.FlowPath) FlowStatus(org.openkilda.model.FlowStatus) Flow(org.openkilda.model.Flow)

Aggregations

FlowStatus (org.openkilda.model.FlowStatus)22 YFlow (org.openkilda.model.YFlow)11 Flow (org.openkilda.model.Flow)9 FlowPath (org.openkilda.model.FlowPath)4 FlowPathStatus (org.openkilda.model.FlowPathStatus)3 TimedExecution (org.openkilda.wfm.share.metrics.TimedExecution)3 YFlowRequest (org.openkilda.messaging.command.yflow.YFlowRequest)2 PathNode (org.openkilda.messaging.info.event.PathNode)2 IslEndpoint (org.openkilda.model.IslEndpoint)2 PathSegment (org.openkilda.model.PathSegment)2 SwitchId (org.openkilda.model.SwitchId)2 YSubFlow (org.openkilda.model.YSubFlow)2 FlowThrottlingData (org.openkilda.wfm.topology.reroute.model.FlowThrottlingData)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Collectors.toSet (java.util.stream.Collectors.toSet)1 Test (org.junit.Test)1 PersistenceManager (org.openkilda.persistence.PersistenceManager)1