use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowTopologyTest method updateFlow.
private Flow updateFlow(final String flowId) throws IOException {
System.out.println("NORTHBOUND: Update flow");
Flow flowPayload = new Flow(flowId, 10000, false, "", "test-switch", 1, 2, "test-switch", 1, 2);
FlowUpdateRequest commandData = new FlowUpdateRequest(flowPayload);
CommandMessage message = new CommandMessage(commandData, 0, "update-flow", Destination.WFM);
// sendNorthboundMessage(message);
sendFlowMessage(message);
return flowPayload;
}
use of org.openkilda.messaging.model.Flow 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);
}
use of org.openkilda.messaging.model.Flow in project open-kilda by telstra.
the class FlowTopologyTest method createFlowCommandBoltTest.
@Test
public void createFlowCommandBoltTest() throws Exception {
ConsumerRecord<String, String> record;
String flowId = UUID.randomUUID().toString();
createFlow(flowId);
record = cacheConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage message = objectMapper.readValue(record.value(), InfoMessage.class);
ImmutablePair<Flow, Flow> flow = getFlowPayload(message);
assertNotNull(flow);
record = nbConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
InfoMessage infoMessage = objectMapper.readValue(record.value(), InfoMessage.class);
FlowResponse response = (FlowResponse) infoMessage.getData();
assertNotNull(response);
}
use of org.openkilda.messaging.model.Flow 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.model.Flow in project open-kilda by telstra.
the class FlowInfoDataTest method toStringTest.
@Test
public void toStringTest() throws Exception {
FlowInfoData data = new FlowInfoData("", new ImmutablePair<>(new Flow(), new Flow()), FlowOperation.CREATE, Utils.DEFAULT_CORRELATION_ID);
String dataString = data.toString();
assertNotNull(dataString);
assertFalse(dataString.isEmpty());
System.out.println(MAPPER.writeValueAsString(data));
}
Aggregations