new DefaultGroupDescription(deviceId, GroupDescription.Type.ALL, new GroupBuckets(Collections.singletonList(bucket)), key, null, case ADD_TO_EXISTING: groupService.addBucketsToGroup(deviceId, key, new GroupBuckets(Collections.singletonList(bucket)), key, nextObjective.appId()); break; case REMOVE_FROM_EXISTING: groupService.removeBucketsFromGroup(deviceId, key, new GroupBuckets(Collections.singletonList(bucket)), key, nextObjective.appId()); break;
groupBucketList.add(groupBucketCodec.decode(bucketJson, context)); }); buckets = new GroupBuckets(groupBucketList);
deviceId, GroupDescription.Type.ALL, new GroupBuckets(l2floodBuckets), l2floodgroupkey, l2floodgroupId,
new GroupBuckets(l3McastBuckets), l3MulticastGroupKey, l3MulticastGroupId,
private void updateFailoverGroup(PointToPointIntent intent, List<Link> links) { GroupKey groupKey = makeGroupKey(intent.id()); TrafficTreatment.Builder tBuilderIn = DefaultTrafficTreatment.builder(); ConnectPoint src = links.get(0).src(); tBuilderIn.setOutput(src.port()); GroupBucket bucket = DefaultGroupBucket.createFailoverGroupBucket(tBuilderIn.build(), src.port(), null); GroupBuckets addBuckets = new GroupBuckets(Collections.singletonList(bucket)); groupService.addBucketsToGroup(src.deviceId(), groupKey, addBuckets, groupKey, intent.appId()); }
deviceId, GroupDescription.Type.SELECT, new GroupBuckets(l3ecmpGroupBuckets), l3ecmpGroupKey, l3ecmpGroupId,
private void updateFailoverGroup(PointToPointIntent pointIntent) { DeviceId deviceId = pointIntent.filteredIngressPoint().connectPoint().deviceId(); GroupKey groupKey = makeGroupKey(pointIntent.id()); Group group = waitForGroup(deviceId, groupKey); Iterator<GroupBucket> groupIterator = group.buckets().buckets().iterator(); while (groupIterator.hasNext()) { GroupBucket bucket = groupIterator.next(); Instruction individualInstruction = bucket.treatment().allInstructions().get(0); if (individualInstruction instanceof Instructions.OutputInstruction) { Instructions.OutputInstruction outInstruction = (Instructions.OutputInstruction) individualInstruction; Port port = deviceService.getPort(deviceId, outInstruction.port()); if (port == null || !port.isEnabled()) { GroupBuckets removeBuckets = new GroupBuckets(Collections.singletonList(bucket)); groupService.removeBucketsFromGroup(deviceId, groupKey, removeBuckets, groupKey, pointIntent.appId()); } } } }
private void addBucketToGroup(NextObjective nextObjective) { log.debug("addBucketToGroup in {}: for next objective id {}", deviceId, nextObjective.id()); Collection<TrafficTreatment> treatments = nextObjective.next(); TrafficTreatment treatment = treatments.iterator().next(); final GroupKey key = new DefaultGroupKey( appKryo.serialize(nextObjective .id())); Group group = groupService.getGroup(deviceId, key); if (group == null) { log.warn("Group is not found in {} for {}", deviceId, key); return; } GroupBucket bucket; if (group.type() == GroupDescription.Type.INDIRECT) { bucket = DefaultGroupBucket.createIndirectGroupBucket(treatment); } else if (group.type() == GroupDescription.Type.SELECT) { bucket = DefaultGroupBucket.createSelectGroupBucket(treatment); } else if (group.type() == GroupDescription.Type.ALL) { bucket = DefaultGroupBucket.createAllGroupBucket(treatment); } else { log.warn("Unsupported Group type {}", group.type()); return; } GroupBuckets bucketsToAdd = new GroupBuckets(Collections.singletonList(bucket)); log.debug("Adding buckets to group id {} of next objective id {} in device {}", group.id(), nextObjective.id(), deviceId); groupService.addBucketsToGroup(deviceId, key, bucketsToAdd, key, appId); }
GroupDescription groupDescription = new DefaultGroupDescription(deviceId, GroupDescription.Type.ALL, new GroupBuckets(buckets), key, L2ForwardServiceImpl.GROUP_ID,
deviceId, GroupDescription.Type.SELECT, new GroupBuckets(buckets), key, null, deviceId, GroupDescription.Type.ALL, new GroupBuckets(buckets), key, null,
deviceId, GroupDescription.Type.SELECT, new GroupBuckets(Collections.singletonList(sbucket)), l3ecmpGroupKey, l3ecmpGroupId,
return; GroupBuckets removeBuckets = new GroupBuckets(Collections.singletonList(bucket)); log.debug("Removing buckets from group id {} of next objective id {} in device {}", group.id(), nextObjective.id(), deviceId);
/** * Creates a new failover group with the initial ports of the links * from the primary and backup path. * * @param links links from the primary path * @param backupLinks links from the backup path * @param intent intent from which this call originates */ private void createFailoverTreatmentGroup(List<Link> links, List<Link> backupLinks, PointToPointIntent intent) { List<GroupBucket> buckets = new ArrayList<>(); TrafficTreatment.Builder tBuilderIn = DefaultTrafficTreatment.builder(); ConnectPoint src = links.get(0).src(); tBuilderIn.setOutput(src.port()); TrafficTreatment.Builder tBuilderIn2 = DefaultTrafficTreatment.builder(); ConnectPoint src2 = backupLinks.get(0).src(); tBuilderIn2.setOutput(src2.port()); buckets.add(DefaultGroupBucket.createFailoverGroupBucket(tBuilderIn.build(), src.port(), null)); buckets.add(DefaultGroupBucket.createFailoverGroupBucket(tBuilderIn2.build(), src2.port(), null)); GroupBuckets groupBuckets = new GroupBuckets(buckets); GroupDescription groupDesc = new DefaultGroupDescription(src.deviceId(), Group.Type.FAILOVER, groupBuckets, makeGroupKey(intent.id()), null, intent.appId()); log.trace("adding failover group {}", groupDesc); groupService.addGroup(groupDesc); }
return new GroupBuckets(bucketList);
deviceId, GroupDescription.Type.INDIRECT, new GroupBuckets(Collections.singletonList( l2InterfaceGroupBucket)), l2InterfaceGroupKey,
= new DefaultGroupDescription(deviceId, GroupDescription.Type.INDIRECT, new GroupBuckets(Collections .singletonList(bucket)), key,
.group(pointedGroup.id()) .build()); GroupBuckets removeBuckets = new GroupBuckets(Collections .singletonList(bucket)); log.debug("Removing buckets from group id {} for next id {} in device {}",
deviceId, GroupDescription.Type.INDIRECT, new GroupBuckets(Collections.singletonList( l3vpnGrpBkt)), l3vpngroupkey,
deviceId, GroupDescription.Type.INDIRECT, new GroupBuckets(Collections.singletonList( mplsinterfaceGroupBucket)), mplsgroupkey, deviceId, GroupDescription.Type.INDIRECT, new GroupBuckets(Collections.singletonList( l3unicastGroupBucket)), l3groupkey, deviceId, GroupDescription.Type.INDIRECT, new GroupBuckets(Collections.singletonList( l2InterfaceGroupBucket)), l2groupkey,
if (newBucketList != null) { GroupBuckets updatedBuckets = new GroupBuckets(newBucketList); GroupKey newCookie = (newAppCookie != null) ? newAppCookie : oldAppCookie; GroupDescription updatedGroupDesc = new DefaultGroupDescription(