Search in sources :

Example 81 with Instructions

use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.

the class MultiTableIngressRuleGenerator method buildInstructions.

private Instructions buildInstructions(Switch sw, List<Action> actions) {
    Instructions instructions = Instructions.builder().applyActions(actions).goToTable(OfTable.POST_INGRESS).build();
    addMeterToInstructions(flowPath.getMeterId(), sw, instructions);
    if (flowPath.isOneSwitchFlow()) {
        RoutingMetadata metadata = RoutingMetadata.builder().oneSwitchFlowFlag(true).build(sw.getFeatures());
        instructions.setWriteMetadata(new OfMetadata(metadata.getValue(), metadata.getMask()));
    }
    return instructions;
}
Also used : OfMetadata(org.openkilda.rulemanager.OfMetadata) Instructions(org.openkilda.rulemanager.Instructions) RoutingMetadata(org.openkilda.rulemanager.utils.RoutingMetadata)

Example 82 with Instructions

use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.

the class BfdCatchRuleGenerator method generateCommands.

@Override
public List<SpeakerData> generateCommands(Switch sw) {
    if (!sw.getFeatures().contains(SwitchFeature.BFD)) {
        return Collections.emptyList();
    }
    Set<FieldMatch> match = catchRuleMatch(sw);
    Instructions instructions = Instructions.builder().applyActions(Collections.singletonList(new PortOutAction(new PortNumber(SpecialPortType.LOCAL)))).build();
    return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(CATCH_BFD_RULE_COOKIE)).table(OfTable.INPUT).priority(CATCH_BFD_RULE_PRIORITY).match(match).instructions(instructions).build());
}
Also used : Cookie(org.openkilda.model.cookie.Cookie) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Instructions(org.openkilda.rulemanager.Instructions) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber)

Example 83 with Instructions

use of org.openkilda.rulemanager.Instructions 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 84 with Instructions

use of org.openkilda.rulemanager.Instructions in project open-kilda by telstra.

the class LldpInputPreDropRuleGenerator method generateCommands.

@Override
public List<SpeakerData> generateCommands(Switch sw) {
    Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.LLDP).build());
    Instructions instructions = buildSendToControllerInstructions();
    Cookie cookie = new Cookie(LLDP_INPUT_PRE_DROP_COOKIE);
    return buildCommands(sw, cookie, OfTable.INPUT, Priority.LLDP_INPUT_PRE_DROP_PRIORITY, match, instructions);
}
Also used : Cookie(org.openkilda.model.cookie.Cookie) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Instructions(org.openkilda.rulemanager.Instructions)

Aggregations

Instructions (org.openkilda.rulemanager.Instructions)84 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)55 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)40 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)35 Action (org.openkilda.rulemanager.action.Action)34 Cookie (org.openkilda.model.cookie.Cookie)31 SpeakerData (org.openkilda.rulemanager.SpeakerData)29 Test (org.junit.Test)26 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)25 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)24 ArrayList (java.util.ArrayList)14 PortColourCookie (org.openkilda.model.cookie.PortColourCookie)14 RoutingMetadata (org.openkilda.rulemanager.utils.RoutingMetadata)13 Switch (org.openkilda.model.Switch)12 Utils.buildSwitch (org.openkilda.rulemanager.Utils.buildSwitch)12 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)11 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)10 MeterAction (org.openkilda.rulemanager.action.MeterAction)9 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)9 OfMetadata (org.openkilda.rulemanager.OfMetadata)8