[ONOS-5170] GroupStore: add purgeGroupEntries

The GroupStore exposes purgeGroupEntry, which purges
from the store by a specific device.

Add purgeGroupEntries, to purge entries from all devices
from the GroupStore, and expose purgeGroupEntries to allow
applications to purge all group entries from the GroupStore
without specifying a device.

Change-Id: I735f011a1fbbfa3ce8f1dd57a591a81c4377b012
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 ab66bd4..64df685 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
@@ -931,19 +931,27 @@
         }
     }
 
+    private void purgeGroupEntries(Set<Entry<GroupStoreKeyMapKey, StoredGroupEntry>> entries) {
+        entries.forEach(entry -> {
+            groupStoreEntriesByKey.remove(entry.getKey());
+        });
+    }
+
     @Override
     public void purgeGroupEntry(DeviceId deviceId) {
-        Set<Entry<GroupStoreKeyMapKey, StoredGroupEntry>> entryPendingRemove =
+        Set<Entry<GroupStoreKeyMapKey, StoredGroupEntry>> entriesPendingRemove =
                 new HashSet<>();
 
         getGroupStoreKeyMap().entrySet().stream()
                 .filter(entry -> entry.getKey().deviceId().equals(deviceId))
-                .forEach(entryPendingRemove::add);
+                .forEach(entriesPendingRemove::add);
 
-        entryPendingRemove.forEach(entry -> {
-            groupStoreEntriesByKey.remove(entry.getKey());
-            notifyDelegate(new GroupEvent(Type.GROUP_REMOVED, entry.getValue()));
-        });
+        purgeGroupEntries(entriesPendingRemove);
+    }
+
+    @Override
+    public void purgeGroupEntries() {
+        purgeGroupEntries(getGroupStoreKeyMap().entrySet());
     }
 
     @Override