use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class Server42FlowRttOutputVxlanRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
Set<SwitchFeature> features = sw.getFeatures();
if (!features.contains(NOVIFLOW_PUSH_POP_VXLAN) && !features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
return Collections.emptyList();
}
List<Action> actions = new ArrayList<>();
actions.add(buildPopVxlanAction(features));
if (server42Vlan > 0) {
actions.add(new PushVlanAction());
actions.add(SetFieldAction.builder().field(Field.VLAN_VID).value(server42Vlan).build());
}
actions.add(SetFieldAction.builder().field(Field.ETH_SRC).value(sw.getSwitchId().toLong()).build());
actions.add(SetFieldAction.builder().field(Field.ETH_DST).value(server42MacAddress.toLong()).build());
actions.add(SetFieldAction.builder().field(Field.UDP_SRC).value(SERVER_42_FLOW_RTT_REVERSE_UDP_PORT).build());
if (sw.getFeatures().contains(NOVIFLOW_COPY_FIELD)) {
// NOTE: We must call copy field action after all set field actions. All set actions called after copy field
// actions will be ignored. It's Noviflow bug.
actions.add(buildCopyTimestamp());
}
actions.add(new PortOutAction(new PortNumber(server42Port)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_FLOW_RTT_OUTPUT_VXLAN_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_FLOW_RTT_OUTPUT_VXLAN_PRIORITY).match(buildMatch(sw.getSwitchId())).instructions(instructions).build());
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class Server42IslRttOutputRuleGenerator method generateCommands.
@Override
public List<SpeakerData> generateCommands(Switch sw) {
List<Action> actions = new ArrayList<>();
if (server42Vlan > 0) {
actions.add(new PushVlanAction());
actions.add(SetFieldAction.builder().field(Field.VLAN_VID).value(server42Vlan).build());
}
actions.add(SetFieldAction.builder().field(ETH_SRC).value(sw.getSwitchId().toMacAddressAsLong()).build());
actions.add(SetFieldAction.builder().field(ETH_DST).value(server42MacAddress.toLong()).build());
actions.add(new PortOutAction(new PortNumber(server42Port)));
Instructions instructions = Instructions.builder().applyActions(actions).build();
Set<FieldMatch> match = buildMatch(new MacAddress(config.getServer42IslRttMagicMacAddress()));
return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_ISL_RTT_OUTPUT_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_ISL_RTT_OUTPUT_PRIORITY).match(match).instructions(instructions).build());
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class FlowLoopIngressRuleGenerator method makeIngressFlowLoopInstructions.
private Instructions makeIngressFlowLoopInstructions(FlowEndpoint endpoint) {
List<Action> applyActions = new ArrayList<>();
if (multiTable) {
applyActions.addAll(Utils.makeVlanReplaceActions(FlowEndpoint.makeVlanStack(endpoint.getInnerVlanId()), endpoint.getVlanStack()));
}
applyActions.add(new PortOutAction(new PortNumber(SpecialPortType.IN_PORT)));
return Instructions.builder().applyActions(applyActions).build();
}
use of org.openkilda.rulemanager.action.PortOutAction in project open-kilda by telstra.
the class IngressMirrorRuleGenerator method buildFlowBucket.
private Bucket buildFlowBucket(Set<SwitchFeature> features) {
Set<Action> actions = new HashSet<>();
// for one switch flow all vlan manipulations were made by ingress rule, not group.
if (!flowPath.isOneSwitchFlow()) {
switch(encapsulation.getType()) {
case TRANSIT_VLAN:
actions.addAll(makeVlanReplaceActions(new ArrayList<>(), makeVlanStack(encapsulation.getId())));
break;
case VXLAN:
actions.add(buildPushVxlan(encapsulation.getId(), flowPath.getSrcSwitchId(), flowPath.getDestSwitchId(), VXLAN_UDP_SRC, features));
break;
default:
throw new IllegalArgumentException(format("Unknown encapsulation type %s", encapsulation.getType()));
}
}
actions.add(new PortOutAction(getOutPort(flowPath, flow)));
return Bucket.builder().watchGroup(WatchGroup.ANY).watchPort(WatchPort.ANY).writeActions(actions).build();
}
use of org.openkilda.rulemanager.action.PortOutAction 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());
}
Aggregations