Fix bugs for dynamic interface configuration

- portNextObjStore is not updated when adding or removing portNextObjective
- Group keys for L2IG in flowObjectiveStore are deleted while modifying L2IG, which in turn causes an exception
- L3UG pointing to L2IG, which is already removed, is not removed
- Empty L2FG, with VLAN ID removed from the configuration, is not removed
- Bridging and unicast routing rules for hosts are not updated when changing port VLAN from untagged to tagged and vice versa

Change-Id: I9454fe553ae53e0fc8839a4ad629c0b5b9039a36
diff --git a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java
index 0c68a7a..8642daa 100644
--- a/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java
+++ b/drivers/default/src/main/java/org/onosproject/driver/pipeline/ofdpa/Ofdpa2GroupHandler.java
@@ -1992,13 +1992,11 @@
         // trying to remove buckets from the same group, each with its own
         // potentially stale copy of allActiveKeys
         synchronized (flowObjectiveStore) {
-            List<Deque<GroupKey>> modifiedGroupKeys = Lists.newArrayList();
-            ArrayDeque<GroupKey> top = new ArrayDeque<>();
-            top.add(l2InterfaceGroupDesc.appCookie());
-            modifiedGroupKeys.add(top);
-
+            // NOTE: The groupKey is computed by deviceId, VLAN and portNum. It remains the same when we modify L2IG.
+            //       Therefore we use the same groupKey of the existing group.
+            List<Deque<GroupKey>> allActiveKeys = appKryo.deserialize(next.data());
             flowObjectiveStore.putNextGroup(nextObjective.id(),
-                                            new OfdpaNextGroup(modifiedGroupKeys,
+                                            new OfdpaNextGroup(allActiveKeys,
                                                                nextObjective));
         }