[YANGTOOLS-821] LeafRefContext fails to process augmentations Created: 20/Oct/17 Updated: 10/Apr/22 Resolved: 24/Jul/18 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | None |
| Affects Version/s: | 1.1.2, 2.0.5 |
| Fix Version/s: | 2.0.9, 2.0.6.1 |
| Type: | Bug | Priority: | Medium |
| Reporter: | Jan Srnicek | Assignee: | Marek Gradzki |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
LeafRefContext.validateNodeData() looks like it cant process augmentation nodes, java.lang.UnsupportedOperationException: Augmentation node has no QName From looking at the method, support for augmentations is missing, in that case it falls back to MapNode logic and fails with exception above Appears in 1.1.2-Carbon |
| Comments |
| Comment by Robert Varga [ 26/Dec/17 ] |
|
We need the models and data used to reproduce this issue. |
| Comment by Marek Gradzki [ 29/Jun/18 ] |
|
Here is example of config that fails to validate: <bgp xmlns="http://openconfig.net/yang/bgp"> <peer-groups> <peer-group> <peer-group-name>application-peers</peer-group-name> </peer-group> </peer-groups> <neighbors> <neighbor> <neighbor-address>10.25.1.9</neighbor-address> <config> <peer-group>application-peers</peer-group> </config> </neighbor> </neighbors> </bgp> Where peer-group is defined in openconfig-bgp@2015-10-09.yang as: // add peer-group pointer only for the neighbor list augment /bgp/neighbors/neighbor/config { description "Augmentation to allow association of a neighbor with a peer-group"; uses bgp-neighbor-peer-group_config; } grouping bgp-neighbor-peer-group_config { [...] leaf peer-group { type leafref { // we are at /bgp/neighbors/neighbor/ path "/bgp/peer-groups/peer-group/peer-group-name"; //TODO: require-instance should be added when it's //supported in YANG 1.1 //require-instance true; } description "The peer-group with which this neighbor is associated"; } } |
| Comment by Marek Gradzki [ 29/Jun/18 ] |
|
Failing unit test (honeycomb): |
| Comment by Marek Gradzki [ 29/Jun/18 ] |
|
More complex example, based on ODL BGP Oxygen User Guide, uses openconfig-network-instance:protocol augmentation defined in bgp-openconfig-extensions@2017-12-07 for configuration of neighbors: <bgp xmlns="http://openconfig.net/yang/bgp"> <peer-groups> <peer-group> <peer-group-name>application-peers</peer-group-name> </peer-group> </peer-groups> </bgp> <network-instances xmlns="http://openconfig.net/yang/network-instance"> <network-instance> <name>global-bgp</name> <config> <name>global-bgp</name> </config> <protocols> <protocol> <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier> <name>hc-bgp-instance</name> <config> <name>hc-bgp-instance</name> <identifier xmlns:x="http://openconfig.net/yang/policy-types">x:BGP</identifier> </config> <bgp xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions"> <neighbors> <neighbor> <neighbor-address>10.25.1.9</neighbor-address> <config> <peer-group>application-peers</peer-group> </config> </neighbor> </neighbors> </bgp> </protocol> </protocols> </network-instance> </network-instances> LeafRefValidatation.validate fails to validate the config with the same exception as in the issue description. |
| Comment by Marek Gradzki [ 23/Jul/18 ] |
|
Fix: Tests are using XmlParserStream (much easier to test + compatibility with XML parser is something we are interested in), Robert, is there a better place for them than yang-data-codec-xml? |
| Comment by Robert Varga [ 23/Jul/18 ] |
|
Couple of nitpicks in review, otherwise it looks good. The test suite is just fine as it is – we can move it down a notch when we refactor yang-data-impl. |