use of org.openkilda.messaging.command.flow.InstallOneSwitchFlow in project open-kilda by telstra.
the class ReplaceInstallFlowTest method installOneSwitchNoneFlow.
@Test
public void installOneSwitchNoneFlow() throws IOException, InterruptedException {
String value = Resources.toString(getClass().getResource("/install_one_switch_none_flow.json"), Charsets.UTF_8);
InstallOneSwitchFlow data = (InstallOneSwitchFlow) prepareData(value);
OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
OFFlowAdd flowCommand = scheme.oneSwitchNoneFlowMod(data.getInputPort(), data.getOutputPort(), data.getMeterId(), 123L);
runTest(value, flowCommand, meterCommand, null, null);
}
use of org.openkilda.messaging.command.flow.InstallOneSwitchFlow in project open-kilda by telstra.
the class FlowTopologyTest method baseInstallFlowCommand.
private InstallOneSwitchFlow baseInstallFlowCommand(final String flowId) throws IOException {
System.out.println("TOPOLOGY: Install flow");
InstallOneSwitchFlow commandData = new InstallOneSwitchFlow(0L, flowId, COOKIE, "switch-id", 1, 2, 0, 0, OutputVlanType.NONE, 10000L, 0L);
CommandMessage commandMessage = new CommandMessage(commandData, 0, "install-flow", Destination.WFM);
// sendTopologyEngineMessage(commandMessage);
// sendSpeakerMessage(commandMessage);
sendFlowMessage(commandMessage);
return commandData;
}
use of org.openkilda.messaging.command.flow.InstallOneSwitchFlow 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());
}
Aggregations