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;
}
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;
}
Aggregations