Search in sources :

Example 41 with VlanIdCriterion

use of org.onosproject.net.flow.criteria.VlanIdCriterion in project onos by opennetworkinglab.

the class ForwardingObjectiveTranslator method bridgingRule.

private void bridgingRule(ForwardingObjective obj, Set<Criterion> criteriaWithMeta, ObjectiveTranslation.Builder resultBuilder, boolean broadcast) throws FabricPipelinerException {
    final VlanIdCriterion vlanIdCriterion = (VlanIdCriterion) criterionNotNull(criteriaWithMeta, Criterion.Type.VLAN_VID);
    final TrafficSelector.Builder selector = DefaultTrafficSelector.builder().add(vlanIdCriterion);
    if (!broadcast) {
        final EthCriterion ethDstCriterion = (EthCriterion) criterionNotNull(obj.selector(), Criterion.Type.ETH_DST);
        selector.matchEthDstMasked(ethDstCriterion.mac(), MacAddress.EXACT_MASK);
    }
    resultBuilder.addFlowRule(flowRule(obj, FabricConstants.FABRIC_INGRESS_FORWARDING_BRIDGING, selector.build()));
}
Also used : EthCriterion(org.onosproject.net.flow.criteria.EthCriterion) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion)

Example 42 with VlanIdCriterion

use of org.onosproject.net.flow.criteria.VlanIdCriterion in project onos by opennetworkinglab.

the class NextObjectiveTranslator method nextVlan.

private void nextVlan(NextObjective obj, ObjectiveTranslation.Builder resultBuilder) throws FabricPipelinerException {
    // We expect NextObjective treatments to contain one or two VLAN instructions.
    // If two, this treatment should be mapped to an action for double-vlan push.
    // In fabric.p4, mapping next IDs to VLAN IDs is done by a direct table (next_vlan),
    // for this reason, we also make sure that all treatments in the NextObjective
    // have exactly the same VLAN instructions, as they will be mapped to a single action
    // Try to extract VLAN instructions in the treatment,
    // later we check if we support multiple VLAN termination.
    final List<List<ModVlanIdInstruction>> vlanInstructions = defaultNextTreatments(obj.nextTreatments(), false).stream().map(defaultNextTreatment -> l2Instructions(defaultNextTreatment.treatment(), VLAN_ID).stream().map(v -> (ModVlanIdInstruction) v).collect(Collectors.toList())).filter(l -> !l.isEmpty()).collect(Collectors.toList());
    final VlanIdCriterion vlanIdCriterion = obj.meta() == null ? null : (VlanIdCriterion) criterion(obj.meta().criteria(), Criterion.Type.VLAN_VID);
    final List<VlanId> vlanIdList;
    if (vlanInstructions.isEmpty() && vlanIdCriterion == null) {
        // No VLAN_ID to apply.
        return;
    }
    if (!vlanInstructions.isEmpty()) {
        // Give priority to what found in the instructions.
        // Expect the same VLAN ID (or two VLAN IDs in the same order) for all instructions.
        final Set<List<VlanId>> vlanIds = vlanInstructions.stream().map(l -> l.stream().map(ModVlanIdInstruction::vlanId).collect(Collectors.toList())).collect(Collectors.toSet());
        if (obj.nextTreatments().size() != vlanInstructions.size() || vlanIds.size() != 1) {
            throw new FabricPipelinerException("Inconsistent VLAN_ID instructions, cannot process " + "next_vlan rule. It is required that all " + "treatments have the same VLAN_ID instructions.");
        }
        vlanIdList = vlanIds.iterator().next();
    } else {
        // Use the value in meta.
        // FIXME: there should be no need to generate a next_vlan rule for
        // the value found in meta. Meta describes the fields that were
        // expected to be matched in previous pipeline stages, i.e.
        // existing packet fields. But, for some reason, if we remove this
        // rule, traffic is not forwarded at spines. We might need to look
        // at the way default VLANs are handled in fabric.p4.
        vlanIdList = List.of(vlanIdCriterion.vlanId());
    }
    final TrafficSelector selector = nextIdSelector(obj.id());
    final TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
    vlanIdList.stream().forEach(vlanId -> treatmentBuilder.setVlanId(vlanId));
    final TrafficTreatment treatment = treatmentBuilder.build();
    resultBuilder.addFlowRule(flowRule(obj, FabricConstants.FABRIC_INGRESS_PRE_NEXT_NEXT_VLAN, selector, treatment));
}
Also used : PiTableId(org.onosproject.net.pi.model.PiTableId) PortNumber(org.onosproject.net.PortNumber) PiActionParam(org.onosproject.net.pi.runtime.PiActionParam) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ObjectiveError(org.onosproject.net.flowobjective.ObjectiveError) FabricUtils.l2Instructions(org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils.l2Instructions) PiCriterion(org.onosproject.net.flow.criteria.PiCriterion) NextObjective(org.onosproject.net.flowobjective.NextObjective) FabricUtils.l2Instruction(org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils.l2Instruction) MPLS_LABEL(org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.MPLS_LABEL) Collection(java.util.Collection) Set(java.util.Set) ModVlanIdInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction) PiGroupKey(org.onosproject.net.pi.runtime.PiGroupKey) Collectors(java.util.stream.Collectors) String.format(java.lang.String.format) Objects(java.util.Objects) List(java.util.List) FabricUtils.outputPort(org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils.outputPort) GroupBuckets(org.onosproject.net.group.GroupBuckets) DeviceId(org.onosproject.net.DeviceId) DefaultGroupDescription(org.onosproject.net.group.DefaultGroupDescription) GroupDescription(org.onosproject.net.group.GroupDescription) PiActionProfileGroupId(org.onosproject.net.pi.runtime.PiActionProfileGroupId) VLAN_POP(org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.VLAN_POP) ModMplsLabelInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction) NextTreatment(org.onosproject.net.flowobjective.NextTreatment) DefaultNextTreatment(org.onosproject.net.flowobjective.DefaultNextTreatment) GroupBucket(org.onosproject.net.group.GroupBucket) GroupKey(org.onosproject.net.group.GroupKey) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) VLAN_ID(org.onosproject.net.flow.instructions.L2ModificationInstruction.L2SubType.VLAN_ID) FabricUtils(org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Criterion(org.onosproject.net.flow.criteria.Criterion) FabricCapabilities(org.onosproject.pipelines.fabric.impl.behaviour.FabricCapabilities) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) MplsLabel(org.onlab.packet.MplsLabel) Instruction(org.onosproject.net.flow.instructions.Instruction) FabricUtils.criterion(org.onosproject.pipelines.fabric.impl.behaviour.FabricUtils.criterion) VlanId(org.onlab.packet.VlanId) FabricConstants(org.onosproject.pipelines.fabric.FabricConstants) DefaultGroupBucket(org.onosproject.net.group.DefaultGroupBucket) PiAction(org.onosproject.net.pi.runtime.PiAction) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) Objective(org.onosproject.net.flowobjective.Objective) Collections(java.util.Collections) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) List(java.util.List) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) VlanId(org.onlab.packet.VlanId) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion)

Example 43 with VlanIdCriterion

use of org.onosproject.net.flow.criteria.VlanIdCriterion in project onos by opennetworkinglab.

the class LinkCollectionCompiler method forwardingTreatment.

/**
 * Compares tag type between ingress and egress point and generate
 * treatment for egress point of intent.
 *
 * @param ingress ingress selector for the intent
 * @param egress egress selector for the intent
 * @param ethType the ethertype to use in mpls_pop
 * @return Builder of TrafficTreatment
 */
private TrafficTreatment forwardingTreatment(TrafficSelector ingress, TrafficSelector egress, EthType ethType) {
    if (ingress.equals(egress)) {
        return DefaultTrafficTreatment.emptyTreatment();
    }
    TrafficTreatment.Builder builder = DefaultTrafficTreatment.builder();
    /*
         * "null" means there is no tag for the port
         * Tag criterion will be null if port is normal connection point
         */
    Criterion ingressTagCriterion = getTagCriterion(ingress);
    Criterion egressTagCriterion = getTagCriterion(egress);
    if (ingressTagCriterion.type() != egressTagCriterion.type()) {
        /*
             * Tag type of ingress port and egress port are different.
             * Need to remove tag from ingress, then add new tag for egress.
             * Remove nothing if ingress port use VXLAN or there is no tag
             * on ingress port.
             */
        switch(ingressTagCriterion.type()) {
            case VLAN_VID:
                builder.popVlan();
                break;
            case MPLS_LABEL:
                if (copyTtl) {
                    builder.copyTtlIn();
                }
                builder.popMpls(ethType);
                break;
            default:
                break;
        }
        /*
             * Push new tag for egress port.
             */
        switch(egressTagCriterion.type()) {
            case VLAN_VID:
                builder.pushVlan();
                break;
            case MPLS_LABEL:
                builder.pushMpls();
                if (copyTtl) {
                    builder.copyTtlOut();
                }
                break;
            default:
                break;
        }
    }
    switch(egressTagCriterion.type()) {
        case VLAN_VID:
            VlanIdCriterion vlanIdCriterion = (VlanIdCriterion) egressTagCriterion;
            builder.setVlanId(vlanIdCriterion.vlanId());
            break;
        case MPLS_LABEL:
            MplsCriterion mplsCriterion = (MplsCriterion) egressTagCriterion;
            builder.setMpls(mplsCriterion.label());
            break;
        case TUNNEL_ID:
            TunnelIdCriterion tunnelIdCriterion = (TunnelIdCriterion) egressTagCriterion;
            builder.setTunnelId(tunnelIdCriterion.tunnelId());
            break;
        default:
            break;
    }
    return builder.build();
}
Also used : TunnelIdCriterion(org.onosproject.net.flow.criteria.TunnelIdCriterion) TunnelIdCriterion(org.onosproject.net.flow.criteria.TunnelIdCriterion) MplsCriterion(org.onosproject.net.flow.criteria.MplsCriterion) Criterion(org.onosproject.net.flow.criteria.Criterion) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) MplsCriterion(org.onosproject.net.flow.criteria.MplsCriterion) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion)

Example 44 with VlanIdCriterion

use of org.onosproject.net.flow.criteria.VlanIdCriterion in project onos by opennetworkinglab.

the class LinkCollectionCompiler method orderedEgressPoints.

/**
 * Helper method to order the egress ports according to a
 * specified criteria. The idea is to generate first the actions
 * for the egress ports which are similar to the specified criteria
 * then the others. In this way we can mitigate the problems related
 * to the chain of actions and we can optimize also the number of
 * actions.
 *
 * @param orderCriteria the ordering criteria
 * @param pointsToOrder the egress points to order
 * @return a list of port ordered
 */
private List<FilteredConnectPoint> orderedEgressPoints(TrafficSelector orderCriteria, List<FilteredConnectPoint> pointsToOrder) {
    /*
         * We are interested only to the labels. The idea is to order
         * by the tags.
         *
         */
    Criterion vlanIdCriterion = orderCriteria.getCriterion(VLAN_VID);
    Criterion mplsLabelCriterion = orderCriteria.getCriterion(MPLS_LABEL);
    /*
         * We collect all the untagged points.
         *
         */
    List<FilteredConnectPoint> untaggedEgressPoints = pointsToOrder.stream().filter(pointToOrder -> {
        TrafficSelector selector = pointToOrder.trafficSelector();
        return selector.getCriterion(VLAN_VID) == null && selector.getCriterion(MPLS_LABEL) == null;
    }).collect(Collectors.toList());
    /*
         * We collect all the vlan points.
         */
    List<FilteredConnectPoint> vlanEgressPoints = pointsToOrder.stream().filter(pointToOrder -> {
        TrafficSelector selector = pointToOrder.trafficSelector();
        return selector.getCriterion(VLAN_VID) != null && selector.getCriterion(MPLS_LABEL) == null;
    }).collect(Collectors.toList());
    /*
         * We collect all the mpls points.
         */
    List<FilteredConnectPoint> mplsEgressPoints = pointsToOrder.stream().filter(pointToOrder -> {
        TrafficSelector selector = pointToOrder.trafficSelector();
        return selector.getCriterion(VLAN_VID) == null && selector.getCriterion(MPLS_LABEL) != null;
    }).collect(Collectors.toList());
    /*
         * We create the final list of ports.
         */
    List<FilteredConnectPoint> orderedList = Lists.newArrayList();
    /*
         * The ordering criteria is vlan id. First we add the vlan
         * ports. Then the others.
         */
    if (vlanIdCriterion != null && mplsLabelCriterion == null) {
        orderedList.addAll(vlanEgressPoints);
        orderedList.addAll(untaggedEgressPoints);
        orderedList.addAll(mplsEgressPoints);
        return orderedList;
    }
    /*
         * The ordering criteria is mpls label. First we add the mpls
         * ports. Then the others.
         */
    if (vlanIdCriterion == null && mplsLabelCriterion != null) {
        orderedList.addAll(mplsEgressPoints);
        orderedList.addAll(untaggedEgressPoints);
        orderedList.addAll(vlanEgressPoints);
        return orderedList;
    }
    /*
         * The ordering criteria is untagged. First we add the untagged
         * ports. Then the others.
         */
    if (vlanIdCriterion == null) {
        orderedList.addAll(untaggedEgressPoints);
        orderedList.addAll(vlanEgressPoints);
        orderedList.addAll(mplsEgressPoints);
        return orderedList;
    }
    /*
         * Unhandled scenario.
         */
    orderedList.addAll(vlanEgressPoints);
    orderedList.addAll(mplsEgressPoints);
    orderedList.addAll(untaggedEgressPoints);
    return orderedList;
}
Also used : PortNumber(org.onosproject.net.PortNumber) LoggerFactory(org.slf4j.LoggerFactory) ModIPv6FlowLabelInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPv6FlowLabelInstruction) Link(org.onosproject.net.Link) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) Ethernet(org.onlab.packet.Ethernet) Map(java.util.Map) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) Ip4Address(org.onlab.packet.Ip4Address) L3ModificationInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction) Set(java.util.Set) ModVlanIdInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanIdInstruction) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) EthType(org.onlab.packet.EthType) ModTransportPortInstruction(org.onosproject.net.flow.instructions.L4ModificationInstruction.ModTransportPortInstruction) List(java.util.List) EncapsulationType(org.onosproject.net.EncapsulationType) ModEtherInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModEtherInstruction) ModTunnelIdInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModTunnelIdInstruction) Optional(java.util.Optional) DeviceId(org.onosproject.net.DeviceId) TunnelIdCriterion(org.onosproject.net.flow.criteria.TunnelIdCriterion) IpPrefix(org.onlab.packet.IpPrefix) MplsCriterion(org.onosproject.net.flow.criteria.MplsCriterion) Identifier(org.onlab.util.Identifier) L4ModificationInstruction(org.onosproject.net.flow.instructions.L4ModificationInstruction) LabelAllocator(org.onosproject.net.resource.impl.LabelAllocator) ModMplsLabelInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsLabelInstruction) DomainConstraint(org.onosproject.net.intent.constraint.DomainConstraint) IntentCompilationException(org.onosproject.net.intent.IntentCompilationException) ModIPInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction.ModIPInstruction) ModArpIPInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpIPInstruction) EncapsulationConstraint(org.onosproject.net.intent.constraint.EncapsulationConstraint) ModVlanPcpInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModVlanPcpInstruction) Type(org.onosproject.net.flow.criteria.Criterion.Type) Lists(com.google.common.collect.Lists) TrafficSelector(org.onosproject.net.flow.TrafficSelector) ImmutableList(com.google.common.collect.ImmutableList) DomainService(org.onosproject.net.domain.DomainService) L0ModificationInstruction(org.onosproject.net.flow.instructions.L0ModificationInstruction) DomainPointToPointIntent(org.onosproject.net.domain.DomainPointToPointIntent) Intent(org.onosproject.net.intent.Intent) LOCAL(org.onosproject.net.domain.DomainId.LOCAL) Criteria(org.onosproject.net.flow.criteria.Criteria) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Criterion(org.onosproject.net.flow.criteria.Criterion) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) ModMplsBosInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction.ModMplsBosInstruction) Logger(org.slf4j.Logger) MplsLabel(org.onlab.packet.MplsLabel) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) Instruction(org.onosproject.net.flow.instructions.Instruction) VlanId(org.onlab.packet.VlanId) ModArpEthInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpEthInstruction) LinkCollectionIntent(org.onosproject.net.intent.LinkCollectionIntent) Maps(com.google.common.collect.Maps) SetMultimap(com.google.common.collect.SetMultimap) DomainId(org.onosproject.net.domain.DomainId) L1ModificationInstruction(org.onosproject.net.flow.instructions.L1ModificationInstruction) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) ModArpOpInstruction(org.onosproject.net.flow.instructions.L3ModificationInstruction.ModArpOpInstruction) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint) TunnelIdCriterion(org.onosproject.net.flow.criteria.TunnelIdCriterion) MplsCriterion(org.onosproject.net.flow.criteria.MplsCriterion) Criterion(org.onosproject.net.flow.criteria.Criterion) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) FilteredConnectPoint(org.onosproject.net.FilteredConnectPoint)

Example 45 with VlanIdCriterion

use of org.onosproject.net.flow.criteria.VlanIdCriterion in project onos by opennetworkinglab.

the class PathCompiler method manageVlanEncap.

/**
 * Creates the flow rules for the path intent using VLAN
 * encapsulation.
 *
 * @param creator the flowrules creator
 * @param flows the list of flows to fill
 * @param devices the devices on the path
 * @param intent the PathIntent to compile
 */
private void manageVlanEncap(PathCompilerCreateFlow<T> creator, List<T> flows, List<DeviceId> devices, PathIntent intent) {
    Set<Link> linksSet = Sets.newConcurrentHashSet();
    for (int i = 1; i <= intent.path().links().size() - 2; i++) {
        linksSet.add(intent.path().links().get(i));
    }
    Map<LinkKey, Identifier<?>> vlanIds = labelAllocator.assignLabelToLinks(linksSet, intent.key(), EncapsulationType.VLAN);
    Iterator<Link> links = intent.path().links().iterator();
    Link srcLink = links.next();
    Link link = links.next();
    // Ingress traffic
    VlanId vlanId = (VlanId) vlanIds.get(linkKey(link));
    if (vlanId == null) {
        throw new IntentCompilationException(ERROR_VLAN + link);
    }
    VlanId prevVlanId = vlanId;
    Optional<VlanIdCriterion> vlanCriterion = intent.selector().criteria().stream().filter(criterion -> criterion.type() == Criterion.Type.VLAN_VID).map(criterion -> (VlanIdCriterion) criterion).findAny();
    // Push VLAN if selector does not include VLAN
    TrafficTreatment.Builder treatBuilder = DefaultTrafficTreatment.builder();
    if (!vlanCriterion.isPresent()) {
        treatBuilder.pushVlan();
    }
    // Tag the traffic with the new encapsulation VLAN
    treatBuilder.setVlanId(vlanId);
    creator.createFlow(intent.selector(), treatBuilder.build(), srcLink.dst(), link.src(), intent.priority(), true, flows, devices);
    ConnectPoint prev = link.dst();
    while (links.hasNext()) {
        link = links.next();
        if (links.hasNext()) {
            // Transit traffic
            VlanId egressVlanId = (VlanId) vlanIds.get(linkKey(link));
            if (egressVlanId == null) {
                throw new IntentCompilationException(ERROR_VLAN + link);
            }
            TrafficSelector transitSelector = DefaultTrafficSelector.builder().matchInPort(prev.port()).matchVlanId(prevVlanId).build();
            TrafficTreatment.Builder transitTreat = DefaultTrafficTreatment.builder();
            // Set the new vlanId only if the previous one is different
            if (!prevVlanId.equals(egressVlanId)) {
                transitTreat.setVlanId(egressVlanId);
            }
            creator.createFlow(transitSelector, transitTreat.build(), prev, link.src(), intent.priority(), true, flows, devices);
            /* For the next hop we have to remember
                 * the previous egress VLAN id and the egress
                 * node
                 */
            prevVlanId = egressVlanId;
            prev = link.dst();
        } else {
            // Egress traffic
            TrafficSelector egressSelector = DefaultTrafficSelector.builder().matchInPort(prev.port()).matchVlanId(prevVlanId).build();
            TrafficTreatment.Builder egressTreat = DefaultTrafficTreatment.builder(intent.treatment());
            Optional<L2ModificationInstruction.ModVlanIdInstruction> modVlanIdInstruction = intent.treatment().allInstructions().stream().filter(instruction -> instruction instanceof L2ModificationInstruction.ModVlanIdInstruction).map(x -> (L2ModificationInstruction.ModVlanIdInstruction) x).findAny();
            Optional<L2ModificationInstruction.ModVlanHeaderInstruction> popVlanInstruction = intent.treatment().allInstructions().stream().filter(instruction -> instruction instanceof L2ModificationInstruction.ModVlanHeaderInstruction).map(x -> (L2ModificationInstruction.ModVlanHeaderInstruction) x).findAny();
            if (!modVlanIdInstruction.isPresent() && !popVlanInstruction.isPresent()) {
                if (vlanCriterion.isPresent()) {
                    egressTreat.setVlanId(vlanCriterion.get().vlanId());
                } else {
                    egressTreat.popVlan();
                }
            }
            creator.createFlow(egressSelector, egressTreat.build(), prev, link.src(), intent.priority(), true, flows, devices);
        }
    }
}
Also used : MplsCriterion(org.onosproject.net.flow.criteria.MplsCriterion) Identifier(org.onlab.util.Identifier) LabelAllocator(org.onosproject.net.resource.impl.LabelAllocator) IntentCompilationException(org.onosproject.net.intent.IntentCompilationException) Link(org.onosproject.net.Link) ResourceService(org.onosproject.net.resource.ResourceService) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) EncapsulationConstraint(org.onosproject.net.intent.constraint.EncapsulationConstraint) Ethernet(org.onlab.packet.Ethernet) TrafficSelector(org.onosproject.net.flow.TrafficSelector) Map(java.util.Map) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) LinkKey.linkKey(org.onosproject.net.LinkKey.linkKey) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) Criterion(org.onosproject.net.flow.criteria.Criterion) LinkKey(org.onosproject.net.LinkKey) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) PathIntent(org.onosproject.net.intent.PathIntent) Logger(org.slf4j.Logger) Iterator(java.util.Iterator) MplsLabel(org.onlab.packet.MplsLabel) EthTypeCriterion(org.onosproject.net.flow.criteria.EthTypeCriterion) Instruction(org.onosproject.net.flow.instructions.Instruction) VlanId(org.onlab.packet.VlanId) Set(java.util.Set) Sets(com.google.common.collect.Sets) EthType(org.onlab.packet.EthType) List(java.util.List) EncapsulationType(org.onosproject.net.EncapsulationType) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion) Optional(java.util.Optional) DeviceId(org.onosproject.net.DeviceId) LinkKey(org.onosproject.net.LinkKey) L2ModificationInstruction(org.onosproject.net.flow.instructions.L2ModificationInstruction) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) ConnectPoint(org.onosproject.net.ConnectPoint) ConnectPoint(org.onosproject.net.ConnectPoint) EncapsulationConstraint(org.onosproject.net.intent.constraint.EncapsulationConstraint) Identifier(org.onlab.util.Identifier) TrafficSelector(org.onosproject.net.flow.TrafficSelector) DefaultTrafficSelector(org.onosproject.net.flow.DefaultTrafficSelector) IntentCompilationException(org.onosproject.net.intent.IntentCompilationException) Link(org.onosproject.net.Link) VlanId(org.onlab.packet.VlanId) VlanIdCriterion(org.onosproject.net.flow.criteria.VlanIdCriterion)

Aggregations

VlanIdCriterion (org.onosproject.net.flow.criteria.VlanIdCriterion)65 DefaultTrafficSelector (org.onosproject.net.flow.DefaultTrafficSelector)48 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)45 FlowRule (org.onosproject.net.flow.FlowRule)41 VlanId (org.onlab.packet.VlanId)37 MplsCriterion (org.onosproject.net.flow.criteria.MplsCriterion)35 List (java.util.List)32 DeviceId (org.onosproject.net.DeviceId)30 TrafficSelector (org.onosproject.net.flow.TrafficSelector)30 PortCriterion (org.onosproject.net.flow.criteria.PortCriterion)30 EthCriterion (org.onosproject.net.flow.criteria.EthCriterion)28 Collection (java.util.Collection)27 Collections (java.util.Collections)27 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)27 Collectors (java.util.stream.Collectors)26 Criterion (org.onosproject.net.flow.criteria.Criterion)26 Test (org.junit.Test)25 ImmutableSet (com.google.common.collect.ImmutableSet)24 CoreService (org.onosproject.core.CoreService)24 FilteredConnectPoint (org.onosproject.net.FilteredConnectPoint)24