Trigger the removal of double tagged rules

Trigger the driver to remove the double tagged rules (fwd classifier) when removing the flow objective and no other host is connected to the same port

Change-Id: I83d50f9b3404f2eaa733cc0c75f76bfe3562b5e8
(cherry picked from commit 7c4534ce5133538e2a6f0c95b4ecc7ea1f250e47)
diff --git a/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java b/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
index 2bc5b30..7dddd3f 100644
--- a/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
+++ b/app/src/main/java/org/onosproject/segmentrouting/RoutingRulePopulator.java
@@ -1147,7 +1147,13 @@
      */
     void processDoubleTaggedFilter(DeviceId deviceId, PortNumber portNum, VlanId outerVlan,
                                    VlanId innerVlan, boolean install) {
-        FilteringObjective.Builder fob = buildDoubleTaggedFilteringObj(deviceId, portNum, outerVlan, innerVlan, false);
+        // We should trigger the removal of double tagged rules only when removing
+        // the filtering objective and no other hosts are connected to the same device port.
+        boolean cleanupDoubleTaggedRules = srManager.hostService
+                .getConnectedHosts(new ConnectPoint(deviceId, portNum)).size() == 0 && !install;
+        FilteringObjective.Builder fob = buildDoubleTaggedFilteringObj(deviceId, portNum,
+                                                                       outerVlan, innerVlan,
+                                                                       cleanupDoubleTaggedRules);
         if (fob == null) {
             // error encountered during build
             return;