use of org.openkilda.floodlight.switchmanager.SwitchOperationException in project open-kilda by telstra.
the class RecordHandler method doProcessTransitFlow.
/**
* Processes transit flow installing message.
*
* @param message command message for flow installation
*/
private void doProcessTransitFlow(final CommandMessage message, String replyToTopic, Destination replyDestination) throws FlowCommandException {
InstallTransitFlow command = (InstallTransitFlow) message.getData();
try {
installTransitFlow(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.floodlight.switchmanager.SwitchOperationException 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.floodlight.switchmanager.SwitchOperationException 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.floodlight.switchmanager.SwitchOperationException in project open-kilda by telstra.
the class RecordHandler method doProcessIngressFlow.
/**
* Processes install ingress flow message.
*
* @param message command message for flow installation
*/
private void doProcessIngressFlow(final CommandMessage message, String replyToTopic, Destination replyDestination) throws FlowCommandException {
InstallIngressFlow command = (InstallIngressFlow) message.getData();
try {
installIngressFlow(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.floodlight.switchmanager.SwitchOperationException in project open-kilda by telstra.
the class RecordHandler method doDeleteFlow.
/**
* Removes flow.
*
* @param message command message for flow installation
*/
private void doDeleteFlow(final CommandMessage message, String replyToTopic, Destination replyDestination) throws FlowCommandException {
RemoveFlow command = (RemoveFlow) message.getData();
logger.debug("deleting a flow: {}", command);
DatapathId dpid = DatapathId.of(command.getSwitchId());
ISwitchManager switchManager = context.getSwitchManager();
try {
switchManager.deleteFlow(dpid, command.getId(), command.getCookie());
Integer meterId = meterPool.deallocate(command.getSwitchId(), command.getId());
if (meterId != null) {
switchManager.deleteMeter(dpid, meterId);
}
message.setDestination(replyDestination);
context.getKafkaProducer().postMessage(replyToTopic, message);
} catch (SwitchOperationException e) {
throw new FlowCommandException(command.getId(), ErrorType.DELETION_FAILURE, e);
}
}
Aggregations