Bug 9244: Fix deviate replace of implicit substatements 17/64517/1
authorIgor Foltin <igor.foltin@pantheon.tech>
Tue, 17 Oct 2017 09:07:51 +0000 (11:07 +0200)
committerIgor Foltin <igor.foltin@pantheon.tech>
Thu, 19 Oct 2017 09:52:42 +0000 (11:52 +0200)
commit4ca1ef912071a5af7a46bdd298315ae34dd0411f
treed2e26ea4d58e396e7fa201be3b7cdd2145e14259
parentf8157f225f3295e32e20c1d146ff24d0ec985f95
Bug 9244: Fix deviate replace of implicit substatements

In case when a deviate replace of a config/mandatory/max/min-elements
substatement targets a node which does not contain an explicitly declared
config/mandatory/max/min-elements, YANG statement parser throws an exception
because it did not find the substatement in the target node.

However, according to RFC6020/7950, these properties are always implicitly
present. Therefore, perform a deviate add instead of throwing an exception
in this particular case.

Change-Id: I79e5c427040c81db7f2f68ebcfa71b274d48816d
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/DeviateStatementImpl.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug9244Test.java [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/bugs/bug9244/bar.yang [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/bugs/bug9244/foo.yang [new file with mode: 0644]