use of org.openkilda.messaging.info.flow.FlowResponse in project open-kilda by telstra.
the class FlowServiceImpl method createFlow.
/**
* {@inheritDoc}
*/
@Override
public FlowPayload createFlow(final FlowPayload flow, final String correlationId) {
LOGGER.debug("Create flow: {}={}", CORRELATION_ID, correlationId);
FlowCreateRequest data = new FlowCreateRequest(Converter.buildFlowByFlowPayload(flow));
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
messageConsumer.clear();
messageProducer.send(topic, request);
Message message = (Message) messageConsumer.poll(correlationId);
FlowResponse response = (FlowResponse) validateInfoMessage(request, message, correlationId);
return Converter.buildFlowPayloadByFlow(response.getPayload());
}
use of org.openkilda.messaging.info.flow.FlowResponse in project open-kilda by telstra.
the class FlowServiceImpl method getFlow.
/**
* {@inheritDoc}
*/
@Override
public FlowPayload getFlow(final String id, final String correlationId) {
LOGGER.debug("Get flow: {}={}", CORRELATION_ID, correlationId);
FlowGetRequest data = new FlowGetRequest(new FlowIdStatusPayload(id, null));
CommandMessage request = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
messageConsumer.clear();
messageProducer.send(topic, request);
Message message = (Message) messageConsumer.poll(correlationId);
FlowResponse response = (FlowResponse) validateInfoMessage(request, message, correlationId);
return Converter.buildFlowPayloadByFlow(response.getPayload());
}
use of org.openkilda.messaging.info.flow.FlowResponse in project open-kilda by telstra.
the class FlowServiceImpl method _deleteFlowRespone.
/**
* Blocking primitive .. waits for the response .. and then converts to FlowPayload.
* @return the deleted flow.
*/
private FlowPayload _deleteFlowRespone(final String correlationId, CommandMessage request) {
Message message = (Message) messageConsumer.poll(correlationId);
FlowResponse response = (FlowResponse) validateInfoMessage(request, message, correlationId);
return Converter.buildFlowPayloadByFlow(response.getPayload());
}
use of org.openkilda.messaging.info.flow.FlowResponse in project open-kilda by telstra.
the class FlowTopologyTest method getFlowTopologyEngineBoltTest.
@Test
@Ignore
public void getFlowTopologyEngineBoltTest() throws Exception {
ConsumerRecord<String, String> nbRecord;
String flowId = UUID.randomUUID().toString();
Flow payload = getFlowCommand(flowId);
nbRecord = nbConsumer.pollMessage();
assertNotNull(nbRecord);
assertNotNull(nbRecord.value());
InfoMessage response = objectMapper.readValue(nbRecord.value(), InfoMessage.class);
assertNotNull(response);
FlowResponse responseData = (FlowResponse) response.getData();
assertNotNull(responseData);
assertEquals(payload, responseData.getPayload());
}
use of org.openkilda.messaging.info.flow.FlowResponse in project open-kilda by telstra.
the class FlowTopologyTest method deleteFlowCommandBoltTest.
@Test
public void deleteFlowCommandBoltTest() 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());
Flow payload = deleteFlow(flowId);
record = cacheConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage message = objectMapper.readValue(record.value(), InfoMessage.class);
assertNotNull(message);
ImmutablePair<Flow, Flow> flow = getFlowPayload(message);
assertNotNull(flow);
Flow flowTePayload = flow.getLeft();
assertEquals(payload.getFlowId(), flowTePayload.getFlowId());
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
System.out.println("record = " + record);
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
FlowResponse response = (FlowResponse) infoMessage.getData();
assertNotNull(response);
}
Aggregations