Notifying the delegate of the DeviceStore with device removed/added events. Aslo properly marking device offline.

Change-Id: Idf2ccb01f704fd31370451400878b047e26c567b
diff --git a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
index df59f17..e95d00d 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/device/impl/GossipDeviceStore.java
@@ -328,6 +328,7 @@
         log.debug("Notifying peers of a device update topology event for providerId: {} and deviceId: {}",
                 providerId, deviceId);
         notifyPeers(new InternalDeviceEvent(providerId, deviceId, mergedDesc));
+        notifyDelegateIfNotNull(deviceEvent);
 
         return deviceEvent;
     }
@@ -487,6 +488,9 @@
 
             Device device = devices.get(deviceId);
             if (device == null) {
+                // Single Instance ONOS, device is removed from devices map and is null here but
+                // must still be marked offline
+                availableDevices.remove(deviceId);
                 return null;
             }
             boolean removed = availableDevices.remove(deviceId);
@@ -1060,6 +1064,7 @@
             log.debug("Notifying peers of a device removed topology event for deviceId: {}",
                       deviceId);
             notifyPeers(new InternalDeviceRemovedEvent(deviceId, timestamp));
+            notifyDelegateIfNotNull(event);
         }
 
         // Relinquish mastership if acquired to remove the device.