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();
}
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;
}
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();
}
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();
}
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();
}
Aggregations