Functionality issue. 1) REMOVE event is generated though the tunnel is not removed 2) Logic w.r.t producer name conflict with Tunnel Manager and Store

Change-Id: I9f4fea885edda97029863b90e2397446c39fdbe3
diff --git a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
index f0ad2b0..78ea587 100644
--- a/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
+++ b/incubator/store/src/main/java/org/onosproject/incubator/store/tunnel/impl/DistributedTunnelStore.java
@@ -78,7 +78,7 @@
     /**
      * The topic used for obtaining globally unique ids.
      */
-    private String runnelOpTopoic = "tunnel-ops-ids";
+    private String tunnelOpTopic = "tunnel-ops-ids";
 
     @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
     protected ClusterCommunicationService clusterCommunicator;
@@ -131,7 +131,7 @@
                 .<ApplicationId, Set<TunnelSubscription>>eventuallyConsistentMapBuilder()
                 .withName("type_tunnel").withSerializer(serializer)
                 .withTimestampProvider((k, v) -> new WallClockTimestamp()).build();
-        idGenerator = coreService.getIdGenerator(runnelOpTopoic);
+        idGenerator = coreService.getIdGenerator(tunnelOpTopic);
         log.info("Started");
     }
 
@@ -236,19 +236,24 @@
         List<TunnelEvent> ls = new ArrayList<TunnelEvent>();
         for (TunnelId id : idSet) {
             deletedTunnel = tunnelIdAsKeyStore.get(id);
-            event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED,
-                                    deletedTunnel);
-            ls.add(event);
-            if (producerName.equals(deletedTunnel.providerId())) {
+
+            if (producerName == null || (producerName != null
+                    && producerName.equals(deletedTunnel.providerId()))) {
                 tunnelIdAsKeyStore.remove(deletedTunnel.tunnelId());
                 tunnelNameAsKeyStore.get(deletedTunnel.tunnelName())
                         .remove(deletedTunnel.tunnelId());
                 srcAndDstKeyStore.get(key).remove(deletedTunnel.tunnelId());
                 typeKeyStore.get(deletedTunnel.type())
                         .remove(deletedTunnel.tunnelId());
+                event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED,
+                                        deletedTunnel);
+                ls.add(event);
             }
         }
-        notifyDelegate(ls);
+
+        if (!ls.isEmpty()) {
+            notifyDelegate(ls);
+        }
     }
 
     @Override
@@ -264,20 +269,24 @@
         List<TunnelEvent> ls = new ArrayList<TunnelEvent>();
         for (TunnelId id : idSet) {
             deletedTunnel = tunnelIdAsKeyStore.get(id);
-            event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED,
-                                    deletedTunnel);
-            ls.add(event);
-            if (producerName.equals(deletedTunnel.providerId())
-                    && type.equals(deletedTunnel.type())) {
+
+            if (type.equals(deletedTunnel.type()) && (producerName == null || (producerName != null
+                    && producerName.equals(deletedTunnel.providerId())))) {
                 tunnelIdAsKeyStore.remove(deletedTunnel.tunnelId());
                 tunnelNameAsKeyStore.get(deletedTunnel.tunnelName())
                         .remove(deletedTunnel.tunnelId());
                 srcAndDstKeyStore.get(key).remove(deletedTunnel.tunnelId());
                 typeKeyStore.get(deletedTunnel.type())
                         .remove(deletedTunnel.tunnelId());
+                event = new TunnelEvent(TunnelEvent.Type.TUNNEL_REMOVED,
+                                        deletedTunnel);
+                ls.add(event);
             }
         }
-        notifyDelegate(ls);
+
+        if (!ls.isEmpty()) {
+            notifyDelegate(ls);
+        }
     }
 
     @Override