Search in sources :

Example 11 with SwitchFeature

use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.

the class TransitIslVxlanRuleGenerator 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();
    }
    Set<FieldMatch> match = buildTransitIslVxlanRuleMatch();
    Instructions instructions = Instructions.builder().goToTable(OfTable.TRANSIT).build();
    return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_TRANSIT_RULES, islPort)).table(OfTable.INPUT).priority(ISL_TRANSIT_VXLAN_RULE_PRIORITY_MULTITABLE).match(match).instructions(instructions).build());
}
Also used : FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Instructions(org.openkilda.rulemanager.Instructions) SwitchFeature(org.openkilda.model.SwitchFeature) PortColourCookie(org.openkilda.model.cookie.PortColourCookie)

Example 12 with SwitchFeature

use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.

the class PktpsFlagFeature method discover.

@Override
public Optional<SwitchFeature> discover(IOFSwitch sw) {
    Optional<SwitchFeature> empty = Optional.empty();
    SwitchDescription description = sw.getSwitchDescription();
    if (description.getHardwareDescription() == null) {
        return empty;
    }
    if (containsIgnoreCase(description.getManufacturerDescription(), CENTEC_MANUFACTURED)) {
        return empty;
    }
    if (E_SWITCH_MANUFACTURER_DESCRIPTION.equalsIgnoreCase(description.getManufacturerDescription()) || E_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher(description.getHardwareDescription()).matches() || NOVIFLOW_VIRTUAL_SWITCH_HARDWARE_DESCRIPTION_REGEX.matcher(description.getHardwareDescription()).matches()) {
        // burst size). That is why we will assume that E switches don't support PKTPS flag.
        return empty;
    }
    return Optional.of(SwitchFeature.PKTPS_FLAG);
}
Also used : SwitchDescription(net.floodlightcontroller.core.SwitchDescription) SwitchFeature(org.openkilda.model.SwitchFeature)

Example 13 with SwitchFeature

use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.

the class BfdFeature method discover.

@Override
public Optional<SwitchFeature> discover(IOFSwitch sw) {
    Optional<SwitchFeature> empty = Optional.empty();
    SwitchDescription description = sw.getSwitchDescription();
    if (description == null || description.getSoftwareDescription() == null) {
        return empty;
    }
    if (!NOVIFLOW_SOFTWARE_DESCRIPTION_REGEX.matcher(description.getSoftwareDescription()).matches()) {
        return empty;
    }
    return Optional.of(SwitchFeature.BFD);
}
Also used : SwitchDescription(net.floodlightcontroller.core.SwitchDescription) SwitchFeature(org.openkilda.model.SwitchFeature)

Example 14 with SwitchFeature

use of org.openkilda.model.SwitchFeature 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());
}
Also used : Cookie(org.openkilda.model.cookie.Cookie) Action(org.openkilda.rulemanager.action.Action) PopVxlanAction(org.openkilda.rulemanager.action.PopVxlanAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) CopyFieldAction(org.openkilda.rulemanager.action.noviflow.CopyFieldAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) SetFieldAction(org.openkilda.rulemanager.action.SetFieldAction) PortOutAction(org.openkilda.rulemanager.action.PortOutAction) PushVlanAction(org.openkilda.rulemanager.action.PushVlanAction) ArrayList(java.util.ArrayList) Instructions(org.openkilda.rulemanager.Instructions) PortNumber(org.openkilda.rulemanager.ProtoConstants.PortNumber) SwitchFeature(org.openkilda.model.SwitchFeature)

Example 15 with SwitchFeature

use of org.openkilda.model.SwitchFeature in project open-kilda by telstra.

the class Server42FlowRttVxlanTurningRuleGenerator method generateCommands.

@Override
public List<SpeakerData> generateCommands(Switch sw) {
    Set<SwitchFeature> features = sw.getFeatures();
    if (!features.contains(NOVIFLOW_SWAP_ETH_SRC_ETH_DST) && !features.contains(KILDA_OVS_SWAP_FIELD)) {
        return Collections.emptyList();
    }
    Set<FieldMatch> match = buildMatch(sw.getSwitchId());
    match.add(FieldMatch.builder().field(Field.UDP_DST).value(VXLAN_UDP_DST).build());
    Instructions instructions = buildInstructions(sw, SERVER_42_FLOW_RTT_REVERSE_UDP_VXLAN_PORT);
    return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_FLOW_RTT_VXLAN_TURNING_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_FLOW_RTT_VXLAN_TURNING_PRIORITY).match(match).instructions(instructions).build());
}
Also used : Cookie(org.openkilda.model.cookie.Cookie) FieldMatch(org.openkilda.rulemanager.match.FieldMatch) Instructions(org.openkilda.rulemanager.Instructions) SwitchFeature(org.openkilda.model.SwitchFeature)

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