use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowTopologyTest method deleteFlow.
private Flow deleteFlow(final String flowId) throws IOException {
System.out.println("NORTHBOUND: Delete flow");
Flow payload = new Flow();
payload.setFlowId(flowId);
FlowDeleteRequest commandData = new FlowDeleteRequest(payload);
CommandMessage message = new CommandMessage(commandData, 0, "delete-flow", Destination.WFM);
// sendNorthboundMessage(message);
// sendTopologyEngineMessage(message);
sendFlowMessage(message);
return payload;
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowTopologyTest method getFlowCommand.
private Flow getFlowCommand(final String flowId) throws IOException {
System.out.println("TOPOLOGY: Get flow");
Flow flowPayload = new Flow(flowId, 10000, false, "", "test-switch", 1, 2, "test-switch", 1, 2);
FlowResponse infoData = new FlowResponse(flowPayload);
InfoMessage infoMessage = new InfoMessage(infoData, 0, "get-flow", Destination.WFM);
sendTopologyEngineMessage(infoMessage);
return flowPayload;
}
use of org.openkilda.messaging.model.Flow 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.model.Flow 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.model.Flow 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());
}
Aggregations