Bug 9244: Fix deviate replace of implicit substatements 89/64389/2
authorIgor Foltin <igor.foltin@pantheon.tech>
Tue, 17 Oct 2017 09:07:51 +0000 (11:07 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 19 Oct 2017 08:26:00 +0000 (08:26 +0000)
commit9c5da491151f5f6174447fa5e4eda3955dae4146
tree526b83ffaf179dd99dc9ee5867d4a1d713dd7637
parent928be5f194f2638cc2da1bdb072c60fe00f814fe
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]