freeconf / yang

Standards-based management for Golang microservices
Apache License 2.0
38 stars 14 forks source link

Yang loading is failing if default substatement is added for leaf of type enum where enum name starts as a number. #42

Closed davidmat50 closed 1 year ago

davidmat50 commented 1 year ago

Not able to add default substatment in leaf if the enum looks like below. (please note the enum name startes with number)

leaf mybytes {
    type enumeration {
        enum 4k;
        enum 8k {
            value 8192;
        }
        enum 12k {
            value 12288;
        }
        enum 16k {
            value 16384;
        }
    }
    default 16k;
 }

But the yang loading is working fine(below) when default substatment is added with similar enum where enum name does not start as number digits.

leaf myenum {
    type enumeration {
        enum zero;
        enum one;
        enum two {
            value 2;
        }
        enum seven {
            value 7;
        }
        enum eight {
            value 8;
        }
    }
    default seven;
}

Yang used for testing:

module enum-default-test {
namespace urn:x;
prefix x;
leaf myenum {
    type enumeration {
        enum zero;
        enum one;
        enum two {
            value 2;
        }
        enum seven {
            value 7;
        }
        enum eight {
            value 8;
        }
    }
    default seven;
}
leaf mybytes {
    type enumeration {
        enum 4k;
        enum 8k {
            value 8192;
        }
        enum 12k {
            value 12288;
        }
        enum 16k {
            value 16384;
        }
    }
    default 16k;
}

}

dhubler commented 1 year ago

should be fixed on master, thank you!