[MDSAL-715] Binding generator fails on resolution of augment whose path contains nodes augmented from another namespace Created: 21/Dec/21 Updated: 20/Jan/22 Resolved: 24/Dec/21 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | Binding codegen |
| Affects Version/s: | 8.0.5, 8.0.7 |
| Fix Version/s: | 9.0.0, 8.0.8 |
| Type: | Bug | Priority: | Medium |
| Reporter: | Igor Foltin | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
Problem occurs in mdsal-binding-generator 8.0.5. YANG Tools parses the whole model without problems, but the binding generator fails afterwards on this error: [ERROR] Failed to execute goal org.opendaylight.yangtools:yang-maven-plugin:7.0.8:generate-sources (binding) on project sonic-model: Execution binding of goal org.opendaylight.yangtools:yang-maven-plugin:7.0.8:generate-sources failed: Failed to find (http://openconfig.net/yang/bgp-evpn/extension?revision=2019-10-03)l2vpn-evpn as (http://openconfig.net/yang/rib/bgp?revision=2019-04-25)l2vpn-evpn in ListGenerator{argument=(http://openconfig.net/yang/rib/bgp?revision=2019-04-25)afi-safi} Whole stack-trace is in the attachments together with the sonic openconfig YANG modules. Problem is caused by this augment statement in the "openconfig-bgp-evpn-ext" YANG module (line 670): augment /oc-netinst:network-instances/oc-netinst:network-instance/oc-netinst:protocols/oc-netinst:protocol/oc-netinst:bgp/oc-netinst:rib/oc-netinst:afi-safis/oc-netinst:afi-safi/oc-bgp-evpn-ext:l2vpn-evpn/oc-bgp-evpn-ext:loc-rib/oc-bgp-evpn-ext:routes/oc-bgp-evpn-ext:route { description "BGP local rib extensions for l2vpn evpn address family"; uses oc-bgp-ext:bgp-ext-attr-sets-state; }The problem occurs while parsing the augment target path at the "oc-bgp-evpn-ext:l2vpn-evpn" node. Nodes in the path up to "oc-netinst:protocol" are in the "openconfig-network-instance" YANG module. The next four (from "bgp" to "afi-safi" are copied to the "oc-netinst:protocol" via groupings from other modules. The oc-bgp-evpn-ext:l2vpn-evpn" node is augmented into "oc-netinst-afi-safi" from the "openconfig-bgp-evpn-ext" YANG module by another augment statement. |
| Comments |
| Comment by Robert Varga [ 21/Dec/21 ] |
|
Does it reproduce with mdsal-8.0.7? |
| Comment by Igor Foltin [ 21/Dec/21 ] |
|
Yes, still the same error with mdsal-8.0.7 |
| Comment by Robert Varga [ 21/Dec/21 ] |
|
It seems the algorithm in AbstractExplicitGenerator.resolveSchemaNode() needs to account for this. We end up adjusting the qname to target list, which I think works for groupings. Perhaps we need to understand changes in namespaces in target path and reset currentModule if the namespace is not the same as we had when we acquired currentModule. |
| Comment by Igor Foltin [ 21/Dec/21 ] |
|
I attached that part of the code with some comments that explain what happened there while I was debugging it. |
| Comment by Igor Foltin [ 22/Dec/21 ] |
|
I attached a minimalized test case model together with the binding generator error message for that. |