Search in sources :

Example 16 with InfoMessage

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

the class OFELinkBoltTest method getDumpTuple.

public Tuple getDumpTuple() throws JsonProcessingException {
    NetworkInfoData dump = new NetworkInfoData("test", Collections.emptySet(), Collections.emptySet(), Collections.emptySet(), Collections.emptySet());
    InfoMessage info = new InfoMessage(dump, 0, DEFAULT_CORRELATION_ID, Destination.WFM);
    String request = objectMapper.writeValueAsString(info);
    return new TupleImpl(context, new Values(request), TASK_ID_BOLT, STREAM_ID_INPUT);
}
Also used : NetworkInfoData(org.openkilda.messaging.info.discovery.NetworkInfoData) InfoMessage(org.openkilda.messaging.info.InfoMessage) Values(org.apache.storm.tuple.Values) TupleImpl(org.apache.storm.tuple.TupleImpl)

Example 17 with InfoMessage

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

Example 18 with InfoMessage

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

the class FlowTopologyTest method removeFlowTopologyEngineSpeakerBoltTest.

@Test
public void removeFlowTopologyEngineSpeakerBoltTest() throws Exception {
    String flowId = UUID.randomUUID().toString();
    ConsumerRecord<String, String> ofsRecord;
    ConsumerRecord<String, String> record;
    createFlow(flowId);
    record = cacheConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    statusFlow(flowId);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
    assertNotNull(infoMessage);
    FlowStatusResponse infoData = (FlowStatusResponse) infoMessage.getData();
    assertNotNull(infoData);
    FlowIdStatusPayload flowNbPayload = infoData.getPayload();
    assertNotNull(flowNbPayload);
    assertEquals(flowId, flowNbPayload.getId());
    assertEquals(FlowState.ALLOCATED, flowNbPayload.getStatus());
    RemoveFlow data = removeFlowCommand(flowId);
    ofsRecord = ofsConsumer.pollMessage();
    assertNotNull(ofsRecord);
    assertNotNull(ofsRecord.value());
    CommandMessage response = objectMapper.readValue(ofsRecord.value(), CommandMessage.class);
    assertNotNull(response);
    RemoveFlow responseData = (RemoveFlow) response.getData();
    Long transactionId = responseData.getTransactionId();
    responseData.setTransactionId(0L);
    assertEquals(data, responseData);
    responseData.setTransactionId(transactionId);
    statusFlow(flowId);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
    assertNotNull(infoMessage);
    infoData = (FlowStatusResponse) infoMessage.getData();
    assertNotNull(infoData);
    flowNbPayload = infoData.getPayload();
    assertNotNull(flowNbPayload);
    assertEquals(flowId, flowNbPayload.getId());
    assertEquals(FlowState.IN_PROGRESS, flowNbPayload.getStatus());
    response.setDestination(Destination.WFM_TRANSACTION);
    removeRuleCommand(response);
    statusFlow(flowId);
    record = nbConsumer.pollMessage();
    assertNotNull(record);
    assertNotNull(record.value());
    infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
    assertNotNull(infoMessage);
    infoData = (FlowStatusResponse) infoMessage.getData();
    assertNotNull(infoData);
    flowNbPayload = infoData.getPayload();
    assertNotNull(flowNbPayload);
    assertEquals(flowId, flowNbPayload.getId());
    assertEquals(FlowState.UP, flowNbPayload.getStatus());
}
Also used : FlowStatusResponse(org.openkilda.messaging.info.flow.FlowStatusResponse) RemoveFlow(org.openkilda.messaging.command.flow.RemoveFlow) FlowIdStatusPayload(org.openkilda.messaging.payload.flow.FlowIdStatusPayload) InfoMessage(org.openkilda.messaging.info.InfoMessage) CommandMessage(org.openkilda.messaging.command.CommandMessage) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Example 19 with InfoMessage

use of org.openkilda.messaging.info.InfoMessage 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());
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) FlowsResponse(org.openkilda.messaging.info.flow.FlowsResponse) RemoveFlow(org.openkilda.messaging.command.flow.RemoveFlow) Flow(org.openkilda.messaging.model.Flow) InstallOneSwitchFlow(org.openkilda.messaging.command.flow.InstallOneSwitchFlow) Ignore(org.junit.Ignore) AbstractStormTest(org.openkilda.wfm.AbstractStormTest) Test(org.junit.Test)

Example 20 with InfoMessage

use of org.openkilda.messaging.info.InfoMessage 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;
}
Also used : InfoMessage(org.openkilda.messaging.info.InfoMessage) FlowResponse(org.openkilda.messaging.info.flow.FlowResponse) RemoveFlow(org.openkilda.messaging.command.flow.RemoveFlow) Flow(org.openkilda.messaging.model.Flow) InstallOneSwitchFlow(org.openkilda.messaging.command.flow.InstallOneSwitchFlow)

Aggregations

InfoMessage (org.openkilda.messaging.info.InfoMessage)87 Test (org.junit.Test)34 Values (org.apache.storm.tuple.Values)27 CommandMessage (org.openkilda.messaging.command.CommandMessage)21 Flow (org.openkilda.messaging.model.Flow)21 Message (org.openkilda.messaging.Message)20 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)19 AbstractStormTest (org.openkilda.wfm.AbstractStormTest)19 RemoveFlow (org.openkilda.messaging.command.flow.RemoveFlow)13 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)12 FlowIdStatusPayload (org.openkilda.messaging.payload.flow.FlowIdStatusPayload)12 IOException (java.io.IOException)9 SwitchInfoData (org.openkilda.messaging.info.event.SwitchInfoData)9 ErrorData (org.openkilda.messaging.error.ErrorData)8 InfoData (org.openkilda.messaging.info.InfoData)8 PortInfoData (org.openkilda.messaging.info.event.PortInfoData)8 FlowResponse (org.openkilda.messaging.info.flow.FlowResponse)8 FlowStatusResponse (org.openkilda.messaging.info.flow.FlowStatusResponse)8 NetworkInfoData (org.openkilda.messaging.info.discovery.NetworkInfoData)7 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)7