ONOS-4751-Fix:creating GroupType INDIRECT, multiple bucket(REST API)
Change-Id: Ic8d5a04b8b00ca43bfadbb3019aa5d72e799da6f
diff --git a/core/api/src/main/java/org/onosproject/net/group/DefaultGroupDescription.java b/core/api/src/main/java/org/onosproject/net/group/DefaultGroupDescription.java
index 119d535..1962e0a 100644
--- a/core/api/src/main/java/org/onosproject/net/group/DefaultGroupDescription.java
+++ b/core/api/src/main/java/org/onosproject/net/group/DefaultGroupDescription.java
@@ -17,6 +17,7 @@
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Preconditions.checkArgument;
import java.util.Objects;
@@ -61,6 +62,10 @@
this.type = checkNotNull(type);
this.deviceId = checkNotNull(deviceId);
this.buckets = checkNotNull(buckets);
+ if (this.type == GroupDescription.Type.INDIRECT) {
+ checkArgument(buckets.buckets().size() == 1, "Indirect group " +
+ "should have only one action bucket");
+ }
this.appCookie = appCookie;
this.givenGroupId = groupId;
this.appId = appId;