Search in sources :

Example 21 with ErrorMessage

use of org.openkilda.messaging.error.ErrorMessage in project open-kilda by telstra.

the class FlowTopologyTest method errorFlowSpeakerCommand.

private ErrorMessage errorFlowSpeakerCommand(final String flowId) throws IOException {
    System.out.println("TOPOLOGY: Error rule");
    ErrorData errorData = new ErrorData(ErrorType.REQUEST_INVALID, "Could not operate with flow", flowId);
    ErrorMessage errorMessage = new ErrorMessage(errorData, 0, "error-flow", Destination.WFM_TRANSACTION);
    // sendSpeakerMessage(errorMessage);
    sendMessage(errorMessage, topologyConfig.getKafkaFlowTopic());
    return errorMessage;
}
Also used : ErrorMessage(org.openkilda.messaging.error.ErrorMessage) ErrorData(org.openkilda.messaging.error.ErrorData)

Example 22 with ErrorMessage

use of org.openkilda.messaging.error.ErrorMessage in project open-kilda by telstra.

the class FlowTopologyTest method getUnknownFlowTest.

@Test
public void getUnknownFlowTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> record;
    getFlow(flowId);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    ErrorMessage errorMessage = objectMapper.readValue(record.value(), ErrorMessage.class);
    assertNotNull(errorMessage);
    ErrorData errorData = errorMessage.getData();
    assertEquals(ErrorType.NOT_FOUND, errorData.getErrorType());
}
Also used : ErrorMessage(org.openkilda.messaging.error.ErrorMessage) ErrorData(org.openkilda.messaging.error.ErrorData) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Example 23 with ErrorMessage

use of org.openkilda.messaging.error.ErrorMessage in project open-kilda by telstra.

the class FlowTopologyTest method pathUnknownFlowTest.

@Test
public void pathUnknownFlowTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> record;
    pathFlow(flowId);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    ErrorMessage errorMessage = objectMapper.readValue(record.value(), ErrorMessage.class);
    assertNotNull(errorMessage);
    ErrorData errorData = errorMessage.getData();
    assertEquals(ErrorType.NOT_FOUND, errorData.getErrorType());
}
Also used : ErrorMessage(org.openkilda.messaging.error.ErrorMessage) ErrorData(org.openkilda.messaging.error.ErrorData) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Aggregations

ErrorMessage (org.openkilda.messaging.error.ErrorMessage)23 ErrorData (org.openkilda.messaging.error.ErrorData)18 Test (org.junit.Test)11 InfoMessage (org.openkilda.messaging.info.InfoMessage)10 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)10 Values (org.apache.storm.tuple.Values)4 Message (org.openkilda.messaging.Message)4 CommandMessage (org.openkilda.messaging.command.CommandMessage)4 RemoveFlow (org.openkilda.messaging.command.flow.RemoveFlow)4 IOException (java.io.IOException)3 SwitchOperationException (org.openkilda.floodlight.switchmanager.SwitchOperationException)3 CommandData (org.openkilda.messaging.command.CommandData)3 ISwitchManager (org.openkilda.floodlight.switchmanager.ISwitchManager)2 BaseInstallFlow (org.openkilda.messaging.command.flow.BaseInstallFlow)2 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)2 MessageException (org.openkilda.messaging.error.MessageException)2 InfoData (org.openkilda.messaging.info.InfoData)2 FlowStatusResponse (org.openkilda.messaging.info.flow.FlowStatusResponse)2 SwitchRulesResponse (org.openkilda.messaging.info.switches.SwitchRulesResponse)2 Flow (org.openkilda.messaging.model.Flow)2