Search in sources :

Example 16 with SwitchFeature

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

the class EgressIslVxlanRuleGenerator 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 = buildEgressIslVxlanRuleMatch(sw.getSwitchId());
    Instructions instructions = Instructions.builder().goToTable(OfTable.EGRESS).build();
    return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new PortColourCookie(CookieType.MULTI_TABLE_ISL_VXLAN_EGRESS_RULES, islPort)).table(OfTable.INPUT).priority(ISL_EGRESS_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 17 with SwitchFeature

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

the class Server42FlowRttTurningRuleGenerator 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());
    Instructions instructions = buildInstructions(sw, SERVER_42_FLOW_RTT_REVERSE_UDP_PORT);
    return Collections.singletonList(FlowSpeakerData.builder().switchId(sw.getSwitchId()).ofVersion(OfVersion.of(sw.getOfVersion())).cookie(new Cookie(SERVER_42_FLOW_RTT_TURNING_COOKIE)).table(OfTable.INPUT).priority(SERVER_42_FLOW_RTT_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)

Example 18 with SwitchFeature

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

the class SwitchManager method getExpectedIslFlowsForPort.

@Override
public List<OFFlowMod> getExpectedIslFlowsForPort(DatapathId dpid, int port) throws SwitchOperationException {
    List<OFFlowMod> flows = new ArrayList<>();
    IOFSwitch sw = lookupSwitch(dpid);
    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)) {
        flows.add(buildEgressIslVxlanRule(ofFactory, dpid, port));
        flows.add(buildTransitIslVxlanRule(ofFactory, port));
    }
    flows.add(buildEgressIslVlanRule(ofFactory, port));
    return flows;
}
Also used : IOFSwitch(net.floodlightcontroller.core.IOFSwitch) OFFactory(org.projectfloodlight.openflow.protocol.OFFactory) ArrayList(java.util.ArrayList) SwitchFeature(org.openkilda.model.SwitchFeature) OFFlowMod(org.projectfloodlight.openflow.protocol.OFFlowMod)

Example 19 with SwitchFeature

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

the class NetworkIntegrationTest method switchAdd.

@Test
@Ignore
public void switchAdd() {
    Set<SwitchFeature> features = new HashSet<>();
    features.add(SwitchFeature.BFD);
    Integer bfdLocalPortOffset = options.getBfdLogicalPortOffset();
    List<SpeakerSwitchPortView> ports = ImmutableList.of(new SpeakerSwitchPortView(1, SpeakerSwitchPortView.State.UP), new SpeakerSwitchPortView(1 + bfdLocalPortOffset, SpeakerSwitchPortView.State.UP), new SpeakerSwitchPortView(2, SpeakerSwitchPortView.State.DOWN), new SpeakerSwitchPortView(2 + bfdLocalPortOffset, SpeakerSwitchPortView.State.DOWN));
    SpeakerSwitchView speakerSwitchView = new SpeakerSwitchView(alphaDatapath, new IpSocketAddress(alphaInetAddress.getHostString(), alphaInetAddress.getPort()), new IpSocketAddress(speakerInetAddress.getHostString(), speakerInetAddress.getPort()), alphaInetAddress.getHostString(), "OF_13", switchDescription, features, ports);
    NetworkSwitchService switchService = integrationCarrier.getSwitchService();
    SwitchInfoData switchAddEvent = new SwitchInfoData(alphaDatapath, SwitchChangeType.ADDED, alphaInetAddress.toString(), alphaDescription, speakerInetAddress.toString(), false, speakerSwitchView);
    switchService.switchEvent(switchAddEvent);
    SwitchInfoData switchActivateEvent = new SwitchInfoData(alphaDatapath, SwitchChangeType.ACTIVATED, alphaInetAddress.toString(), alphaDescription, speakerInetAddress.toString(), false, speakerSwitchView);
    switchService.switchEvent(switchActivateEvent);
}
Also used : SpeakerSwitchPortView(org.openkilda.messaging.model.SpeakerSwitchPortView) SpeakerSwitchView(org.openkilda.messaging.model.SpeakerSwitchView) SwitchInfoData(org.openkilda.messaging.info.event.SwitchInfoData) SwitchFeature(org.openkilda.model.SwitchFeature) IpSocketAddress(org.openkilda.model.IpSocketAddress) HashSet(java.util.HashSet) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 20 with SwitchFeature

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

the class LagPortOperationService method createTransaction.

private LagLogicalPort createTransaction(SwitchId switchId, Set<Integer> targetPorts) {
    // locate switch first to produce correct error if switch is missing
    Switch sw = querySwitch(switchId);
    if (!isSwitchLagCapable(sw)) {
        throw new InvalidDataException(format("Switch %s doesn't support LAG.", sw.getSwitchId()));
    }
    Set<SwitchFeature> features = sw.getFeatures();
    for (Integer portNumber : targetPorts) {
        validatePhysicalPort(switchId, features, portNumber);
    }
    ensureNoLagCollisions(switchId, targetPorts);
    LagLogicalPort port = queryPoolManager(switchId).allocate();
    port.setPhysicalPorts(targetPorts.stream().map(portNumber -> new PhysicalPort(switchId, portNumber, port)).collect(Collectors.toList()));
    log.info("Adding new LAG logical port entry into DB: {}", port);
    lagLogicalPortRepository.add(port);
    return port;
}
Also used : Switch(org.openkilda.model.Switch) LagLogicalPort(org.openkilda.model.LagLogicalPort) InvalidDataException(org.openkilda.wfm.topology.switchmanager.error.InvalidDataException) PhysicalPort(org.openkilda.model.PhysicalPort) 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