[CORD-1051] Fix bug when remove multiple bucket
Change-Id: Iefe343278d561c6d60b842cbecc85e9328a64169
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java
index fedfc20..2bb2dd6 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/Ofdpa2GroupHandler.java
@@ -1458,7 +1458,6 @@
return;
}
-
List<GroupBucket> bucketsToRemove = Lists.newArrayList();
//first group key is the one we want to modify
GroupKey modGroupKey = chainsToRemove.get(0).peekFirst();
@@ -1521,15 +1520,14 @@
removeBuckets, modGroupKey,
nextObjective.appId());
// update store
- // If the bucket removed was the last bucket in the group, then
- // retain an entry for the top level group which still exists.
- if (allActiveKeys.size() == 1) {
+ allActiveKeys.removeAll(chainsToRemove);
+ // If no buckets in the group, then retain an entry for the
+ // top level group which still exists.
+ if (allActiveKeys.isEmpty()) {
ArrayDeque<GroupKey> top = new ArrayDeque<>();
top.add(modGroupKey);
allActiveKeys.add(top);
}
-
- allActiveKeys.removeAll(chainsToRemove);
flowObjectiveStore.putNextGroup(nextObjective.id(),
new OfdpaNextGroup(allActiveKeys,
nextObjective));