use of org.openkilda.messaging.command.CommandMessage in project open-kilda by telstra.
the class FlowTopologyTest method getFlow.
private FlowIdStatusPayload getFlow(final String flowId) throws IOException {
System.out.println("NORTHBOUND: Get flow");
FlowIdStatusPayload payload = new FlowIdStatusPayload(flowId);
FlowGetRequest commandData = new FlowGetRequest(payload);
CommandMessage message = new CommandMessage(commandData, 0, "get-flow", Destination.WFM);
// sendNorthboundMessage(message);
sendFlowMessage(message);
return payload;
}
use of org.openkilda.messaging.command.CommandMessage in project open-kilda by telstra.
the class FlowTopologyTest method statusFlow.
private FlowIdStatusPayload statusFlow(final String flowId) throws IOException {
System.out.println("NORTHBOUND: Status flow");
FlowIdStatusPayload payload = new FlowIdStatusPayload(flowId);
FlowStatusRequest commandData = new FlowStatusRequest(payload);
CommandMessage message = new CommandMessage(commandData, 0, "status-flow", Destination.WFM);
// sendNorthboundMessage(message);
sendFlowMessage(message);
return payload;
}
use of org.openkilda.messaging.command.CommandMessage 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.command.CommandMessage in project open-kilda by telstra.
the class FlowTopologyTest method installFlowTopologyEngineSpeakerBoltTest.
@Test
public void installFlowTopologyEngineSpeakerBoltTest() throws Exception {
/*
* This test will verify the state transitions of a flow, through the status mechanism.
* It achieves this by doing the following:
* - CreateFlow .. clear both cache and northbound consumers
* - GetStatus .. confirm STATE = FlowState.ALLOCATED
* - baseInstallFlowCommand .. read speaker .. validate data/responsedata
* - GetStatus .. confirm STATE = FlowState.IN_PROGRESS
* - baseInstallRuleCommand ..
* - GetStatus .. confirm STATE = FlowState.UP
*/
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());
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());
InstallOneSwitchFlow data = baseInstallFlowCommand(flowId);
record = ofsConsumer.pollMessage();
assertNotNull(record);
assertNotNull(record.value());
CommandMessage response = objectMapper.readValue(record.value(), CommandMessage.class);
assertNotNull(response);
InstallOneSwitchFlow responseData = (InstallOneSwitchFlow) 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);
baseInstallRuleCommand(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.command.CommandMessage in project open-kilda by telstra.
the class FlowTopologyTest method removeFlowCommand.
private RemoveFlow removeFlowCommand(final String flowId) throws IOException {
System.out.println("TOPOLOGY: Remove flow");
RemoveFlow commandData = new RemoveFlow(0L, flowId, COOKIE, "switch-id", 0L);
CommandMessage commandMessage = new CommandMessage(commandData, 0, "remove-flow", Destination.WFM);
// sendTopologyEngineMessage(commandMessage);
sendFlowMessage(commandMessage);
return commandData;
}
Aggregations