mbj4668 / pyang

An extensible YANG validator and converter in python
ISC License
537 stars 344 forks source link

Unexpected keyword error when using multiple default values in leaf-list refine statement #787

Open splinc opened 2 years ago

splinc commented 2 years ago

In yang 1.1 it is possible to refine a leaf list with repeated default statements but this is not handled correctly by pyang (v2.5.2) Using the attached file (test.yang) I see the following output

pyang -f tree test.yang test.yang:20: error: unexpected keyword "default" module: test +--rw test +--rw test-list* string

Note:

Unfortunately we are using pyang to process a yang model that includes 3rd party yang files that use this pattern to refine leaf-lists so there is no obvious workaround in our plugins.

test.zip .

ygorelik commented 2 years ago

Same issue observed on tail-f module:

YGORELIK-M-C3GG:yang ygorelik$ pyang tailf-ncs-cluster.yang
tailf-ncs-cluster.yang:224: error: unexpected keyword "default"
tailf-ncs-cluster.yang:225: error: unexpected keyword "default"
tailf-ncs-cluster.yang:226: error: unexpected keyword "default"
tailf-ncs-cluster.yang:227: error: unexpected keyword "default"
tailf-ncs-cluster.yang:228: error: unexpected keyword "default"
tailf-ncs-cluster.yang:232: error: unexpected keyword "default"
tailf-ncs-cluster.yang:233: error: unexpected keyword "default"
tailf-ncs-cluster.yang:234: error: unexpected keyword "default"
tailf-ncs-cluster.yang:235: error: unexpected keyword "default"
tailf-ncs-cluster.yang:236: error: unexpected keyword "default"
tailf-ncs-cluster.yang:237: error: unexpected keyword "default"
tailf-ncs-cluster.yang:238: error: unexpected keyword "default"
tailf-ncs-cluster.yang:239: error: unexpected keyword "default"
tailf-ncs-cluster.yang:240: error: unexpected keyword "default"
tailf-ncs-cluster.yang:244: error: unexpected keyword "default"
tailf-ncs-cluster.yang:245: error: unexpected keyword "default"
tailf-ncs-cluster.yang:246: error: unexpected keyword "default"
tailf-ncs-cluster.yang:247: error: unexpected keyword "default"
tailf-ncs-cluster.yang:248: error: unexpected keyword "default"
tailf-ncs-cluster.yang:249: error: unexpected keyword "default"
tailf-ncs-cluster.yang:253: error: unexpected keyword "default"
tailf-ncs-cluster.yang:254: error: unexpected keyword "default"
tailf-ncs-cluster.yang:255: error: unexpected keyword "default"
tailf-ncs-cluster.yang:256: error: unexpected keyword "default"
tailf-ncs-cluster.yang:257: error: unexpected keyword "default"
tailf-ncs-cluster.yang:258: error: unexpected keyword "default"
tailf-ncs-cluster.yang:259: error: unexpected keyword "default"
tailf-ncs-cluster.yang:263: error: unexpected keyword "default"
tailf-ncs-cluster.yang:264: error: unexpected keyword "default"
YGORELIK-M-C3GG:yang ygorelik$ pip list | grep pyang
pyang        2.5.2

Need the fix ASAP, please.

beegeesquare commented 1 year ago

Is this issue fixed?