public Bucket build() { return new BucketImpl(this); }
public BucketBuilder(Bucket base) { if (base.getKey() == null) { this._key = new BucketKey( base.getBucketId() ); this._bucketId = base.getBucketId(); } else { this._key = base.getKey(); this._bucketId = _key.getBucketId(); } this._action = base.getAction(); this._watchGroup = base.getWatchGroup(); this._watchPort = base.getWatchPort(); this._weight = base.getWeight(); if (base instanceof BucketImpl) { BucketImpl _impl = (BucketImpl) base; this.augmentation = new HashMap<>(_impl.augmentation); } }
private BucketImpl(BucketBuilder base) { if (base.getKey() == null) { this._key = new BucketKey( base.getBucketId() ); this._bucketId = base.getBucketId(); } else { this._key = base.getKey(); this._bucketId = _key.getBucketId(); } this._action = base.getAction(); this._watchGroup = base.getWatchGroup(); this._watchPort = base.getWatchPort(); this._weight = base.getWeight(); switch (base.augmentation.size()) { case 0: this.augmentation = Collections.emptyMap(); break; case 1: final Map.Entry<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket>> e = base.augmentation.entrySet().iterator().next(); this.augmentation = Collections.<java.lang.Class<? extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket>>, Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket>>singletonMap(e.getKey(), e.getValue()); break; default : this.augmentation = new HashMap<>(base.augmentation); } }
GroupKey key = new GroupKey(new GroupId(id)); GroupBuilder group = new GroupBuilder(); BucketBuilder bucket = new BucketBuilder(); bucket.setBucketId(new BucketId((long) 12)); bucket.setKey(new BucketKey(new BucketId((long) 12))); bucket.setAction(createPopVlanAction()); break; case "a2": bucket.setAction(createPushVlanAction()); break; case "a3": bucket.setAction(createPushMplsAction()); break; case "a4": bucket.setAction(createPopMplsAction()); break; case "a5": bucket.setAction(createPopPbbAction()); break; case "a6": bucket.setAction(createPushPbbAction()); break; case "a7": bucket.setAction(createPushPbbAction()); break; case "a8": bucket.setAction(createCopyTtlInAction()); break;
BucketBuilder bucket = new BucketBuilder(); bucket.setBucketId(new BucketId((long) bucketId)); bucket.setKey(new BucketKey(new BucketId((long) bucketId))); bucketId++; List<Action> origbucketActions = origbucket.getAction(); for (Action action : origbucketActions) { if (action.getAction() instanceof OutputActionCase) { bucket.setAction(bucketActionList); bucketList.add(bucket.build()); BucketBuilder bucket = new BucketBuilder(); bucket.setBucketId(new BucketId((long) 1)); bucket.setKey(new BucketKey(new BucketId((long) 1))); bucket.setAction(bucketActionList); bucketList.add(bucket.build()); removeDrop = true;
if (other.getAction() != null) { return false; } else if(!_action.equals(other.getAction())) { return false; if (other.getBucketId() != null) { return false; } else if(!_bucketId.equals(other.getBucketId())) { return false; if (other.getKey() != null) { return false; } else if(!_key.equals(other.getKey())) { return false; if (other.getWatchGroup() != null) { return false; } else if(!_watchGroup.equals(other.getWatchGroup())) { return false; if (other.getWatchPort() != null) { return false; } else if(!_watchPort.equals(other.getWatchPort())) { return false;
private void processGroupAction(GroupActionCase actionCase, FlowTableLookUpResult result) { GroupAction groupAction = actionCase.getGroupAction(); Group group = indexedGroups.get(groupAction.getGroupId()); GroupTypes groupType = group.getGroupType(); List<Bucket> buckets = group.getBuckets().getBucket(); if (groupType.equals(GroupTypes.GroupAll)) { for (Bucket bucket : buckets) { processActionSet(bucket.getAction(), result); } } else if (groupType.equals(GroupTypes.GroupIndirect) && buckets.size() == 1) { processActionSet(buckets.get(0).getAction(), result); } }
/** * Creates a group path from a node ID and group ID * * @param nodeId the Id of the node * @param groupId the ID of the group table * @param bucketId the ID of the bucket in the group table * @return the {@link InstanceIdentifier} */ public static InstanceIdentifier<Bucket> createBucketPath(final NodeId nodeId, final GroupId groupId, final BucketId bucketId) { return createNodePath(nodeId).builder() .augmentation(FlowCapableNode.class) .child(Group.class, new GroupKey(groupId)) .child(Buckets.class) .child(Bucket.class, new BucketKey(bucketId)) .build(); }
private static void salToOFBucketListWeight(Bucket groupBucket, BucketsListBuilder bucketBuilder, int groupType) { if (null != groupBucket.getWeight()) { bucketBuilder.setWeight(groupBucket.getWeight()); } else { bucketBuilder.setWeight(DEFAULT_WEIGHT); if (groupType == GroupType.OFPGTSELECT.getIntValue()) { LOG.error("Weight value required for this OFPGT_SELECT"); } } }
private static void salToOFBucketListWatchGroup(Bucket groupBucket, BucketsListBuilder bucketBuilder, int groupType) { if (null != groupBucket.getWatchGroup()) { bucketBuilder.setWatchGroup(groupBucket.getWatchGroup()); } else { bucketBuilder.setWatchGroup(BinContent.intToUnsignedLong(DEFAULT_WATCH_GROUP.intValue())); if (groupType == GroupType.OFPGTFF.getIntValue()) { LOG.error("WatchGroup required for this OFPGT_FF"); } } }
private static void salToOFBucketListWatchPort(Bucket groupBucket, BucketsListBuilder bucketBuilder, int groupType) { if (null != groupBucket.getWatchPort()) { bucketBuilder.setWatchPort(new PortNumber(groupBucket.getWatchPort())); } else { bucketBuilder.setWatchPort(new PortNumber(BinContent.intToUnsignedLong(DEFAULT_WATCH_PORT.intValue()))); if (groupType == GroupType.OFPGTFF.getIntValue()) { LOG.error("WatchPort required for this OFPGT_FF"); } } }
public BucketBuilder setWatchGroup(java.lang.Long value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value); boolean isValidRange = false; for (Range<BigInteger> r : _watchGroup_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _watchGroup_range)); } } this._watchGroup = value; return this; } public static List<Range<BigInteger>> _watchGroup_range() {
public BucketBuilder setWatchPort(java.lang.Long value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value); boolean isValidRange = false; for (Range<BigInteger> r : _watchPort_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _watchPort_range)); } } this._watchPort = value; return this; } public static List<Range<BigInteger>> _watchPort_range() {
public BucketBuilder setWeight(java.lang.Integer value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value); boolean isValidRange = false; for (Range<BigInteger> r : _weight_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _weight_range)); } } this._weight = value; return this; } public static List<Range<BigInteger>> _weight_range() {
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((_action == null) ? 0 : _action.hashCode()); result = prime * result + ((_bucketId == null) ? 0 : _bucketId.hashCode()); result = prime * result + ((_key == null) ? 0 : _key.hashCode()); result = prime * result + ((_watchGroup == null) ? 0 : _watchGroup.hashCode()); result = prime * result + ((_watchPort == null) ? 0 : _watchPort.hashCode()); result = prime * result + ((_weight == null) ? 0 : _weight.hashCode()); result = prime * result + ((augmentation == null) ? 0 : augmentation.hashCode()); return result; }
public BucketBuilder setBucketId(BucketId value) { if (value != null) { BigInteger _constraint = BigInteger.valueOf(value.getValue()); boolean isValidRange = false; for (Range<BigInteger> r : _bucketId_range()) { if (r.contains(_constraint)) { isValidRange = true; } } if (!isValidRange) { throw new IllegalArgumentException(String.format("Invalid range: %s, expected: %s.", value, _bucketId_range)); } } this._bucketId = value; return this; } public static List<Range<BigInteger>> _bucketId_range() {
GroupKey key = new GroupKey(new GroupId(id)); GroupBuilder group = new GroupBuilder(); BucketBuilder bucket = new BucketBuilder(); bucket.setBucketId(new BucketId((long) 12)); bucket.setKey(new BucketKey(new BucketId((long) 12))); bucket.setAction(createPopVlanAction()); break; case "a2": bucket.setAction(createPushVlanAction()); break; case "a3": bucket.setAction(createPushMplsAction()); break; case "a4": bucket.setAction(createPopMplsAction()); break; case "a5": bucket.setAction(createPopPbbAction()); break; case "a6": bucket.setAction(createPushPbbAction()); break; case "a7": bucket.setAction(createPushPbbAction()); break; case "a8": bucket.setAction(createCopyTtlInAction()); break;
BucketBuilder bucket = new BucketBuilder(); BucketId bucketId = new BucketId(portCount); bucket.setBucketId(bucketId); bucket.setKey(new BucketKey(bucketId)); ab.setKey(new ActionKey(bucketActionList.size())); bucket.setAction(bucketActionList); bucketList.add(bucket.build());
private List<BucketsList> salToOFBucketList(Buckets buckets, short version, int groupType, BigInteger datapathid) { final List<BucketsList> bucketLists = new ArrayList<>(); final ActionConvertorData data = new ActionConvertorData(version); data.setDatapathId(datapathid); for (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket groupBucket : buckets .getBucket()) { BucketsListBuilder bucketBuilder = new BucketsListBuilder(); salToOFBucketListWeight(groupBucket, bucketBuilder, groupType); salToOFBucketListWatchGroup(groupBucket, bucketBuilder, groupType); salToOFBucketListWatchPort(groupBucket, bucketBuilder, groupType); Optional<List<Action>> bucketActionList = getConvertorExecutor().convert( groupBucket.getAction(), data); bucketBuilder.setAction(bucketActionList.orElse(Collections.emptyList())); BucketsList bucket = bucketBuilder.build(); bucketLists.add(bucket); } return bucketLists; }
BucketBuilder bucketDesc = new BucketBuilder(); final Optional<List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action>> convertedSalActions = getConvertorExecutor().convert( bucketDesc.setAction(actions); } else { bucketDesc.setAction(Collections.emptyList()); bucketDesc.setWeight(bucketDetails.getWeight()); bucketDesc.setWatchPort(bucketDetails.getWatchPort().getValue()); bucketDesc.setWatchGroup(bucketDetails.getWatchGroup()); BucketId bucketId = new BucketId((long) bucketKey); bucketDesc.setBucketId(bucketId); bucketDesc.setKey(new BucketKey(bucketId)); bucketKey++; allBuckets.add(bucketDesc.build());