use of org.openkilda.messaging.command.flow.InstallOneSwitchFlow in project open-kilda by telstra.
the class RecordHandler method doProcessOneSwitchFlow.
/**
* Processes one-switch flow installing message.
*
* @param message command message for flow installation
*/
private void doProcessOneSwitchFlow(final CommandMessage message, String replyToTopic, Destination replyDestination) throws FlowCommandException {
InstallOneSwitchFlow command = (InstallOneSwitchFlow) message.getData();
logger.debug("creating a flow through one switch: {}", command);
try {
installOneSwitchFlow(command);
message.setDestination(replyDestination);
context.getKafkaProducer().postMessage(replyToTopic, message);
} catch (SwitchOperationException e) {
throw new FlowCommandException(command.getId(), ErrorType.CREATION_FAILURE, e);
}
}
use of org.openkilda.messaging.command.flow.InstallOneSwitchFlow in project open-kilda by telstra.
the class RecordHandler method doSyncRulesRequest.
/**
* Installs missed flows on the switch.
* @param message with list of flows.
*/
private void doSyncRulesRequest(final CommandMessage message) {
InstallMissedFlowsRequest request = (InstallMissedFlowsRequest) message.getData();
final String switchId = request.getSwitchId();
logger.debug("Processing rules to be updated for switch {}", switchId);
for (BaseInstallFlow command : request.getFlowCommands()) {
logger.debug("Processing command for switch {} {}", switchId, command);
try {
if (command instanceof InstallIngressFlow) {
installIngressFlow((InstallIngressFlow) command);
} else if (command instanceof InstallEgressFlow) {
installEgressFlow((InstallEgressFlow) command);
} else if (command instanceof InstallTransitFlow) {
installTransitFlow((InstallTransitFlow) command);
} else if (command instanceof InstallOneSwitchFlow) {
installOneSwitchFlow((InstallOneSwitchFlow) command);
}
} catch (SwitchOperationException e) {
logger.error("Error during flow installation", e);
}
}
}
use of org.openkilda.messaging.command.flow.InstallOneSwitchFlow in project open-kilda by telstra.
the class ReplaceInstallFlowTest method installOneSwitchReplaceFlow.
@Test
public void installOneSwitchReplaceFlow() throws IOException, InterruptedException {
String value = Resources.toString(getClass().getResource("/install_one_switch_replace_flow.json"), Charsets.UTF_8);
InstallOneSwitchFlow data = (InstallOneSwitchFlow) prepareData(value);
OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
OFFlowAdd flowCommand = scheme.oneSwitchReplaceFlowMod(data.getInputPort(), data.getOutputPort(), data.getInputVlanId(), data.getOutputVlanId(), 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 ReplaceInstallFlowTest method installOneSwitchPushFlow.
@Test
public void installOneSwitchPushFlow() throws IOException, InterruptedException {
String value = Resources.toString(getClass().getResource("/install_one_switch_push_flow.json"), Charsets.UTF_8);
InstallOneSwitchFlow data = (InstallOneSwitchFlow) prepareData(value);
OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
OFFlowAdd flowCommand = scheme.oneSwitchPushFlowMod(data.getInputPort(), data.getOutputPort(), data.getOutputVlanId(), 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 ReplaceInstallFlowTest method installOneSwitchPopFlow.
@Test
public void installOneSwitchPopFlow() throws IOException, InterruptedException {
String value = Resources.toString(getClass().getResource("/install_one_switch_pop_flow.json"), Charsets.UTF_8);
InstallOneSwitchFlow data = (InstallOneSwitchFlow) prepareData(value);
OFMeterMod meterCommand = scheme.installMeter(data.getBandwidth(), 1024, data.getMeterId());
OFFlowAdd flowCommand = scheme.oneSwitchPopFlowMod(data.getInputPort(), data.getOutputPort(), data.getInputVlanId(), data.getMeterId(), 123L);
runTest(value, flowCommand, meterCommand, null, null);
}
Aggregations