use of org.openkilda.wfm.share.metrics.TimedExecution in project open-kilda by telstra.
the class CompleteFlowPathInstallationAction method perform.
@TimedExecution("fsm.complete_flow_path_install")
@Override
protected void perform(State from, State to, Event event, FlowRerouteContext context, FlowRerouteFsm stateMachine) {
if (stateMachine.getNewPrimaryForwardPath() != null && stateMachine.getNewPrimaryReversePath() != null) {
PathId newForward = stateMachine.getNewPrimaryForwardPath();
PathId newReverse = stateMachine.getNewPrimaryReversePath();
log.debug("Completing installation of the flow primary path {} / {}", newForward, newReverse);
FlowPathStatus primaryPathStatus;
if (stateMachine.isIgnoreBandwidth() || stateMachine.isBackUpPrimaryPathComputationWayUsed()) {
primaryPathStatus = FlowPathStatus.DEGRADED;
} else {
primaryPathStatus = FlowPathStatus.ACTIVE;
}
transactionManager.doInTransaction(() -> {
flowPathRepository.updateStatus(newForward, primaryPathStatus);
flowPathRepository.updateStatus(newReverse, primaryPathStatus);
});
stateMachine.saveActionToHistory("Flow paths were installed", format("The flow paths %s / %s were installed", newForward, newReverse));
}
if (stateMachine.getNewProtectedForwardPath() != null && stateMachine.getNewProtectedReversePath() != null) {
PathId newForward = stateMachine.getNewProtectedForwardPath();
PathId newReverse = stateMachine.getNewProtectedReversePath();
FlowPathStatus protectedPathStatus;
if (stateMachine.isIgnoreBandwidth() || stateMachine.isBackUpProtectedPathComputationWayUsed()) {
protectedPathStatus = FlowPathStatus.DEGRADED;
} else {
protectedPathStatus = FlowPathStatus.ACTIVE;
}
log.debug("Completing installation of the flow protected path {} / {}", newForward, newReverse);
transactionManager.doInTransaction(() -> {
flowPathRepository.updateStatus(newForward, protectedPathStatus);
flowPathRepository.updateStatus(newReverse, protectedPathStatus);
});
stateMachine.saveActionToHistory("Flow paths were installed", format("The flow paths %s / %s were installed", newForward, newReverse));
}
}
use of org.openkilda.wfm.share.metrics.TimedExecution in project open-kilda by telstra.
the class UpdateFlowStatusAction method perform.
@TimedExecution("fsm.update_flow_status")
@Override
protected void perform(State from, State to, Event event, FlowRerouteContext context, FlowRerouteFsm stateMachine) {
String flowId = stateMachine.getFlowId();
FlowStatus resultStatus = transactionManager.doInTransaction(() -> {
Flow flow = getFlow(flowId);
FlowStatus flowStatus = flow.computeFlowStatus();
if (flowStatus != flow.getStatus()) {
dashboardLogger.onFlowStatusUpdate(flowId, flowStatus);
flow.setStatus(flowStatus);
flow.setStatusInfo(getFlowStatusInfo(flow, flowStatus, stateMachine));
} else if (FlowStatus.DEGRADED.equals(flowStatus)) {
flow.setStatusInfo(getDegradedFlowStatusInfo(flow, stateMachine));
}
stateMachine.setNewFlowStatus(flowStatus);
return flowStatus;
});
stateMachine.saveActionToHistory(format("The flow status was set to %s", resultStatus));
}
use of org.openkilda.wfm.share.metrics.TimedExecution in project open-kilda by telstra.
the class CompleteFlowPathRemovalAction method perform.
@TimedExecution("fsm.complete_flow_path_remove")
@Override
protected void perform(State from, State to, Event event, FlowRerouteContext context, FlowRerouteFsm stateMachine) {
Flow flow = getFlow(stateMachine.getFlowId());
removeOldPrimaryFlowPaths(flow, stateMachine);
removeOldProtectedFlowPaths(flow, stateMachine);
removeRejectedFlowPaths(flow, stateMachine);
}
use of org.openkilda.wfm.share.metrics.TimedExecution in project open-kilda by telstra.
the class SwapFlowPathsAction method perform.
@TimedExecution("fsm.swap_flow_paths")
@Override
protected void perform(State from, State to, Event event, FlowRerouteContext context, FlowRerouteFsm stateMachine) {
swapPrimaryPaths(stateMachine);
swapProtectedPaths(stateMachine);
if (stateMachine.getNewEncapsulationType() != null) {
transactionManager.doInTransaction(() -> {
Flow flow = getFlow(stateMachine.getFlowId());
flow.setEncapsulationType(stateMachine.getNewEncapsulationType());
});
}
}
use of org.openkilda.wfm.share.metrics.TimedExecution in project open-kilda by telstra.
the class HistoryOperationsBolt method getFlowHistory.
@TimedExecution("get_flow_history")
private List<InfoData> getFlowHistory(GetFlowHistoryRequest request) {
Instant timeFrom = Instant.ofEpochSecond(request.getTimestampFrom());
Instant timeTo = Instant.ofEpochSecond(request.getTimestampTo() + 1).minusMillis(1);
return historyService.listFlowEvents(request.getFlowId(), timeFrom, timeTo, request.getMaxCount()).stream().map(entry -> {
List<FlowHistoryPayload> payload = listFlowHistories(entry);
List<FlowDumpPayload> dumps = listFlowDumps(entry);
return HistoryMapper.INSTANCE.map(entry, payload, dumps);
}).collect(Collectors.toList());
}
Aggregations