Search in sources :

Example 6 with BaseInstallFlow

use of org.openkilda.messaging.command.flow.BaseInstallFlow in project open-kilda by telstra.

the class CommandBuilderImpl method buildInstallSpecialDefaultRuleCommands.

/**
 * Some default rules require additional properties to be installed. This method creates commands for such rules.
 */
private List<BaseInstallFlow> buildInstallSpecialDefaultRuleCommands(SwitchId switchId, List<Long> switchRules) {
    SwitchProperties properties = getSwitchProperties(switchId);
    List<BaseInstallFlow> commands = new ArrayList<>();
    for (Long cookie : switchRules) {
        InstallServer42FlowBuilder command = InstallServer42Flow.builder().transactionId(transactionIdGenerator.generate()).cookie(cookie).switchId(switchId).multiTable(properties.isMultiTable()).inputPort(0).outputPort(0).server42Vlan(properties.getServer42Vlan()).server42MacAddress(properties.getServer42MacAddress());
        if (cookie == SERVER_42_FLOW_RTT_OUTPUT_VLAN_COOKIE) {
            commands.add(command.id("SWMANAGER_SERVER_42_FLOW_RTT_OUTPUT_VLAN_RULE_INSTALL").outputPort(properties.getServer42Port()).build());
        } else if (cookie == SERVER_42_FLOW_RTT_OUTPUT_VXLAN_COOKIE) {
            commands.add(command.id("SWMANAGER_SERVER_42_FLOW_RTT_OUTPUT_VXLAN_RULE_INSTALL").outputPort(properties.getServer42Port()).build());
        } else if (new PortColourCookie(cookie).getType() == CookieType.SERVER_42_FLOW_RTT_INPUT) {
            commands.add(command.id("SWMANAGER_SERVER_42_FLOW_RTT_INPUT_RULE_INSTALL").inputPort(properties.getServer42Port()).build());
        } else if (cookie == SERVER_42_ISL_RTT_OUTPUT_COOKIE) {
            commands.add(command.id("SWMANAGER_SERVER_42_ISL_RTT_OUTPUT_RULE_INSTALL").outputPort(properties.getServer42Port()).build());
        } else if (new PortColourCookie(cookie).getType() == CookieType.SERVER_42_ISL_RTT_INPUT) {
            commands.add(command.id("SWMANAGER_SERVER_42_ISL_RTT_INPUT_RULE_INSTALL").inputPort(properties.getServer42Port()).build());
        } else {
            log.warn("Got request for installation of unknown rule {} on switch {}", cookie, switchId);
        }
    }
    return commands;
}
Also used : ArrayList(java.util.ArrayList) BaseInstallFlow(org.openkilda.messaging.command.flow.BaseInstallFlow) InstallServer42FlowBuilder(org.openkilda.messaging.command.flow.InstallServer42Flow.InstallServer42FlowBuilder) SwitchProperties(org.openkilda.model.SwitchProperties) PortColourCookie(org.openkilda.model.cookie.PortColourCookie)

Aggregations

BaseInstallFlow (org.openkilda.messaging.command.flow.BaseInstallFlow)6 IOException (java.io.IOException)3 Message (org.openkilda.messaging.Message)3 CommandData (org.openkilda.messaging.command.CommandData)3 CommandMessage (org.openkilda.messaging.command.CommandMessage)3 RemoveFlow (org.openkilda.messaging.command.flow.RemoveFlow)3 ArrayList (java.util.ArrayList)2 Values (org.apache.storm.tuple.Values)2 ErrorMessage (org.openkilda.messaging.error.ErrorMessage)2 ISwitchManager (org.openkilda.floodlight.switchmanager.ISwitchManager)1 SwitchOperationException (org.openkilda.floodlight.switchmanager.SwitchOperationException)1 BaseFlow (org.openkilda.messaging.command.flow.BaseFlow)1 InstallEgressFlow (org.openkilda.messaging.command.flow.InstallEgressFlow)1 InstallIngressFlow (org.openkilda.messaging.command.flow.InstallIngressFlow)1 InstallOneSwitchFlow (org.openkilda.messaging.command.flow.InstallOneSwitchFlow)1 InstallServer42Flow (org.openkilda.messaging.command.flow.InstallServer42Flow)1 InstallServer42FlowBuilder (org.openkilda.messaging.command.flow.InstallServer42Flow.InstallServer42FlowBuilder)1 InstallSharedFlow (org.openkilda.messaging.command.flow.InstallSharedFlow)1 InstallTransitFlow (org.openkilda.messaging.command.flow.InstallTransitFlow)1 InstallMissedFlowsRequest (org.openkilda.messaging.command.switches.InstallMissedFlowsRequest)1