In this commit:
Removing dependence on hashing for unique groupkeys in ofdpa driver.
Group-store no longer removes groups from store if a group-operation fails due to GROUP_EXISTS.
Group-store also checks for unique group-id when given by app.
Group-provider now logs warning before making call to core.
Change-Id: I4a1dcb887cb74cd6e245df0c82c90a50d8f3898a
diff --git a/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java b/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
index 250dfb9..520c65d 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java
@@ -537,6 +537,19 @@
// Get a new group identifier
id = new DefaultGroupId(getFreeGroupIdValue(groupDesc.deviceId()));
} else {
+ // we need to use the identifier passed in by caller, but check if
+ // already used
+ Group existing = getGroup(groupDesc.deviceId(),
+ new DefaultGroupId(groupDesc.givenGroupId()));
+ if (existing != null) {
+ log.warn("Group already exists with the same id: 0x{} in dev:{} "
+ + "but with different key: {} (request gkey: {})",
+ Integer.toHexString(groupDesc.givenGroupId()),
+ groupDesc.deviceId(),
+ existing.appCookie(),
+ groupDesc.appCookie());
+ return;
+ }
id = new DefaultGroupId(groupDesc.givenGroupId());
}
// Create a group entry object
@@ -621,7 +634,8 @@
// Check if a group is existing with the provided key
Group oldGroup = getGroup(deviceId, oldAppCookie);
if (oldGroup == null) {
- log.warn("updateGroupDescriptionInternal: Group not found...strange");
+ log.warn("updateGroupDescriptionInternal: Group not found...strange. "
+ + "GroupKey:{} DeviceId:{}", oldAppCookie, deviceId);
return;
}
@@ -940,6 +954,19 @@
log.warn("Current extraneous groups in device:{} are: {}",
deviceId,
getExtraneousGroups(deviceId));
+ if (operation.buckets().equals(existing.buckets())) {
+ if (existing.state() == GroupState.PENDING_ADD) {
+ log.info("GROUP_EXISTS: GroupID and Buckets match for group in pending "
+ + "add state - moving to ADDED for group {} in device {}",
+ existing.id(), deviceId);
+ addOrUpdateGroupEntry(existing);
+ return;
+ } else {
+ log.warn("GROUP EXISTS: Group ID matched but buckets did not. "
+ + "Operation: {} Existing: {}", operation.buckets(),
+ existing.buckets());
+ }
+ }
}
switch (operation.opType()) {
case ADD: