[YANGTOOLS-924] Yang parser does not allow min-elements in deviate delete Created: 19/Dec/18  Updated: 07/Jan/19  Resolved: 01/Jan/19

Status: Resolved
Project: yangtools
Component/s: parser
Affects Version/s: 2.0.11, 2.1.6
Fix Version/s: None

Type: Bug Priority: Medium
Reporter: Peter Verthez Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive deviate.zip    

 Description   

This is on release 2.0.11.

When parsing the attached model, the following error occurs:

Caused by: org.opendaylight.yangtools.yang.parser.spi.meta.InvalidSubstatementException: MIN_ELEMENTS is not valid for DEVIATE. Error in module testdev (QNameModule

{ns=[http://example.com/testdev], rev=2018-08-14}

) [at /home/verthezp/local/logs/deviate/testdev.yang:13:4]
    at org.opendaylight.yangtools.yang.parser.spi.meta.SubstatementValidator.validate(SubstatementValidator.java:136)
    at org.opendaylight.yangtools.yang.parser.rfc7950.stmt.deviate.AbstractDeviateStatementSupport.onFullDefinitionDeclared(AbstractDeviateStatementSupport.java:129)
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementDefinitionContext.onDeclarationFinished(StatementDefinitionContext.java:80)
    at org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase.endDeclared(StatementContextBase.java:578)

 

Apparently the yang parser does not accept the min-elements statement in deviate delete (in deviate add and deviate replace it works fine).   According to the RFC this seems to be a valid statement there, as long as it matches exactly what is in the target node of the deviation.

This occurs both on yang 1.0 and yang 1.1.

 

 



 Comments   
Comment by Robert Varga [ 19/Dec/18 ]

It seems add/delete share different allowed statements, I am not sure why that is.

Comment by Robert Varga [ 01/Jan/19 ]

While the text of RFC6020 or RFC7950 regarding "deviate" statement does not specifically exclude the substatements, the ABNF rule "deviate-delete-stmt" specifically excludes these statements:

   deviate-delete-stmt = deviate-keyword sep delete-keyword-str optsep
                         (";" /
                          "{" stmtsep
                              ;; these stmts can appear in any order
                              [units-stmt]
                              *must-stmt
                              *unique-stmt
                              *default-stmt
                          "}") stmtsep

 

Comment by Peter Verthez [ 07/Jan/19 ]

OK, I had not noticed this, but I agree.

Generated at Wed Feb 07 20:54:41 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.