/** * Creates group key unique to each intent. * * @param intentId identifier of intent to get a key for * @return unique group key for the intent identifier */ public static GroupKey makeGroupKey(IntentId intentId) { ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); buffer.putLong(intentId.fingerprint()); return new DefaultGroupKey(buffer.array()); }
/** * Storage for a GroupKey or a TrafficTreatment. One of the params * to this constructor must be null. * @param key represents a GroupKey * @param treatment represents flow actions in a dummy group */ public SpringOpenGroup(GroupKey key, TrafficTreatment treatment) { if (key == null) { this.key = new DefaultGroupKey(new byte[]{0}); this.treatment = treatment; this.dummy = true; } else { this.key = key; this.treatment = DefaultTrafficTreatment.builder().build(); this.dummy = false; } }
@Override public void next(NextObjective nextObjective) { pendingNext.put(nextObjective.id(), nextObjective); flowObjectiveStore.putNextGroup(nextObjective.id(), new SingleGroup(new DefaultGroupKey(appKryo.serialize(nextObjective.id())))); nextObjective.context().ifPresent(context -> context.onSuccess(nextObjective)); }
private void removeGroup(NextObjective nextObjective) { log.debug("removeGroup in {}: for next objective id {}", deviceId, nextObjective.id()); final GroupKey key = new DefaultGroupKey( appKryo.serialize(nextObjective.id())); groupService.removeGroup(deviceId, key, appId); }
throw new IllegalArgumentException("APP_COOKIE must be a hex string starts with 0x"); GroupKey groupKey = new DefaultGroupKey(HexString.fromHexString( groupKeyStr.split("0x")[1], ""));
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); }
final GroupKey l2floodgroupkey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(l2floodgk));
final GroupKey l3MulticastGroupKey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(l3MulticastIndex));
Collection<TrafficTreatment> treatments = nextObjective.next(); TrafficTreatment treatment = treatments.iterator().next(); final GroupKey key = new DefaultGroupKey( appKryo.serialize(nextObjective .id()));
GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id()));
.collect(Collectors.toList()); if (!buckets.isEmpty()) { final GroupKey key = new DefaultGroupKey( appKryo.serialize(nextObjective.id())); GroupDescription groupDescription = new DefaultGroupDescription( .collect(Collectors.toList()); if (!buckets.isEmpty()) { final GroupKey key = new DefaultGroupKey( appKryo.serialize(nextObjective .id()));
GroupKey l3ecmpGroupKey = new DefaultGroupKey( Ofdpa2Pipeline.appKryo.serialize(l3ecmpIndex)); GroupDescription l3ecmpGroupDesc =
GroupKey l3ecmpGroupKey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(l3ecmpGroupId));
buckets.add(bucket); }); final GroupKey key = new DefaultGroupKey(APP_ID.getBytes()); GroupDescription groupDescription = new DefaultGroupDescription(deviceId, GroupDescription.Type.ALL,
int l2gk = l2InterfaceGroupKey(deviceId, l2InterfaceGroupVlan, portNum.toLong()); final GroupKey l2InterfaceGroupKey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(l2gk)); int l2InterfaceGroupId = L2_INTERFACE_TYPE | (l2InterfaceGroupVlan.toShort() << 16) | (int) portNum.toLong();
final GroupKey key = new DefaultGroupKey(appKryo.serialize(nextObjective.id())); GroupDescription groupDescription = new DefaultGroupDescription(deviceId,
int l3vpnIndex = getNextAvailableIndex(); int l3vpngroupId = MPLS_L3VPN_SUBTYPE | (SUBTYPE_MASK & l3vpnIndex); GroupKey l3vpngroupkey = new DefaultGroupKey( Ofdpa2Pipeline.appKryo.serialize(l3vpnIndex)); GroupDescription l3vpnGroupDesc =
final GroupKey l2groupkey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(l2gk)); final GroupKey mplsgroupkey = new DefaultGroupKey( Ofdpa2Pipeline.appKryo.serialize(mplsInterfaceIndex)); outerTtb.group(new DefaultGroupId(l2groupId)); final GroupKey l3groupkey = new DefaultGroupKey( Ofdpa2Pipeline.appKryo.serialize(l3unicastIndex)); outerTtb.group(new DefaultGroupId(l2groupId));
final GroupKey l2groupkey = new DefaultGroupKey(Ofdpa2Pipeline.appKryo.serialize(l2gk)); final GroupKey mplsgroupkey = new DefaultGroupKey( Ofdpa2Pipeline.appKryo.serialize(mplsInterfaceIndex)); outerTtb.group(new DefaultGroupId(l2groupId)); final GroupKey l3groupkey = new DefaultGroupKey( Ofdpa2Pipeline.appKryo.serialize(l3unicastIndex)); outerTtb.group(new DefaultGroupId(l2groupId));