use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class ArpTransitFlowGenerator method getArpFlowMod.
@Override
OFFlowMod getArpFlowMod(IOFSwitch sw, OFInstructionMeter meter, List<OFAction> actionList) {
OFFactory ofFactory = sw.getOFFactory();
Match match = ofFactory.buildMatch().setExact(MatchField.ETH_TYPE, EthType.ARP).build();
actionList.add(actionSendToController(sw.getOFFactory()));
OFInstructionApplyActions actions = ofFactory.instructions().applyActions(actionList).createBuilder().build();
return prepareFlowModBuilder(ofFactory, ARP_TRANSIT_COOKIE, ARP_TRANSIT_ISL_PRIORITY, TRANSIT_TABLE_ID).setMatch(match).setInstructions(meter != null ? ImmutableList.of(meter, actions) : ImmutableList.of(actions)).build();
}
use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class LldpPostIngressFlowGenerator method getLldpFlowMod.
@Override
OFFlowMod getLldpFlowMod(IOFSwitch sw, OFInstructionMeter meter, List<OFAction> actionList) {
OFFactory ofFactory = sw.getOFFactory();
RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().lldpFlag(true), sw);
Match match = ofFactory.buildMatch().setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).build();
actionList.add(actionSendToController(sw.getOFFactory()));
OFInstructionApplyActions actions = ofFactory.instructions().applyActions(actionList).createBuilder().build();
return prepareFlowModBuilder(ofFactory, LLDP_POST_INGRESS_COOKIE, LLDP_POST_INGRESS_PRIORITY, POST_INGRESS_TABLE_ID).setMatch(match).setInstructions(meter != null ? ImmutableList.of(meter, actions) : ImmutableList.of(actions)).build();
}
use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class LldpPostIngressVxlanFlowGenerator method getLldpFlowMod.
@Override
OFFlowMod getLldpFlowMod(IOFSwitch sw, OFInstructionMeter meter, List<OFAction> actionList) {
OFFactory ofFactory = sw.getOFFactory();
Set<SwitchFeature> features = featureDetectorService.detectSwitch(sw);
if (!features.contains(NOVIFLOW_PUSH_POP_VXLAN) && !features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
return null;
}
RoutingMetadata metadata = buildMetadata(RoutingMetadata.builder().lldpFlag(true), sw);
Match.Builder matchBuilder = ofFactory.buildMatch().setMasked(MatchField.METADATA, OFMetadata.of(metadata.getValue()), OFMetadata.of(metadata.getMask())).setExact(MatchField.IP_PROTO, IpProtocol.UDP).setExact(MatchField.UDP_SRC, TransportPort.of(STUB_VXLAN_UDP_SRC)).setExact(MatchField.UDP_DST, TransportPort.of(VXLAN_UDP_DST));
if (features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
matchBuilder.setExact(MatchField.ETH_TYPE, EthType.IPv4);
}
Match match = matchBuilder.build();
if (features.contains(NOVIFLOW_PUSH_POP_VXLAN)) {
actionList.add(ofFactory.actions().noviflowPopVxlanTunnel());
} else {
actionList.add(ofFactory.actions().kildaPopVxlanField());
}
actionList.add(actionSendToController(sw.getOFFactory()));
OFInstructionApplyActions actions = ofFactory.instructions().applyActions(actionList).createBuilder().build();
return prepareFlowModBuilder(ofFactory, LLDP_POST_INGRESS_VXLAN_COOKIE, LLDP_POST_INGRESS_VXLAN_PRIORITY, POST_INGRESS_TABLE_ID).setMatch(match).setInstructions(meter != null ? ImmutableList.of(meter, actions) : ImmutableList.of(actions)).build();
}
use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class Server42FlowRttInputFlowGenerator method generateFlowMod.
/**
* Generated OFFlowMod for Server 42 Flow RTT input rule.
*/
public static Optional<OFFlowMod> generateFlowMod(OFFactory ofFactory, Set<SwitchFeature> features, int udpOffset, int customerPort, int server42Port, MacAddress server42macAddress) {
Match match = buildMatch(ofFactory, server42Port, customerPort + udpOffset, server42macAddress);
List<OFAction> actions = Lists.newArrayList(actionSetUdpSrcAction(ofFactory, TransportPort.of(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT)), actionSetUdpDstAction(ofFactory, TransportPort.of(SERVER_42_FLOW_RTT_FORWARD_UDP_PORT)));
if (features.contains(NOVIFLOW_COPY_FIELD)) {
actions.add(buildServer42CopyFirstTimestamp(ofFactory));
}
List<OFInstruction> instructions = ImmutableList.of(buildInstructionApplyActions(ofFactory, actions), instructionWriteMetadata(ofFactory, customerPort, features), instructionGoToTable(ofFactory, TableId.of(PRE_INGRESS_TABLE_ID)));
return Optional.of(prepareFlowModBuilder(ofFactory, encodeServer42FlowRttInput(customerPort), SERVER_42_FLOW_RTT_INPUT_PRIORITY, INPUT_TABLE_ID).setMatch(match).setInstructions(instructions).build());
}
use of org.projectfloodlight.openflow.protocol.match.Match in project open-kilda by telstra.
the class BfdCatchFlowGenerator method generateFlow.
@Override
public SwitchFlowTuple generateFlow(IOFSwitch sw) {
Set<SwitchFeature> features = featureDetectorService.detectSwitch(sw);
if (!features.contains(SwitchFeature.BFD)) {
return SwitchFlowTuple.getEmpty();
}
OFFactory ofFactory = sw.getOFFactory();
Match match = catchRuleMatch(sw.getId(), ofFactory);
OFFlowMod flowMod = prepareFlowModBuilder(ofFactory, CATCH_BFD_RULE_COOKIE, CATCH_BFD_RULE_PRIORITY, INPUT_TABLE_ID).setMatch(match).setActions(ImmutableList.of(ofFactory.actions().buildOutput().setPort(OFPort.LOCAL).build())).build();
return SwitchFlowTuple.builder().sw(sw).flow(flowMod).build();
}
Aggregations