Search in sources :

Example 6 with FlowPathResponse

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());
}
Also used : PathInfoData(org.openkilda.messaging.info.event.PathInfoData) FlowPathResponse(org.openkilda.messaging.info.flow.FlowPathResponse) InfoMessage(org.openkilda.messaging.info.InfoMessage) Ignore(org.junit.Ignore) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Example 7 with FlowPathResponse

use of org.openkilda.messaging.info.flow.FlowPathResponse in project open-kilda by telstra.

the class FlowServiceImpl method rerouteFlow.

/**
 * {@inheritDoc}
 */
@Override
public FlowPathPayload rerouteFlow(String flowId, String correlationId) {
    Flow flow = new Flow();
    flow.setFlowId(flowId);
    FlowRerouteRequest data = new FlowRerouteRequest(flow, FlowOperation.UPDATE);
    CommandMessage command = new CommandMessage(data, System.currentTimeMillis(), correlationId, Destination.WFM);
    messageConsumer.clear();
    messageProducer.send(topic, command);
    Message message = (Message) messageConsumer.poll(correlationId);
    logger.debug("Got response {}", message);
    FlowPathResponse response = (FlowPathResponse) validateInfoMessage(command, message, correlationId);
    return Converter.buildFlowPathPayloadByFlowPath(flowId, response.getPayload());
}
Also used : FlowPathResponse(org.openkilda.messaging.info.flow.FlowPathResponse) InfoMessage(org.openkilda.messaging.info.InfoMessage) Message(org.openkilda.messaging.Message) CommandMessage(org.openkilda.messaging.command.CommandMessage) FlowRerouteRequest(org.openkilda.messaging.command.flow.FlowRerouteRequest) Flow(org.openkilda.messaging.model.Flow) CommandMessage(org.openkilda.messaging.command.CommandMessage)

Aggregations

InfoMessage (org.openkilda.messaging.info.InfoMessage)7 FlowPathResponse (org.openkilda.messaging.info.flow.FlowPathResponse)7 Test (org.junit.Test)3 Message (org.openkilda.messaging.Message)3 CommandMessage (org.openkilda.messaging.command.CommandMessage)3 PathInfoData (org.openkilda.messaging.info.event.PathInfoData)3 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)2 Ignore (org.junit.Ignore)1 FlowPathRequest (org.openkilda.messaging.command.flow.FlowPathRequest)1 FlowRerouteRequest (org.openkilda.messaging.command.flow.FlowRerouteRequest)1 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)1 PathNode (org.openkilda.messaging.info.event.PathNode)1 Flow (org.openkilda.messaging.model.Flow)1 FlowIdStatusPayload (org.openkilda.messaging.payload.flow.FlowIdStatusPayload)1 FlowPathPayload (org.openkilda.messaging.payload.flow.FlowPathPayload)1 Flow (org.openkilda.topology.domain.Flow)1