[YANGTOOLS-1478] USE statement not recognised Created: 18/Jan/23  Updated: 27/Jan/23  Resolved: 26/Jan/23

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

Type: Bug Priority: High
Reporter: Lee Anjella Macabuhay Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Zip Archive owb-msa221.zip     Zip Archive sized-down-files.zip    

 Description   

Using Version 6.0.x of yang tools, we are able to parse the attached model 'owb-msa22.zip' with the following data and it gives no error:

{
  "openroadm-devices":{
    "openroadm-device":[
      {
        "device-id":"C201-7-1A",
        "ne-state":"inservice",
        "commission-date-time":"2022-11-06T14:12:23.260487-06:00",
        "org-openroadm-device":{
          "degree":[
            {
              "degree-number":1,
              "max-wavelengths":128,
              "circuit-packs":[
                {
                  "index":1,
                  "circuit-pack-name":"1/0"
                }
              ],
              "connection-ports":[
                {
                  "index":1,
                  "circuit-pack-name":"2/0/0"
                }
              ]
            }
          ]
        },
        "status":"success"
      }
    ]
  }
 

The key node 'circuit-pack-name' was augmented via the 'use' statement and has a typeLeafRef and given path.

 

Upgrading to version 8.0.6, the parser returns with 'Data tree child org-openroadm-device not found in openroadm-device module' when using the same data and model as above. However, using the following data (without the use of circuit pack name) the parser accepts it:

{
  "openroadm-devices":{
    "openroadm-device":[
      {
        "device-id":"C201-7-1A",
        "ne-state":"inservice",
        "commission-date-time":"2022-11-06T14:12:23.260487-06:00",
        "org-openroadm-device":{
          "degree":[
            {
              "degree-number":1,
              "max-wavelengths":128,
              "circuit-packs":[
                {
                  "index":1
                }
              ],
              "connection-ports":[
                {
                  "index":1
                }
              ]
            }
          ]
        },
        "status":"success"
      }
    ]
  }
} 

 

Please see the unit test analysis that we have used in our code to show this:

https://gerrit.onap.org/r/c/cps/+/132864

 

 



 Comments   
Comment by Robert Varga [ 26/Jan/23 ]

This looks like an issue with base models, org-openroadm-device defines:

 

  grouping circuit-pack-name {
    leaf circuit-pack-name {
      type leafref {
        path "/org-openroadm-device/circuit-packs/circuit-pack-name";
      }

      description
        "Circuit-Pack identifier. Unique within the context of a device.";
    }
  }

note the leafref is using unqualified names.

This is then used in openroadm-devices-inventory-v2 via uses. Based on https://www.rfc-editor.org/rfc/rfc7950#section-9.9.2 , the "context node" is the node created via uses in openroadm-devices-inventory-v2, which means the default namespace is that module, not org-openroadm-device – and therefore the path does not bind, and therefore it cannot be interpreted. This has also been fixed in MDSAL-677 (https://git.opendaylight.org/gerrit/c/mdsal/+/96976), although there the RFC7950 guidance is much clearer.

 

Comment by Robert Varga [ 26/Jan/23 ]

I believe our behaviour complies to RFC7950 and the problem lies with how openroadm defines an absolute path in a grouping without using qualified names.

Comment by Robert Varga [ 26/Jan/23 ]

Alternatively, openroadm-devices-inventory-v2 would need to match the layout expected by circuit-pack-name's path, i.e. so that 'openroadm-devices-inventory-v2:org-openroadm-device' is a valid reference

Comment by Lee Anjella Macabuhay [ 27/Jan/23 ]

Thanks for your reply Robert (rovarga )

Wondered then how come the old yang parser (version 6.0.x) was able to parse the following data. What has changed since then that affected this?

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