Search in sources :

Example 51 with DefaultGroupKey

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

the class FabricIntProgrammableTest method testInit.

private void testInit() {
    final List<GroupDescription> expectedGroups = Lists.newArrayList();
    final Capture<GroupDescription> capturedGroup = newCapture(CaptureType.ALL);
    final Map<Integer, Long> recircPorts = intProgrammable.capabilities.isArchV1model() ? V1MODEL_MIRROR_SESS_TO_RECIRC_PORTS : QUAD_PIPE_MIRROR_SESS_TO_RECIRC_PORTS;
    recircPorts.forEach((sessionId, port) -> {
        // Set up mirror sessions
        final List<GroupBucket> buckets = ImmutableList.of(getCloneBucket(port));
        expectedGroups.add(new DefaultGroupDescription(LEAF_DEVICE_ID, GroupDescription.Type.CLONE, new GroupBuckets(buckets), new DefaultGroupKey(KRYO.serialize(sessionId)), sessionId, APP_ID));
        groupService.addGroup(capture(capturedGroup));
    });
    replay(groupService, flowRuleService);
    assertTrue(intProgrammable.init());
    for (int i = 0; i < recircPorts.size(); i++) {
        GroupDescription expectGroup = expectedGroups.get(i);
        GroupDescription actualGroup = capturedGroup.getValues().get(i);
        assertEquals(expectGroup, actualGroup);
    }
    verify(groupService, flowRuleService);
    reset(groupService, flowRuleService);
}
Also used : DefaultGroupDescription(org.onosproject.net.group.DefaultGroupDescription) GroupDescription(org.onosproject.net.group.GroupDescription) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) GroupBucket(org.onosproject.net.group.GroupBucket) DefaultGroupBucket.createCloneGroupBucket(org.onosproject.net.group.DefaultGroupBucket.createCloneGroupBucket) GroupBuckets(org.onosproject.net.group.GroupBuckets) DefaultGroupDescription(org.onosproject.net.group.DefaultGroupDescription)

Example 52 with DefaultGroupKey

use of org.onosproject.net.group.DefaultGroupKey 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)

Aggregations

DefaultGroupKey (org.onosproject.net.group.DefaultGroupKey)52 GroupKey (org.onosproject.net.group.GroupKey)48 GroupBuckets (org.onosproject.net.group.GroupBuckets)39 GroupBucket (org.onosproject.net.group.GroupBucket)38 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)34 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)34 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)32 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)31 GroupDescription (org.onosproject.net.group.GroupDescription)27 Group (org.onosproject.net.group.Group)21 GroupId (org.onosproject.core.GroupId)19 PortNumber (org.onosproject.net.PortNumber)18 DefaultGroup (org.onosproject.net.group.DefaultGroup)15 ArrayList (java.util.ArrayList)14 GroupOperation (org.onosproject.net.group.GroupOperation)10 Instruction (org.onosproject.net.flow.instructions.Instruction)9 L2ModificationInstruction (org.onosproject.net.flow.instructions.L2ModificationInstruction)9 OfdpaGroupHandlerUtility.l2MulticastGroupKey (org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.l2MulticastGroupKey)8 TrafficSelector (org.onosproject.net.flow.TrafficSelector)8 ArrayDeque (java.util.ArrayDeque)7