[YANGTOOLS-505] malformed union type not caught at compile time Created: 15/Sep/15  Updated: 10/Apr/22  Resolved: 18/Dec/15

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Jan Medved Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Issue Links:
Blocks
is blocked by YANGTOOLS-550 Parser accepts invalid models Resolved
External issue ID: 4310

 Description   

I (mis)defined a union as this (missing 'type' keywords inside the union):

leaf datapath-id {
type union

{ yang-types:hex-string; uint64; }

The parser did not complain, but at run time i got the following exception:

2015-09-14 19:41:54,787 | WARN | bundle-tracker-0 | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 89: Failed to resolve node urn:ietf:params:xml:ns:yang:ietf-yang-types:hex-string : no such extension definition found.
2015-09-14 19:41:54,787 | WARN | bundle-tracker-0 | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 90: Failed to resolve node urn:opendaylight:openflow-pce-topology:uint64 : no such extension definition found.
2015-09-14 19:41:55,054 | WARN | bundle-tracker-0 | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 89: Failed to resolve node urn:ietf:params:xml:ns:yang:ietf-yang-types:hex-string : no such extension definition found.
2015-09-14 19:41:55,054 | WARN | bundle-tracker-0 | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 90: Failed to resolve node urn:opendaylight:openflow-pce-topology:uint64 : no such extension definition found.
2015-09-14 19:41:55,386 | WARN | bundle-tracker-0 | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 89: Failed to resolve node urn:ietf:params:xml:ns:yang:ietf-yang-types:hex-string : no such extension definition found.
2015-09-14 19:41:55,386 | WARN | bundle-tracker-0 | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 90: Failed to resolve node urn:opendaylight:openflow-pce-topology:uint64 : no such extension definition found.
2015-09-14 19:41:55,878 | WARN | ty-notifications | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 89: Failed to resolve node urn:ietf:params:xml:ns:yang:ietf-yang-types:hex-string : no such extension definition found.
2015-09-14 19:41:55,878 | WARN | ty-notifications | YangParserImpl | 79 - org.opendaylight.yangtools.yang-parser-impl - 0.8.0.SNAPSHOT | Error in module of-l3-topology at line 90: Failed to resolve node urn:opendaylight:openflow-pce-topology:uint64 : no such extension definition found.

The parser should catch this syntax error.



 Comments   
Comment by Martin Ciglan [ 16/Sep/15 ]

Hi Jan

Basically, both (mis)defined statements were recognized as unknown ones.
Obviously, there are no such extensions defined, so warning messages are valid.

If we want parser to recognize this type of input error, we would need to implement extra functionality to check all TYPE statements afterwards and inform user accordingly.

Comment by Robert Varga [ 10/Nov/15 ]

The parser should be reacting rather strongly to such a yang file now – is this still reproducible (e.g. silent failure)?

Comment by Jan Medved [ 10/Nov/15 ]

It is a silent failure in the sense that it gets detected at run time, not at compile time. Compilation finished just fine.

Comment by Filip Gregor [ 01/Dec/15 ]

This issue is resolved in current yangtools code base, please retry

Comment by Filip Gregor [ 02/Dec/15 ]

latest related patch: https://git.opendaylight.org/gerrit/#/c/30202/

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