[ONOS-5797] GroupService: add setBucketsForGroup
Add method to set all buckets from a group, overwriting the
previous group buckets entirely. Useful for edits that before
required two operations: removing the buckets and then adding
others. It can all be done with one OF message in the end.
Change-Id: Ic5669603ed4fd18b8efaa8d0253ab9d7b1e870f5
diff --git a/core/common/src/test/java/org/onosproject/store/trivial/SimpleGroupStore.java b/core/common/src/test/java/org/onosproject/store/trivial/SimpleGroupStore.java
index 01930ef..42a6d56 100644
--- a/core/common/src/test/java/org/onosproject/store/trivial/SimpleGroupStore.java
+++ b/core/common/src/test/java/org/onosproject/store/trivial/SimpleGroupStore.java
@@ -321,6 +321,10 @@
private List<GroupBucket> getUpdatedBucketList(Group oldGroup,
UpdateType type,
GroupBuckets buckets) {
+ if (type == UpdateType.SET) {
+ return buckets.buckets();
+ }
+
List<GroupBucket> oldBuckets = oldGroup.buckets().buckets();
List<GroupBucket> updatedBucketList = new ArrayList<>();
boolean groupDescUpdated = false;