corenova / yang-js

YANG parser and composer
Apache License 2.0
56 stars 18 forks source link

non min/max multiple ranges error #150

Open ohad182 opened 9 months ago

ohad182 commented 9 months ago

Hi,

i tried to load a yang file with the following content and i get range error no matter what the value is:

// doesnt work - getting range violation error
container my_container {
    description "container settings";
    list my-list {
        description "a list of values";
        key "list-base";

        leaf list-base {
            description "the base list element";
            type uint32 {
                range "0 | 1024 | 2048 | 3072 | 4096 | 5120";
            }
        }
    }
}

when i set min/max in each of the or parts, it works well

// works
container my_container {
    description "container settings";
    list my-list {
        description "a list of values";
        key "list-base";

        leaf list-base {
            description "the base list element";
            type uint32 {
                range "0 .. 0 | 1024 .. 1024 | 2048 .. 2048 | 3072 .. 3072 | 4096 .. 4096 | 5120 .. 5120";
            }
        }
    }
}

can we have support for the first range? from my understanding, the RFC supports it: https://datatracker.ietf.org/doc/html/rfc6020#section-9.2.4