use of org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowUpdateServiceTest method processCreateRequestAndSpeakerCommands.
private void processCreateRequestAndSpeakerCommands(YFlowRequest yFlowRequest) throws DuplicateKeyException {
YFlowCreateService service = makeYFlowCreateService(0);
service.handleRequest(yFlowRequest.getYFlowId(), new CommandContext(), yFlowRequest);
verifyYFlowStatus(yFlowRequest.getYFlowId(), FlowStatus.IN_PROGRESS);
handleSpeakerRequests(speakerRequest -> {
SpeakerResponse commandResponse;
if (speakerRequest instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) speakerRequest;
commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) speakerRequest;
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(service, yFlowRequest.getYFlowId(), commandResponse);
});
}
use of org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowUpdateServiceTest method handleSpeakerCommandsAndFailInstall.
private void handleSpeakerCommandsAndFailInstall(YFlowUpdateService yFlowUpdateService, String yFlowFsmKey, String commandFlowIdToFail) {
handleSpeakerRequests(request -> {
SpeakerResponse commandResponse;
if (request instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
commandResponse = flowSegmentRequest.isInstallRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail) ? buildErrorSpeakerResponse(flowSegmentRequest) : buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
commandResponse = request instanceof InstallSpeakerCommandsRequest ? buildErrorYFlowSpeakerResponse(speakerCommandsRequest) : buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(yFlowUpdateService, yFlowFsmKey, commandResponse);
});
}
use of org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowUpdateServiceTest method handleSpeakerCommandsAndTimeoutInstall.
private void handleSpeakerCommandsAndTimeoutInstall(YFlowUpdateService yFlowUpdateService, String yFlowFsmKey) {
handleSpeakerRequests(request -> {
SpeakerResponse commandResponse;
if (request instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
yFlowUpdateService.handleAsyncResponse(yFlowFsmKey, commandResponse);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
if (speakerCommandsRequest instanceof InstallSpeakerCommandsRequest) {
handleTimeout(yFlowUpdateService, yFlowFsmKey);
} else {
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
yFlowUpdateService.handleAsyncResponse(yFlowFsmKey, commandResponse);
}
}
});
}
use of org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowCreateServiceTest method handleSpeakerCommandsAndFailVerify.
private void handleSpeakerCommandsAndFailVerify(YFlowCreateService yFlowCreateService, String yFlowFsmKey, String commandFlowIdToFail) {
handleSpeakerRequests(request -> {
SpeakerResponse commandResponse;
if (request instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
commandResponse = flowSegmentRequest.isVerifyRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail) ? buildErrorSpeakerResponse(flowSegmentRequest) : buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
handleAsyncResponse(yFlowCreateService, yFlowFsmKey, commandResponse);
});
}
use of org.openkilda.floodlight.api.request.rulemanager.BaseSpeakerCommandsRequest in project open-kilda by telstra.
the class YFlowCreateServiceTest method handleSpeakerCommandsAndTimeoutVerify.
private void handleSpeakerCommandsAndTimeoutVerify(YFlowCreateService yFlowCreateService, String yFlowFsmKey, String commandFlowIdToFail) {
handleSpeakerRequests(request -> {
SpeakerResponse commandResponse;
if (request instanceof FlowSegmentRequest) {
FlowSegmentRequest flowSegmentRequest = (FlowSegmentRequest) request;
if (flowSegmentRequest.isVerifyRequest() && flowSegmentRequest.getMetadata().getFlowId().equals(commandFlowIdToFail)) {
handleTimeout(yFlowCreateService, yFlowFsmKey);
}
commandResponse = buildSuccessfulSpeakerResponse(flowSegmentRequest);
} else {
BaseSpeakerCommandsRequest speakerCommandsRequest = (BaseSpeakerCommandsRequest) request;
commandResponse = buildSuccessfulYFlowSpeakerResponse(speakerCommandsRequest);
}
yFlowCreateService.handleAsyncResponse(yFlowFsmKey, commandResponse);
});
}
Aggregations