Search in sources :

Example 6 with SwitchFeature

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;
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) ArrayList(java.util.ArrayList) SwitchFeature(org.openkilda.model.SwitchFeature)

Example 7 with SwitchFeature

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();
}
Also used : OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) SwitchFeature(org.openkilda.model.SwitchFeature) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Match(org.projectfloodlight.openflow.protocol.match.Match)

Example 8 with SwitchFeature

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();
}
Also used : OFInstructionMeter(org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter) OFMeterMod(org.projectfloodlight.openflow.protocol.OFMeterMod) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) ArrayList(java.util.ArrayList) SwitchFeature(org.openkilda.model.SwitchFeature) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Example 9 with SwitchFeature

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();
}
Also used : OFInstructionApplyActions(org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) RoutingMetadata(org.openkilda.floodlight.utils.metadata.RoutingMetadata) SwitchFeature(org.openkilda.model.SwitchFeature) Match(org.projectfloodlight.openflow.protocol.match.Match)

Example 10 with SwitchFeature

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();
}
Also used : OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) OFAction(org.projectfloodlight.openflow.protocol.action.OFAction) SwitchFeature(org.openkilda.model.SwitchFeature) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod) Match(org.projectfloodlight.openflow.protocol.match.Match)

Aggregations

SwitchFeature (org.openkilda.model.SwitchFeature)23 ArrayList (java.util.ArrayList)7 OFFactory (org.projectfloodlight.openflow.protocol.OFFactory)7 OFFlowMod (org.projectfloodlight.openflow.protocol.OFFlowMod)6 Match (org.projectfloodlight.openflow.protocol.match.Match)5 Instructions (org.openkilda.rulemanager.Instructions)4 OFAction (org.projectfloodlight.openflow.protocol.action.OFAction)4 IOFSwitch (net.floodlightcontroller.core.IOFSwitch)3 SwitchDescription (net.floodlightcontroller.core.SwitchDescription)3 Cookie (org.openkilda.model.cookie.Cookie)3 FieldMatch (org.openkilda.rulemanager.match.FieldMatch)3 HashSet (java.util.HashSet)2 RoutingMetadata (org.openkilda.floodlight.utils.metadata.RoutingMetadata)2 IpSocketAddress (org.openkilda.model.IpSocketAddress)2 LagLogicalPort (org.openkilda.model.LagLogicalPort)2 PhysicalPort (org.openkilda.model.PhysicalPort)2 Switch (org.openkilda.model.Switch)2 PortColourCookie (org.openkilda.model.cookie.PortColourCookie)2 Sets (com.google.common.collect.Sets)1 SetView (com.google.common.collect.Sets.SetView)1