Search in sources :

Example 1 with ErrorData

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

the class FlowTopologyTest method statusUnknownFlowTest.

@Test
public void statusUnknownFlowTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> record;
    statusFlow(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 2 with ErrorData

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

the class FlowTopologyTest method updateUnknownFlowCommandBoltTest.

@Test
public void updateUnknownFlowCommandBoltTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> record;
    updateFlow(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 3 with ErrorData

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

the class FlowTopologyTest method deleteUnknownFlowCommandBoltTest.

@Test
public void deleteUnknownFlowCommandBoltTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> record;
    deleteFlow(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 4 with ErrorData

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

the class FlowTopologyTest method errorFlowDeleteMessageStatusBoltTopologyEngineBoltTest.

@Test
public void errorFlowDeleteMessageStatusBoltTopologyEngineBoltTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> record;
    createFlow(flowId);
    record = cacheConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    deleteFlow(flowId);
    record = cacheConsumer.pollMessage();
    assertNotNull(record);
    InfoMessage message = objectMapper.readValue(record.value(), InfoMessage.class);
    assertNotNull(message);
    ImmutablePair<Flow, Flow> flow = getFlowPayload(message);
    assertNotNull(flow);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    statusFlow(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());
    errorFlowTopologyEngineCommand(flowId, ErrorType.DELETION_FAILURE);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    errorMessage = objectMapper.readValue(record.value(), ErrorMessage.class);
    assertNotNull(errorMessage);
    errorData = errorMessage.getData();
    assertEquals(ErrorType.DELETION_FAILURE, errorData.getErrorType());
    statusFlow(flowId);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    errorMessage = objectMapper.readValue(record.value(), ErrorMessage.class);
    assertNotNull(errorMessage);
    errorData = errorMessage.getData();
    assertEquals(ErrorType.NOT_FOUND, errorData.getErrorType());
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) ErrorMessage(org.openkilda.messaging.error.ErrorMessage) ErrorData(org.openkilda.messaging.error.ErrorData) RemoveFlow(org.openkilda.messaging.command.flow.RemoveFlow) Flow(org.openkilda.messaging.model.Flow) InstallOneSwitchFlow(org.openkilda.messaging.command.flow.InstallOneSwitchFlow) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Example 5 with ErrorData

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

the class FlowTopologyTest method createAlreadyExistsFlowCommandBoltTest.

@Test
public void createAlreadyExistsFlowCommandBoltTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> record;
    createFlow(flowId);
    record = cacheConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    createFlow(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.ALREADY_EXISTS, 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

ErrorData (org.openkilda.messaging.error.ErrorData)18 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)18 Test (org.junit.Test)11 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)10 InfoMessage (org.openkilda.messaging.info.InfoMessage)8 ISwitchManager (org.openkilda.floodlight.switchmanager.ISwitchManager)2 SwitchOperationException (org.openkilda.floodlight.switchmanager.SwitchOperationException)2 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)2 RemoveFlow (org.openkilda.messaging.command.flow.RemoveFlow)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 FlowIdStatusPayload (org.openkilda.messaging.payload.flow.FlowIdStatusPayload)2 DatapathId (org.projectfloodlight.openflow.types.DatapathId)2 Message (org.openkilda.messaging.Message)1 CommandMessage (org.openkilda.messaging.command.CommandMessage)1 DeleteRulesAction (org.openkilda.messaging.command.switches.DeleteRulesAction)1 InstallRulesAction (org.openkilda.messaging.command.switches.InstallRulesAction)1