cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2467
Views
1
Helpful
3
Replies

Pyang validation of ODL Yang schemas

brfoster
Cisco Employee
Cisco Employee

Can anyone help me here?  I'm seeing errors using pyang with the downloaded Yang schemas from ODL.  I'm running distribution-karaf-0.4.2-Beryllium-SR2.

I downloaded all the yang schema files from the server (http://localhost:8181/restconf/modules...)

I get errors on basically all of them.  For example,

[gibson@rickenbacker yang]$ pyang -f tree opendaylight-inventory

opendaylight-inventory:1: error: module "yang-ext" not found in search path

opendaylight-inventory:1: error: module "ietf-inet-types" not found in search path

opendaylight-inventory:1: warning: imported module yang-ext not used

opendaylight-inventory:21 (at opendaylight-inventory:18): warning: "mandatory" statement for a key leaf is ignored

opendaylight-inventory:21: error: no module with the namespace "urn:opendaylight:yang:extension:yang-ext" is imported

opendaylight-inventory:21 (at opendaylight-inventory:21): warning: "mandatory" statement for a key leaf is ignored

opendaylight-inventory:27: error: no module with the namespace "urn:opendaylight:yang:extension:yang-ext" is imported

opendaylight-inventory:27: warning: explicit config statement is ignored

opendaylight-inventory:33: error: no module with the namespace "urn:opendaylight:yang:extension:yang-ext" is imported

opendaylight-inventory:33: warning: explicit config statement is ignored

opendaylight-inventory:39: error: no module with the namespace "urn:opendaylight:yang:extension:yang-ext" is imported

opendaylight-inventory:39: warning: explicit config statement is ignored

opendaylight-inventory:45: error: no module with the namespace "urn:opendaylight:yang:extension:yang-ext" is imported

opendaylight-inventory:45: warning: explicit config statement is ignored

module: opendaylight-inventory

   x--rw nodes!

      +--rw node* [id]

         +--rw id                node-id

         +--rw node-connector* [id]

            +--rw id    node-connector-id

notifications:

   x---n node-removed

   |  +--ro node-ref?   node-ref

   x---n node-connector-removed

   |  +--ro node-connector-ref?   node-connector-ref

   x---n node-updated

   |  +--ro node-ref?         node-ref

   |  +--rw id?               node-id

   |  +--rw node-connector* [id]

   |     +--rw id    node-connector-id

   x---n node-connector-updated

      +--ro node-connector-ref?   node-connector-ref

      +--rw id?                   node-connector-id

However, "yang-ext" schema file is in the same directory with all the other files.  I see similar errors running other files.

Anyone have a suggestion?

3 Replies 3

giheron
Cisco Employee
Cisco Employee

hmmm - not sure.   I can do a "pyang -f tree opendaylight-inventory@2013-08-19.yang" in ODL's cache/schema directory.

how did you download the modules?

I'm just downloading from the server with the URL for the schema like...

http://192.168.5.102:8181/restconf/modules/module/opendaylight-inventory/2013-08-19/schema

I can do it with the browser or wget or curl and I get the same result shown above.  Do the files get corrupted with that method?

ah ok.  So if you do that then the schemas are downloaded in YIN, not YANG (I'm not sure why).

so you need to convert each schema file using e.g. "pyang -f yang schema > yang-ext.yang"

let me know if that works

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: