use of org.openkilda.messaging.info.flow.FlowsResponse in project open-kilda by telstra.
the class FlowTopologyTest method dumpFlowsTopologyEngineBoltTest.
@Test
@Ignore
public void dumpFlowsTopologyEngineBoltTest() throws Exception {
ConsumerRecord<String, String> nbRecord;
String flowId = UUID.randomUUID().toString();
List<Flow> payload = dumpFlowCommand(flowId);
nbRecord = nbConsumer.pollMessage();
assertNotNull(nbRecord);
assertNotNull(nbRecord.value());
InfoMessage response = objectMapper.readValue(nbRecord.value(), InfoMessage.class);
assertNotNull(response);
FlowsResponse responseData = (FlowsResponse) response.getData();
assertNotNull(responseData);
assertEquals(payload, responseData.getPayload());
}
use of org.openkilda.messaging.info.flow.FlowsResponse in project open-kilda by telstra.
the class FlowTopologyTest method dumpFlowsTest.
@Test
public void dumpFlowsTest() 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());
dumpFlows(null);
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
FlowsResponse infoData = (FlowsResponse) infoMessage.getData();
assertNotNull(infoData);
assertNotNull(infoData.getPayload());
assertFalse(infoData.getPayload().isEmpty());
}
use of org.openkilda.messaging.info.flow.FlowsResponse in project open-kilda by telstra.
the class FlowTopologyTest method dumpFlowCommand.
private List<Flow> dumpFlowCommand(final String flowId) throws IOException {
System.out.println("TOPOLOGY: Get flows");
Flow flow = new Flow(flowId, 10000, false, "", "test-switch", 1, 2, "test-switch", 1, 2);
List<Flow> payload = Collections.singletonList(flow);
FlowsResponse infoData = new FlowsResponse(payload);
InfoMessage infoMessage = new InfoMessage(infoData, 0, "dump-flows", Destination.WFM);
sendTopologyEngineMessage(infoMessage);
return payload;
}
use of org.openkilda.messaging.info.flow.FlowsResponse in project open-kilda by telstra.
the class TopologyController method flows.
/**
* Dumps flows.
*
* @param correlationId correlation ID header value
* @return flows
*/
@RequestMapping(value = "/flows", method = RequestMethod.GET, produces = APPLICATION_JSON_UTF8_VALUE)
public ResponseEntity<FlowsPayload> flows(@RequestHeader(value = CORRELATION_ID, defaultValue = DEFAULT_CORRELATION_ID) String correlationId) {
logger.debug("Dump flows: {}={}", CORRELATION_ID, correlationId);
InfoMessage message = flowService.getFlows(null, correlationId);
FlowsResponse response = (FlowsResponse) message.getData();
return new ResponseEntity<>(response.getPayload(), new HttpHeaders(), HttpStatus.OK);
}
use of org.openkilda.messaging.info.flow.FlowsResponse in project open-kilda by telstra.
the class FlowServiceImpl method getFlows.
/**
* {@inheritDoc}
*/
@Override
public InfoMessage getFlows(final FlowIdStatusPayload payload, final String correlationId) {
Set<Flow> flows = flowRepository.findAll();
List<FlowPayload> flowsPayload = new ArrayList<>(flows.size() / 2);
for (Flow flow : flows) {
if ((flow.getCookie() & DIRECT_FLOW_COOKIE) == DIRECT_FLOW_COOKIE) {
flowsPayload.add(getFlowPayloadByFlow(flow));
}
}
logger.debug("Flows get: {}", flowsPayload);
return new InfoMessage(new FlowsResponse(new FlowsPayload(flowsPayload)), System.currentTimeMillis(), correlationId, Destination.WFM);
}
Aggregations