ONOS-885: Group store interface definition and in-memory store implementation
Change-Id: I1125fbc23f1e58bcb8aaf5f67c02da610fa7ef25
ONOS-885: Group store interface definition and in-memory store implementation
Change-Id: Id3794bed63785e10ed86c0b5d90bf875d127224c
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 46ccafd..25af506 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
@@ -20,6 +20,9 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
+/**
+ * Default implementation of group description interface.
+ */
public class DefaultGroupDescription implements GroupDescription {
private final GroupDescription.Type type;
private final GroupBuckets buckets;
@@ -28,15 +31,15 @@
private final DeviceId deviceId;
/**
+ * Constructor to be used by north bound applications.
+ * NOTE: The caller of this subsystem MUST ensure the appCookie
+ * provided in this API is immutable
*
* @param deviceId device identifier
* @param type type of the group
* @param buckets immutable list of group bucket
* @param appCookie immutable application cookie to be associated with the group
* @param appId application id
- *
- * NOTE: The caller of this subsystem MUST ensure the appCookie
- * provided in this API is immutable
*/
public DefaultGroupDescription(DeviceId deviceId,
GroupDescription.Type type,
@@ -51,7 +54,22 @@
}
/**
- * Return type of a group object.
+ * Constructor to be used by group subsystem internal components.
+ * Creates group description object from another object of same type.
+ *
+ * @param groupDesc group description object
+ *
+ */
+ public DefaultGroupDescription(GroupDescription groupDesc) {
+ this.type = checkNotNull(groupDesc.type());
+ this.deviceId = checkNotNull(groupDesc.deviceId());
+ this.buckets = checkNotNull(groupDesc.buckets());
+ this.appCookie = checkNotNull(groupDesc.appCookie());
+ this.appId = checkNotNull(groupDesc.appId());
+ }
+
+ /**
+ * Returns type of a group object.
*
* @return GroupType group type
*/
@@ -61,7 +79,7 @@
}
/**
- * Return device identifier on which this group object is created.
+ * Returns device identifier on which this group object is created.
*
* @return DeviceId device identifier
*/
@@ -71,7 +89,7 @@
}
/**
- * Return application identifier that has created this group object.
+ * Returns application identifier that has created this group object.
*
* @return ApplicationId application identifier
*/
@@ -81,7 +99,7 @@
}
/**
- * Return application cookie associated with a group object.
+ * Returns application cookie associated with a group object.
*
* @return GroupKey application cookie
*/
@@ -91,7 +109,7 @@
}
/**
- * Return group buckets of a group.
+ * Returns group buckets of a group.
*
* @return GroupBuckets immutable list of group bucket
*/