From 23554c385d6067e817124a4ebd11ed5c3c209f18 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Fri, 29 Jan 2021 14:34:01 +0100 Subject: [PATCH] Add a proper statement policy for 'mount-point' A bit of the policy is dictated by UnknownSchemaNode, but otherwise this is quite simple. JIRA: YANGTOOLS-1208 Change-Id: I81f4bb5aac5f530e3fcc293b495e1bc76a6b3f8a Signed-off-by: Robert Varga --- .../rfc8528/parser/MountPointStatementSupport.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/yang/rfc8528-parser-support/src/main/java/org/opendaylight/yangtools/rfc8528/parser/MountPointStatementSupport.java b/yang/rfc8528-parser-support/src/main/java/org/opendaylight/yangtools/rfc8528/parser/MountPointStatementSupport.java index a9fca04319..f74595e301 100644 --- a/yang/rfc8528-parser-support/src/main/java/org/opendaylight/yangtools/rfc8528/parser/MountPointStatementSupport.java +++ b/yang/rfc8528-parser-support/src/main/java/org/opendaylight/yangtools/rfc8528/parser/MountPointStatementSupport.java @@ -43,7 +43,12 @@ public final class MountPointStatementSupport private final SubstatementValidator validator; MountPointStatementSupport(final StatementDefinition definition) { - super(definition, StatementPolicy.legacyDeclaredCopy()); + super(definition, StatementPolicy.copyDeclared((copy, current, substatements) -> + copy.getArgument().equals(current.getArgument()) + // Implied by UnknownSchemaNode + && copy.history().isAugmenting() == current.history().isAugmenting() + && copy.history().isAddedByUses() == current.history().isAddedByUses() + && copy.equalParentPath(current))); this.validator = SubstatementValidator.builder(definition) .addOptional(YangStmtMapping.CONFIG) .addOptional(YangStmtMapping.DESCRIPTION) @@ -56,6 +61,12 @@ public final class MountPointStatementSupport return INSTANCE; } + // FIXME: these two methods are not quite right. RFC8528 states that: + // + // If a mount point is defined within a grouping, its label is + // bound to the module where the grouping is used. + // + // We are not doing exactly that, in that we can end up rebinding the argument through 'augment', I think. @Override public QName parseArgumentValue(final StmtContext ctx, final String value) { return StmtContextUtils.parseIdentifier(ctx, value); -- 2.36.6