use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class FlowTopologyTest method getFlowTest.
@Test
public void getFlowTest() throws Exception {
String flowId = UUID.randomUUID().toString();
ConsumerRecord<String, String> record;
Flow flow = createFlow(flowId);
flow.setCookie(1);
flow.setFlowPath(new PathInfoData(0L, Collections.emptyList()));
flow.setMeterId(1);
flow.setTransitVlan(2);
flow.setState(FlowState.ALLOCATED);
record = cacheConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
getFlow(flowId);
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
FlowResponse infoData = (FlowResponse) infoMessage.getData();
assertNotNull(infoData);
Flow flowTePayload = infoData.getPayload();
assertEquals(flow, flowTePayload);
}
use of org.openkilda.messaging.info.InfoMessage 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());
}
use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class FlowTopologyTest method errorFlowUpdateMessageStatusBoltTopologyEngineBoltTest.
@Test
public void errorFlowUpdateMessageStatusBoltTopologyEngineBoltTest() 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());
updateFlow(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());
InfoMessage infoMessageUp = objectMapper.readValue(record.value(), InfoMessage.class);
assertNotNull(infoMessageUp);
FlowStatusResponse infoDataUp = (FlowStatusResponse) infoMessageUp.getData();
assertNotNull(infoDataUp);
FlowIdStatusPayload flowNbPayloadUp = infoDataUp.getPayload();
assertNotNull(flowNbPayloadUp);
assertEquals(flowId, flowNbPayloadUp.getId());
assertEquals(FlowState.ALLOCATED, flowNbPayloadUp.getStatus());
errorFlowTopologyEngineCommand(flowId, ErrorType.UPDATE_FAILURE);
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
ErrorMessage errorMessage = objectMapper.readValue(record.value(), ErrorMessage.class);
assertNotNull(errorMessage);
ErrorData errorData = errorMessage.getData();
assertEquals(ErrorType.UPDATE_FAILURE, errorData.getErrorType());
statusFlow(flowId);
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
assertNotNull(infoMessage);
FlowStatusResponse response = (FlowStatusResponse) infoMessage.getData();
assertNotNull(response);
FlowIdStatusPayload flowNbPayload = response.getPayload();
assertNotNull(flowNbPayload);
assertEquals(flowId, flowNbPayload.getId());
assertEquals(FlowState.DOWN, flowNbPayload.getStatus());
}
use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class FlowTopologyTest method updateFlowCommandBoltTest.
@Test
public void updateFlowCommandBoltTest() 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());
updateFlow(flowId);
record = cacheConsumer.pollMessage();
assertNotNull(record);
InfoMessage message = objectMapper.readValue(record.value(), InfoMessage.class);
assertNotNull(message);
ImmutablePair<Flow, Flow> flow = getFlowPayload(message);
assertNotNull(flow);
Flow flowTePayload = flow.getLeft();
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
FlowResponse payload = (FlowResponse) infoMessage.getData();
assertNotNull(payload);
Flow flowNbPayload = payload.getPayload();
assertEquals(flowNbPayload, flowTePayload);
}
use of org.openkilda.messaging.info.InfoMessage in project open-kilda by telstra.
the class IslStatsBoltTest method getIslInfoData.
@Test
public void getIslInfoData() throws Exception {
Object data = statsBolt.getIslInfoData(statsBolt.getInfoData(message));
assertThat(data, instanceOf(IslInfoData.class));
assertEquals(data, islInfoData);
thrown.expect(Exception.class);
thrown.expectMessage(containsString("is not an IslInfoData"));
PortInfoData portData = new PortInfoData();
InfoMessage badMessage = new InfoMessage(portData, TIMESTAMP, CORRELATION, null);
data = statsBolt.getIslInfoData(statsBolt.getIslInfoData(badMessage.getData()));
}
Aggregations