Search in sources :

Example 26 with PortColourCookie

use of org.openkilda.model.cookie.PortColourCookie in project open-kilda by telstra.

the class EgressIslVlanRuleGenerator method generateCommands.

@Override
public List<SpeakerData> generateCommands(Switch sw) {
    Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(islPort).build());
    Instructions instructions = Instructions.builder().goToTable(OfTable.EGRESS).build();
    return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.MULTI_TABLE_ISL_VLAN_EGRESS_RULES, islPort)).table(OfTable.INPUT).priority(ISL_EGRESS_VLAN_RULE_PRIORITY_MULTITABLE).match(match).instructions(instructions).build());
}
Also used : FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Instructions(org.openkilda.rulemanager.Instructions) PortColourCookie(org.openkilda.model.cookie.PortColourCookie)

Example 27 with PortColourCookie

use of org.openkilda.model.cookie.PortColourCookie 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

PortColourCookie (org.openkilda.model.cookie.PortColourCookie)27 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)15 Test (org.junit.Test)14 Instructions (org.openkilda.rulemanager.Instructions)14 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)10 SpeakerData (org.openkilda.rulemanager.SpeakerData)10 Switch (org.openkilda.model.Switch)6 Utils.buildSwitch (org.openkilda.rulemanager.Utils.buildSwitch)6 RoutingMetadata (org.openkilda.rulemanager.utils.RoutingMetadata)6 FlowEndpoint (org.openkilda.model.FlowEndpoint)5 FlowSharedSegmentCookie (org.openkilda.model.cookie.FlowSharedSegmentCookie)5 Action (org.openkilda.rulemanager.action.Action)5 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)5 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)5 ISwitchManager (org.openkilda.floodlight.switchmanager.ISwitchManager)4 CommandMessage (org.openkilda.messaging.command.CommandMessage)4 Cookie (org.openkilda.model.cookie.Cookie)4 OfMetadata (org.openkilda.rulemanager.OfMetadata)4 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)4 DatapathId (org.projectfloodlight.openflow.types.DatapathId)4