use of org.openkilda.messaging.info.flow.FlowPathResponse in project open-kilda by telstra.
the class FlowTopologyTest method pathFlowTest.
@Test
public void pathFlowTest() 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());
PathInfoData payload = pathFlow(flowId);
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
FlowPathResponse infoData = (FlowPathResponse) infoMessage.getData();
assertNotNull(infoData);
PathInfoData flowTePayload = infoData.getPayload();
assertEquals(payload, flowTePayload);
}
use of org.openkilda.messaging.info.flow.FlowPathResponse in project open-kilda by telstra.
the class FlowServiceImpl method pathFlow.
/**
* {@inheritDoc}
*/
@Override
public InfoMessage pathFlow(final FlowIdStatusPayload payload, final String correlationId) {
Set<Flow> flows = flowRepository.findByFlowId(payload.getId());
FlowPathPayload flowPathPayload = null;
for (Flow flow : flows) {
if ((flow.getCookie() & DIRECT_FLOW_COOKIE) == DIRECT_FLOW_COOKIE) {
flowPathPayload = new FlowPathPayload(flow.getFlowId(), flow.getFlowPath());
}
}
logger.debug("Flow with id={} path: {}", payload.getId(), flowPathPayload);
return new InfoMessage(new FlowPathResponse(flowPathPayload), System.currentTimeMillis(), correlationId, Destination.WFM);
}
use of org.openkilda.messaging.info.flow.FlowPathResponse in project open-kilda by telstra.
the class AbstractSerializerTest method flowPathResponseTest.
@Test
public void flowPathResponseTest() throws IOException, ClassNotFoundException {
FlowPathResponse data = new FlowPathResponse(path);
System.out.println(data);
InfoMessage info = new InfoMessage(data, System.currentTimeMillis(), CORRELATION_ID, DESTINATION);
serialize(info);
Message message = (Message) deserialize();
assertTrue(message instanceof InfoMessage);
InfoMessage resultInfo = (InfoMessage) message;
assertTrue(resultInfo.getData() instanceof FlowPathResponse);
FlowPathResponse resultData = (FlowPathResponse) resultInfo.getData();
System.out.println(resultData);
assertEquals(data, resultData);
assertEquals(data.hashCode(), resultData.hashCode());
assertEquals(path.hashCode(), resultData.getPayload().hashCode());
}
use of org.openkilda.messaging.info.flow.FlowPathResponse in project open-kilda by telstra.
the class FlowTopologyTest method pathFlowCommand.
private PathInfoData pathFlowCommand(final String flowId) throws IOException {
System.out.println("TOPOLOGY: Path flow");
PathInfoData payload = new PathInfoData(0L, Collections.singletonList(new PathNode("test-switch", 1, 0, null)));
FlowPathResponse infoData = new FlowPathResponse(payload);
InfoMessage infoMessage = new InfoMessage(infoData, 0, "path-flow", Destination.WFM);
sendTopologyEngineMessage(infoMessage);
return payload;
}
use of org.openkilda.messaging.info.flow.FlowPathResponse in project open-kilda by telstra.
the class FlowTopologyTest method getPathTopologyEngineBoltTest.
@Test
@Ignore
public void getPathTopologyEngineBoltTest() throws Exception {
ConsumerRecord<String, String> nbRecord;
String flowId = UUID.randomUUID().toString();
PathInfoData payload = pathFlowCommand(flowId);
nbRecord = nbConsumer.pollMessage();
assertNotNull(nbRecord);
assertNotNull(nbRecord.value());
InfoMessage response = objectMapper.readValue(nbRecord.value(), InfoMessage.class);
assertNotNull(response);
FlowPathResponse responseData = (FlowPathResponse) response.getData();
assertNotNull(responseData);
assertEquals(payload, responseData.getPayload());
}
Aggregations