/** * 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); }
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()); }
DefaultGroupBucket.createFailoverGroupBucket(trafficTreatment, watchPort, watchGroup); break; default:
new DefaultGroupId(bucket.getWatchGroup().getGroupNumber()); groupBucket = DefaultGroupBucket.createFailoverGroupBucket(treatment, port, groupId); break;