diff options
author | Maros Marsalek <mmarsale@cisco.com> | 2016-11-21 13:09:23 +0100 |
---|---|---|
committer | Marek Gradzki <mgradzki@cisco.com> | 2016-11-24 07:03:59 +0000 |
commit | 8128f33de85b2e839a8ce6d18812374a63b81c66 (patch) | |
tree | ab4e51ea3c95ea12c018145a022cfa8ab4e115a6 /infra/data-impl/src/main/java/io | |
parent | 567247ad5a1ba1c8aff3cb2b47211f7c68f0545d (diff) |
Fix leaf list modification detection
Change-Id: Ib7bcde546faf8e9bf73d16adaf87c2f8c43ec4aa
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'infra/data-impl/src/main/java/io')
-rw-r--r-- | infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java index f999ba1ee..86666ba70 100644 --- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java +++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java @@ -45,6 +45,7 @@ import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode; import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; +import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; import org.opendaylight.yangtools.yang.model.api.ListSchemaNode; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -151,7 +152,9 @@ final class ModificationDiff { // Check if there are any modified leaves and if so, consider current node as modified final Boolean directLeavesModified = emptyPresenceNode || modification.streamChildren() - .filter(child -> child.is(LeafSchemaNode.class)) + // Checking leaf or leaf-lists children for direct modification, which means that leafs of leaf lists + // trigger a modification on parent node + .filter(child -> child.is(LeafSchemaNode.class) || child.is(LeafListSchemaNode.class)) // For some reason, we get modifications on unmodified list keys // and that messes up our modifications collection here, so we need to skip .filter(Modification::isBeforeAndAfterDifferent) @@ -387,6 +390,10 @@ final class ModificationDiff { if (maybeChild.isPresent()) { found = maybeChild.get(); } + // Special handling for leaf-list nodes. Basically the same as is for list mixin nodes + } else if (schema instanceof LeafListSchemaNode && + ((SchemaNode) schema).getQName().equals(identifier.getNodeType())) { + found = schema; } return checkNotNull(found, "Unable to find child node in: %s identifiable by: %s", schema, identifier); |