Search in sources :

Example 16 with Action

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

the class SingleTableServer42IngressRuleGenerator method buildIngressInstructions.

private Instructions buildIngressInstructions(Switch sw, int outerVlan) {
    List<Action> applyActions = new ArrayList<>(buildTransformActions(outerVlan, sw.getFeatures()));
    applyActions.add(new PortOutAction(getOutPort(flowPath, flow)));
    return Instructions.builder().applyActions(applyActions).build();
}
Also used : Action(org.openkilda.rulemanager.action.Action) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) ArrayList(java.util.ArrayList)

Example 17 with Action

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

the class EgressRuleGenerator method buildApplyActions.

private List<Action> buildApplyActions(FlowEndpoint egressEndpoint, Switch sw) {
    List<Action> result = buildTransformActions(egressEndpoint, sw);
    result.add(new PortOutAction(new PortNumber(egressEndpoint.getPortNumber())));
    return result;
}
Also used : Action(org.openkilda.rulemanager.action.Action) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber)

Example 18 with Action

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

the class MultiTableServer42IngressRuleGenerator method buildServer42InputCommand.

private FlowSpeakerData buildServer42InputCommand(Switch sw, int inPort) {
    int udpSrcPort = inPort + config.getServer42FlowRttUdpPortOffset();
    Set<FieldMatch> match = Sets.newHashSet(FieldMatch.builder().field(Field.IN_PORT).value(switchProperties.getServer42Port()).build(), FieldMatch.builder().field(Field.ETH_SRC).value(switchProperties.getServer42MacAddress().toLong()).build(), FieldMatch.builder().field(Field.ETH_TYPE).value(EthType.IPv4).build(), FieldMatch.builder().field(Field.IP_PROTO).value(IpProto.UDP).build(), FieldMatch.builder().field(Field.UDP_SRC).value(udpSrcPort).build());
    PortColourCookie cookie = new PortColourCookie(CookieType.SERVER_42_FLOW_RTT_INPUT, inPort);
    List<Action> applyActions = Lists.newArrayList(SetFieldAction.builder().field(Field.UDP_SRC).value(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT).build(), SetFieldAction.builder().field(Field.UDP_DST).value(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT).build());
    if (sw.getFeatures().contains(NOVIFLOW_COPY_FIELD)) {
        applyActions.add(buildServer42CopyFirstTimestamp());
    }
    Instructions instructions = Instructions.builder().applyActions(applyActions).goToTable(OfTable.PRE_INGRESS).writeMetadata(mapMetadata(RoutingMetadata.builder().inputPort(inPort).build(sw.getFeatures()))).build();
    return FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(cookie).table(OfTable.INPUT).priority(Priority.SERVER_42_FLOW_RTT_INPUT_PRIORITY).match(match).instructions(instructions).build();
}
Also used : SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Instructions(org.openkilda.rulemanager.Instructions) FlowEndpoint(org.openkilda.model.FlowEndpoint) PortColourCookie(org.openkilda.model.cookie.PortColourCookie)

Example 19 with Action

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

the class MultiTableServer42IngressRuleGenerator method buildIngressInstructions.

private Instructions buildIngressInstructions(Switch sw, int innerVlan) {
    List<Action> applyActions = new ArrayList<>(buildTransformActions(innerVlan, sw.getFeatures()));
    applyActions.add(new PortOutAction(getOutPort(flowPath, flow)));
    return Instructions.builder().applyActions(applyActions).build();
}
Also used : SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) Action(org.openkilda.rulemanager.action.Action) PopVlanAction(org.openkilda.rulemanager.action.PopVlanAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) ArrayList(java.util.ArrayList)

Example 20 with Action

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

the class SingleTableIngressYRuleGenerator method buildFlowIngressCommand.

private FlowSpeakerData buildFlowIngressCommand(Switch sw, FlowEndpoint ingressEndpoint) {
    List<Action> actions = new ArrayList<>();
    Instructions instructions = Instructions.builder().applyActions(actions).build();
    actions.addAll(buildTransformActions(ingressEndpoint.getOuterVlanId(), sw.getFeatures()));
    actions.add(new PortOutAction(getOutPort(flowPath, flow)));
    addMeterToInstructions(sharedMeterId, sw, instructions);
    FlowSpeakerDataBuilder<?, ?> builder = FlowSpeakerData.builder().switchId(ingressEndpoint.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(flowPath.getCookie().toBuilder().yFlow(true).build()).table(OfTable.INPUT).priority(isFullPortEndpoint(ingressEndpoint) ? Constants.Priority.Y_DEFAULT_FLOW_PRIORITY : Constants.Priority.Y_FLOW_PRIORITY).match(buildMatch(ingressEndpoint, sw.getFeatures())).instructions(instructions);
    if (sw.getFeatures().contains(SwitchFeature.RESET_COUNTS_FLAG)) {
        builder.flags(Sets.newHashSet(OfFlowFlag.RESET_COUNTERS));
    }
    return builder.build();
}
Also used : Action(org.openkilda.rulemanager.action.Action) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) ArrayList(java.util.ArrayList) Instructions(org.openkilda.rulemanager.Instructions)

Aggregations

Action (org.openkilda.rulemanager.action.Action)196 PortOutAction (org.openkilda.rulemanager.action.PortOutAction)195 SetFieldAction (org.openkilda.rulemanager.action.SetFieldAction)168 Test (org.junit.Test)151 PushVlanAction (org.openkilda.rulemanager.action.PushVlanAction)149 PopVlanAction (org.openkilda.rulemanager.action.PopVlanAction)146 Flow (org.openkilda.model.Flow)136 PushVxlanAction (org.openkilda.rulemanager.action.PushVxlanAction)117 FlowSpeakerData (org.openkilda.rulemanager.FlowSpeakerData)67 SpeakerData (org.openkilda.rulemanager.SpeakerData)67 PortNumber (org.openkilda.rulemanager.ProtoConstants.PortNumber)59 GroupAction (org.openkilda.rulemanager.action.GroupAction)55 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)47 PopVxlanAction (org.openkilda.rulemanager.action.PopVxlanAction)46 Instructions (org.openkilda.rulemanager.Instructions)34 ArrayList (java.util.ArrayList)29 FlowPath (org.openkilda.model.FlowPath)27 GroupSpeakerData (org.openkilda.rulemanager.GroupSpeakerData)23 MeterSpeakerData (org.openkilda.rulemanager.MeterSpeakerData)21 CopyFieldAction (org.openkilda.rulemanager.action.noviflow.CopyFieldAction)20