use of org.openkilda.wfm.share.history.model.FlowDumpData in project open-kilda by telstra.
the class BaseResourceAllocationAction method saveAllocationActionWithDumpsToHistory.
protected void saveAllocationActionWithDumpsToHistory(T stateMachine, Flow flow, String pathType, FlowPathPair newFlowPaths) {
FlowDumpData dumpData = HistoryMapper.INSTANCE.map(flow, newFlowPaths.getForward(), newFlowPaths.getReverse(), DumpType.STATE_AFTER);
stateMachine.saveActionWithDumpToHistory(format("New %s paths were created", pathType), format("The flow paths %s / %s were created (with allocated resources)", newFlowPaths.getForward().getPathId(), newFlowPaths.getReverse().getPathId()), dumpData);
}
use of org.openkilda.wfm.share.history.model.FlowDumpData in project open-kilda by telstra.
the class ResourcesAllocationAction method saveHistory.
private void saveHistory(FlowCreateFsm stateMachine, Flow flow) {
FlowDumpData primaryPathsDumpData = HistoryMapper.INSTANCE.map(flow, flow.getForwardPath(), flow.getReversePath(), DumpType.STATE_AFTER);
stateMachine.saveActionWithDumpToHistory("New primary paths were created", format("The flow paths were created (with allocated resources): %s / %s", flow.getForwardPathId(), flow.getReversePathId()), primaryPathsDumpData);
if (flow.isAllocateProtectedPath()) {
FlowDumpData protectedPathsDumpData = HistoryMapper.INSTANCE.map(flow, flow.getProtectedForwardPath(), flow.getProtectedReversePath(), DumpType.STATE_AFTER);
stateMachine.saveActionWithDumpToHistory("New protected paths were created", format("The flow paths were created (with allocated resources): %s / %s", flow.getProtectedForwardPathId(), flow.getProtectedReversePathId()), protectedPathsDumpData);
}
}
use of org.openkilda.wfm.share.history.model.FlowDumpData in project open-kilda by telstra.
the class SkipPathsAndResourcesDeallocationAction method perform.
@Override
public void perform(State from, State to, Event event, FlowUpdateContext context, FlowUpdateFsm stateMachine) {
if (stateMachine.getEndpointUpdate().isPartialUpdate()) {
FlowDumpData dumpData = HistoryMapper.INSTANCE.map(RequestedFlowMapper.INSTANCE.toFlow(stateMachine.getOriginalFlow()), getFlowPath(stateMachine.getNewPrimaryForwardPath()), getFlowPath(stateMachine.getNewPrimaryReversePath()), DumpType.STATE_BEFORE);
stateMachine.saveActionWithDumpToHistory("New endpoints were stored for flow", format("The flow endpoints were updated for: %s / %s", stateMachine.getTargetFlow().getSrcSwitch(), stateMachine.getTargetFlow().getDestSwitch()), dumpData);
stateMachine.fire(Event.UPDATE_ENDPOINT_RULES_ONLY);
}
}
use of org.openkilda.wfm.share.history.model.FlowDumpData in project open-kilda by telstra.
the class UpdateFlowAction method performWithResponse.
@Override
protected Optional<Message> performWithResponse(State from, State to, Event event, FlowUpdateContext context, FlowUpdateFsm stateMachine) {
RequestedFlow targetFlow = stateMachine.getTargetFlow();
String flowId = targetFlow.getFlowId();
transactionManager.doInTransaction(() -> {
Flow flow = getFlow(flowId);
log.debug("Updating the flow {} with properties: {}", flowId, targetFlow);
RequestedFlow originalFlow = RequestedFlowMapper.INSTANCE.toRequestedFlow(flow);
stateMachine.setOldTargetPathComputationStrategy(flow.getTargetPathComputationStrategy());
stateMachine.setOriginalFlow(originalFlow);
stateMachine.setOriginalDiverseFlowGroup(flow.getDiverseGroupId());
stateMachine.setOriginalAffinityFlowGroup(flow.getAffinityGroupId());
// Complete target flow in FSM with values from original flow
stateMachine.setTargetFlow(updateFlow(flow, targetFlow));
EndpointUpdate endpointUpdate = updateEndpointRulesOnly(originalFlow, targetFlow, stateMachine.getOriginalDiverseFlowGroup(), flow.getDiverseGroupId(), stateMachine.getOriginalAffinityFlowGroup(), flow.getAffinityGroupId());
stateMachine.setEndpointUpdate(endpointUpdate);
if (endpointUpdate.isPartialUpdate()) {
FlowLoopOperation flowLoopOperation = detectFlowLoopOperation(originalFlow, targetFlow);
stateMachine.setFlowLoopOperation(flowLoopOperation);
stateMachine.setNewPrimaryForwardPath(flow.getForwardPathId());
stateMachine.setNewPrimaryReversePath(flow.getReversePathId());
stateMachine.setNewProtectedForwardPath(flow.getProtectedForwardPathId());
stateMachine.setNewProtectedReversePath(flow.getProtectedReversePathId());
FlowDumpData dumpData = HistoryMapper.INSTANCE.map(flow, flow.getForwardPath(), flow.getReversePath(), DumpType.STATE_AFTER);
stateMachine.saveActionWithDumpToHistory("New endpoints were stored for flow", format("The flow endpoints were updated for: %s / %s", flow.getSrcSwitch(), flow.getDestSwitch()), dumpData);
}
});
stateMachine.saveActionToHistory("The flow properties were updated");
if (stateMachine.getEndpointUpdate().isPartialUpdate()) {
stateMachine.saveActionToHistory("Skip paths and resources allocation");
stateMachine.fire(Event.UPDATE_ENDPOINT_RULES_ONLY);
}
return Optional.empty();
}
use of org.openkilda.wfm.share.history.model.FlowDumpData in project open-kilda by telstra.
the class RevertResourceAllocationAction method saveHistory.
private void saveHistory(FlowUpdateFsm stateMachine, Flow flow, FlowResources resources) {
FlowDumpData flowDumpData = HistoryMapper.INSTANCE.map(flow, resources, DumpType.STATE_BEFORE);
stateMachine.saveActionWithDumpToHistory("Flow resources were deallocated", format("The flow resources for %s / %s were deallocated", resources.getForward().getPathId(), resources.getReverse().getPathId()), flowDumpData);
}
Aggregations