Search in sources :

Example 1 with SubFlowsResponse

use of org.openkilda.messaging.command.yflow.SubFlowsResponse in project open-kilda by telstra.

the class YFlowReadBolt method handleInput.

protected void handleInput(Tuple input) throws Exception {
    String requestId = getCommandContext().getCorrelationId();
    CommandData request = pullValue(input, FIELD_ID_PAYLOAD, CommandData.class);
    try {
        if (request instanceof YFlowsDumpRequest) {
            List<YFlowResponse> result = processYFlowDumpRequest();
            emitMessages(input, requestId, result);
        } else if (request instanceof YFlowReadRequest) {
            YFlowResponse result = processYFlowReadRequest((YFlowReadRequest) request);
            emitMessage(input, requestId, result);
        } else if (request instanceof YFlowPathsReadRequest) {
            YFlowPathsResponse result = processYFlowPathsReadRequest((YFlowPathsReadRequest) request);
            emitMessage(input, requestId, result);
        } else if (request instanceof SubFlowsReadRequest) {
            SubFlowsResponse result = processSubFlowsReadRequest((SubFlowsReadRequest) request);
            emitMessage(input, requestId, result);
        } else {
            unhandledInput(input);
        }
    } catch (MessageException e) {
        ErrorData errorData = new ErrorData(e.getErrorType(), e.getMessage(), e.getErrorDescription());
        Message message = new ErrorMessage(errorData, System.currentTimeMillis(), requestId);
        emit(input, new Values(requestId, message));
    }
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) Message(org.openkilda.messaging.Message) ChunkedInfoMessage(org.openkilda.messaging.info.ChunkedInfoMessage) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) Values(org.apache.storm.tuple.Values) YFlowsDumpRequest(org.openkilda.messaging.command.yflow.YFlowsDumpRequest) MessageException(org.openkilda.messaging.error.MessageException) CommandData(org.openkilda.messaging.command.CommandData) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) YFlowResponse(org.openkilda.messaging.command.yflow.YFlowResponse) YFlowReadRequest(org.openkilda.messaging.command.yflow.YFlowReadRequest) SubFlowsResponse(org.openkilda.messaging.command.yflow.SubFlowsResponse) ErrorData(org.openkilda.messaging.error.ErrorData) YFlowPathsReadRequest(org.openkilda.messaging.command.yflow.YFlowPathsReadRequest) SubFlowsReadRequest(org.openkilda.messaging.command.yflow.SubFlowsReadRequest) YFlowPathsResponse(org.openkilda.messaging.command.yflow.YFlowPathsResponse)

Example 2 with SubFlowsResponse

use of org.openkilda.messaging.command.yflow.SubFlowsResponse in project open-kilda by telstra.

the class YFlowReadServiceTest method shouldFetchYFlowSubFlows.

@Test
public void shouldFetchYFlowSubFlows() throws FlowNotFoundException {
    // given
    String yFlowId = "test_y_flow_1";
    createYFlowViaTransit(yFlowId);
    // when
    SubFlowsResponse yFlowResponse = yFlowReadService.getYFlowSubFlows(yFlowId);
    // then
    assertEquals(2, yFlowResponse.getFlows().size());
}
Also used : SubFlowsResponse(org.openkilda.messaging.command.yflow.SubFlowsResponse) Test(org.junit.Test) AbstractYFlowTest(org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)

Aggregations

SubFlowsResponse (org.openkilda.messaging.command.yflow.SubFlowsResponse)2 Values (org.apache.storm.tuple.Values)1 Test (org.junit.Test)1 Message (org.openkilda.messaging.Message)1 CommandData (org.openkilda.messaging.command.CommandData)1 SubFlowsReadRequest (org.openkilda.messaging.command.yflow.SubFlowsReadRequest)1 YFlowPathsReadRequest (org.openkilda.messaging.command.yflow.YFlowPathsReadRequest)1 YFlowPathsResponse (org.openkilda.messaging.command.yflow.YFlowPathsResponse)1 YFlowReadRequest (org.openkilda.messaging.command.yflow.YFlowReadRequest)1 YFlowResponse (org.openkilda.messaging.command.yflow.YFlowResponse)1 YFlowsDumpRequest (org.openkilda.messaging.command.yflow.YFlowsDumpRequest)1 ErrorData (org.openkilda.messaging.error.ErrorData)1 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)1 MessageException (org.openkilda.messaging.error.MessageException)1 ChunkedInfoMessage (org.openkilda.messaging.info.ChunkedInfoMessage)1 InfoMessage (org.openkilda.messaging.info.InfoMessage)1 AbstractYFlowTest (org.openkilda.wfm.topology.flowhs.service.AbstractYFlowTest)1