CORD-45 CORD-394
Bugfix in group store - group delete state updated correctly.
SR app no longer deletes buckets in existing groups - workaround for OFDPA bug.
Instead it invalidates the entire group, thereby forcing new group creation.
Also incorporating Charles' changes to remove state from group and flow stores,
and the SR app when device goes offline.

Change-Id: I162d3fb6bf709a8f02b01b8d57e131c2bac9b46b
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 520c65d..0cf77b3 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
@@ -769,6 +769,9 @@
                 existing.state());
         synchronized (existing) {
             existing.setState(GroupState.PENDING_DELETE);
+            getGroupStoreKeyMap().
+                put(new GroupStoreKeyMapKey(existing.deviceId(), existing.appCookie()),
+                    existing);
         }
         log.debug("deleteGroupDescriptionInternal: in device {} issuing GROUP_REMOVE_REQUESTED",
                   deviceId);