BUG-2399: take into account new ModificationTypes 08/27108/2
authorRobert Varga <rovarga@cisco.com>
Thu, 17 Sep 2015 03:39:35 +0000 (05:39 +0200)
committerRobert Varga <rovarga@cisco.com>
Thu, 17 Sep 2015 21:17:28 +0000 (23:17 +0200)
APPEARED/DISAPPEARED changes may occur when structural containers come
and go. These should be treated as WRITE and DELETE for change
resolution purposes.

Change-Id: I22d7c76f149b8f72decb1c81ce960cd60ba8dc6c
Signed-off-by: Robert Varga <rovarga@cisco.com>
dom/mdsal-dom-inmemory-datastore/src/main/java/org/opendaylight/mdsal/dom/store/inmemory/ResolveDataChangeEventsTask.java

index 7fe2c545236aaf1c30b65eeefcf6252ca32951b2..f144d4b04885cbde41cef51f4b86d42a51714106 100644 (file)
@@ -118,6 +118,7 @@ public final class ResolveDataChangeEventsTask {
         switch (type) {
         case SUBTREE_MODIFIED:
             return resolveSubtreeChangeEvent(state, node);
+        case APPEARED:
         case WRITE:
             Preconditions.checkArgument(maybeAfter.isPresent(),
                     "Modification at {} has type {} but no after-data", state.getPath(), type);
@@ -130,6 +131,7 @@ public final class ResolveDataChangeEventsTask {
 
             return resolveReplacedEvent(state, maybeBefore.get(), maybeAfter.get());
         case DELETE:
+        case DISAPPEARED:
             Preconditions.checkArgument(maybeBefore.isPresent(),
                     "Modification at {} has type {} but no before-data", state.getPath(), type);
 
@@ -277,8 +279,10 @@ public final class ResolveDataChangeEventsTask {
             final ResolveDataChangeState childState = state.child(childMod.getIdentifier());
 
             switch (childMod.getModificationType()) {
-            case WRITE:
+            case APPEARED:
             case DELETE:
+            case DISAPPEARED:
+            case WRITE:
                 if (resolveAnyChangeEvent(childState, childMod)) {
                     scope = DataChangeScope.ONE;
                 }