Search in sources :

Example 66 with DefaultGroupDescription

use of org.onosproject.net.group.DefaultGroupDescription in project fabric-tna by stratum.

the class FabricIntProgrammable method init.

@Override
public boolean init() {
    if (!setupBehaviour()) {
        return false;
    }
    Map<Integer, Long> sessionToPortMap = null;
    if (capabilities.isArchTna()) {
        final int hwPipeCount = capabilities.hwPipeCount();
        switch(hwPipeCount) {
            case 4:
                sessionToPortMap = QUAD_PIPE_MIRROR_SESS_TO_RECIRC_PORTS;
                break;
            case 2:
                sessionToPortMap = DUAL_PIPE_MIRROR_SESS_TO_RECIRC_PORTS;
                break;
            default:
                log.error("{} it not a valid HW pipe count", hwPipeCount);
                return false;
        }
    } else if (capabilities.isArchV1model()) {
        sessionToPortMap = V1MODEL_MIRROR_SESS_TO_RECIRC_PORT;
    }
    // Mirroring sessions for report cloning.
    sessionToPortMap.forEach((sessionId, port) -> {
        // Set up mirror sessions
        TrafficTreatment.Builder trafficTreatment = DefaultTrafficTreatment.builder().setOutput(PortNumber.portNumber(port));
        if (capabilities.isArchTna()) {
            trafficTreatment.truncate(INT_MIRROR_TRUNCATE_MAX_LEN);
        }
        final List<GroupBucket> buckets = ImmutableList.of(createCloneGroupBucket(trafficTreatment.build()));
        groupService.addGroup(new DefaultGroupDescription(deviceId, GroupDescription.Type.CLONE, new GroupBuckets(buckets), new DefaultGroupKey(KRYO.serialize(sessionId)), sessionId, appId));
    });
    return true;
}
Also used : DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) GroupBucket(org.onosproject.net.group.GroupBucket) DefaultGroupBucket.createCloneGroupBucket(org.onosproject.net.group.DefaultGroupBucket.createCloneGroupBucket) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) GroupBuckets(org.onosproject.net.group.GroupBuckets) DefaultGroupDescription(org.onosproject.net.group.DefaultGroupDescription)

Example 67 with DefaultGroupDescription

use of org.onosproject.net.group.DefaultGroupDescription in project fabric-tna by stratum.

the class NextObjectiveTranslator method selectGroup.

private int selectGroup(NextObjective obj, ObjectiveTranslation.Builder resultBuilder) throws FabricPipelinerException {
    final PiTableId hashedTableId = P4InfoConstants.FABRIC_INGRESS_NEXT_HASHED;
    final List<DefaultNextTreatment> defaultNextTreatments = defaultNextTreatments(obj.nextTreatments(), true);
    final List<TrafficTreatment> piTreatments = Lists.newArrayList();
    for (DefaultNextTreatment t : defaultNextTreatments) {
        // Map treatment to PI...
        piTreatments.add(mapTreatmentToPiIfNeeded(t.treatment(), hashedTableId));
        // ...and handle egress if necessary.
        handleEgress(obj, t.treatment(), resultBuilder, false);
    }
    final List<GroupBucket> bucketList = piTreatments.stream().map(DefaultGroupBucket::createSelectGroupBucket).collect(Collectors.toList());
    final int groupId = obj.id();
    final PiGroupKey groupKey = (PiGroupKey) getGroupKey(obj);
    resultBuilder.addGroup(new DefaultGroupDescription(deviceId, GroupDescription.Type.SELECT, new GroupBuckets(bucketList), groupKey, groupId, obj.appId()));
    return groupId;
}
Also used : DefaultNextTreatment(org.onosproject.net.flowobjective.DefaultNextTreatment) PiGroupKey(org.onosproject.net.pi.runtime.PiGroupKey) PiTableId(org.onosproject.net.pi.model.PiTableId) GroupBucket(org.onosproject.net.group.GroupBucket) DefaultGroupBucket(org.onosproject.net.group.DefaultGroupBucket) DefaultTrafficTreatment(org.onosproject.net.flow.DefaultTrafficTreatment) TrafficTreatment(org.onosproject.net.flow.TrafficTreatment) GroupBuckets(org.onosproject.net.group.GroupBuckets) DefaultGroupDescription(org.onosproject.net.group.DefaultGroupDescription)

Aggregations

DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)67 GroupBuckets (org.onosproject.net.group.GroupBuckets)61 GroupBucket (org.onosproject.net.group.GroupBucket)56 GroupDescription (org.onosproject.net.group.GroupDescription)54 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)47 GroupKey (org.onosproject.net.group.GroupKey)45 DefaultGroupKey (org.onosproject.net.group.DefaultGroupKey)42 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)40 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)39 GroupId (org.onosproject.core.GroupId)21 Group (org.onosproject.net.group.Group)21 ArrayList (java.util.ArrayList)18 OfdpaGroupHandlerUtility.l2MulticastGroupKey (org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.l2MulticastGroupKey)15 PortNumber (org.onosproject.net.PortNumber)14 PiGroupKey (org.onosproject.net.pi.runtime.PiGroupKey)14 ArrayDeque (java.util.ArrayDeque)13 Deque (java.util.Deque)13 TrafficSelector (org.onosproject.net.flow.TrafficSelector)13 DefaultGroup (org.onosproject.net.group.DefaultGroup)13 VlanId (org.onlab.packet.VlanId)10