YangModels / yang

YANG modules from standards organizations such as the IETF, The IEEE, The Metro Ethernet Forum, open source such as Open Daylight or vendor specific modules
1.51k stars 1.19k forks source link

FAILURE: pyang -f tree yang/vendor/cisco/xe/16111/ietf-ipv4-unicast-routing.yang #1363

Open freedanzman opened 1 year ago

freedanzman commented 1 year ago

ERRORS:

$ pwd /c/CODE/repos/cisco-product-apis/restconf/yang/vendor/cisco/xe/16111 $ pyang -f tree ietf-ipv4-unicast-routing.yang ietf-ipv4-unicast-routing.yang:104: error: node ietf-routing::routing-instance is not found ietf-ipv4-unicast-routing.yang:149: error: node ietf-routing::fib-route is not found ietf-ipv4-unicast-routing.yang:164: error: node ietf-routing::fib-route is not found ietf-ipv4-unicast-routing.yang:180: error: node ietf-routing::fib-route is not found

ATTEMPTED DIAGNOSIS:

ietf-routing.yang line 5:

prefix "rt";

ietf-ipv4-unicast-routing.yang lines 7-9:

import ietf-routing { prefix "rt"; }

ietf-ipv4-unicast-routing.yang lines 103-104:

augment "/rt:routing/rt:routing-instance/rt:routing-protocols/"

  • "rt:routing-protocol/rt:static-routes" {

The error seems to be saying that from the augment statement above, it cannot find "rt:routing-instance" under the "rt:routing" part of the model/tree in ietf-routing.yang.

ietf-routing.yang lines 500-526:

container routing { description "Configuration parameters for the routing subsystem."; list routing-instance { key "name"; description "Configuration of a routing instance.";

And yet "list routing-instance" is right there on line 523, right under the parent routing container (typical).

So... yeah. No idea why this is broken. I checked the syntax to make sure nothing was missing or misplaced in terms of {}s or ;s and that all seems legitimate to me. No idea why it cannot find routing-instance in the hierarchy when it is clearly there.

Similar problem with fib-route on ietf-ipv4-unicast-routing.yang lines 149/164/180. I was able to find fib-route in ietf-routing.yang line 669.

I must not know enough. Please teach me YANG wizards.

Cheers.

einarnn commented 1 year ago

IIRC, this is a defect in pyang. If you try yanglint instead:

❯ /opt/git-repos/libyang/build/yanglint -f tree ietf-ipv4-unicast-routing.yang
module: ietf-ipv4-unicast-routing

  augment /rt:routing/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes:
    +--rw ipv4
       +--rw route* [destination-prefix]
          +--rw destination-prefix    inet:ipv4-prefix
          +--rw description?          string
          +--rw next-hop
             +---u rt:next-hop-content
  augment /rt:fib-route/rt:input/rt:destination-address:
    +--rw address?   inet:ipv4-address
  augment /rt:fib-route/rt:output/rt:route:
    +--rw destination-prefix?   inet:ipv4-prefix
  augment /rt:fib-route/rt:output/rt:route/rt:next-hop/rt:next-hop-options/rt:simple-next-hop:
    +--rw next-hop-address?   inet:ipv4-address

Unfortunately I cannot recall if a defect was raised against pyang.