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);
}
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);
}
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());
}
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());
}
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;
}
Aggregations