[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/store/dist/src/test/java/org/onosproject/store/group/impl/DistributedGroupStoreTest.java b/core/store/dist/src/test/java/org/onosproject/store/group/impl/DistributedGroupStoreTest.java
index a3ca1ec..e9cebef 100644
--- a/core/store/dist/src/test/java/org/onosproject/store/group/impl/DistributedGroupStoreTest.java
+++ b/core/store/dist/src/test/java/org/onosproject/store/group/impl/DistributedGroupStoreTest.java
@@ -430,6 +430,20 @@
assertEquals(weight, bucket.weight());
}
}
+
+ buckets = new GroupBuckets(ImmutableList.of(selectGroupBucketWithWeight));
+
+ groupStore.updateGroupDescription(deviceId1,
+ newKey,
+ SET,
+ buckets,
+ newKey);
+
+ group1 = groupStore.getGroup(deviceId1, groupId1);
+ assertThat(group1.appCookie(), is(newKey));
+ assertThat(group1.buckets().buckets(), hasSize(1));
+ GroupBucket onlyBucket = group1.buckets().buckets().iterator().next();
+ assertEquals(weight, onlyBucket.weight());
}
@Test