use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class SwitchManager method installMultitableEndpointIslRules.
@Override
public List<Long> installMultitableEndpointIslRules(DatapathId dpid, int port) throws SwitchOperationException {
IOFSwitch sw = lookupSwitch(dpid);
List<Long> installedRules = new ArrayList<>();
Set<SwitchFeature> features = featureDetectorService.detectSwitch(sw);
if (features.contains(NOVIFLOW_PUSH_POP_VXLAN) || features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
installedRules.add(installEgressIslVxlanRule(dpid, port));
installedRules.add(installTransitIslVxlanRule(dpid, port));
} else {
logger.info("Skip installation of isl multitable vxlan rule for switch {} {}", dpid, port);
}
installedRules.add(installEgressIslVlanRule(dpid, port));
return installedRules;
}
use of org.openkilda.model.SwitchFeature 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();
}
use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class UnicastVerificationVxlanRuleGenerator method generateFlow.
@Override
public SwitchFlowTuple generateFlow(IOFSwitch sw) {
// should be replaced with fair feature detection based on ActionId's during handshake
Set<SwitchFeature> features = featureDetectorService.detectSwitch(sw);
if (!features.contains(NOVIFLOW_PUSH_POP_VXLAN) && !features.contains(KILDA_OVS_PUSH_POP_MATCH_VXLAN)) {
return SwitchFlowTuple.getEmpty();
}
ArrayList<OFAction> actionList = new ArrayList<>();
long cookie = VERIFICATION_UNICAST_VXLAN_RULE_COOKIE;
long meterId = createMeterIdForDefaultRule(cookie).getValue();
long meterRate = config.getUnicastRateLimit();
OFMeterMod meter = generateAddMeterForDefaultRule(sw, meterId, meterRate, config.getSystemMeterBurstSizeInPackets(), config.getDiscoPacketSize());
OFInstructionMeter ofInstructionMeter = buildMeterInstruction(meterId, sw, actionList);
OFFlowMod flowMod = buildUnicastVerificationRuleVxlan(sw, features, cookie, ofInstructionMeter, actionList);
return SwitchFlowTuple.builder().sw(sw).flow(flowMod).meter(meter).build();
}
use of org.openkilda.model.SwitchFeature 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.openkilda.model.SwitchFeature in project open-kilda by telstra.
the class Server42FlowRttTurningFlowGenerator method generateFlow.
@Override
public SwitchFlowTuple generateFlow(IOFSwitch sw) {
Set<SwitchFeature> switchFeatures = featureDetectorService.detectSwitch(sw);
if (!switchFeatures.contains(NOVIFLOW_SWAP_ETH_SRC_ETH_DST) && !switchFeatures.contains(KILDA_OVS_SWAP_FIELD)) {
return SwitchFlowTuple.getEmpty();
}
OFFactory ofFactory = sw.getOFFactory();
Match match = buildMatch(sw.getId(), ofFactory);
List<OFAction> actions = ImmutableList.of(actionSetUdpSrcAction(ofFactory, TransportPort.of(SERVER_42_FLOW_RTT_REVERSE_UDP_PORT)), buildSwapAction(switchFeatures, ofFactory), actionSetOutputPort(ofFactory, OFPort.IN_PORT));
OFFlowMod flowMod = prepareFlowModBuilder(ofFactory, SERVER_42_FLOW_RTT_TURNING_COOKIE, SERVER_42_FLOW_RTT_TURNING_PRIORITY, INPUT_TABLE_ID).setMatch(match).setInstructions(ImmutableList.of(buildInstructionApplyActions(ofFactory, actions))).build();
return SwitchFlowTuple.builder().sw(sw).flow(flowMod).build();
}
Aggregations