CiscoDevNet / yangsuite

Cisco YANG Suite provides a set of tools and plugins to learn, test, and adopt YANG programmable interfaces such as NETCONF, RESTCONF, gNMI and more.
Other
244 stars 76 forks source link

YANG tree parsing fails if submodule access parent module definitions #36

Closed jj651a closed 2 years ago

jj651a commented 3 years ago

Problem:
Validation(button Validate YANG modules in greater depth) of YANG set fails with errors, YANG tree is not complete:

The following modules in the YANG set reported errors and warnings when parsed and validated.  
   module1-sub @ 2017-10-02 
        - CRITICAL ERROR line 13: node module1::test is not found
        - CRITICAL ERROR line 16: module1-sub:test in the path for ref-id at /home/owner/tmp/yangsuite/yangsuite/users/owner/repositories/test-circular/module1-sub@2017-10-02.yang:14 is not found

Used versions:

yangsuite==2.8.2
yangsuite-devices==2.8.7
yangsuite-filemanager==1.8.1
yangsuite-netconf==1.15.3
yangsuite-yangtree==1.19.9.post0.dev4
pyang==1.7.8

module1.yang:

module module1 {
    namespace "http://module1";
    prefix module1;
    yang-version 1.1;
    include module1-sub;
    revision 2017-09-30 {
        description "Initial release 1";
    }
    container test {
        leaf id {
            type enumeration {
                enum "option1";
                enum "option2";
            }
        }
        leaf copy-of-id {
            type leafref {
                path "../id";
            }
        }
    }
}

module1-sub.yang:

submodule module1-sub {
    belongs-to "module1" {
        prefix "module1";
    }
    yang-version 1.1;
    revision 2017-10-02 {
        description "Initial release 1";
    }
    augment /module1:test {
        leaf ref-id {
            type leafref {
                path "/module1:test/id";
            }
        }
    }
}
jeremycohoe commented 2 years ago

Hi @jj651a we are looking into this and will get back

jj651a commented 2 years ago

@jeremycohoe any news here?

jj651a commented 2 years ago

ping

chenghit commented 2 years ago

Similar issue.

The following modules in the YANG set reported errors and warnings when parsed and validated. Cisco-IOS-XE-wireless-access-point-cfg-rpc @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-access-point-cmd-rpc @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-access-point-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-ap-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-ap-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-apf-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-awips-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-ble-ltx-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-ble-mgmt-cmd-rpc @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-ble-mgmt-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-client-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-client-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-cts-sxp-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-cts-sxp-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-dot11-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-dot15-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-enum-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-events-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-fabric-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-flex-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-fqdn-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-general-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-general-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-hotspot-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-hyperlocation-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-lisp-agent-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-location-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-location-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-mcast-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-mdns-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-mesh-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-mesh-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-mobility-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-mobility-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-mobility-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-nmsp-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-radio-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rf-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rfid-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rfid-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rlan-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rogue-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rogue-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rogue-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rrm-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rrm-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rrm-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rule-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-rule-mdns-oper @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-security-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-site-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-tunnel-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-tunnel-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-types @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html> Cisco-IOS-XE-wireless-wlan-cfg @ unknown CRITICAL ERROR line 7: syntax error: illegal keyword: <!DOCTYPE html>

jeremycohoe commented 2 years ago

we have resolved this, fix will be published in the next release...

We shared the wheel with you directly to test, can you confirm it is now working for you @jj651a

jj651a commented 2 years ago

@jeremycohoe thank you for update. I did not receive any wheel. I think it may be firewall on our side. In previous issue we used dropbox with the same email address jj651a@intl.att.com .

miott commented 2 years ago

This issue has not been investigated yet. @jj651a had reported a different issue months ago and that was the one that is resolved.

miott commented 2 years ago

@chenghit , your errors are completely different. It looks like you have html in your yang files. If you copied them from the internet they probably were not retrieved correctly.

apoorvashastry commented 2 years ago

@jj651a : This is a know issue with pyang as mentioned here https://github.com/mbj4668/pyang/issues/323. Even though model definition is correct as per YANG 1.1 RFC, pyang is still not able to resolve this. However as a workaround I tried something like below, after which I could see the leaf ref-id when I load module1.yang in Yangsuite. Please see if this works for you.

It will still show the below error when you validate.

CRITICAL ERROR line 16: module1-sub:test in the path for ref-id at /home/owner/tmp/yangsuite/yangsuite/users/owner/repositories/test-circular/module1-sub@2017-10-02.yang:14 is not found

However you can ignore it for now as its a pyang issue and its fixed in latest version of pyang. So eventually when we upgrade pyang in yangsuite this error will go away.

module1.yang

module module1 {
    namespace "http://module1";
    prefix module1;
    yang-version 1.1;
    include module1-sub;
    revision 2017-09-30 {
        description "Initial release 1";
    }
    container test {
        leaf id {
            type enumeration {
                enum "option1";
                enum "option2";
            }
        }
        leaf copy-of-id {
            type leafref {
                path "../id";
            }
        }
        uses module1-sub-grouping;
    }
}

module1-sub.yang

submodule module1-sub {
    belongs-to "module1" {
        prefix "module1";
    }
    yang-version 1.1;
    revision 2017-10-02 {
        description "Initial release 1";
    }
    grouping module1-sub-grouping {
        leaf ref-id {
            type leafref {
                path "/module1:test/module1:id";
            }
        }
    }
}
Screen Shot 2022-01-19 at 12 32 18 PM
jeremycohoe commented 2 years ago

Fix will be in the next release